DORMANTno replies

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

From: Jonas Fonseca <hidden>
Date: 2016-06-15 22:41:59
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---

 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help