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

Re: [PATCH v2] merge: allow to pretend a merge is made into a different branch

From
Derrick Stolee <stolee@gmail.com>
Date
Dec 21, 2021, 13:52 UTC
Message-ID
<c09a2e85-1c27-ed19-eb6b-c4daece49133@gmail.com>
In-Reply-To
<xmqqee66ubuw.fsf_-_@gitster.g>
On 12/20/2021 5:53 PM, Junio C Hamano wrote:
Show 6 quoted lines
> Teach the "--into-name=<branch>" option to "git merge" and its
> underlying "git fmt-merge-message", to pretend as if we were merging
> into <branch>, no matter what branch we are actually merging into,
> when they prepare the merge message.  The pretend name honors the
> usual "into <target>" suppression mechanism, which can be seen in
> the tests added here.
I like the change to "--into-name".
 
Show 6 quoted lines
> -	if (starts_with(current_branch, "refs/heads/"))
> +
> +	if (opts->into_name)
> +		current_branch = opts->into_name;
> +	else if (starts_with(current_branch, "refs/heads/"))
>  		current_branch += 11;

I briefly considered whether this 'else if' should just be an 'if' to allow stripping "revs/heads/" from the --into-name option, but I think it is better as-is, so we use the literal value that the user supplied.

This patch LGTM.

Thanks, -Stolee

Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 5 of 8 in “merge: allow to pretend a merge into detached HEAD is made into a branch”
  1. merge: allow to pretend a merge into detached HEAD is made into a branchJunio C Hamano, Dec 18, 2021
  2. Sergey OrganovDec 18, 2021
  3. Junio C HamanoDec 20, 2021
  4. merge: allow to pretend a merge is made into a different branchJunio C Hamano, Dec 20, 2021
  5. Derrick StoleeDec 21, 2021
  6. Ævar Arnfjörð BjarmasonDec 18, 2021
  7. Derrick StoleeDec 20, 2021
  8. Junio C HamanoDec 20, 2021

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.