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

bug report: regression in git subtree add

From
PWPeter Wolanin <pwolanin@gmail.com>
Date
Mar 14, 2014, 20:49 UTC
Message-ID
<CANae7MgZQs4tV9QcJvU3_anABSj-uTdwO+Y4x4mWKySprOEnBA@mail.gmail.com>

In this commit: https://github.com/git/git/commit/10a49587fabde88c0afbc80a99d97fae91811f5f

git subtree add for a remote repository and branch was fundamentally broken.

It works by chance if a local branch exists that matches the name of the desired remote branch. Thus, "master" happens to work and the bug possibly escapes common notice.

cmd_add_repository() does a git fetch - the desired remote refspec can never be found in the local repo until that git fetch is run, so the attempt to validate it within cmd_add() is wrong - if desired, that should happen after the fetch in cmd_add_repository().

I think the additions shown in lines 505 and 506 should be reverted, since the rev is also checked in cmd_add_commit()

Best,
Peter Wolanin
Message 1 of 1 in “bug report: regression in git subtree add”
  1. Peter WolaninMar 14, 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.