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

Re: [PATCH 1/2] am: handle stray $dotest directory

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 14, 2013, 19:00 UTC
Message-ID
<7vbo78o6ut.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vip1gpqjp.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 12 quoted lines
> Ramkumar Ramachandra <artagnon@gmail.com> writes:
>
>> Junio C Hamano wrote:
>>> And then the message triggers at the second test in t3420 when
>>> applied on top of 587947750bd7 (rebase: implement --[no-]autostash
>>> and rebase.autostash, 2013-05-12) or 45acb7592825 (Merge branch
>>> 'rr/rebase-autostash', 2013-06-11).
>>
>> What was triggered?  (I didn't understand what you said)
>
> The patch applied on top of either of these commits will *BREAK* the
> second test in t3420.
Here is how "sh -x t3420-*.sh -i" ends:
    ...
    ++ git rebase unrelated-onto-branch
    Created autostash: cdca6ca
    HEAD is now at 0c4d2f1 third commit
    First, rewinding head to replay your work on top of it...
    Stray /srv/project/git/git.git/t/trash
    directory.t3420-rebase-autostash/.git/rebase-apply directory found.
    Use "git am --abort" to remove it.
    + eval_ret=1
    + test -z t
    + test 1 = 0
    + test -n ''
    + test t = t
    + test -n ''
    + return 1
    + test_failure_ 'rebase: dirty worktree, non-conflicting rebase' '
    ...
I _think_ the new check you added may be too loose.
A fix-up may look like this.
 git-am.sh | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index 37edfae..3f89cf6 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -505,9 +505,9 @@ then
 		exit ;;
 	esac
 	rm -f "$dotest/dirtyindex"
-else
-	# Possible stray $dotest directory
-	if test -d "$dotest"; then
+elif test -d "$dotest" && ! test -f "$dotest/autostash"
+then
+	# stray $dotest directory
 	case "$skip,$resolved,$abort" in
 	,,t)
 		rm -fr "$dotest"
@@ -518,8 +518,7 @@ else
 Use \"git am --abort\" to remove it.")"
 		;;
 	esac
-	fi
-
+else
 	# Make sure we are not given --skip, --resolved, nor --abort
 	test "$skip$resolved$abort" = "" ||
 		die "$(gettext "Resolve operation not in progress, we are not resuming.")"
Previous: Junio C HamanoNext: Ramkumar Ramachandra
Message 9 of 16 in “Fix am with stray $dotest directory”
  1. 0/2 Fix am with stray $dotest directoryRamkumar Ramachandra, Jun 14, 2013
  2. 1/2 am: handle stray $dotest directoryRamkumar Ramachandra, Jun 14, 2013
  3. Junio C HamanoJun 14, 2013
  4. Ramkumar RamachandraJun 14, 2013
  5. Ramkumar RamachandraJun 16, 2013
  6. Junio C HamanoJun 14, 2013
  7. Ramkumar RamachandraJun 14, 2013
  8. Junio C HamanoJun 14, 2013
  9. Junio C HamanoJun 14, 2013
  10. Ramkumar RamachandraJun 15, 2013
  11. Junio C HamanoJun 14, 2013
  12. Ramkumar RamachandraJun 14, 2013
  13. Junio C HamanoJun 14, 2013
  14. Ramkumar RamachandraJun 14, 2013
  15. Junio C HamanoJun 14, 2013
  16. 2/2 t/am: use test_path_is_missing() where appropriateRamkumar Ramachandra, Jun 14, 2013

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.