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

Feature Request: Option to make "git rev-list --objects" output duplicate objects

From
Baumann, Moritz <moritz.baumann@sap.com>
Date
Mar 24, 2023, 15:51 UTC
Message-ID
<AS1PR02MB8185A45DB63216699AFB2C5494849@AS1PR02MB8185.eurprd02.prod.outlook.com>
Good afternoon,

While rewriting a slow pre-receive hook to (hopefully) speed it up, I ran into the following problem:

We want to perform a bunch of checks on all newly pushed files, some of which are based on the file contents and some of which are based on the file name. I started with…

  git rev-list --pretty=format:'' --no-commit-header \
  --objects --filter=object:type=blob "$new_head" --not --all

…and then used the resulting list for all subsequent checks. After writing some unit tests, I noticed that the returned list is not sufficient: If you generate the exact same file twice, once with a "bad" name and once with a "good" name, you will only see one of those names and therefore the hook will mistakenly allow the push.

So, what I would want/need is an option that forces "git rev-list --objects" to output the object multiple times if it has multiple names in the commit range. Admittedly, such an option would likely only be useful for hooks that validate file names.

Would it be feasible to implement such an option? If so, does it sound like a good or bad idea?

Is there any alternative for my use case that doesn't involve walking the commits one-by-one? (That's what we previously did and what turned out to be quite slow on our repository.)

Best regards, Moritz Baumann

Next: Junio C Hamano
Message 1 of 9 in “Feature Request: Option to make "git rev-list --objects" output duplicate objects”
  1. Baumann, MoritzMar 24, 2023
  2. Junio C HamanoMar 24, 2023
  3. Baumann, MoritzMar 27, 2023
  4. Junio C HamanoMar 27, 2023
  5. Jeff KingMar 24, 2023
  6. Baumann, MoritzMar 28, 2023
  7. docs: document caveats of rev-list's object-name outputJeff King, Mar 28, 2023
  8. Baumann, MoritzMar 30, 2023
  9. Jeff KingMar 28, 2023

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.