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

Re: gitweb using "--cc"?

From
Junio C Hamano <junkio@cox.net>
Date
Feb 9, 2006, 22:26 UTC
Message-ID
<7v3bis88y9.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vk6c48a69.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
Show 11 quoted lines
> Junio C Hamano <junkio@cox.net> writes:
>
>> On top of your patch, it was quite easy ;-)
>>
>> After the "Evil merge" in your test script, I added these:
>>
>>...
>>
>>         git diff-tree -M --cc HEAD
>
> Sorry for the noise.  The test was broken.
Second try.  Sorry again for the previous noise.

This time I made sure I am getting double-colon output; here is what I added after your test script:

        for i in a b c d e f g h i j k l m n; do echo $i; done >d
        git-update-index --add d
        git commit -m 'Add d'
        git checkout other
        git merge fast HEAD master
        echo o >>d
        git-update-index d
        git commit -m 'Edit d'
        git checkout master
        echo 'Another' >>a
        git-update-index a
        git commit -m 'Modify a'
        git merge --no-commit 'Merge' HEAD other
        echo Extra >>a
        mv d e
        echo extra >>e
        git update-index --add --remove a d e
        git commit -m 'Evil again'
        git diff-tree -M -c HEAD

But you are right. Rename detection with combined diff has a funny semantics:

    diff-tree 9df5f2d... (from parents)
    Merge: 1da47fa... 09eee61...
    Author: Junio C Hamano <junkio@cox.net>
    Date:   Thu Feb 9 14:11:13 2006 -0800
        Evil again
    ::100644 100644 100644 8c3beaf... aad9366... c54c990... M	a
    ::100644 100644 100644 4f7cbe7... f8c295c... 19d5d80... M	e

This is showing that what was "d" was somehow magically called "e" in the merge result with its own changes. --cc output is more interesting but the point is there is no sign of "d" in its output, which does not feel right.

If we really care, we could show a status letter for each parent (both are renames in this case but it is plausible one parent is rename-edit and another is modify) and the original path in each parent.

Does it matter? I presume that a Porcelain that cares would rather use the traditional "diff-tree -m -r" to look at diff with each parent. I dunno.

---
diff --git a/combine-diff.c b/combine-diff.c
index 15f369e..6d78305 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -829,7 +829,7 @@ const char *diff_tree_combined_merge(con
 	struct combine_diff_path *p, *paths = NULL;
 	int num_parent, i, num_paths;
 
-	diff_setup(&diffopts);
+	diffopts = *opt;
 	diffopts.output_format = DIFF_FORMAT_NO_OUTPUT;
 	diffopts.recursive = 1;
 
@@ -846,6 +846,7 @@ const char *diff_tree_combined_merge(con
 		struct commit *parent = parents->item;
 		diff_tree_sha1(parent->object.sha1, commit->object.sha1, "",
 			       &diffopts);
+		diffcore_std(&diffopts);
 		paths = intersect_paths(paths, i, num_parent);
 		diff_flush(&diffopts);
 	}
Previous: Junio C HamanoNext: Marco Costalba
Message 18 of 27 in “gitweb using "--cc"?”
  1. Linus TorvaldsFeb 8, 2006
  2. Junio C HamanoFeb 8, 2006
  3. Use describe to come up with the closest tag.Junio C Hamano, Feb 9, 2006
  4. Allow using --cc when showing a merge.Junio C Hamano, Feb 9, 2006
  5. Brian GerstFeb 9, 2006
  6. Linus TorvaldsFeb 9, 2006
  7. Junio C HamanoFeb 9, 2006
  8. Linus TorvaldsFeb 9, 2006
  9. Linus TorvaldsFeb 9, 2006
  10. Linus TorvaldsFeb 9, 2006
  11. Junio C HamanoFeb 9, 2006
  12. Linus TorvaldsFeb 9, 2006
  13. Linus TorvaldsFeb 9, 2006
  14. Junio C HamanoFeb 9, 2006
  15. Junio C HamanoFeb 9, 2006
  16. Junio C HamanoFeb 9, 2006
  17. Junio C HamanoFeb 9, 2006
  18. Junio C HamanoFeb 9, 2006
  19. Marco CostalbaFeb 11, 2006
  20. Junio C HamanoFeb 11, 2006
  21. Junio C HamanoFeb 11, 2006
  22. Junio C HamanoFeb 9, 2006
  23. Linus TorvaldsFeb 9, 2006
  24. Junio C HamanoFeb 9, 2006
  25. combine-diff: Record diff status a bit more faithfullyJunio C Hamano, Feb 10, 2006
  26. combine-diff: move formatting logic to show_combined_diff()Junio C Hamano, Feb 9, 2006
  27. Kay SieversFeb 9, 2006

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.