Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Jon Forrest <nobozo@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Is Git Add Supposed to Work Like This (git 2.50)?
Date: Tue, 9 Sep 2025 14:40:45 -0400	[thread overview]
Message-ID: <20250909184045.GA1912898@coredump.intra.peff.net> (raw)
In-Reply-To: <b8df3605-7afe-4121-ae50-095dfd671df9@gmail.com>

On Tue, Sep 09, 2025 at 09:00:34AM -0700, Jon Forrest wrote:

> > 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.

Interestingly there are a few --ignore-* options, including
--ignore-missing, which I think does what you want. But it only works
with --dry-run. I didn't dig into the rationale.

-Peff

      parent reply	other threads:[~2025-09-09 18:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-07  2:02 Is Git Add Supposed to Work Like This (git 2.50)? Jon Forrest
2025-09-07  8:10 ` Re " K Jayatheerth
2025-09-07 23:34 ` Jeff King
2025-09-09 16:00   ` Jon Forrest
2025-09-09 18:33     ` Jon Forrest
2025-09-09 18:42       ` Jeff King
2025-09-09 20:55         ` Junio C Hamano
2025-09-09 21:01           ` Jeff King
2025-09-09 18:40     ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250909184045.GA1912898@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=nobozo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox