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

Re: "git am --abort" screwing up index?

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 17, 2015, 08:01 UTC
Message-ID
<03631611149f05dbcd862b4c1e8e9d6b@www.dscho.org>
In-Reply-To
<CA+55aFwwD=K-i9d40N5FtnTLT-ApZOzmgnXhnuA=C0zw2eBt3Q@mail.gmail.com>
Hi Linus,
On 2015-08-17 01:33, Linus Torvalds wrote:
Show 10 quoted lines
> On Sun, Aug 16, 2015 at 12:46 PM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
>>
>> Maybe it has always done this, and I just haven't noticed (I usually
>> _just_ do the "git reset --hard" thing, don't ask me why I wanted to
>> be doubly sure this time). But maybe it's an effect of the new
>> built-in "am".
> 
> I bisected this. It's definitely used to work, and the regression is
> from the new built-in am.
This patch is a reproducer:
-- snipsnap --
From 5323f1c309ad40721e2e19fa9c6ce5ad52d98271 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Mon, 17 Aug 2015 09:37:39 +0200
Subject: [PATCH] t4151: demonstrate that builtin am corrupts index' stat data
Reported by Linus Torvalds.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t4151-am-abort.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh
index 05bdc3e..bf2e6f4 100755
--- a/t/t4151-am-abort.sh
+++ b/t/t4151-am-abort.sh
@@ -168,4 +168,16 @@ test_expect_success 'am --abort on unborn branch will keep local commits intact'
 	test_cmp expect actual
 '
 
+test_expect_failure 'am --abort leaves index stat info alone' '
+	git checkout -f --orphan stat-info &&
+	git reset &&
+	test_commit should-be-untouched &&
+	test-chmtime =0 should-be-untouched.t &&
+	git update-index --refresh &&
+	git diff-files --exit-code --quiet &&
+	test_must_fail git am 0001-*.patch &&
+	git am --abort &&
+	git diff-files --exit-code --quiet
+'
+
 test_done
-- 
2.3.1.windows.1.9.g8c01ab4
Previous: Linus TorvaldsNext: Paul Tan
Message 3 of 9 in “"git am --abort" screwing up index?”
  1. Linus TorvaldsAug 16, 2015
  2. Linus TorvaldsAug 16, 2015
  3. Johannes SchindelinAug 17, 2015
  4. am --abort: merge ORIG_HEAD tree into indexPaul Tan, Aug 17, 2015
  5. Johannes SchindelinAug 17, 2015
  6. Linus TorvaldsAug 17, 2015
  7. Junio C HamanoAug 17, 2015
  8. am --skip/--abort: merge HEAD/ORIG_HEAD tree into indexPaul Tan, Aug 19, 2015
  9. Junio C HamanoAug 19, 2015

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.