Subject: Re: Change behavior of git add --patch on newly added file?

From: Emily Shaffer <[email-masked]>
Date: Tue, 12 Nov 2019 10:47:20 -0800

On Sat, Nov 09, 2019 at 01:27:16PM +0900, Junio C Hamano wrote:
> Emily Shaffer <[email-masked]> writes:
> 
> > Should 'git add -p <newly-added-file>' do the same thing as 'git add -N
> > <newly-added-file && git add -p <newly-added-file>'?
> 
> Probably.  
> 
> I originally wrote "git add -i" with the intention that the
> interactive mode is _the_ primary interface to the machinery, so the
> expected way to work with a new file was "git add -i", tell the
> command to add that <newly-added-file>, and do the "patch" thing
> using the interactive subcommand to do so within the "git add -i"
> session.
> 
> Later people liked (only) the patch part, and "git add -p" (and
> various "--patch" options that invoke "add -p" internally from other
> commands like "checkout", "reset" were added) was born.  I think
> nobody thought things through when they did so.
> 
> If I were designing "git add -p" from scratch and explicitly asked
> not to do the other parts of the "--interactive" feature, I would
> imagine "add -N && add -p" combination is what I would make it
> mimic.
> 
> Patches welcome, but you may want to check with Dscho as there is an
> effort going on to reimplement the entire "add -i" machinery in C.

Ah, this is a compelling point. I imagine the landscape will be fairly
different when that effort is finished.

>From the replies, it sounds like it's a favorable change, but it makes
sense to wait on it considering the refactor to use C. Thanks, all.

 - Emily