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

[PATCH] git-merge: do up-to-date check also for strategies ours, subtree.

From
Gerrit Pape <pape@smarden.org>
Date
Aug 9, 2007, 12:08 UTC
Message-ID
<20070809120831.19319.qmail@a61af064a2a242.315fe32.mid.smarden.org>

If called with one argument, check also for no_trivial_merge_strategies whether all the merge can already be reached by HEAD. Otherwise git-merge creates an unnecessary commit, e.g.:

 $ (git init && touch foo && git add foo && git commit -m foo) >/dev/null
 $ git merge -s ours master
 Merge made by ours.
 $ git log --pretty=oneline
 d941346f022b7cb70c51d8122de4ae82657ae943 Merge branch 'master'
 68a1d32229917d5d1f4c8f64096d1abde84e9f6b foo
 $
Signed-off-by: Gerrit Pape <pape@smarden.org>
---
 git-merge.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/git-merge.sh b/git-merge.sh
index 5ccf282..e90f62a 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -287,9 +287,6 @@ esac
 echo "$head" >"$GIT_DIR/ORIG_HEAD"
 
 case "$index_merge,$#,$common,$no_commit" in
-f,*)
-	# We've been told not to try anything clever.  Skip to real merge.
-	;;
 ?,*,'',*)
 	# No common ancestors found. We need a real merge.
 	;;
@@ -299,6 +296,9 @@ f,*)
 	finish_up_to_date "Already up-to-date."
 	exit 0
 	;;
+f,*)
+	# We've been told not to try anything clever.  Skip to real merge.
+	;;
 ?,1,"$head",*)
 	# Again the most common case of merging one remote.
 	echo "Updating $(git rev-parse --short $head)..$(git rev-parse --short $1)"
-- 
debian.1.5.3_rc4.1-dirty
Next: Junio C Hamano
Message 1 of 7 in “git-merge: do up-to-date check also for strategies ours, subtree.”
  1. git-merge: do up-to-date check also for strategies ours, subtree.Gerrit Pape, Aug 9, 2007
  2. Junio C HamanoAug 9, 2007
  3. Jeff KingAug 10, 2007
  4. Junio C HamanoAug 10, 2007
  5. Junio C HamanoAug 10, 2007
  6. Gerrit PapeAug 10, 2007
  7. git-merge: do up-to-date check also for all strategiesJunio C Hamano, Aug 16, 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.