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

Should "git apply --check" imply verbose?

From
PGPaul Gortmaker <paul.gortmaker@windriver.com>
Date
Aug 20, 2013, 15:11 UTC
Message-ID
<5213873A.6010003@windriver.com>

TL;DR -- "git apply --reject" implies verbose, but the similar "git apply --check" does not, which seems inconsistent.

Background:  A common (non-git) workflow can be to use "patch --dry-run"
to inspect whether a patch is feasible, and then use patch again
a 2nd time (w/o --dry-run) to actually apply it (and then work
through the rejects).

You can also do the above in a git repo, but you lose out because "patch" doesn't (yet) capture the patched function names[1] in the rejected hunks, making it hard to double check your work.

My initial thought was to replace the above two steps with "git apply --check ..." and then "git apply --reject ..." so that I could just abandon using patch altogether.

That works great, with just one snag that had me go reading the source. It seems that "git apply --reject" is verbose, and kind of looks like the identical output I'd get if I used patch. But "git apply --check" is quite reserved in its output and doesn't look at all like "patch --dry-run". I initially believed that "--check" was stopping at the 1st failure, based on the output.

Only when I read the source did I realize it was checking all the hunks silently, and adding a "-v" would make it similar to the output from "patch --dry-run".

Not a critical issue by any means, but having the "-v" implied by "--check" (or perhaps having both default to non-verbose?) might save other users from getting confused in the same way.

Thanks, Paul. --

[1] https://savannah.gnu.org/bugs/index.php?39819
Next: Junio C Hamano
Message 1 of 13 in “Should "git apply --check" imply verbose?”
  1. Paul GortmakerAug 20, 2013
  2. Junio C HamanoAug 20, 2013
  3. Paul GortmakerAug 20, 2013
  4. Jonathan NiederAug 20, 2013
  5. Paul GortmakerAug 20, 2013
  6. Junio C HamanoAug 20, 2013
  7. Steven RostedtAug 20, 2013
  8. Junio C HamanoAug 20, 2013
  9. Steven RostedtAug 20, 2013
  10. Paul GortmakerAug 20, 2013
  11. Junio C HamanoAug 20, 2013
  12. Junio C HamanoAug 20, 2013
  13. Steven RostedtAug 20, 2013

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.