Merge branch 'maint'
authorShawn O. Pearce <spearce@spearce.org>
Thu, 12 Jul 2007 06:40:54 +0000 (02:40 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 12 Jul 2007 06:40:54 +0000 (02:40 -0400)
* maint:
git-gui: Work around bad interaction between Tcl and cmd.exe on ^{tree}

lib/commit.tcl
index dc7c88c6017bcb390c599f8b904ad3e7c31cc7d2..3172d7cb60b87cfb5d681d511fe9c5442749793c 100644 (file)
@@ -258,7 +258,18 @@ proc commit_committree {fd_wt curHEAD msg} {
        # -- Verify this wasn't an empty change.
        #
        if {$commit_type eq {normal}} {
-               set old_tree [git rev-parse "$PARENT^{tree}"]
+               set fd_ot [open "| git cat-file commit $PARENT" r]
+               fconfigure $fd_ot -encoding binary -translation lf
+               set old_tree [gets $fd_ot]
+               close $fd_ot
+
+               if {[string equal -length 5 {tree } $old_tree]
+                       && [string length $old_tree] == 45} {
+                       set old_tree [string range $old_tree 5 end]
+               } else {
+                       error "Commit $PARENT appears to be corrupt"
+               }
+
                if {$tree_id eq $old_tree} {
                        info_popup {No changes to commit.