[Xfce4-commits] r28557 - in xfce4-dev-tools/trunk: . scripts
Brian J. Tarricone
bjt23 at cornell.edu
Sat Nov 1 21:18:23 CET 2008
On Sat, 1 Nov 2008 21:04:18 +0100 Jannis Pohlmann wrote:
> Am Sat, 1 Nov 2008 09:35:02 -0700
> schrieb "Brian J. Tarricone" <bjt23 at cornell.edu>:
>
> > On Sat, 1 Nov 2008 11:44:28 +0000 (UTC) Jannis Pohlmann wrote:
> >
> > > Author: jannis
> > > Date: 2008-11-01 11:44:28 +0000 (Sat, 01 Nov 2008)
> > > New Revision: 28557
> > >
> > > Modified:
> > > xfce4-dev-tools/trunk/ChangeLog
> > > xfce4-dev-tools/trunk/scripts/xdt-commit
> > > Log:
> > > * scripts/xdt-commit: Automatically add ChangeLog files of
> > > git repositories to the commit with "git add ${CHANGELOG}". Use
> > > "git diff --cached" instead of "git diff HEAD" for the commit
> > > messages.
> >
> > Hmm, not sure I like this... wouldn't "git diff HEAD^..HEAD" work
> > better?
>
> HEAD^..HEAD would print the diff between the previous and the last
> commit. That's not really useful if you need the diff between HEAD and
> the future commit. --cached and HEAD do the same, but there is help
> explicitely available for --cached in the man page:
>
> git diff [--options] --cached [<commit>] [--] [<path>...]
>
> This form is to view the changes you staged for the next
> commit relative to the named <commit>. Typically you would want
> comparison with the latest commit, so if you do not give <commit>,
> it defaults to HEAD.
No, I don't think that's the case. My understanding is that HEAD gives
you the diff between the last commit and the current state of the
working tree. --cached will restrict that to only giving you a diff
between the last commit and changes in the working tree that have been
*staged*. Now, I see you added a line to stage ChangeLog, but that
just strikes me as kinda wrong. But in practice it'll of course work
fine.
My suggestion to use "git diff HEAD^..HEAD" was that in theory it means
"give me a diff between the last commit from the current HEAD, and the
current working tree." But maybe it doesn't... anyway, I guess your
modification will work all the time even if I don't particularly like
it ^_^.
-brian
More information about the Xfce4-dev
mailing list