git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [BUG] Branches before "git subtree add --squash" are pushed via "git subtree push"
@ 2019-07-15 18:30 Danny Lin
  2020-08-14 16:28 ` Danny Lin
  0 siblings, 1 reply; 2+ messages in thread
From: Danny Lin @ 2019-07-15 18:30 UTC (permalink / raw)
  To: git develop

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] Branches before "git subtree add --squash" are pushed via "git subtree push"
  2019-07-15 18:30 [BUG] Branches before "git subtree add --squash" are pushed via "git subtree push" Danny Lin
@ 2020-08-14 16:28 ` Danny Lin
  0 siblings, 0 replies; 2+ messages in thread
From: Danny Lin @ 2020-08-14 16:28 UTC (permalink / raw)
  To: git develop
  Cc: Junio C Hamano, David A. Greene, Dave Ware, apenwarr,
	Roger Strain, Jonathan Nieder, Stephen R Guglielmo

Sadly no one cares about this issue... This bug is especially obvious
if we simply run `git subtree push` after a `git subtree add --squash`:

If master is at commit D, which is generated by
`git subtree add --squash -P sub Y`:

    A---B---C---D  master
               /
              Y'

    X---Y  sub

After running `git subtree push -P sub . sub`, we get:

    A---B---C---D'  sub (after push, actual)
               /
          X---Y

While the sub branch should not change at all!

This bug, seemingly introduced by 933cfeb90b5d03b4096db6d60494a6eedea25d03
critically makes --squash approach for `git subtree` almost unusable.
Added related developers to CC list for better notice.

>
> 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-14 16:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-15 18:30 [BUG] Branches before "git subtree add --squash" are pushed via "git subtree push" Danny Lin
2020-08-14 16:28 ` Danny Lin

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git