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

Re: Syntax check via update hook?

From
Mark Plaksin <happy@usg.edu>
Date
May 20, 2009, 20:57 UTC
Message-ID
<ws8wkrsdb6.fsf@usg.edu>
In-Reply-To
<20090520152224.GB22426@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 19 quoted lines
> On Wed, May 20, 2009 at 11:13:09AM -0400, Mark Plaksin wrote:
>
>> Well, it's oh so close!  If we make changes that don't pass the syntax
>> check and try to push them the hook rejects the changes.  If we then
>> make a change that will pass the syntax check, leave the others broken,
>> and push, 'git diff-tree' doesn't list the previously rejected files so
>> the hook accepts the push.  Is there any way to get 'git diff-tree' to
>> list all of the files?
>
> Ah, yeah, that was my mistake. If you are looking at the whole tree,
> then you only need to look at what is being pushed, as it contains the
> changes for all of the commits being pushed. But if you are going to ask
> for a diff, you want to see not just the final commit, but the diff
> between what is in the ref now and what you are proposing to push.
>
> The old commit is passed as the second argument to the hook. So you
> should be able to just do:
>
>   git diff-tree "$2" "$3"
That did the trick once we put the '-r' back :)  Thanks very much!
Previous: Jeff King
Message 8 of 8 in “Syntax check via update hook?”
  1. Mark PlaksinMay 8, 2009
  2. Jeff KingMay 9, 2009
  3. Mark PlaksinMay 12, 2009
  4. Jeff KingMay 14, 2009
  5. Mark PlaksinMay 14, 2009
  6. Mark PlaksinMay 20, 2009
  7. Jeff KingMay 20, 2009
  8. Mark PlaksinMay 20, 2009

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.