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

[PATCH 2/4] Use BASE index extension in git-am.

From
Junio C Hamano <junkio@cox.net>
Date
Apr 9, 2007, 06:13 UTC
Message-ID
<7vwt0m3wj6.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vps6e5b93.fsf_-_@assigned-by-dhcp.cox.net>

This makes git-am to record the expected HEAD location after finishing its operation in the index, so that subsequent BASE check would notice when somebody else updated your branch head while you are looking the other way.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 git-am.sh |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index e69ecbf..27912ce 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -13,6 +13,7 @@ git var GIT_COMMITTER_IDENT >/dev/null || exit
 
 stop_here () {
     echo "$1" >"$dotest/next"
+    git update-index --set-base $(git rev-parse --verify HEAD)
     exit 1
 }
 
@@ -157,6 +158,8 @@ do
 	esac
 done
 
+check_base || exit
+
 # If the dotest directory exists, but we have finished applying all the
 # patches in them, clear it out.
 if test -d "$dotest" &&
@@ -468,5 +471,6 @@ do
 
 	go_next
 done
+git update-index --set-base $(git rev-parse --verify HEAD)
 
 rm -fr "$dotest"
-- 
1.5.1.730.g0d43be
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 7 in “What's cooking in git.git (topics)”
  1. Junio C HamanoApr 3, 2007
  2. Junio C HamanoApr 5, 2007
  3. The index is based on blah, however, the HEAD points at different commit.Junio C Hamano, Apr 9, 2007
  4. 1/4 Move check_base() shell function to git-sh-setupJunio C Hamano, Apr 9, 2007
  5. 2/4 Use BASE index extension in git-am.Junio C Hamano, Apr 9, 2007
  6. 3/4 git-read-tree --set-base=<commit>Junio C Hamano, Apr 9, 2007
  7. 4/4 Teach git-reset to use index BASE extension.Junio C Hamano, Apr 9, 2007

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.