EmptyCommit simply create an empty commit
( ctx context.Context, msg string, noVerify bool, authorName, authorEmail string, )
| 60 | |
| 61 | // EmptyCommit simply create an empty commit |
| 62 | func EmptyCommit( |
| 63 | ctx context.Context, |
| 64 | msg string, |
| 65 | noVerify bool, |
| 66 | authorName, authorEmail string, |
| 67 | ) *exec.Cmd { |
| 68 | if msg == "" { |
| 69 | msg = defaultCommitMessage |
| 70 | } |
| 71 | |
| 72 | cmd := exec.CommandContext( |
| 73 | ctx, |
| 74 | "git", |
| 75 | "commit", |
| 76 | "--allow-empty", |
| 77 | "-m", |
| 78 | msg, |
| 79 | ) |
| 80 | |
| 81 | if noVerify { |
| 82 | cmd.Args = append( |
| 83 | cmd.Args, |
| 84 | "--no-verify") |
| 85 | } |
| 86 | |
| 87 | if authorName != "" || authorEmail != "" { |
| 88 | cmd.Args = append( |
| 89 | cmd.Args, |
| 90 | fmt.Sprintf("--author=\"%s <%q>\"", authorName, authorEmail)) |
| 91 | } |
| 92 | |
| 93 | return cmd |
| 94 | } |
| 95 | |
| 96 | // ForceCommit commits every change while skipping CI. |
| 97 | func ForceCommit( |