git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Matthias Lederhofer <matled@gmx.net>
Cc: git@vger.kernel.org
Subject: Re: [BUG] git-diff-tree or git-commit: wrong diff(stat)
Date: Mon, 05 Mar 2007 12:22:57 -0800	[thread overview]
Message-ID: <7v3b4jzbha.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20070305200751.GA13655@moooo.ath.cx> (Matthias Lederhofer's message of "Mon, 5 Mar 2007 21:07:51 +0100")

Matthias Lederhofer <matled@gmx.net> 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

  reply	other threads:[~2007-03-05 20:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-05 20:07 [BUG] git-diff-tree or git-commit: wrong diff(stat) Matthias Lederhofer
2007-03-05 20:22 ` Junio C Hamano [this message]
2007-03-05 22:08   ` Matthias Lederhofer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v3b4jzbha.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=matled@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).