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

[PATCH] cg-log: also search the initial commit for files

From
Jonas Fonseca <fonseca@diku.dk>
Date
Jun 2, 2005, 13:10 UTC
Message-ID
<20050602131000.GA16143@diku.dk>

When restricting the log to a set of files pass --root to git-diff-tree if no parent is found so the initial commit is also checked.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
 cg-log |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/cg-log b/cg-log
--- a/cg-log
+++ b/cg-log
@@ -167,7 +167,9 @@ $revls | $revsort | while read time comm
 	[ "$revfmt" = "git-rev-list" ] && commit="$time"
 	if [ $# -ne 0 ]; then
 		parent=$(git-cat-file commit $commit | sed -n '2s/parent //p;2Q')
-		[ "$parent" ] && [ "$(git-diff-tree -r $commit $parent "$@")" ] || continue
+		diff_ops=
+		[ "$parent" ] || diff_ops=--root
+		[ "$(git-diff-tree -r $diff_ops $commit $parent "$@")" ] || continue
 	fi
 	if [ "$user" ]; then
 		git-cat-file commit $commit | grep -e '^author ' -e '^committer ' | grep -qi "$user" || continue
-- 
Jonas Fonseca
Message 1 of 1 in “cg-log: also search the initial commit for files”
  1. cg-log: also search the initial commit for filesJonas Fonseca, Jun 2, 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.