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

[PATCH] Identical trees should not trigger error in cg-diff

From
PRPavel Roskin <proski@gnu.org>
Date
Aug 17, 2005, 03:42 UTC
Message-ID
<1124250163.26240.19.camel@dv>
Hello!

cg-diff reports error when comparing identical trees. It's not as useless as it may seem. For example, I make local changes, e-mail them upstream and then get them back via cg-update with minor changes. I revert the minor differences between master and origin. Here's what I get when I want to make sure the trees are identical (their history is not):

$ cg-diff -r origin:master cg-diff: trying to diff b00f462cee5b02455abdbb476fa7c9e94a9fcb4c against itself

What's worse, cg-diff exists with exit status 1, indicating an error. I don't see any reason for this to be an error. No difference between branches is OK. This may be especially important when cg-diff is used non-interactively in a script.

Signed-off-by: Pavel Roskin <proski@gnu.org>
diff --git a/cg-diff b/cg-diff
--- a/cg-diff
+++ b/cg-diff
@@ -167,7 +167,7 @@ fi
 id1=$(tree-id "$id1") || exit 1
 id2=$(tree-id "$id2") || exit 1
 
-[ "$id1" = "$id2" ] && die "trying to diff $id1 against itself"
+[ "$id1" = "$id2" ] && exit 0
 
 cat $filter | xargs git-diff-tree -r -p $id1 $id2 | colorize | pager
 
-- 
Regards,
Pavel Roskin
Message 1 of 1 in “Identical trees should not trigger error in cg-diff”
  1. Identical trees should not trigger error in cg-diffPavel Roskin, Aug 17, 2005

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.