{"thread":{"id":"51482","subject":"[BUG] Branches before \"git subtree add --squash\" are pushed via \"git subtree push\"","startedAt":"2019-07-15T18:31:00Z","lastAt":"2020-08-14T16:28:52Z","messageCount":2,"participants":["Danny Lin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"378952","messageId":"CAMbsUu5bYN9q34st8AhOCv8y5eJQpVpEKOO3ebTi+CxbYetgmQ@mail.gmail.com","threadId":"51482","inReplyTo":null,"subject":"[BUG] Branches before \"git subtree add --squash\" are pushed via \"git subtree push\"","fromName":"Danny Lin","fromEmail":"danny0838@gmail.com","sentAt":"2019-07-15T18:30:44Z","receivedAt":"2019-07-15T18:31:00Z","isPatch":false,"sender":{"key":"danny0838@gmail.com","avatar":"https://avatars.githubusercontent.com/u/531417?v=4"},"body":"Say we have a repository with \"master\" and \"sub\" branches like below:\n\n    A---B---C---D---E---F  master\n               /\n          X---Y\n\n    X---Y  sub\n\nwhere commits A and B include changes in subdirectory \"sub\", commit C\nremoves subdirectory \"sub\", commit D is generated by \"git subtree add\n-P sub Y\", and commits E and F also include changes in subdirectory\n\"sub\".\n\nWe'd get this if we run \"git subtree push -P sub . sub\" on master at F:\n\n    X---Y---E'--F'  sub (after push)\n\nOn the other hand, if we have simliar trees except that commit D is\ngenerated by \"git subtree add --squash -P sub Y\":\n\n    A---B---C---D---E---F  master\n               /\n              Y'\n\n    X---Y  sub\n\nWe'd expect to get this when we run \"git subtree push -P sub . sub\" on\nmaster at F:\n\n    X---Y---E'--F'  sub (after push, expected)\n\nBut actually we get this (in Git 2.22.0):\n\n    A---B---C---D'--E'--F'  sub (after push, actual)\n               /\n          X---Y\n\nThis seems to be a side effect of 2.7.0 -> 2.7.1 in which a change is\nmade to include merged branches in \"git subtree push\", but mistakenly\ncauses branches before \"git subtree add --squash\" be included.\n"},{"id":"403683","messageId":"CAMbsUu47FUPCnW=EBm-tE9_g5NqKzvzjVQWM1TNdBnTj-TauaA@mail.gmail.com","threadId":"51482","inReplyTo":"CAMbsUu5bYN9q34st8AhOCv8y5eJQpVpEKOO3ebTi+CxbYetgmQ@mail.gmail.com","subject":"Re: [BUG] Branches before \"git subtree add --squash\" are pushed via \"git subtree push\"","fromName":"Danny Lin","fromEmail":"danny0838@gmail.com","sentAt":"2020-08-14T16:28:31Z","receivedAt":"2020-08-14T16:28:52Z","isPatch":false,"sender":{"key":"danny0838@gmail.com","avatar":"https://avatars.githubusercontent.com/u/531417?v=4"},"body":"Sadly no one cares about this issue... This bug is especially obvious\nif we simply run `git subtree push` after a `git subtree add --squash`:\n\nIf master is at commit D, which is generated by\n`git subtree add --squash -P sub Y`:\n\n    A---B---C---D  master\n               /\n              Y'\n\n    X---Y  sub\n\nAfter running `git subtree push -P sub . sub`, we get:\n\n    A---B---C---D'  sub (after push, actual)\n               /\n          X---Y\n\nWhile the sub branch should not change at all!\n\nThis bug, seemingly introduced by 933cfeb90b5d03b4096db6d60494a6eedea25d03\ncritically makes --squash approach for `git subtree` almost unusable.\nAdded related developers to CC list for better notice.\n\n>\n> Say we have a repository with \"master\" and \"sub\" branches like below:\n>\n>     A---B---C---D---E---F  master\n>                /\n>           X---Y\n>\n>     X---Y  sub\n>\n> where commits A and B include changes in subdirectory \"sub\", commit C\n> removes subdirectory \"sub\", commit D is generated by \"git subtree add\n> -P sub Y\", and commits E and F also include changes in subdirectory\n> \"sub\".\n>\n> We'd get this if we run \"git subtree push -P sub . sub\" on master at F:\n>\n>     X---Y---E'--F'  sub (after push)\n>\n> On the other hand, if we have simliar trees except that commit D is\n> generated by \"git subtree add --squash -P sub Y\":\n>\n>     A---B---C---D---E---F  master\n>                /\n>               Y'\n>\n>     X---Y  sub\n>\n> We'd expect to get this when we run \"git subtree push -P sub . sub\" on\n> master at F:\n>\n>     X---Y---E'--F'  sub (after push, expected)\n>\n> But actually we get this (in Git 2.22.0):\n>\n>     A---B---C---D'--E'--F'  sub (after push, actual)\n>                /\n>           X---Y\n>\n> This seems to be a side effect of 2.7.0 -> 2.7.1 in which a change is\n> made to include merged branches in \"git subtree push\", but mistakenly\n> causes branches before \"git subtree add --squash\" be included.\n"}]}