threads / discuss / 55959

Nonexistent changes appear rebasing but only with rebase.backend=apply

Subject: Nonexistent changes appear rebasing but only with rebase.backend=apply

## tl;dr

9 messages between Jun 18, 2021 and Jun 29, 2021.

replies: 8people: 4as markdown or json

Marco Giuliano· Jun 18, 2021, 15:21 UTC · lore
Hi All

I'm facing a strange anomaly during rebase. I'll try to explain what happens because unfortunately I cannot share more information since it's confidential and unfortunately an anonymized export does not reproduce the issue.

I have the following repository status:
   * commit 2 (BRANCH X)
   |
   |  * commit 4 (BRANCH Y) (HEAD)
   |  |
   |  * commit 3
   | /
   |/
   * commit 1
   |
   |
 (...)

What I'm trying to do is rebasing branch Y on branch X, with the command: git rebase X

The anomaly is that, among other expected conflicts, also two files (fileA, fileB) appear modified in both branches, but those two files have not been modified in any of the 4 commits you see in the graph above! The anomaly appears only with the config setting rebase.backend=apply, while not with rebase.backend=merge (*).

This might not be caused by rebase command itself, but rather by some previous operations which might have accidentally "broken" something and that the rebase simply makes them appear. You need to know that commit 4 is the result of several squash and reordering of multiple commits; is it possible that some of those operations have created some "leftovers" ?

I know this is difficult without seeing the actual repository, but could you just give me some advice or point me to the place where I can investigate ?

(*) When the anomaly first appeared, I was using git for windows, version < 2.26.0 (unfortunately I cannot recover the exact number); I decided to upgrade git to 2.31.1 and the anomaly disappeared. Investigating the release notes, I noticed that rebase.backend default value changed from apply to rebase from version 2.26.0. I also copied the repository on linux (with git 2.31.0), and the behavior is the same.

Thanks in advance for any help, Best Regards, Marco

Felipe Contreras· Jun 18, 2021, 23:44 UTC · re: Marco Giuliano · lore

RE: Nonexistent changes appear rebasing but only with rebase.backend=apply

Marco Giuliano wrote:
Show 6 quoted lines
> This might not be caused by rebase command itself, but rather by some
> previous operations which might have accidentally "broken" something
> and that the rebase simply makes them appear.
> You need to know that commit 4 is the result of several squash and
> reordering of multiple commits; is it possible that some of those
> operations have created some "leftovers" ?
Smells like the reflog.
Have you tried --no-fork-point?
-- 
Felipe Contreras
Phillip Wood· Jun 20, 2021, 18:02 UTC · re: Marco Giuliano · lore

Re: Nonexistent changes appear rebasing but only with rebase.backend=apply

Hi Marco
On 18/06/2021 16:21, Marco Giuliano wrote:
Show 41 quoted lines
> Hi All
> 
> I'm facing a strange anomaly during rebase.
> I'll try to explain what happens because unfortunately I cannot share
> more information since it's confidential and unfortunately an
> anonymized export does not reproduce the issue.
> 
> I have the following repository status:
> 
>     * commit 2 (BRANCH X)
>     |
>     |  * commit 4 (BRANCH Y) (HEAD)
>     |  |
>     |  * commit 3
>     | /
>     |/
>     * commit 1
>     |
>     |
>   (...)
> 
> What I'm trying to do is rebasing branch Y on branch X, with the command:
> git rebase X
> 
> The anomaly is that, among other expected conflicts, also two files
> (fileA, fileB) appear modified in both branches, but those two files
> have not been modified in any of the 4 commits you see in the graph
> above!
> The anomaly appears only with the config setting rebase.backend=apply,
> while not with rebase.backend=merge (*).
> 
> This might not be caused by rebase command itself, but rather by some
> previous operations which might have accidentally "broken" something
> and that the rebase simply makes them appear.
> You need to know that commit 4 is the result of several squash and
> reordering of multiple commits; is it possible that some of those
> operations have created some "leftovers" ?
> 
> I know this is difficult without seeing the actual repository, but
> could you just give me some advice or point me to the place where I
> can investigate ?

