{"thread":{"id":"593","subject":"[PATCH Cogito] Add -u option to cg-log to show only commits from a specific user","startedAt":"2005-05-12T21:58:45Z","lastAt":"2005-05-12T21:58:45Z","messageCount":1,"participants":["Marcel Holtmann"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"3208","messageId":"1115935125.18499.74.camel@pegasus","threadId":"593","inReplyTo":null,"subject":"[PATCH Cogito] Add -u option to cg-log to show only commits from a specific user","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-05-12T21:58:45Z","receivedAt":"2005-05-12T21:58:45Z","isPatch":true,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi Petr,\n\nthe attached patch introduces the -u option for cg-log. Now you can give\na username or a part of an username and only commits with a matching\nauthor or committer will be displayed. Based on a patch from Sean.\n\nRegards\n\nMarcel\n\n\nSigned-off-by: Marcel Holtmann <marcel@holtmann.org>\n\n\n\nIndex: cg-log\n===================================================================\n--- 7fa81b554162c34c616e74392960939412d18081/cg-log  (mode:100755)\n+++ uncommitted/cg-log  (mode:100755)\n@@ -15,6 +15,9 @@\n #\n # Takes an -f option to list which files was changed.\n #\n+# Takes -u\"username\" to list only commits where author or\n+# committer contains username.\n+#\n # Takes an -r followed with id resolving to a commit to start from\n # (HEAD by default), or id1:id2 representing an (id1;id2] range\n # of commits to show.\n@@ -34,6 +37,7 @@\n colsignoff=\n coldefault=\n list_files=\n+user=\n while [ \"$1\" ]; do\n \t# TODO: Parse -r here too.\n \tcase \"$1\" in\n@@ -51,6 +55,10 @@\n \t\tlist_files=1\n \t\tshift\n \t\t;;\n+\t-u*)\n+\t\tuser=\"${1#-u}\"\n+\t\tshift\n+\t\t;;\n \t*)\n \t\tbreak\n \t\t;;\n@@ -123,6 +131,9 @@\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 \tfi\n+\tif [ \"$user\" ]; then\n+\t\tgit-cat-file commit $commit | grep -e '^author ' -e '^committer ' | grep -qi \"$user\" || continue\n+\tfi\n \techo $colheader\"\"commit ${commit%:*} $coldefault;\n \tgit-cat-file commit $commit | \\\n \t\twhile read key rest; do\n"}]}