mirror of
https://github.com/Slug-Boi/cocommit.git
synced 2026-05-13 12:45:47 +00:00
refactor: flags and change hash to be ignored
This commit is contained in:
+11
-1
@@ -129,10 +129,12 @@ func group_selection(group []User, excludeMode []string) []string {
|
|||||||
return excludeMode
|
return excludeMode
|
||||||
}
|
}
|
||||||
|
|
||||||
func GitCommitAppender(authors string, hash string, flags []string) error {
|
func GitCommitAppender(authors string, hash string, flags []string, t,p bool) error {
|
||||||
// Get old commit message
|
// Get old commit message
|
||||||
var cmd *exec.Cmd
|
var cmd *exec.Cmd
|
||||||
|
|
||||||
|
//TODO: Make the hash ammend work with rebase but its more complicated than orignally thought.
|
||||||
|
|
||||||
// git log --format=%B -n1
|
// git log --format=%B -n1
|
||||||
if hash == "" {
|
if hash == "" {
|
||||||
cmd = exec.Command("git", "log", "--format=%B", "-n1")
|
cmd = exec.Command("git", "log", "--format=%B", "-n1")
|
||||||
@@ -152,7 +154,15 @@ func GitCommitAppender(authors string, hash string, flags []string) error {
|
|||||||
// specify git command1
|
// specify git command1
|
||||||
input := []string{"commit"}
|
input := []string{"commit"}
|
||||||
input = append(input, flags...)
|
input = append(input, flags...)
|
||||||
|
old_commit = strings.TrimSpace(old_commit)
|
||||||
input = append(input, "--amend", "-m", old_commit+"\n"+authors)
|
input = append(input, "--amend", "-m", old_commit+"\n"+authors)
|
||||||
|
|
||||||
|
if p {
|
||||||
|
println(old_commit + "\n" + authors)
|
||||||
|
if t {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
// append the message to the flags
|
// append the message to the flags
|
||||||
// concat the git command and the flags + message
|
// concat the git command and the flags + message
|
||||||
cmd = exec.Command("git", input...)
|
cmd = exec.Command("git", input...)
|
||||||
|
|||||||
Reference in New Issue
Block a user