Re: [BUG] git-diff-tree or git-commit: wrong diff(stat)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matthias Lederhofer <matled@xxxxxxx> writes:

> git-commit.sh uses git-diff-tree [options] HEAD --.  The '--' was
> added in 521f9c4d to prevent problems when HEAD exists as a file but
> git-diff-tree shows only differences below the current directory when
> '--' is used.  Hence git-commit in a subdirectory shows only stats for
> the subdirectory.

A cd_to_toplevel before that diff-tree should fix that,
shouldn't it?

For that matter, I think the commit hook should be run from a
known environment without getting affected by the user running
git-commit from a random subdirectory, and so should rerere.  So
how about....


 git-commit.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/git-commit.sh b/git-commit.sh
index be3677c..b8c00b8 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -622,6 +622,9 @@ else
 fi
 ret="$?"
 rm -f "$GIT_DIR/COMMIT_MSG" "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG"
+
+cd_to_toplevel
+
 if test -d "$GIT_DIR/rr-cache"
 then
 	git-rerere

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]