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

Re: [PATCH 4/4] merge-recursive: Avoid showing conflicts with merge branch before HEAD

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 15, 2018, 05:23 UTC
Message-ID
<xmqqzhvf4wcc.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20181012212551.7689-5-newren@gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 6 quoted lines
> The correct order usually comes naturally and for free, but with renames
> we often have data in the form {rename_branch, other_branch}, and
> working relative to the rename first (e.g. for rename/add) is more
> convenient elsewhere in the code.  Address the slight impedance
> mismatch by having some functions re-call themselves with flipped
> arguments when the branch order is reversed.

I've never noticed or felt disturbed myself, but thanks for this level of attention to the detail.

Show 23 quoted lines
> @@ -228,7 +228,26 @@ static inline void setup_rename_conflict_info(enum rename_type rename_type,
>  					      struct stage_data *src_entry1,
>  					      struct stage_data *src_entry2)
>  {
> -	struct rename_conflict_info *ci = xcalloc(1, sizeof(struct rename_conflict_info));
> +	struct rename_conflict_info *ci;
> +
> +	/*
> +	 * When we have two renames involved, it's easiest to get the
> +	 * correct things into stage 2 and 3, and to make sure that the
> +	 * content merge puts HEAD before the other branch if we just
> +	 * ensure that branch1 == o->branch1.  So, simply flip arguments
> +	 * around if we don't have that.
> +	 */
> +	if (dst_entry2 && branch1 != o->branch1) {
> +		setup_rename_conflict_info(rename_type,
> +					   pair2,      pair1,
> +					   branch2,    branch1,
> +					   dst_entry2, dst_entry1,
> +					   o,
> +					   src_entry2, src_entry1);
> +		return;
> +	}
;-)
Previous: Elijah NewrenNext: Elijah Newren
Message 5 of 15 in “More merge cleanups”
  1. 0/4 More merge cleanupsElijah Newren, Oct 12, 2018
  2. 3/4 merge-recursive: improve auto-merging messages with path collisionsElijah Newren, Oct 12, 2018
  3. Junio C HamanoOct 15, 2018
  4. 4/4 merge-recursive: Avoid showing conflicts with merge branch before HEADElijah Newren, Oct 12, 2018
  5. Junio C HamanoOct 15, 2018
  6. 1/4 t6036: add testcase where virtual merge base contains nested conflictsElijah Newren, Oct 12, 2018
  7. 2/4 merge-recursive: increase marker length with depth of recursionElijah Newren, Oct 12, 2018
  8. Junio C HamanoOct 15, 2018
  9. Elijah NewrenOct 15, 2018
  10. Junio C HamanoOct 16, 2018
  11. Elijah NewrenOct 16, 2018
  12. 0/2 More merge cleanupsElijah Newren, Oct 16, 2018
  13. 1/2 merge-recursive: improve auto-merging messages with path collisionsElijah Newren, Oct 16, 2018
  14. 2/2 merge-recursive: avoid showing conflicts with merge branch before HEADElijah Newren, Oct 16, 2018
  15. Junio C HamanoOct 18, 2018

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.