summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-07-12 06:31:28 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-07-12 06:38:14 (GMT)
commit20f1a10bfb6c31a3728a74bf1c33cb3cc5ac0c7e (patch)
tree8d68b72b2f7875d4f52de0876dedecde71079735
parente87fb0f1b4a4b458394a65d664145a9a8001e821 (diff)
downloadgit-gitgui-0.7.5.zip
git-gitgui-0.7.5.tar.gz
git-gitgui-0.7.5.tar.bz2
git-gui: Work around bad interaction between Tcl and cmd.exe on ^{tree}gitgui-0.7.5
From Johannes Sixt <J.Sixt@eudaptics.com>: > It seems that MSYS's wish does some quoting for Bourne shells, > in particular, escape the first '{' of the "^{tree}" suffix, but > then it uses cmd.exe to run "git rev-parse". However, cmd.exe does > not remove the backslash, so that the resulting rev expression > ends up in git's guts as unrecognizable garbage: rev-parse fails, > and git-gui hickups in a way that it must be restarted. Johannes originally submitted a patch to this section of commit.tcl to use `git rev-parse $PARENT:`, but not all versions of Git will accept that format. So I'm just taking the really simple approach here of scanning the first line of the commit to grab its tree. About the same cost, but works everywhere. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--lib/commit.tcl13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/commit.tcl b/lib/commit.tcl
index f9791f6..e139f4d 100644
--- a/lib/commit.tcl
+++ b/lib/commit.tcl
@@ -260,7 +260,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.