func runUpdate(c *cli.Context) error { if c.IsSet("config") { setting.CustomConf = c.String("config") } setup("update.log") if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 { log.GitLogger.Trace("SSH_ORIGINAL_COMMAND is empty") return nil } args := c.Args() if len(args) != 3 { log.GitLogger.Fatal(2, "Arguments received are not equal to three") } else if len(args[0]) == 0 { log.GitLogger.Fatal(2, "First argument 'refName' is empty, shouldn't use") } task := models.UpdateTask{ UUID: os.Getenv("uuid"), RefName: args[0], OldCommitID: args[1], NewCommitID: args[2], } if err := models.AddUpdateTask(&task); err != nil { log.GitLogger.Fatal(2, "AddUpdateTask: %v", err) } return nil }
func runUpdate(c *cli.Context) { if c.IsSet("config") { setting.CustomConf = c.String("config") } cmd := os.Getenv("SSH_ORIGINAL_COMMAND") if cmd == "" { return } setup("update.log") args := c.Args() if len(args) != 3 { log.GitLogger.Fatal(2, "received less 3 parameters") } else if args[0] == "" { log.GitLogger.Fatal(2, "refName is empty, shouldn't use") } task := models.UpdateTask{ UUID: os.Getenv("uuid"), RefName: args[0], OldCommitID: args[1], NewCommitID: args[2], } if err := models.AddUpdateTask(&task); err != nil { log.GitLogger.Fatal(2, "AddUpdateTask: %v", err) } }
func runUpdate(c *cli.Context) { cmd := os.Getenv("SSH_ORIGINAL_COMMAND") if cmd == "" { return } setup("update.log") args := c.Args() if len(args) != 3 { log.GitLogger.Fatal("received less 3 parameters") } else if args[0] == "" { log.GitLogger.Fatal("refName is empty, shouldn't use") } uuid := os.Getenv("uuid") task := models.UpdateTask{ Uuid: uuid, RefName: args[0], OldCommitId: args[1], NewCommitId: args[2], } if err := models.AddUpdateTask(&task); err != nil { log.GitLogger.Fatal(err.Error()) } }