Re: Odd rebase behavior
- From
John Keeping <john@keeping.me.uk>
- Date
- Dec 16, 2015, 22:17 UTC
- Message-ID
- <20151216221716.GD1581@serenity.lan>
- In-Reply-To
- <877fkf9j5h.fsf@waller.obbligato.org>
On Tue, Dec 15, 2015 at 09:17:30PM -0600, David A. Greene wrote:
Show 19 quoted lines
> According to the rebase man page, rebase gathers commits as in "git log > <upstream>..HEAD." However, that is not what happens in the tests > below. Some of the commits disappear. > > The test basically does this: > > - Setup a master project and a subproject, merged via a subtree-like > merge (this is how git-subtree does it). > > - Add some commits to the subproject directory after the subtree merge, > to create some history not in the original subproject. > > - filter-branch --subdirectory-filter to extract commits from the > subproject directory. > > - Rebase those commits back on to the original subproject repository. > > The above loses all commits made after the subproject is merged into > the main project.
[snip]
Show 6 quoted lines
> # Does not preserve master4 and master5. > test_expect_success 'Rebase default' ' > git checkout -b rebase-default master && > git filter-branch --prune-empty -f --subdirectory-filter files_subtree && > git commit -m "Empty commit" --allow-empty && > git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master &&
It seems that the problem is introduces by --preserve-merges (and -Xsubtree causes something interesting to happen as well). I see the following behaviour:
git rebase --onto files-master master
Works (master4 and master5 preserved).
git rebase --preserve-merges --onto files-master master
Behaves as described above (master4 and master5 are lost).
git rebase -Xsubtree=files_subtree --onto files-master master
fatal: Could not parse object 'b15c4133fc3146e1330c84159886f0f7a09fbf43^' Unknown exit code (128) from command: git-merge-recursive b15c4133fc3146e1330c84159886f0f7a09fbf43^ -- HEAD b15c4133fc3146e1330c84159886f0f7a09fbf43
git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master
Same as the version with only --preserve-merges.