git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Danny Lin <danny0838@gmail.com>
To: git develop <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	"David A. Greene" <greened@obbligato.org>,
	Dave Ware <davidw@realtimegenomics.com>,
	apenwarr@gmail.com, Roger Strain <rstrain@swri.org>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Stephen R Guglielmo <srg@guglielmo.us>
Subject: Re: [BUG] Branches before "git subtree add --squash" are pushed via "git subtree push"
Date: Sat, 15 Aug 2020 00:28:31 +0800	[thread overview]
Message-ID: <CAMbsUu47FUPCnW=EBm-tE9_g5NqKzvzjVQWM1TNdBnTj-TauaA@mail.gmail.com> (raw)
In-Reply-To: <CAMbsUu5bYN9q34st8AhOCv8y5eJQpVpEKOO3ebTi+CxbYetgmQ@mail.gmail.com>

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.

      reply	other threads:[~2020-08-14 16:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMbsUu47FUPCnW=EBm-tE9_g5NqKzvzjVQWM1TNdBnTj-TauaA@mail.gmail.com' \
    --to=danny0838@gmail.com \
    --cc=apenwarr@gmail.com \
    --cc=davidw@realtimegenomics.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=greened@obbligato.org \
    --cc=jrnieder@gmail.com \
    --cc=rstrain@swri.org \
    --cc=srg@guglielmo.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).