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

Re: [PATCH v2 8/8] log --remerge-diff: show what the conflict resolution changed

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 27, 2014, 00:40 UTC
Message-ID
<xmqqbnxt1j7l.fsf@gitster.dls.corp.google.com>
In-Reply-To
<75c29215c6a61fe1dc3f088f0fcd9acfa54f24fa.1393059605.git.tr@thomasrast.ch>
Thomas Rast <tr@thomasrast.ch> writes:
Show 22 quoted lines
> diff --git a/log-tree.c b/log-tree.c
> index 30b3063..9b831e9 100644
> --- a/log-tree.c
> +++ b/log-tree.c
> @@ -11,6 +11,8 @@
>  #include "gpg-interface.h"
>  #include "sequencer.h"
>  #include "line-log.h"
> +#include "cache-tree.h"
> +#include "merge-recursive.h"
>  
>  struct decoration name_decoration = { "object names" };
>  
> @@ -723,6 +725,300 @@ static int do_diff_combined(struct rev_info *opt, struct commit *commit)
>  }
>  
>  /*
> + * Helpers for make_asymmetric_conflict_entries() below.
> + */
> +static char *load_cache_entry_blob(struct cache_entry *entry,
> +				   unsigned long *size)
> +{

I briefly wondered if this helper need to know about contents conversions (e.g. smudge/clean or crlf), but not doing any of that *is* the right thing to do. IOW, I agree with what this part of the patch does.

But it feels, at least to me, that this helper function ...
> +static void strbuf_append_cache_entry_blob(struct strbuf *sb,
> +					   struct cache_entry *entry)
> +{

... and this one are overly specific. Why should they know about (and limit themselves to operate on) cache-entry type? Isn't it too much to ask for the caller to say "entry->sha1" instead of "entry"?

I do not have an issue with a "load_blob()" helper that makes sure what it reads is a blob, though, of course.

Show 26 quoted lines
> +static void assemble_conflict_entry(struct strbuf *sb,
> +				    const char *branch1,
> +				    const char *branch2,
> +				    struct cache_entry *entry1,
> +				    struct cache_entry *entry2)
> +{
> +	strbuf_addf(sb, "<<<<<<< %s\n", branch1);
> +	strbuf_append_cache_entry_blob(sb, entry1);
> +	strbuf_addstr(sb, "=======\n");
> +	strbuf_append_cache_entry_blob(sb, entry2);
> +	strbuf_addf(sb, ">>>>>>> %s\n", branch2);
> +}
> +
> +/*
> + * For --remerge-diff, we need conflicted (<<<<<<< ... >>>>>>>)
> + * representations of as many conflicts as possible.  Default conflict
> + * generation only applies to files that have all three stages.
> + *
> + * This function generates conflict hunk representations for files
> + * that have only one of stage 2 or 3.  The corresponding side in the
> + * conflict hunk format will be empty.  A stage 1, if any, will be
> + * dropped in the process.
> + */
> +static void make_asymmetric_conflict_entries(const char *branch1,
> +					     const char *branch2)
> +{

I should comment on this one in a separate message after I read it over once again.

Show 9 quoted lines
> +}
> +
> +/*
> + * --remerge-diff doesn't currently handle entries that cannot be
> + * turned into a stage0 conflicted-file format blob.  So this routine
> + * clears the corresponding entries from the index.  This is
> + * suboptimal; we should eventually handle them _somehow_.
> +*/
> +static void drop_non_stage0()
"static void drop_non_stage0(void)"
Previous: Thomas Rast
Message 16 of 16 in “log --remerge-diff”
  1. 0/8 log --remerge-diffThomas Rast, Feb 22, 2014
  2. 1/8 merge-recursive: remove dead conditional in update_stages()Thomas Rast, Feb 22, 2014
  3. 2/8 merge-recursive: internal flag to avoid touching the worktreeThomas Rast, Feb 22, 2014
  4. 3/8 merge-recursive: -Xindex-only to leave worktree unchangedThomas Rast, Feb 22, 2014
  5. Eric SunshineFeb 23, 2014
  6. Thomas RastFeb 23, 2014
  7. Eric SunshineFeb 23, 2014
  8. 4/8 combine-diff: do not pass revs->dense_combined_merges redundantlyThomas Rast, Feb 22, 2014
  9. 5/8 Fold all merge diff variants into an enumThomas Rast, Feb 22, 2014
  10. 6/8 merge-recursive: allow storing conflict hunks in indexThomas Rast, Feb 22, 2014
  11. 7/8 name-hash: allow dir hashing even when !ignore_caseThomas Rast, Feb 22, 2014
  12. Eric SunshineFeb 23, 2014
  13. Thomas RastSep 6, 2014
  14. Junio C HamanoFeb 27, 2014
  15. 8/8 log --remerge-diff: show what the conflict resolution changedThomas Rast, Feb 22, 2014
  16. Junio C HamanoFeb 27, 2014

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.