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

[PATCH Cogito] Add -u option to cg-log to show only commits from a specific user

From
MHMarcel Holtmann <marcel@holtmann.org>
Date
May 12, 2005, 21:58 UTC
Message-ID
<1115935125.18499.74.camel@pegasus>
Hi Petr,

the attached patch introduces the -u option for cg-log. Now you can give a username or a part of an username and only commits with a matching author or committer will be displayed. Based on a patch from Sean.

Regards
Marcel
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Index: cg-log
===================================================================
--- 7fa81b554162c34c616e74392960939412d18081/cg-log  (mode:100755)
+++ uncommitted/cg-log  (mode:100755)
@@ -15,6 +15,9 @@
 #
 # Takes an -f option to list which files was changed.
 #
+# Takes -u"username" to list only commits where author or
+# committer contains username.
+#
 # Takes an -r followed with id resolving to a commit to start from
 # (HEAD by default), or id1:id2 representing an (id1;id2] range
 # of commits to show.
@@ -34,6 +37,7 @@
 colsignoff=
 coldefault=
 list_files=
+user=
 while [ "$1" ]; do
 	# TODO: Parse -r here too.
 	case "$1" in
@@ -51,6 +55,10 @@
 		list_files=1
 		shift
 		;;
+	-u*)
+		user="${1#-u}"
+		shift
+		;;
 	*)
 		break
 		;;
@@ -123,6 +131,9 @@
 		parent=$(git-cat-file commit $commit | sed -n '2s/parent //p;2Q')
 		[ "$parent" ] && [ "$(git-diff-tree -r $commit $parent "$@")" ] || continue
 	fi
+	if [ "$user" ]; then
+		git-cat-file commit $commit | grep -e '^author ' -e '^committer ' | grep -qi "$user" || continue
+	fi
 	echo $colheader""commit ${commit%:*} $coldefault;
 	git-cat-file commit $commit | \
 		while read key rest; do
Message 1 of 1 in “Add -u option to cg-log to show only commits from a specific user”
  1. Add -u option to cg-log to show only commits from a specific userMarcel Holtmann, May 12, 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.