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

[PATCH] Enable and fix support for base less merges.

From
Fredrik Kuivinen <freku045@student.liu.se>
Date
Oct 3, 2005, 06:13 UTC
Message-ID
<20051003061309.GA1712@c165.ib.student.liu.se>
In-Reply-To
<7vfyrjw8qb.fsf@assigned-by-dhcp.cox.net>

Let the merge strategies handle the base less case if they are able to do it. It also fixes git-resolve.sh to die if no common ancestors exists, instead of doing the wrong thing. Furthermore, it contains a small independent fix for git-merge.sh and a fix for a base less code path in gitMergeCommon.py.

With this it's possible to use
    git merge -s recursive 'merge message' A B
to do a base less merge of A and B.
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
 git-merge-resolve.sh |    6 ++++++
 git-merge.sh         |    4 ++--
 gitMergeCommon.py    |    2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)
d298deec60a0fac7a16f43135f390c285251f613
diff --git a/git-merge-resolve.sh b/git-merge-resolve.sh
--- a/git-merge-resolve.sh
+++ b/git-merge-resolve.sh
@@ -31,6 +31,12 @@ case "$remotes" in
 	exit 2 ;;
 esac
 
+# Give up if this is a baseless merge.
+if test '' == "$bases"
+then
+	exit 2
+fi
+
 git-update-index --refresh 2>/dev/null
 git-read-tree -u -m $bases $head $remotes || exit 2
 echo "Trying simple merge."
diff --git a/git-merge.sh b/git-merge.sh
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -26,7 +26,7 @@ dropsave() {
 savestate() {
 	# Stash away any local modifications.
 	git-diff-index -r -z --name-only $head |
-	cpio -0 -o >"$GIR_DIR/MERGE_SAVE"
+	cpio -0 -o >"$GIT_DIR/MERGE_SAVE"
 }
 
 restorestate() {
@@ -103,7 +103,7 @@ echo "$head" >"$GIT_DIR/ORIG_HEAD"
 
 case "$#,$common" in
 *,'')
-	die "Unable to find common commit between $head_arg and $*"
+	# No common ancestors found. We need a real merge.
 	;;
 1,"$1")
 	# If head can reach all the merge then we are up to date.
diff --git a/gitMergeCommon.py b/gitMergeCommon.py
--- a/gitMergeCommon.py
+++ b/gitMergeCommon.py
@@ -213,7 +213,7 @@ def buildGraph(heads):
 
 # Write the empty tree to the object database and return its SHA1
 def writeEmptyTree():
-    tmpIndex = os.environ['GIT_DIR'] + '/merge-tmp-index'
+    tmpIndex = os.environ.get('GIT_DIR', '.git') + '/merge-tmp-index'
     def delTmpIndex():
         try:
             os.unlink(tmpIndex)
Previous: Junio C HamanoNext: Josef Weidendorfer
Message 4 of 39 in “What to expect after 0.99.8”
  1. Junio C HamanoOct 3, 2005
  2. A Large Angry SCMOct 3, 2005
  3. Junio C HamanoOct 3, 2005
  4. Enable and fix support for base less merges.Fredrik Kuivinen, Oct 3, 2005
  5. Josef WeidendorferOct 3, 2005
  6. Junio C HamanoOct 4, 2005
  7. Josef WeidendorferOct 4, 2005
  8. Junio C HamanoOct 4, 2005
  9. Random documentation fixesJonas Fonseca, Oct 3, 2005
  10. Daniel BarkalowOct 3, 2005
  11. Martin CoxallOct 3, 2005
  12. Nick HengeveldOct 3, 2005
  13. Daniel BarkalowOct 3, 2005
  14. Junio C HamanoOct 3, 2005
  15. Daniel BarkalowOct 3, 2005
  16. Junio C HamanoOct 3, 2005
  17. Linus TorvaldsOct 3, 2005
  18. Dan AloniOct 4, 2005
  19. Daniel BarkalowOct 4, 2005
  20. Matthias UrlichsOct 4, 2005
  21. H. Peter AnvinOct 4, 2005
  22. Matthias UrlichsOct 4, 2005
  23. H. Peter AnvinOct 4, 2005
  24. Junio C HamanoOct 4, 2005
  25. Linus TorvaldsOct 5, 2005
  26. H. Peter AnvinOct 5, 2005
  27. Daniel BarkalowOct 4, 2005
  28. H. Peter AnvinOct 4, 2005
  29. Daniel BarkalowOct 4, 2005
  30. Alan ChandlerOct 3, 2005
  31. H. Peter AnvinOct 3, 2005
  32. Greg KHOct 4, 2005
  33. H. Peter AnvinOct 5, 2005
  34. Matthias UrlichsOct 3, 2005
  35. Chuck LeverOct 4, 2005
  36. Junio C HamanoOct 4, 2005
  37. Fredrik KuivinenOct 4, 2005
  38. Fredrik KuivinenOct 5, 2005
  39. Junio C HamanoOct 5, 2005

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.