git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Advices to imlement update hook

From
FMFrancis Moreau <francis.moro@gmail.com>
Date
Feb 10, 2011, 13:24 UTC
Message-ID
<AANLkTin0p77wd3dOdF6h3+Gw7vphj=CTvn0UUtRwf5un@mail.gmail.com>
In-Reply-To
<20110209170535.GA5254@sigill.intra.peff.net>
Hello,
On Wed, Feb 9, 2011 at 6:05 PM, Jeff King <peff@peff.net> wrote:
Show 39 quoted lines
> 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.
Oh, I see. I undestand why the git-rev-list is needed now.
Thanks for your help !
-- 
Francis
Previous: Jeff King
Message 6 of 6 in “Advices to imlement update hook”
  1. Francis MoreauFeb 9, 2011
  2. Johannes SixtFeb 9, 2011
  3. Johannes SixtFeb 9, 2011
  4. Francis MoreauFeb 9, 2011
  5. Jeff KingFeb 9, 2011
  6. Francis MoreauFeb 10, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.