git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git apply --indent-to-add deletes other files from the index
@ 2021-10-26 15:11 Ryan Hodges (rhodges)
  2021-10-30 20:39 ` git apply --intent-to-add " Johannes Altmanninger
  2021-10-30 20:41 ` [PATCH] apply: make --intent-to-add not stomp index Johannes Altmanninger
  0 siblings, 2 replies; 18+ messages in thread
From: Ryan Hodges (rhodges) @ 2021-10-26 15:11 UTC (permalink / raw)
  To: git@vger.kernel.org; +Cc: Ryan Hodges

Hi all,
 
I’ve got a quick question about ‘git apply –intent-to-add’.  If I’ve got a patch that just adds one file to the tree:
 
[sjc-ads-2565:t.git]$ git diff
diff --git a/c.c b/c.c
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/c.c
@@ -0,0 +1 @@
+test
 
and I apply that patch with –intent-to-add:
 
[sjc-ads-2565:t.git]$ git apply --intent-to-add c.diff
 
The newly added file is tracked but other files in the tree get marked as deleted:
 
[sjc-ads-2565:t.git]$ git status
On branch master
Changes to be committed:
  (use “git restore –staged <file>…” to unstage)
                deleted:    a.c
                deleted:    b.c
 
Changes not staged for commit:
  (use “git add <file>…” to update what will be committed)
  (use “git restore <file>…” to discard changes in working directory)
                new file:   c.c
 
It looks like Git created a new index with only the newly added file in the patch.  However, I’d like Git to just add one entry to the index corresponding to the newly added file in the patch.  Is this a bug or am I completely misinterpreting the goal of ‘intent-to-add’.  I just started looking at the source but a quick message from the experts would be much appreciated. 
 
I’m currently testing with Git version 2.33.
 
Regards,
Ryan
 

^ permalink raw reply related	[flat|nested] 18+ messages in thread
* RE: [PATCH v3] apply: --intent-to-add should imply --index
@ 2025-05-01  9:03 Jason Cho
  2025-05-01 12:48 ` Kristoffer Haugsbakk
  0 siblings, 1 reply; 18+ messages in thread
From: Jason Cho @ 2025-05-01  9:03 UTC (permalink / raw)
  To: git@vger.kernel.org
  Cc: aclopte@gmail.com, gitster@pobox.com, rhodges@cisco.com,
	rphodges@gmail.com

I'm following up on the bug reported by Ryan Hodges on October 26, 2021,
regarding the `git apply --intent-to-add` command incorrectly marking all 
other tracked files as deleted from the index.

Johannes Altmanninger submitted patch v3 titled "apply: --intent-to-add 
should imply --index" to fix this issue. 

Is this fix merged? If so, which Git version includes this fix.



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-05-03  8:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-26 15:11 git apply --indent-to-add deletes other files from the index Ryan Hodges (rhodges)
2021-10-30 20:39 ` git apply --intent-to-add " Johannes Altmanninger
2021-10-30 21:42   ` Ryan Hodges
2021-10-31  6:43     ` Johannes Altmanninger
2021-10-30 20:41 ` [PATCH] apply: make --intent-to-add not stomp index Johannes Altmanninger
2021-10-30 20:51   ` [PATCH v2] " Johannes Altmanninger
2021-11-01  6:40     ` Junio C Hamano
2021-11-01  7:07       ` Re* " Junio C Hamano
2021-11-06 11:24         ` Johannes Altmanninger
2021-11-06 11:42           ` [PATCH v3] apply: --intent-to-add should imply --index Johannes Altmanninger
2021-11-06 11:47             ` Johannes Altmanninger
2021-11-06 11:24       ` [PATCH v2] apply: make --intent-to-add not stomp index Johannes Altmanninger
  -- strict thread matches above, loose matches on Subject: below --
2025-05-01  9:03 [PATCH v3] apply: --intent-to-add should imply --index Jason Cho
2025-05-01 12:48 ` Kristoffer Haugsbakk
2025-05-01 16:31   ` Junio C Hamano
2025-05-02  4:11     ` Ryan Hodges
2025-05-03  3:51       ` Raymond E. Pasco
2025-05-03  8:22         ` Raymond E. Pasco

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).