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

git merge -s subtree seems to be broken.

From
George Shammas <georgyo@gmail.com>
Date
Jul 31, 2018, 14:09 UTC
Message-ID
<CAF1Ko+FBP5UmETmh071dvn9iv8-N-3YgaP61q-4jQvxFdN0GTA@mail.gmail.com>

At work, we recently updated from a massively old version of git (1.7.10) to 2.18. There are a few code bases that use subtrees, and they seem to have completely broke when trying to merge in updates.

I have confirmed that it works correctly in 1.7.10. The 2.18 behavior is clearly incorrect.

git init echo init > test git add test git commit -m init

git remote add tig https://github.com/jonas/tig.git git fetch tig git merge -s ours --no-commit --allow-unrelated-histories tig-2.3.0 git read-tree --prefix=src/ -u tig-2.3.0 git commit -m "Get upstream tig-2.3.0" # Notice how the history are merged, and that the source from the upstream repo is in src

echo update > test git commit -a -m "test"

git merge -s subtree tig-2.4.0 # Boom, in 2.18 instead of merging into the subtree, it just deletes everything in the repository, which is clearly the wrong behavior.

Next: George Shammas
Message 1 of 17 in “git merge -s subtree seems to be broken.”
  1. George ShammasJul 31, 2018
  2. George ShammasJul 31, 2018
  3. Jeff KingJul 31, 2018
  4. Junio C HamanoJul 31, 2018
  5. René ScharfeAug 1, 2018
  6. Junio C HamanoJul 31, 2018
  7. George ShammasJul 31, 2018
  8. Jeff KingJul 31, 2018
  9. Junio C HamanoJul 31, 2018
  10. Jeff KingJul 31, 2018
  11. Jeff KingJul 31, 2018
  12. George ShammasJul 31, 2018
  13. Jeff KingJul 31, 2018
  14. Junio C HamanoJul 31, 2018
  15. René ScharfeAug 1, 2018
  16. Jeff KingAug 2, 2018
  17. Jeff KingAug 2, 2018

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.