Skip to content

Commit c7bafad

Browse files
committed
git-gui: Allow committing empty merges
Johannes Sixt noticed that git-gui would not let the user commit a merge created by `git merge -s ours` as the ours strategy does not alter the tree (that is HEAD^1^{tree} = HEAD^{tree} after the merge). The same issue arises from amending such a merge commit. We now permit an empty commit (no changed files) if we are doing a merge commit. Core Git does this with its command line based git-commit tool, so it makes sense for the GUI to do the same. Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent 0b5ea16 commit c7bafad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

git-gui.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ File [short_path $path] cannot be committed by this program.
11711171
}
11721172
}
11731173
}
1174-
if {!$files_ready} {
1174+
if {!$files_ready && ![string match *merge $curType]} {
11751175
info_popup {No changes to commit.
11761176

11771177
You must add at least 1 file before you can commit.

0 commit comments

Comments
 (0)