git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Rebase-via-merge behavior difference between Linux and Windows
@ 2020-03-31 23:24 Bryan Turner
  2020-04-01  6:35 ` Elijah Newren
  0 siblings, 1 reply; 4+ messages in thread
From: Bryan Turner @ 2020-03-31 23:24 UTC (permalink / raw)
  To: Git Users

With the default rebase backend changing from "apply" to "merge" in
2.26, I've seen several threads about behavior changes between the two
backends. This is _not_ one of those (although, as I mention at the
end, the "apply" backend doesn't appear to have this issue).

Instead, what I'm observing is a behavior difference between the same
"merge" backend depending on whether the command is run on Linux or
Windows.

A little context: Bitbucket Server has a set of zipped repositories
that provide consistent initial state, and we have tests that download
those zips and then run various Git commands against them and verify
we get expected outcomes. These same tests run on both Windows and
Linux.

Using our merge test repository[1], one such test performs the following steps:
* Unzip bare repository
* `git clone --shared -b branch_that_differ_by_empty_commit_trgt
<unzipped> rebase-test`
* `git rebase -q --no-verify 7549846524f8aed2bd1c0249993ae1bf9d3c9998
298924b8c403240eaf89dcda0cce7271620ab2f6`

298924b8c40 is an empty commit (i.e. `git commit --allow-empty`), and
is the only commit not already reachable from 7549846524f.

On Linux, when this test completes, "HEAD" in "rebase-test" is
7549846524f because the empty commit was discarded. This is the
expected behavior. On Windows, "HEAD" is a new empty commit, which
causes our test to fail.

If I set "rebase.backend=apply" on the "git rebase" command, I once
again get identical behavior on both platforms, with the empty commit
discarded. (I'm just noting this in case it's relevant.)

[1] https://packages.atlassian.com/maven-public-local/com/atlassian/stash/git/merge/2.9/merge-2.9.zip

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

* Re: Rebase-via-merge behavior difference between Linux and Windows
  2020-03-31 23:24 Rebase-via-merge behavior difference between Linux and Windows Bryan Turner
@ 2020-04-01  6:35 ` Elijah Newren
  2020-04-02  1:15   ` Bryan Turner
  0 siblings, 1 reply; 4+ messages in thread
From: Elijah Newren @ 2020-04-01  6:35 UTC (permalink / raw)
  To: Bryan Turner; +Cc: Git Users

On Tue, Mar 31, 2020 at 4:25 PM Bryan Turner <bturner@atlassian.com> wrote:
>
> With the default rebase backend changing from "apply" to "merge" in
> 2.26, I've seen several threads about behavior changes between the two
> backends. This is _not_ one of those (although, as I mention at the
> end, the "apply" backend doesn't appear to have this issue).
>
> Instead, what I'm observing is a behavior difference between the same
> "merge" backend depending on whether the command is run on Linux or
> Windows.
>
> A little context: Bitbucket Server has a set of zipped repositories
> that provide consistent initial state, and we have tests that download
> those zips and then run various Git commands against them and verify
> we get expected outcomes. These same tests run on both Windows and
> Linux.
>
> Using our merge test repository[1], one such test performs the following steps:
> * Unzip bare repository
> * `git clone --shared -b branch_that_differ_by_empty_commit_trgt
> <unzipped> rebase-test`
> * `git rebase -q --no-verify 7549846524f8aed2bd1c0249993ae1bf9d3c9998
> 298924b8c403240eaf89dcda0cce7271620ab2f6`
>
> 298924b8c40 is an empty commit (i.e. `git commit --allow-empty`), and
> is the only commit not already reachable from 7549846524f.
>
> On Linux, when this test completes, "HEAD" in "rebase-test" is
> 7549846524f because the empty commit was discarded. This is the
> expected behavior. On Windows, "HEAD" is a new empty commit, which
> causes our test to fail.

I don't have a Windows box to test, but it's good that you are seeing
the correct behavior there.  I do have a Linux box, and cannot
duplicate the behavior you state, even downloading the zip you
mentioned and following your steps to reproduce.  Actually, I did
reproduce that behavior the first time because I was accidentally
using git-2.25.0.  But with git-2.26.0 on Linux, I see a new empty
commit after rebasing, as expected.

Is there any chance you accidentally ran with an older git version
when on Linux?  If you really were using git 2.26.0 on Linux...then
I'm totally confused at how you got that behavior.

And yes, I am stating the exact opposite expectation than what you
did; let me quote from the relevant bits of the 2.26.0 manpage for git
rebase:

BEHAVIORAL DIFFERENCES
-----------------------
...
Empty commits
~~~~~~~~~~~~~

The apply backend unfortunately drops intentionally empty commits, i.e.
commits that started empty, though these are rare in practice.  It
also drops commits that become empty and has no option for controlling
this behavior.

The merge backend keeps intentionally empty commits.  Similar to the
apply backend, by default the merge backend drops commits that become
empty unless -i/--interactive is specified (in which case it stops and
asks the user what to do).  The merge backend also has an
--empty={drop,keep,ask} option for changing the behavior of handling
commits that become empty.


So the apply backend has the wrong behavior, we just haven't bothered
updating it.  Perhaps we should.

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

* Re: Rebase-via-merge behavior difference between Linux and Windows
  2020-04-01  6:35 ` Elijah Newren
@ 2020-04-02  1:15   ` Bryan Turner
  2020-04-02  3:02     ` Elijah Newren
  0 siblings, 1 reply; 4+ messages in thread
From: Bryan Turner @ 2020-04-02  1:15 UTC (permalink / raw)
  To: Elijah Newren; +Cc: Git Users