That certainly sounds quite strange. I think the patches used by the apply backend are stored in .git/rebased-patches, it might be worth looking at that file when the rebase stops for you to resolve the conflict resolution to see if that sheds any light on which commits the conflicts are coming from. Failing that does the content of the conflicts provide any clues as to which commits they are coming from? You could also try matching the blob id's from the index line of `diff --cc` to the index lines in `git log -p` to try and find where they are coming from.

Rebase ought to just replay the commits so in theory it shouldn't matter that you've been squashing and rearranging commits. What does `git log -p branch-x...branch-y fileA fileB` show? (it shouldn't show anything if those files are not touched by any of the commits)

Best Wishes
Phillip
Show 13 quoted lines
> (*)
> When the anomaly first appeared, I was using git for windows, version
> < 2.26.0 (unfortunately I cannot recover the exact number); I decided
> to upgrade git to 2.31.1 and the anomaly disappeared. Investigating
> the release notes, I noticed that rebase.backend default value changed
> from apply to rebase from version 2.26.0.
> I also copied the repository on linux (with git 2.31.0), and the
> behavior is the same.
> 
> Thanks in advance for any help,
> Best Regards,
> Marco
> 
Marco Giuliano· Jun 24, 2021, 16:23 UTC · re: Phillip Wood · lore

Re: Nonexistent changes appear rebasing but only with rebase.backend=apply

Thanks Felipe and Philip for your answers.

Let's proceed in order: @Felipe: I tried rebasing with --no-fork-point but the problem remains the same

@Philip: I'm a basic git user, so bear with me if I say silly things... I tried to search for rebased-patches in .git folder when rebase stopped waiting for conflict resolution, but I didn't find any file named like that. There's a folder named rebase-apply though did you mean that ?

Anyway, looking at the conflict file of "fileA" directly (not behind a
visual diff tool) I noticed that the marker line >>>>>>>> COMMIT
DESCR: FILENAME indicates a different file name then the current
conflicted file.
That reminded me that those two files A & B, were actually copies
(real copy, not symlink) of other two files inside the same repo.
Is it somehow possible that auto-detected-renaming is involved in this
(since the files are identical but in two different locations) ?
Trying to give you some hints, maybe it is totally unrelated...

About the blob check you suggested, please be patient but I didn't understand exactly how to proceed.

Thanks again for your support, Marco

On Sun, Jun 20, 2021 at 8:02 PM Phillip Wood <phillip.wood123@gmail.com> wrote:
Show 79 quoted lines
>
> Hi Marco
>
> On 18/06/2021 16:21, Marco Giuliano wrote:
> > Hi All
> >
> > I'm facing a strange anomaly during rebase.
> > I'll try to explain what happens because unfortunately I cannot share
> > more information since it's confidential and unfortunately an
> > anonymized export does not reproduce the issue.
> >
> > I have the following repository status:
> >
> >     * commit 2 (BRANCH X)
> >     |
> >     |  * commit 4 (BRANCH Y) (HEAD)
> >     |  |
> >     |  * commit 3
> >     | /
> >     |/
> >     * commit 1
> >     |
> >     |
> >   (...)
> >
> > What I'm trying to do is rebasing branch Y on branch X, with the command:
> > git rebase X
> >
> > The anomaly is that, among other expected conflicts, also two files
> > (fileA, fileB) appear modified in both branches, but those two files
> > have not been modified in any of the 4 commits you see in the graph
> > above!
> > The anomaly appears only with the config setting rebase.backend=apply,
> > while not with rebase.backend=merge (*).
> >
> > This might not be caused by rebase command itself, but rather by some
> > previous operations which might have accidentally "broken" something
> > and that the rebase simply makes them appear.
> > You need to know that commit 4 is the result of several squash and
> > reordering of multiple commits; is it possible that some of those
> > operations have created some "leftovers" ?
> >
> > I know this is difficult without seeing the actual repository, but
> > could you just give me some advice or point me to the place where I
> > can investigate ?
>
> That certainly sounds quite strange. I think the patches used by the
> apply backend are stored in .git/rebased-patches, it might be worth
> looking at that file when the rebase stops for you to resolve the
> conflict resolution to see if that sheds any light on which commits the
> conflicts are coming from. Failing that does the content of the
> conflicts provide any clues as to which commits they are coming from?
> You could also try matching the blob id's from the index line of `diff
> --cc` to the index lines in `git log -p` to try and find where they are
> coming from.
>
> Rebase ought to just replay the commits so in theory it shouldn't matter
> that you've been squashing and rearranging commits. What does `git log
> -p branch-x...branch-y fileA fileB` show? (it shouldn't show anything if
> those files are not touched by any of the commits)
>
> Best Wishes
>
> Phillip
>
> > (*)
> > When the anomaly first appeared, I was using git for windows, version
> > < 2.26.0 (unfortunately I cannot recover the exact number); I decided
> > to upgrade git to 2.31.1 and the anomaly disappeared. Investigating
> > the release notes, I noticed that rebase.backend default value changed
> > from apply to rebase from version 2.26.0.
> > I also copied the repository on linux (with git 2.31.0), and the
> > behavior is the same.
> >
> > Thanks in advance for any help,
> > Best Regards,
> > Marco
> >
>
Phillip Wood· Jun 24, 2021, 18:39 UTC · re: Marco Giuliano · lore

Re: Nonexistent changes appear rebasing but only with rebase.backend=apply

Hi Marco
On 24/06/2021 17:23, Marco Giuliano wrote:
Show 11 quoted lines
> Thanks Felipe and Philip for your answers.
> 
> Let's proceed in order:
> @Felipe: I tried rebasing with --no-fork-point but the problem remains the same
> 
> @Philip:
> I'm a basic git user, so bear with me if I say silly things...
> I tried to search for rebased-patches in .git folder when rebase
> stopped waiting for
> conflict resolution, but I didn't find any file named like that.
> There's a folder named rebase-apply though did you mean that ?

Looking at the source I thought they ended up just in .git but I haven't checked again, as you seem to have found the source of the problem below lets not worry about that.

Show 9 quoted lines
> Anyway, looking at the conflict file of "fileA" directly (not behind a
> visual diff tool) I noticed that the marker line >>>>>>>> COMMIT
> DESCR: FILENAME indicates a different file name then the current
> conflicted file.
> That reminded me that those two files A & B, were actually copies
> (real copy, not symlink) of other two files inside the same repo.
> Is it somehow possible that auto-detected-renaming is involved in this
> (since the files are identical but in two different locations) ?
> Trying to give you some hints, maybe it is totally unrelated...

I meant to ask if anything had been copied or renamed but forgot. The merge backend detects copies and renames and handles them correctly but the apply backend does not so I think this is the source of the discrepancy.

Best Wishes
Phillip
Show 88 quoted lines
> About the blob check you suggested, please be patient but I didn't
> understand exactly how to proceed.
> 
> Thanks again for your support,
> Marco
> 
> 
> 
> On Sun, Jun 20, 2021 at 8:02 PM Phillip Wood <phillip.wood123@gmail.com> wrote:
>>
>> Hi Marco
>>
>> On 18/06/2021 16:21, Marco Giuliano wrote:
>>> Hi All
>>>
>>> I'm facing a strange anomaly during rebase.
>>> I'll try to explain what happens because unfortunately I cannot share
>>> more information since it's confidential and unfortunately an
>>> anonymized export does not reproduce the issue.
>>>
>>> I have the following repository status:
>>>
>>>      * commit 2 (BRANCH X)
>>>      |
>>>      |  * commit 4 (BRANCH Y) (HEAD)
>>>      |  |
>>>      |  * commit 3
>>>      | /
>>>      |/
>>>      * commit 1
>>>      |
>>>      |
>>>    (...)
>>>
>>> What I'm trying to do is rebasing branch Y on branch X, with the command:
>>> git rebase X
>>>
>>> The anomaly is that, among other expected conflicts, also two files
>>> (fileA, fileB) appear modified in both branches, but those two files
>>> have not been modified in any of the 4 commits you see in the graph
>>> above!
>>> The anomaly appears only with the config setting rebase.backend=apply,
>>> while not with rebase.backend=merge (*).
>>>
>>> This might not be caused by rebase command itself, but rather by some
>>> previous operations which might have accidentally "broken" something
>>> and that the rebase simply makes them appear.
>>> You need to know that commit 4 is the result of several squash and
>>> reordering of multiple commits; is it possible that some of those
>>> operations have created some "leftovers" ?
>>>
>>> I know this is difficult without seeing the actual repository, but
>>> could you just give me some advice or point me to the place where I
>>> can investigate ?
>>
>> That certainly sounds quite strange. I think the patches used by the
>> apply backend are stored in .git/rebased-patches, it might be worth
>> looking at that file when the rebase stops for you to resolve the
>> conflict resolution to see if that sheds any light on which commits the
>> conflicts are coming from. Failing that does the content of the
>> conflicts provide any clues as to which commits they are coming from?
>> You could also try matching the blob id's from the index line of `diff
>> --cc` to the index lines in `git log -p` to try and find where they are
>> coming from.
>>
>> Rebase ought to just replay the commits so in theory it shouldn't matter
>> that you've been squashing and rearranging commits. What does `git log
>> -p branch-x...branch-y fileA fileB` show? (it shouldn't show anything if
>> those files are not touched by any of the commits)
>>
>> Best Wishes
>>
>> Phillip
>>
>>> (*)
>>> When the anomaly first appeared, I was using git for windows, version
>>> < 2.26.0 (unfortunately I cannot recover the exact number); I decided
>>> to upgrade git to 2.31.1 and the anomaly disappeared. Investigating
>>> the release notes, I noticed that rebase.backend default value changed
>>> from apply to rebase from version 2.26.0.
>>> I also copied the repository on linux (with git 2.31.0), and the
>>> behavior is the same.
>>>
>>> Thanks in advance for any help,
>>> Best Regards,
>>> Marco
>>>
>>
Marco Giuliano· Jun 25, 2021, 07:12 UTC · re: Phillip Wood · lore

Re: Nonexistent changes appear rebasing but only with rebase.backend=apply

Hi Philip, oh, so I guessed correctly... Could you be more specific about the copy/rename issue of the apply backend ? Is there any bug report I can refer to ?

Thank you very much for your support
Marco
On Thu, Jun 24, 2021 at 8:39 PM Phillip Wood <phillip.wood123@gmail.com> wrote:
Show 126 quoted lines
>
> Hi Marco
>
> On 24/06/2021 17:23, Marco Giuliano wrote:
> > Thanks Felipe and Philip for your answers.
> >
> > Let's proceed in order:
> > @Felipe: I tried rebasing with --no-fork-point but the problem remains the same
> >
> > @Philip:
> > I'm a basic git user, so bear with me if I say silly things...
> > I tried to search for rebased-patches in .git folder when rebase
> > stopped waiting for
> > conflict resolution, but I didn't find any file named like that.
> > There's a folder named rebase-apply though did you mean that ?
>
> Looking at the source I thought they ended up just in .git but I haven't
> checked again, as you seem to have found the source of the problem below
> lets not worry about that.
>
> > Anyway, looking at the conflict file of "fileA" directly (not behind a
> > visual diff tool) I noticed that the marker line >>>>>>>> COMMIT
> > DESCR: FILENAME indicates a different file name then the current
> > conflicted file.
> > That reminded me that those two files A & B, were actually copies
> > (real copy, not symlink) of other two files inside the same repo.
> > Is it somehow possible that auto-detected-renaming is involved in this
> > (since the files are identical but in two different locations) ?
> > Trying to give you some hints, maybe it is totally unrelated...
>
> I meant to ask if anything had been copied or renamed but forgot. The
> merge backend detects copies and renames and handles them correctly but
> the apply backend does not so I think this is the source of the discrepancy.
>
> Best Wishes
>
> Phillip
>
> > About the blob check you suggested, please be patient but I didn't
> > understand exactly how to proceed.
> >
> > Thanks again for your support,
> > Marco
> >
> >
> >
> > On Sun, Jun 20, 2021 at 8:02 PM Phillip Wood <phillip.wood123@gmail.com> wrote:
> >>
> >> Hi Marco
> >>
> >> On 18/06/2021 16:21, Marco Giuliano wrote:
> >>> Hi All
> >>>
> >>> I'm facing a strange anomaly during rebase.
> >>> I'll try to explain what happens because unfortunately I cannot share
> >>> more information since it's confidential and unfortunately an
> >>> anonymized export does not reproduce the issue.
> >>>
> >>> I have the following repository status:
> >>>
> >>>      * commit 2 (BRANCH X)
> >>>      |
> >>>      |  * commit 4 (BRANCH Y) (HEAD)
> >>>      |  |
> >>>      |  * commit 3
> >>>      | /
> >>>      |/
> >>>      * commit 1
> >>>      |
> >>>      |
> >>>    (...)
> >>>
> >>> What I'm trying to do is rebasing branch Y on branch X, with the command:
> >>> git rebase X
> >>>
> >>> The anomaly is that, among other expected conflicts, also two files
> >>> (fileA, fileB) appear modified in both branches, but those two files
> >>> have not been modified in any of the 4 commits you see in the graph
> >>> above!
> >>> The anomaly appears only with the config setting rebase.backend=apply,
> >>> while not with rebase.backend=merge (*).
> >>>
> >>> This might not be caused by rebase command itself, but rather by some
> >>> previous operations which might have accidentally "broken" something
> >>> and that the rebase simply makes them appear.
> >>> You need to know that commit 4 is the result of several squash and
> >>> reordering of multiple commits; is it possible that some of those
> >>> operations have created some "leftovers" ?
> >>>
> >>> I know this is difficult without seeing the actual repository, but
> >>> could you just give me some advice or point me to the place where I
> >>> can investigate ?
> >>
> >> That certainly sounds quite strange. I think the patches used by the
> >> apply backend are stored in .git/rebased-patches, it might be worth
> >> looking at that file when the rebase stops for you to resolve the
> >> conflict resolution to see if that sheds any light on which commits the
> >> conflicts are coming from. Failing that does the content of the
> >> conflicts provide any clues as to which commits they are coming from?
> >> You could also try matching the blob id's from the index line of `diff
> >> --cc` to the index lines in `git log -p` to try and find where they are
> >> coming from.
> >>
> >> Rebase ought to just replay the commits so in theory it shouldn't matter
> >> that you've been squashing and rearranging commits. What does `git log
> >> -p branch-x...branch-y fileA fileB` show? (it shouldn't show anything if
> >> those files are not touched by any of the commits)
> >>
> >> Best Wishes
> >>
> >> Phillip
> >>
> >>> (*)
> >>> When the anomaly first appeared, I was using git for windows, version
> >>> < 2.26.0 (unfortunately I cannot recover the exact number); I decided
> >>> to upgrade git to 2.31.1 and the anomaly disappeared. Investigating
> >>> the release notes, I noticed that rebase.backend default value changed
> >>> from apply to rebase from version 2.26.0.
> >>> I also copied the repository on linux (with git 2.31.0), and the
> >>> behavior is the same.
> >>>
> >>> Thanks in advance for any help,
> >>> Best Regards,
> >>> Marco
> >>>
> >>
Elijah Newren· Jun 26, 2021, 07:53 UTC · re: Marco Giuliano · lore

Re: Nonexistent changes appear rebasing but only with rebase.backend=apply

Hi Marco,

On Fri, Jun 25, 2021 at 12:15 AM Marco Giuliano <marco.giuliano@tesisquare.com> wrote:

Show 7 quoted lines
>
> Hi Philip,
> oh, so I guessed correctly...
> Could you be more specific about the copy/rename issue of the apply backend ?
> Is there any bug report I can refer to ?
>
> Thank you very much for your support

Could you do us a favor? Please avoid top-posting and instead answer after the quoted original text, much like I'll do here...

Show 35 quoted lines
> On Thu, Jun 24, 2021 at 8:39 PM Phillip Wood <phillip.wood123@gmail.com> wrote:
> >
> > Hi Marco
> >
> > On 24/06/2021 17:23, Marco Giuliano wrote:
> > > Thanks Felipe and Philip for your answers.
> > >
> > > Let's proceed in order:
> > > @Felipe: I tried rebasing with --no-fork-point but the problem remains the same
> > >
> > > @Philip:
> > > I'm a basic git user, so bear with me if I say silly things...
> > > I tried to search for rebased-patches in .git folder when rebase
> > > stopped waiting for
> > > conflict resolution, but I didn't find any file named like that.
> > > There's a folder named rebase-apply though did you mean that ?
> >
> > Looking at the source I thought they ended up just in .git but I haven't
> > checked again, as you seem to have found the source of the problem below
> > lets not worry about that.
> >
> > > Anyway, looking at the conflict file of "fileA" directly (not behind a
> > > visual diff tool) I noticed that the marker line >>>>>>>> COMMIT
> > > DESCR: FILENAME indicates a different file name then the current
> > > conflicted file.
> > > That reminded me that those two files A & B, were actually copies
> > > (real copy, not symlink) of other two files inside the same repo.
> > > Is it somehow possible that auto-detected-renaming is involved in this
> > > (since the files are identical but in two different locations) ?
> > > Trying to give you some hints, maybe it is totally unrelated...
> >
> > I meant to ask if anything had been copied or renamed but forgot. The
> > merge backend detects copies and renames and handles them correctly but
> > the apply backend does not so I think this is the source of the discrepancy.
> >
So I've got a hunch here.  First, Marco, from your example, can you run
git diff --name-status -C Y...X

and report whether the files involved were either renamed or copied on the upstream side of history. (Also, please note that there are three dots between Y and X) Also, can you report whether a message of the form "inexact rename detection was skipped due to too many files" when using the merge backend and that files you copied from end up in modify/delete conflicts when using the merge backend?

My suspicion is:
* You both renamed some files and copied them on the upstream side of history
* You made further changes to the renamed files, more so than to the "copies"
* You have enough added/removed/renamed files that with the merge
backend you are triggering merge.renameLimit and not getting rename
detection, causing various reports of modify/delete conflicts
* The apply backend's use of fake trees can be viewed as a poor-man's
version of the irrelevant rename detection optimization I added to
merge-ort, but it works well enough to get you under merge.renameLimit
so that renames are detected for the apply backend
* The fact that you modified what you view as renames more than what
you viewed as copies has the perverse effect of causing git's rename
detection to pair up files with the copy rather than the rename, and
apply changes to it

The net result is that the 'merge' backend isn't apply your changes from various files to their renamed counterpart, while the 'apply' backend is almost doing that but applying them to what you think of as the copy rather than the intended renamed file. The questions I asked above may be able to help us either confirm or rule out this theory.

Marco Giuliano· Jun 29, 2021, 18:58 UTC · re: Elijah Newren · lore

Re: Nonexistent changes appear rebasing but only with rebase.backend=apply

On Sat, Jun 26, 2021 at 9:53 AM Elijah Newren <newren@gmail.com> wrote:
Show 84 quoted lines
>
> Hi Marco,
>
> On Fri, Jun 25, 2021 at 12:15 AM Marco Giuliano
> <marco.giuliano@tesisquare.com> wrote:
> >
> > Hi Philip,
> > oh, so I guessed correctly...
> > Could you be more specific about the copy/rename issue of the apply backend ?
> > Is there any bug report I can refer to ?
> >
> > Thank you very much for your support
>
> Could you do us a favor?  Please avoid top-posting and instead answer
> after the quoted original text, much like I'll do here...
>
> > On Thu, Jun 24, 2021 at 8:39 PM Phillip Wood <phillip.wood123@gmail.com> wrote:
> > >
> > > Hi Marco
> > >
> > > On 24/06/2021 17:23, Marco Giuliano wrote:
> > > > Thanks Felipe and Philip for your answers.
> > > >
> > > > Let's proceed in order:
> > > > @Felipe: I tried rebasing with --no-fork-point but the problem remains the same
> > > >
> > > > @Philip:
> > > > I'm a basic git user, so bear with me if I say silly things...
> > > > I tried to search for rebased-patches in .git folder when rebase
> > > > stopped waiting for
> > > > conflict resolution, but I didn't find any file named like that.
> > > > There's a folder named rebase-apply though did you mean that ?
> > >
> > > Looking at the source I thought they ended up just in .git but I haven't
> > > checked again, as you seem to have found the source of the problem below
> > > lets not worry about that.
> > >
> > > > Anyway, looking at the conflict file of "fileA" directly (not behind a
> > > > visual diff tool) I noticed that the marker line >>>>>>>> COMMIT
> > > > DESCR: FILENAME indicates a different file name then the current
> > > > conflicted file.
> > > > That reminded me that those two files A & B, were actually copies
> > > > (real copy, not symlink) of other two files inside the same repo.
> > > > Is it somehow possible that auto-detected-renaming is involved in this
> > > > (since the files are identical but in two different locations) ?
> > > > Trying to give you some hints, maybe it is totally unrelated...
> > >
> > > I meant to ask if anything had been copied or renamed but forgot. The
> > > merge backend detects copies and renames and handles them correctly but
> > > the apply backend does not so I think this is the source of the discrepancy.
> > >
>
> So I've got a hunch here.  First, Marco, from your example, can you run
>
> git diff --name-status -C Y...X
>
> and report whether the files involved were either renamed or copied on
> the upstream side of history.  (Also, please note that there are three
> dots between Y and X)  Also, can you report whether a message of the
> form "inexact rename detection was skipped due to too many files" when
> using the merge backend and that files you copied from end up in
> modify/delete conflicts when using the merge backend?
>
>
> My suspicion is:
> * You both renamed some files and copied them on the upstream side of history
> * You made further changes to the renamed files, more so than to the "copies"
> * You have enough added/removed/renamed files that with the merge
> backend you are triggering merge.renameLimit and not getting rename
> detection, causing various reports of modify/delete conflicts
> * The apply backend's use of fake trees can be viewed as a poor-man's
> version of the irrelevant rename detection optimization I added to
> merge-ort, but it works well enough to get you under merge.renameLimit
> so that renames are detected for the apply backend
> * The fact that you modified what you view as renames more than what
> you viewed as copies has the perverse effect of causing git's rename
> detection to pair up files with the copy rather than the rename, and
> apply changes to it
>
> The net result is that the 'merge' backend isn't apply your changes
> from various files to their renamed counterpart, while the 'apply'
> backend is almost doing that but applying them to what you think of as
> the copy rather than the intended renamed file.  The questions I asked
> above may be able to help us either confirm or rule out this theory.

Hi Elijah, sorry for the top posting.

I tried the 3-dots command, but no changes on those 2 files are reported. Neither I got any message about inexact rename detection using the merge backend.

I think it might be something related to copy/rename/slighly-change very similar files, but probably not exactly what you described. Commit 4 is the result of a squash where I remember doing changes and copies of those two files, is it possible that the squash operation (which uses rebase under the hood) somehow nullified some of those changes because of their similarities and the current rebase-apply made them reappear ?

I don't know if it can be useful, but if I do an interactive rebase (rebase -i X), even with rebase.backend=apply, the two files do not appear among the conflicts (same as rebase.backend=merge).

Thanks for the support Marco

Felipe Contreras· Jun 25, 2021, 16:08 UTC · re: Marco Giuliano · lore

RE: Nonexistent changes appear rebasing but only with rebase.backend=apply

Marco Giuliano wrote:
Show 16 quoted lines
> I have the following repository status:
> 
>    * commit 2 (BRANCH X)
>    |
>    |  * commit 4 (BRANCH Y) (HEAD)
>    |  |
>    |  * commit 3
>    | /
>    |/
>    * commit 1
>    |
>    |
>  (...)
> 
> What I'm trying to do is rebasing branch Y on branch X, with the command:
> git rebase X
Have you tried using --onto?
  git rebase --onto X commt1
-- 
Felipe Contreras

← back to recent threads