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

Re: [PATCH v4 2/2] revision: implement `git log --merge` also for rebase/cherry-pick/revert

From
Jean-Noël Avila <avila.jn@gmail.com>
Date
Feb 13, 2024, 08:33 UTC
Message-ID
<7a2a0ed5-f9dc-42dd-886b-457641b9bc79@gmail.com>
In-Reply-To
<20240210-ml-log-merge-with-cherry-pick-and-other-pseudo-heads-v4-2-3bc9e62808f4@gmail.com>
Le 11/02/2024 à 00:35, Philippe Blain a écrit :
Show 59 quoted lines
> From: Michael Lohmann <mi.al.lohmann@gmail.com>
> 
> 'git log' learned in ae3e5e1ef2 (git log -p --merge [[--] paths...],
> 2006-07-03) to show commits touching conflicted files in the range
> HEAD...MERGE_HEAD, an addition documented in d249b45547 (Document
> rev-list's option --merge, 2006-08-04).
> 
> It can be useful to look at the commit history to understand what lead
> to merge conflicts also for other mergy operations besides merges, like
> cherry-pick, revert and rebase.
> 
> For rebases, an interesting range to look at is HEAD...REBASE_HEAD,
> since the conflicts are usually caused by how the code changed
> differently on HEAD since REBASE_HEAD forked from it.
> 
> For cherry-picks and revert, it is less clear that
> HEAD...CHERRY_PICK_HEAD and HEAD...REVERT_HEAD are indeed interesting
> ranges, since these commands are about applying or unapplying a single
> (or a few, for cherry-pick) commit(s) on top of HEAD. However, conflicts
> encountered during these operations can indeed be caused by changes
> introduced in preceding commits on both sides of the history.
> 
> Adjust the code in prepare_show_merge so it constructs the range
> HEAD...$OTHER for each of OTHER={MERGE_HEAD, CHERRY_PICK_HEAD,
> REVERT_HEAD or REBASE_HEAD}. Note that we try these pseudorefs in order,
> so keep REBASE_HEAD last since the three other operations can be
> performed during a rebase. Note also that in the uncommon case where
> $OTHER and HEAD do not share a common ancestor, this will show the
> complete histories of both sides since their root commits, which is the
> same behaviour as currently happens in that case for HEAD and
> MERGE_HEAD.
> 
> Adjust the documentation of this option accordingly.
> 
> Co-authored-by: Philippe Blain <levraiphilippeblain@gmail.com>
> Co-authored-by: Johannes Sixt <j6t@kdbg.org>
> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
> Signed-off-by: Michael Lohmann <mi.al.lohmann@gmail.com>
> [jc: tweaked in j6t's precedence fix that tries REBASE_HEAD last]
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>   Documentation/gitk.txt             |  8 ++++----
>   Documentation/rev-list-options.txt |  6 ++++--
>   revision.c                         | 31 +++++++++++++++++++++++--------
>   3 files changed, 31 insertions(+), 14 deletions(-)
> 
> diff --git a/Documentation/gitk.txt b/Documentation/gitk.txt
> index c2213bb77b..80ff4e149a 100644
> --- a/Documentation/gitk.txt
> +++ b/Documentation/gitk.txt
> @@ -63,10 +63,10 @@ linkgit:git-rev-list[1] for a complete list.
>   
>   --merge::
>   
> -	After an attempt to merge stops with conflicts, show the commits on
> -	the history between two branches (i.e. the HEAD and the MERGE_HEAD)
> -	that modify the conflicted files and do not exist on all the heads
> -	being merged.
> +	Show commits touching conflicted paths in the range `HEAD...$OTHER`,

if $OTHER is a placeholder, why not use the placeholder notation <other> instead of a notation that could deceive the reader into thinking that this is an actual environment variable?

> +	where `$OTHER` is the first existing pseudoref in `MERGE_HEAD`,
> +	`CHERRY_PICK_HEAD`, `REVERT_HEAD` or `REBASE_HEAD`. Only works
> +	when the index has unmerged entries.
>   
Thanks
Previous: Phillip WoodNext: Philippe Blain
Message 11 of 26 in “Implement `git log --merge` also for rebase/cherry-pick/revert”
  1. 0/2 Implement `git log --merge` also for rebase/cherry-pick/revertPhilippe Blain, Feb 10, 2024
  2. 1/2 revision: ensure MERGE_HEAD is a ref in prepare_show_mergePhilippe Blain, Feb 10, 2024
  3. 2/2 revision: implement `git log --merge` also for rebase/cherry-pick/revertPhilippe Blain, Feb 10, 2024
  4. Johannes SixtFeb 11, 2024
  5. Philippe BlainFeb 11, 2024
  6. Johannes SixtFeb 11, 2024
  7. Junio C HamanoFeb 12, 2024
  8. Phillip WoodFeb 12, 2024
  9. Philippe BlainFeb 13, 2024
  10. Phillip WoodFeb 14, 2024
  11. Jean-Noël AvilaFeb 13, 2024
  12. Philippe BlainFeb 13, 2024
  13. 0/2 Implement `git log --merge` also for rebase/cherry-pick/revertPhilippe Blain, Feb 25, 2024
  14. 1/2 revision: ensure MERGE_HEAD is a ref in prepare_show_mergePhilippe Blain, Feb 25, 2024
  15. Jean-Noël AvilaFeb 26, 2024
  16. Philippe BlainFeb 26, 2024
  17. 2/2 revision: implement `git log --merge` also for rebase/cherry-pick/revertPhilippe Blain, Feb 25, 2024
  18. Junio C HamanoFeb 26, 2024
  19. Philippe BlainFeb 26, 2024
  20. Phillip WoodFeb 27, 2024
  21. Junio C HamanoFeb 27, 2024
  22. 0/2 Implement `git log --merge` also for rebase/cherry-pick/revertPhilippe Blain, Feb 28, 2024
  23. 1/2 revision: ensure MERGE_HEAD is a ref in prepare_show_mergePhilippe Blain, Feb 28, 2024
  24. 2/2 revision: implement `git log --merge` also for rebase/cherry-pick/revertPhilippe Blain, Feb 28, 2024
  25. phillip.wood123@gmail.comFeb 28, 2024
  26. Philippe BlainMar 2, 2024

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.