git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Brett CundalNext: Johannes Schindelin
Message 2 of 6 in “git-subtree.sh: Use --allow-unrelated-histories when splitting with --rejoin”
  1. git-subtree.sh: Use --allow-unrelated-histories when splitting with --rejoinBrett Cundal, Jul 21, 2016
  2. David AguilarJul 21, 2016
  3. Johannes SchindelinJul 21, 2016
  4. Brett CundalJul 21, 2016
  5. Johannes SchindelinJul 22, 2016
  6. Brett CundalJul 22, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.