Re: Minor UX annoyance w/`git add --patch untracked/file`
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Dec 8, 2023, 22:29 UTC
- Message-ID
- <ZXOY1Qq4MKQPEEAZ@nand.local>
- In-Reply-To
- <xmqqmsuk1jvp.fsf@gitster.g>
On Sat, Dec 09, 2023 at 06:09:46AM +0900, Junio C Hamano wrote:
Show 14 quoted lines
> Jeff King <peff@peff.net> writes: > > > They _could_, but keep in mind that the argument is not strictly a path. > > It is a pathspec that may match multiple paths. So: > > > > git add -p path/to/ > > > > for example will pick up the tracked files in path/to/, but not your > > untracked one. > > The corresponding command w/o "-p", i.e., "git add path/to/", will > pick up both tracked and untracked ones from the named directory, > while honoring the ignore settings. So I suspect it might feel more > natural if "-p" followed suit.
I tend to agree. I do think that the full specification of when "git add -p" implies "git add -N ... && git add -p" would be difficult to explain to users.
But I think it's a worthwhile trade-off in that it makes the UX more consistent in the common case (where the argument to add is a literal path, not a pathspec).
Thanks, Taylor