git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Francis Moreau <francis.moro@gmail.com>
Cc: Johannes Sixt <j.sixt@viscovery.net>, git@vger.kernel.org
Subject: Re: Advices to imlement update hook
Date: Wed, 9 Feb 2011 12:05:35 -0500	[thread overview]
Message-ID: <20110209170535.GA5254@sigill.intra.peff.net> (raw)
In-Reply-To: <AANLkTik=Xw3b1i-AranJtfngOsfLvEDSzrMq3jKTy-Yy@mail.gmail.com>

On Wed, Feb 09, 2011 at 05:51:24PM +0100, Francis Moreau wrote:

> >>>    git diff-tree <oldref> <newref> -- ^b || exit 1
> >>>
> >>> but it doesn't work.
> >>
> >>   git diff-tree --quiet <oldref> <newref> -- b
> >
> > should do it; it sets the exit code.
> 
> but does that work if a commit modify b/ and another directory ?

No, it just looks for commits that modified b. There is currently no way
to specify a path to say "commit that did not modify b". You need to
check the output of:

  git rev-list | git diff-tree --stdin -m --name-only

which should list all paths modified by all commits. And then you can
either blacklist or whitelist as appropriate (note that the names can be
quoted; you might want to look at the "-z" option and do your
list-checking in perl).

> > But don't you also want to inspect all commits between oldref and newref?
> 
> Yes I want to inspect all commits in the range.

see above.

> > Someone could have modified the directory, and then reverted the
> > modification in a later commit. If these commits arrive in a single push,
> > the above code wouldn't notice this.
> 
> I agree but I thought that git diff-tree would list all changes made
> between the 2 refs.

Between the two endpoints. It won't even look at the commits in the
middle, so as long as a later middle commit reverts the change of an
earlier middle commit, the endpoints won't be affected.

-Peff

  reply	other threads:[~2011-02-09 17:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09 16:27 Advices to imlement update hook Francis Moreau
2011-02-09 16:38 ` Johannes Sixt
2011-02-09 16:42   ` Johannes Sixt
2011-02-09 16:51     ` Francis Moreau
2011-02-09 17:05       ` Jeff King [this message]
2011-02-10 13:24         ` Francis Moreau

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=20110209170535.GA5254@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=francis.moro@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.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).