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

Re: Is Git Add Supposed to Work Like This (git 2.50)?

From
Jon Forrest <nobozo@gmail.com>
Date
Sep 9, 2025, 16:00 UTC
Message-ID
<b8df3605-7afe-4121-ae50-095dfd671df9@gmail.com>
In-Reply-To
<20250907233456.GA1281511@coredump.intra.peff.net>
On 9/7/25 4:34 PM, Jeff King wrote:
Show 7 quoted lines
> I guess one could argue either way (though probably not at this point in
> time, as switching behaviors would cause confusion). But one challenge
> with "partial success" like this is that the exit code is binary. If we
> return "0" even though some items were ignored, callers may miss a
> failure. If we return "1" even though some items were added, callers may
> not realize they've mutated the state (and might need to rollback
> depending on what they were trying to accomplish).

If this were a big deal, which it isn't, I'd suggest a command line flag that says what to do if there's an invalid file specified on the command line. One setting of the flag would result in the current behavior and the other setting would result in all the invalid file(s) being ignored and the valid file(s) being handled normally.

Jon
Previous: Jeff KingNext: Jon Forrest
Message 4 of 9 in “Is Git Add Supposed to Work Like This (git 2.50)?”
  1. Jon ForrestSep 7, 2025
  2. Re Is Git Add Supposed to Work Like This (git 2.50)?K Jayatheerth, Sep 7, 2025
  3. Jeff KingSep 7, 2025
  4. Jon ForrestSep 9, 2025
  5. Jon ForrestSep 9, 2025
  6. Jeff KingSep 9, 2025
  7. Junio C HamanoSep 9, 2025
  8. Jeff KingSep 9, 2025
  9. Jeff KingSep 9, 2025

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.