Code

git-gui: Don't create empty (same tree as parent) commits.
[git.git] / git-gui.sh
index 36155bb8ea6e5049c313bb1406f4664a21894422..743099c57301bc4af103162e0279559a6e211638 100755 (executable)
@@ -1267,6 +1267,24 @@ proc commit_committree {fd_wt curHEAD msg} {
                return
        }
 
+       # -- Verify this wasn't an empty change.
+       #
+       if {$commit_type eq {normal}} {
+               set old_tree [git rev-parse "$PARENT^{tree}"]
+               if {$tree_id eq $old_tree} {
+                       info_popup {No changes to commit.
+
+No files were modified by this commit and it
+was not a merge commit.
+
+A rescan will be automatically started now.
+}
+                       unlock_index
+                       rescan {set ui_status_value {No changes to commit.}}
+                       return
+               }
+       }
+
        # -- Build the message.
        #
        set msg_p [gitdir COMMIT_EDITMSG]