X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-gui%2Flib%2Fcommit.tcl;fp=git-gui%2Flib%2Fcommit.tcl;h=e139f4da2b84718d74dce0e9286dedd3cd8465c5;hb=1b2782a5e2f88bf5e6e2cbb58e54fea015e21af5;hp=f9791f64dbec927726622f3d0a368606a4f13b17;hpb=512e44b24501df0b4b231cc7f999f9646d96617b;p=git.git diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl index f9791f64d..e139f4da2 100644 --- a/git-gui/lib/commit.tcl +++ b/git-gui/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.