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

[BUG] Branches before "git subtree add --squash" are pushed via "git subtree push"

From
Danny Lin <danny0838@gmail.com>
Date
Jul 15, 2019, 18:30 UTC
Message-ID
<CAMbsUu5bYN9q34st8AhOCv8y5eJQpVpEKOO3ebTi+CxbYetgmQ@mail.gmail.com>
Say we have a repository with "master" and "sub" branches like below:
    A---B---C---D---E---F  master
               /
          X---Y
    X---Y  sub

where commits A and B include changes in subdirectory "sub", commit C removes subdirectory "sub", commit D is generated by "git subtree add -P sub Y", and commits E and F also include changes in subdirectory "sub".

We'd get this if we run "git subtree push -P sub . sub" on master at F:
    X---Y---E'--F'  sub (after push)

On the other hand, if we have simliar trees except that commit D is generated by "git subtree add --squash -P sub Y":

    A---B---C---D---E---F  master
               /
              Y'
    X---Y  sub

We'd expect to get this when we run "git subtree push -P sub . sub" on master at F:

    X---Y---E'--F'  sub (after push, expected)
But actually we get this (in Git 2.22.0):
    A---B---C---D'--E'--F'  sub (after push, actual)
               /
          X---Y

This seems to be a side effect of 2.7.0 -> 2.7.1 in which a change is made to include merged branches in "git subtree push", but mistakenly causes branches before "git subtree add --squash" be included.

Next: Danny Lin
Message 1 of 2 in “[BUG] Branches before "git subtree add --squash" are pushed via "git subtree push"”
  1. Danny LinJul 15, 2019
  2. Danny LinAug 14, 2020

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.