diff --git a/cmd/joj3/conf.go b/cmd/joj3/conf.go index 5a82acf..3afa8ad 100644 --- a/cmd/joj3/conf.go +++ b/cmd/joj3/conf.go @@ -121,23 +121,27 @@ func commitMsgToConf() (conf Conf, err error) { switch head { case "feat", "fix", "refactor", "perf", "test", "build", "revert": - if len(words) < 2 { - return Conf{}, fmt.Errorf("error: hw not assigned") + // TODO: Decide strategy to give students error + // if len(words) < 2 { + // return Conf{}, fmt.Errorf("error: hw not assigned") + // } + if len(words) >= 2 { + hw = words[1] + if err = validateHw(hw); err == nil { + file = strings.Replace(file, "conf", "conf-"+hw+"-cq", 1) + } } - hw = words[1] - if err = validateHw(hw); err != nil { - return - } - file = strings.Replace(file, "conf", "conf-"+hw+"-cq", 1) case "joj", "grading": - if len(words) < 2 { - return Conf{}, fmt.Errorf("error: hw not assigned") + // TODO: Decide strategy to give students error + // if len(words) < 2 { + // return Conf{}, fmt.Errorf("error: hw not assigned") + // } + if len(words) >= 2 { + hw = words[1] + if err = validateHw(hw); err == nil { + file = strings.Replace(file, "conf", "conf-"+hw+"-oj", 1) + } } - hw = words[1] - if err = validateHw(hw); err != nil { - return - } - file = strings.Replace(file, "conf", "conf-"+hw+"-oj", 1) } conf, err = parseConfFile(file)