Re: [PATCH] git-subtree.sh: Use --allow-unrelated-histories when splitting with --rejoin
- From
David Aguilar <davvid@gmail.com>
- Date
- Jul 21, 2016, 05:26 UTC
- Message-ID
- <20160721052625.GA31423@gmail.com>
- In-Reply-To
- <010201560af48050-012ea887-a1e1-4d1b-82d3-4799ac7788bc-000000@eu-west-1.amazonses.com>
[cc'd Roberto for submitGit q's]
On Thu, Jul 21, 2016 at 12:56:51AM +0000, Brett Cundal wrote:
> ---
<emtpy commit message>
The message on the pull request[1] has a better justification for this change, which would have been nice in the commit message itself:
Git 2.9 added a check against merging unrelated histories, which is exactly what git subtree with --rejoin does. Adding the --allow-unrelated-histories flag to merge will override this check.
Is it possible that maybe submitGit can detect an empty commit message for single-commit PRs and transplant that message onto it?
As-is, the commit itself should probably be amended to contain that information.
Show 18 quoted lines
> contrib/subtree/git-subtree.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh > index 7a39b30..556cd92 100755 > --- a/contrib/subtree/git-subtree.sh > +++ b/contrib/subtree/git-subtree.sh > @@ -661,7 +661,7 @@ cmd_split() > if [ -n "$rejoin" ]; then > debug "Merging split branch into HEAD..." > latest_old=$(cache_get latest_old) > - git merge -s ours \ > + git merge -s ours --allow-unrelated-histories \ > -m "$(rejoin_msg "$dir" $latest_old $latest_new)" \ > $latest_new >&2 || exit $? > fi > > --
With the above description this change makes more sense, but it seems that the existing tests do not detect the breakage fixed by this patch.
Can you please add a test case in t/t7900-subtree.sh demonstrating the breakage?
Looks good otherwise.
[1] https://github.com/git/git/pull/274
-- David