{"thread":{"id":"808","subject":"[PATCH] cg-log: also search the initial commit for files","startedAt":"2005-06-02T13:10:00Z","lastAt":"2005-06-02T13:10:00Z","messageCount":1,"participants":["Jonas Fonseca"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"4415","messageId":"20050602131000.GA16143@diku.dk","threadId":"808","inReplyTo":null,"subject":"[PATCH] cg-log: also search the initial commit for files","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2005-06-02T13:10:00Z","receivedAt":"2005-06-02T13:10:00Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"When restricting the log to a set of files pass --root to git-diff-tree if\nno parent is found so the initial commit is also checked.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n---\n\n cg-log |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/cg-log b/cg-log\n--- a/cg-log\n+++ b/cg-log\n@@ -167,7 +167,9 @@ $revls | $revsort | while read time comm\n \t[ \"$revfmt\" = \"git-rev-list\" ] && commit=\"$time\"\n \tif [ $# -ne 0 ]; then\n \t\tparent=$(git-cat-file commit $commit | sed -n '2s/parent //p;2Q')\n-\t\t[ \"$parent\" ] && [ \"$(git-diff-tree -r $commit $parent \"$@\")\" ] || continue\n+\t\tdiff_ops=\n+\t\t[ \"$parent\" ] || diff_ops=--root\n+\t\t[ \"$(git-diff-tree -r $diff_ops $commit $parent \"$@\")\" ] || continue\n \tfi\n \tif [ \"$user\" ]; then\n \t\tgit-cat-file commit $commit | grep -e '^author ' -e '^committer ' | grep -qi \"$user\" || continue\n-- \nJonas Fonseca\n"}]}