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

Re: Issue when adding new files to staged changes using interactive mode

From
AEAnother Email <yetanotheroneemail@gmail.com>
Date
Jul 29, 2020, 22:33 UTC
Message-ID
<3B809D01-D744-436E-98A5-73B4BE6351CC@gmail.com>
In-Reply-To
<C4JFF5L90V54.1FQKYQPIC3O43@ziyou.local>
Hi Raymond,
Thanks for looking into this.
Show 10 quoted lines
> Before I continue rooting around in the source, though, I wonder if the
> real issue here isn't the fact that add -p fails to support new files
> (requiring the intent-to-add workaround in the first place). I have
> always thought it's a confusing user experience that git add -p on a
> file that isn't yet tracked simply returns "No changes".
> 
> The underlying problem may be, and I say this without intimate knowledge
> of the subsystem, that we're now trying to force add-patch.c to do
> something it doesn't actually support, namely new files, whereas before
> it was attempting to patch what it saw as an empty file.
I cannot comment on the internals of git, but the typical use-case for using git add -p on new files would be when you add them as part of the changes that also involve existing files in the interactive mode, therefore it's helpful to have support for both compared to having to stage new files separately.
Show 5 quoted lines
> 
> This (patch-adding new files) is real in my workflow; is there any
> reason why git add -p with an explicit argument shouldn't attempt to add
> untracked files covered by the explicit argument? (In addition to fixing
> it for intent-to-adds.)
If I get the question right, it's perfectly fine for me personally to stage a single new file via git add -p. I agree, technically, it doesn't make a lot of sense, probably rather a matter of muscle memory, when you treat new files the same way as existing ones.
Previous: Raymond E. PascoNext: Taylor Blau
Message 4 of 5 in “Issue when adding new files to staged changes using interactive mode”
  1. Another EmailJul 28, 2020
  2. Raymond E. PascoJul 29, 2020
  3. Raymond E. PascoJul 29, 2020
  4. Another EmailJul 29, 2020
  5. Taylor BlauJul 31, 2020

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.