On Tue, Mar 31, 2020 at 11:35 PM Elijah Newren <newren@gmail.com> wrote:
>
> On Tue, Mar 31, 2020 at 4:25 PM Bryan Turner <bturner@atlassian.com> wrote:
> >
> > Using our merge test repository[1], one such test performs the following steps:
> > * Unzip bare repository
> > * `git clone --shared -b branch_that_differ_by_empty_commit_trgt
> > <unzipped> rebase-test`
> > * `git rebase -q --no-verify 7549846524f8aed2bd1c0249993ae1bf9d3c9998
> > 298924b8c403240eaf89dcda0cce7271620ab2f6`
> >
> > 298924b8c40 is an empty commit (i.e. `git commit --allow-empty`), and
> > is the only commit not already reachable from 7549846524f.
> >
> > On Linux, when this test completes, "HEAD" in "rebase-test" is
> > 7549846524f because the empty commit was discarded. This is the
> > expected behavior. On Windows, "HEAD" is a new empty commit, which
> > causes our test to fail.
>
> I don't have a Windows box to test, but it's good that you are seeing
> the correct behavior there.  I do have a Linux box, and cannot
> duplicate the behavior you state, even downloading the zip you
> mentioned and following your steps to reproduce.  Actually, I did
> reproduce that behavior the first time because I was accidentally
> using git-2.25.0.  But with git-2.26.0 on Linux, I see a new empty
> commit after rebasing, as expected.
>
> Is there any chance you accidentally ran with an older git version
> when on Linux?  If you really were using git 2.26.0 on Linux...then
> I'm totally confused at how you got that behavior.

I went back through our build logs and confirmed that we _are_ running
Git 2.26 (phew). I then set up a local Git 2.26 environment and...it
produced the same new behavior as 2.26 on Windows (so the correct
behavior, per the documented changes).

At that point I dug further into our builds and found that while we
were using the right Git version, we _weren't_ running all the same
tests on Linux and Windows. So the successful build on Linux was not
because the tests pass--I've adjusted the builds and confirmed that
the tests _don't_ pass--but rather because the relevant tests weren't
being run at all.

Very sorry for wasting your time, Elijah. I should have looked into
our builds more closely to verify they were running the same tests
before I took the question to the list.

Best regards,
Bryan Turner

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

* Re: Rebase-via-merge behavior difference between Linux and Windows
  2020-04-02  1:15   ` Bryan Turner
@ 2020-04-02  3:02     ` Elijah Newren
  0 siblings, 0 replies; 4+ messages in thread
From: Elijah Newren @ 2020-04-02  3:02 UTC (permalink / raw)
  To: Bryan Turner; +Cc: Git Users

Hi Bryan,

On Wed, Apr 1, 2020 at 6:16 PM Bryan Turner <bturner@atlassian.com> wrote:
>
> On Tue, Mar 31, 2020 at 11:35 PM Elijah Newren <newren@gmail.com> wrote:
> >
> > On Tue, Mar 31, 2020 at 4:25 PM Bryan Turner <bturner@atlassian.com> wrote:
> > >
> > > Using our merge test repository[1], one such test performs the following steps:
> > > * Unzip bare repository
> > > * `git clone --shared -b branch_that_differ_by_empty_commit_trgt
> > > <unzipped> rebase-test`
> > > * `git rebase -q --no-verify 7549846524f8aed2bd1c0249993ae1bf9d3c9998
> > > 298924b8c403240eaf89dcda0cce7271620ab2f6`
> > >
> > > 298924b8c40 is an empty commit (i.e. `git commit --allow-empty`), and
> > > is the only commit not already reachable from 7549846524f.
> > >
> > > On Linux, when this test completes, "HEAD" in "rebase-test" is
> > > 7549846524f because the empty commit was discarded. This is the
> > > expected behavior. On Windows, "HEAD" is a new empty commit, which
> > > causes our test to fail.
> >
> > I don't have a Windows box to test, but it's good that you are seeing
> > the correct behavior there.  I do have a Linux box, and cannot
> > duplicate the behavior you state, even downloading the zip you
> > mentioned and following your steps to reproduce.  Actually, I did
> > reproduce that behavior the first time because I was accidentally
> > using git-2.25.0.  But with git-2.26.0 on Linux, I see a new empty
> > commit after rebasing, as expected.
> >
> > Is there any chance you accidentally ran with an older git version
> > when on Linux?  If you really were using git 2.26.0 on Linux...then
> > I'm totally confused at how you got that behavior.
>
> I went back through our build logs and confirmed that we _are_ running
> Git 2.26 (phew). I then set up a local Git 2.26 environment and...it
> produced the same new behavior as 2.26 on Windows (so the correct
> behavior, per the documented changes).
>
> At that point I dug further into our builds and found that while we
> were using the right Git version, we _weren't_ running all the same
> tests on Linux and Windows. So the successful build on Linux was not
> because the tests pass--I've adjusted the builds and confirmed that
> the tests _don't_ pass--but rather because the relevant tests weren't
> being run at all.
>
> Very sorry for wasting your time, Elijah. I should have looked into
> our builds more closely to verify they were running the same tests
> before I took the question to the list.

Hey, no worries; you provide good comments on the list and it was
really nice that your report came with very detailed steps to follow,
so it ended up not taking that long to check.  Thanks for double
checking to verify that I wasn't insane (or at least that this one
issue doesn't prove I am).  Anyway, not a big deal at all; keep
reporting potential issues you run across in the future.

Elijah

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

end of thread, other threads:[~2020-04-02  3:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31 23:24 Rebase-via-merge behavior difference between Linux and Windows Bryan Turner
2020-04-01  6:35 ` Elijah Newren
2020-04-02  1:15   ` Bryan Turner
2020-04-02  3:02     ` Elijah Newren

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