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

Interesting behavior in git mergetool with no BASE revision

From
JWJason Wenger <jcwenger@gmail.com>
Date
Jan 18, 2012, 23:05 UTC
Message-ID
<CAM6z=4_+yC4EnL9SZFd6=Nxs89QeHevNCakVzVycGBe7G+nTKQ@mail.gmail.com>

Doing a git merge on 1.7.4.3, on a case where both branches have a file created, and the base does not.  Per git-mergetool:

"the configured command line will be invoked with $BASE set to the name of a temporary file containing the common base for the merge, if available;"

So testing in this case, I set my mergetool cmd as "echo $MERGED $LOCAL $REMOTE $BASE", and I get the following:

cio/.cproject ./cio/.cproject.LOCAL.9029.cproject ./cio/.cproject.REMOTE.9029.cproject ./cio/.cproject.BASE.9029.cproject

ls -a cio shows the following files:

.cproject .cproject.LOCAL.9325.cproject .cproject.BACKUP.9325.cproject .cproject.REMOTE.9325.cproject

So the lack of base file makes sense -- There is no base to start from.  However, $BASE evaluates to ./cio/.cproject.BASE.9029.cproject, which is a nonexistent file.  This makes my actual mergetool upset to no end.  Intuitively from documents, I would expect $BASE to evaluate to an empty string in this case.

Is this intended behavior?
--Jason C. Wenger
Next: David Aguilar
Message 1 of 17 in “Interesting behavior in git mergetool with no BASE revision”
  1. Jason WengerJan 18, 2012
  2. David AguilarJan 20, 2012
  3. mergetool: Provide an empty file when no base existsDavid Aguilar, Jan 20, 2012
  4. David AguilarJan 20, 2012
  5. Junio C HamanoJan 20, 2012
  6. David AguilarJan 20, 2012
  7. mergetool: Provide an empty file when no base existsDavid Aguilar, Jan 20, 2012
  8. Junio C HamanoJan 20, 2012
  9. David AguilarJan 20, 2012
  10. Junio C HamanoJan 20, 2012
  11. Junio C HamanoJan 20, 2012
  12. mergetool: Provide an empty file when neededDavid Aguilar, Jan 20, 2012
  13. David AguilarJan 20, 2012
  14. Jason WengerJan 20, 2012
  15. Junio C HamanoJan 20, 2012
  16. mergetool: Provide an empty file when neededDavid Aguilar, Jan 20, 2012
  17. mergetool: Provide an empty file when no base existsDavid Aguilar, Jan 20, 2012

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.