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

jpalacios@atlassian.com

From
JPJuan Palacios <jpalacios@atlassian.com>
Date
Oct 24, 2014, 02:50 UTC
Message-ID
<CABY2JrJjZH+hgeGCBwFjBxsTdo_M2yXctr1dJKLxFL28hacQPw@mail.gmail.com>

In a project with a submodule, if you merge two diverging branches in which one branch updated which commit the submodule points to, and the other branch moves the submodule to a new location, the resulting merge error message does not provide information about what the conflict was, or the path to the conflicted directory.

I've included at the bottom a short script which sets up a project with a submodule and creates both branches. If after running it you cd into 'top-level-project' and run 'git merge branch_that_points_the_submodule_to_new_commit' the resulting error message is:

Auto-merging submodule-moved Adding as submodule-moved~HEAD instead Automatic merge failed; fix conflicts and then commit the result.

I would have expected an output in line with other merge conflict messages. Something with the format:

CONFLICT (<REASON>): Merge conflict in <PATH_TO_CONFLICT>

Where <REASON> would be something like (delete/modify) I believe this might be a bug in the implementation.

Thank you
--------------------------

# Create a submodule mkdir submodule pushd submodule echo "This is a submodule" > README.txt git init git add README.txt git commit -m "Initial commit" popd

# Create a top level project mkdir top-level-project pushd top-level-project echo "This is a parent project" > README.txt git init git add README.txt git commit -m "Initial commit"

# Add submodule to top level project git submodule add ../submodule/ git commit -m "Added a submodule"

# Create two diverging branches git checkout -b branch_that_points_the_submodule_to_new_commit git checkout -b branch_that_moves_the_submodule_to_new_path

# Update the commit the submodule points to in one branch git checkout branch_that_points_the_submodule_to_new_commit pushd submodule echo "This modifies the README file" > README.txt git add . git commit -m "Added line to README file" popd git add submodule git commit -m "Updated submodule to point to new commit"

# Move the submodule directory in the other branch git checkout branch_that_moves_the_submodule_to_new_path git submodule update git mv submodule submodule-moved git commit -m "Moved submodule to new path"

Message 1 of 1 in “jpalacios@atlassian.com”
  1. Juan PalaciosOct 24, 2014

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.