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

Re: [PATCH] log,diff-tree: add --combined-with-paths options for merges with renames

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 25, 2019, 19:29 UTC
Message-ID
<xmqqmunofsdv.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190124164654.1923-1-newren@gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 21 quoted lines
> The raw diff format for merges with -c or --cc will only list one
> filename, even if rename detection is active and a rename was detected
> for the given path.  Examples:
>
>   ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM	describe.c
>   ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM	bar.sh
>   ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR	phooey.c
>
> This doesn't let us know what the original name of bar.sh was in the
> first parent, and doesn't let us know what either of the original
> names of phooey.c were in either of the parents.  In contrast, for
> non-merge commits, raw format does provide original filenames (and a
> rename score to boot).  In order to also provide original filenames
> for merge commits, add a --combined-with-paths option (which is only
> useful in conjunction with -c, --raw, and -M and thus implies all
> those options) so that we can print tab-separated filenames when
> renames are involved.  This transforms the above output to:
>
>   ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM	describe.c
>   ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM	foo.sh	bar.sh
>   ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR	fooey.c	fuey.c	phooey.c

I admit that I designed the original without too much thought. Perhaps we should have avoided discarding info, but it is way too late to fix with a default behaviour change.

I am not sure if it is easy for consumers to guess which name on the output line corresponds to which input tree from the status letter, though. Would it make it easier for consumers if this showed names in all input trees if any of them is different from the name in the resulting tree, I wonder? Even in that case, the consumer must know some rule like "if R or C appears in the status column, then we have N preimage names plus the name in the result for N-way merge", so it may not be too bad to force them to know "for each of R or C in the status column, the name in the preimage tree is emitted, and the last name is the name in the result". I dunno.

Show 7 quoted lines
> +For `-c` and `--cc`, only the destination or final path is shown even
> +if the file was renamed on any side of history.  With
> +`--combined-with-paths`, the number of paths printed will be one more
> +than the number of 'R' characters in the concatenated status.  For
> +each 'R' in the concatenated status characters, the original pathname
> +on that side of history will be shown, and the final path shown on the
> +line will be the path used in the merge.

Is it safe for readers to pay attention to only 'R'? Will it stay forever that way? My immediate worry is 'C', but there might be other cases that original and result have different names.

> +--combined-with-paths::
> +	This flag is similar to -c, but modifies the raw output format for
> +	merges to also show the original paths when renames are found.
> +	Implies	-c, -M, and --raw.

So, --cc -p is not allowed to use this? I was wondering if we want to have a separate "even though traditionally we did not show preimage names in combined output, this option tells Git to do so, regardless of output format used, as long as 'combine-diff' is in effect".

Previous: Junio C HamanoNext: Elijah Newren
Message 35 of 39 in “log,diff-tree: add --combined-with-paths options for merges with renames”
  1. log,diff-tree: add --combined-with-paths options for merges with renamesElijah Newren, Jan 24, 2019
  2. brian m. carlsonJan 25, 2019
  3. Elijah NewrenJan 25, 2019
  4. Derrick StoleeJan 25, 2019
  5. Elijah NewrenJan 25, 2019
  6. log,diff-tree: add --combined-with-paths options for merges with renamesElijah Newren, Jan 25, 2019
  7. Derrick StoleeJan 25, 2019
  8. Elijah NewrenJan 25, 2019
  9. Eric SunshineJan 25, 2019
  10. Elijah NewrenJan 26, 2019
  11. brian m. carlsonJan 27, 2019
  12. log,diff-tree: add --combined-all-names optionElijah Newren, Jan 26, 2019
  13. log,diff-tree: add --combined-all-names optionElijah Newren, Feb 4, 2019
  14. Junio C HamanoFeb 4, 2019
  15. Elijah NewrenFeb 5, 2019
  16. Junio C HamanoFeb 5, 2019
  17. Elijah NewrenFeb 7, 2019
  18. Junio C HamanoFeb 7, 2019
  19. Elijah NewrenFeb 7, 2019
  20. Junio C HamanoFeb 7, 2019
  21. Elijah NewrenFeb 7, 2019
  22. Johannes SchindelinFeb 5, 2019
  23. Elijah NewrenFeb 5, 2019
  24. Junio C HamanoFeb 5, 2019
  25. Junio C HamanoFeb 7, 2019
  26. Elijah NewrenFeb 7, 2019
  27. 0/2 add --combined-all-paths option to log and diff-treeElijah Newren, Feb 8, 2019
  28. 2/2 squash! log,diff-tree: add --combined-all-paths optionElijah Newren, Feb 8, 2019
  29. Junio C HamanoFeb 8, 2019
  30. Elijah NewrenFeb 8, 2019
  31. 1/2 log,diff-tree: add --combined-all-paths optionElijah Newren, Feb 8, 2019
  32. Junio C HamanoFeb 8, 2019
  33. Elijah NewrenFeb 8, 2019
  34. Junio C HamanoFeb 8, 2019
  35. Junio C HamanoJan 25, 2019
  36. Elijah NewrenJan 25, 2019
  37. Junio C HamanoJan 25, 2019
  38. Elijah NewrenJan 26, 2019
  39. Junio C HamanoJan 28, 2019

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.