{"thread":{"id":"861","subject":"cogito-0.10 broken for cg-commit < logmessagefile","startedAt":"2005-06-08T13:46:32Z","lastAt":"2005-06-08T21:03:24Z","messageCount":7,"participants":["Russell King","Catalin Marinas","Petr Baudis","Dan Holmsand"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"4698","messageId":"20050608144632.A28042@flint.arm.linux.org.uk","threadId":"861","inReplyTo":null,"subject":"cogito-0.10 broken for cg-commit < logmessagefile","fromName":"Russell King","fromEmail":"rmk@arm.linux.org.uk","sentAt":"2005-06-08T13:46:32Z","receivedAt":"2005-06-08T13:46:32Z","isPatch":false,"sender":{"key":"rmk@arm.linux.org.uk","avatar":null},"body":"The command in the subject prepends the log message with a blank line.\nThis ain't good because it messes up commit messages as per Linus'\nrequirements (the first line must be a summary.)\n\nIs this known about / has this been fixed in 0.11 ?\n\n(It's presently a blocking bug...)\n\n-- \nRussell King\n\n"},{"id":"4704","messageId":"tnxhdg8g6e1.fsf@arm.com","threadId":"861","inReplyTo":"20050608144632.A28042@flint.arm.linux.org.uk","subject":"Re: cogito-0.10 broken for cg-commit < logmessagefile","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@arm.com","sentAt":"2005-06-08T16:28:22Z","receivedAt":"2005-06-08T16:28:22Z","isPatch":false,"sender":{"key":"catalin.marinas@arm.com","avatar":null},"body":"Russell King <rmk@arm.linux.org.uk> wrote:\n> The command in the subject prepends the log message with a blank line.\n> This ain't good because it messes up commit messages as per Linus'\n> requirements (the first line must be a summary.)\n\nThe patch below should fix the problem. There is no point in writing\nthe status information in a file which is read from stdin.\n\n-- \nCatalin\n\n\n\nFix the log file when read from stdin\n\nLog messages read from stdin shouldn't have additional lines.\n\nSigned-off-by: Catalin Marinas <catalin.marinas@arm.com>\n\ndiff --git a/cg-commit b/cg-commit\n--- a/cg-commit\n+++ b/cg-commit\n@@ -215,7 +215,7 @@ if tty -s; then\n \t\tfi\n \tfi\n else\n-\tcat >>$LOGMSG2\n+\tcat >$LOGMSG2\n fi\n # Remove heading and trailing blank lines.\n grep -v ^CG: $LOGMSG2 | git-stripspace >$LOGMSG\n"},{"id":"4709","messageId":"20050608181747.GA982@pasky.ji.cz","threadId":"861","inReplyTo":"tnxhdg8g6e1.fsf@arm.com","subject":"Re: cogito-0.10 broken for cg-commit < logmessagefile","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-06-08T18:17:47Z","receivedAt":"2005-06-08T18:17:47Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, Jun 08, 2005 at 06:28:22PM CEST, I got a letter\nwhere Catalin Marinas <catalin.marinas@arm.com> told me that...\n> Russell King <rmk@arm.linux.org.uk> wrote:\n> > The command in the subject prepends the log message with a blank line.\n> > This ain't good because it messes up commit messages as per Linus'\n> > requirements (the first line must be a summary.)\n> \n> The patch below should fix the problem. There is no point in writing\n> the status information in a file which is read from stdin.\n\nOh, yes. Thanks, applied.\n\nFYI, I plan to release 0.11.2 this evening. I'll try to go through some\nmore queued patches before and update cg-log to fully use git-rev-list.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"4722","messageId":"42A754D5.10705@gmail.com","threadId":"861","inReplyTo":"20050608181747.GA982@pasky.ji.cz","subject":"[PATCH] Many new features for cg-diff and cg-log","fromName":"Dan Holmsand","fromEmail":"holmsand@gmail.com","sentAt":"2005-06-08T20:28:05Z","receivedAt":"2005-06-08T20:28:05Z","isPatch":true,"sender":{"key":"holmsand@gmail.com","avatar":"https://gravatar.com/avatar/5c722084bafd85e754a02efad01fe69107eb6f393253c49232c5c9f7faa974df?d=mp&s=160"},"body":"Petr Baudis wrote:\n> FYI, I plan to release 0.11.2 this evening. I'll try to go through some\n> more queued patches before and update cg-log to fully use git-rev-list.\n\nIn that case, you might want to have a look at this patch. I've been \ntinkering with cg-log and cg-diff for some time, and just about got \nready to send you a patch.\n\nSorry about the monster patch, but I wanted to get it to you quickly...\n\n...\n\n[PATCH] Many new features for cg-diff and cg-log\n\nBoth cg-diff and cg-log get:\n\n- A common infrastructure for option parsing, that allows for \ncombinations of options like all getopt-using programs. So you can say:\n\ncg-log -cfm\ncg-diff foo --color\ncg-log -sfrlinus foobar\n\nAt the same time, you get decent error reporting on illegal options.\n\n- A common infrastructure for colorization. cg-log and cg-diff share \nsetup, and sed scripts for colorization.\n\n- diffstat (or rather, git-apply --stat) support.\n\n- Support for the new -M, -C and -B switches to the git-diff-* brothers.\n\n- Automatic search in less, so you can jump to the next commit/diff \nchunk by \"n\".\n\n- Automatic color if the COGITO_AUTO_COLOR environment variable is set.\n\n- \"Smart pager\" support - less isn't invoked unless there's actually \nsome output. This is useful is COGITO_AUTO_COLOR is set.\n\ncg-log also gets:\n\n- Vast speedup. It uses git-rev-list and git-diff-tree to do most of the \nheavy lifting.\n\n- A new default \"-f\" format, that allows deletions, renames etc. to be \nshown (the old format is still available as -F). Deletions and new files \nare color-coded.\n\n- Diff output. cg-log -p shows diff output between commits. Colorized as \nin cg-diff.\n\n- New, more compact summary, that's readable on 80-column terminals. By\ndefault, sha1's are hidden, and the date is more compact (and readable). \nIt can also be combined with the other options: for example \"cg-log -sf\" \ngives a nice overview of commits and the files they touch.\n\n- Slightly new behaviour, thanks to use of git-diff-tree: when you use \nany of the options that shows differences between revisions, or that \ngives a subset of revisions, merge commits are hidden by default. They \nare visible if the \"-a/--all\" option is given.\n\n- The default log format is also shorter. The full version is available \nwith \"-v\". An even shorter format is available with \"-q\".\n\n- Selection of ranges by date or maximum number of commits to show.\n\n\n cg-Xlib |   83 +++++++++\n cg-diff |  220 +++++++++++--------------\n cg-log  |  556 ++++++++++++++++++++++++++++++++++++++++-----------------------\n 3 files changed, 534 insertions(+), 325 deletions(-)\n\ndiff --git a/cg-Xlib b/cg-Xlib\n--- a/cg-Xlib\n+++ b/cg-Xlib\n@@ -119,11 +119,94 @@ print_help () {\n }\n \n for option in \"$@\"; do\n+\t[ \"$option\" = -- ] && break\n \tif [ \"$option\" = \"-h\" -o \"$option\" = \"--help\" ]; then\n \t\tprint_help ${_cg_cmd##cg-}\n \tfi\n done\n \n+# option parsing\n+\n+ARGS=(\"$@\")\n+ARGPOS=0\n+\n+optshift() {\n+\tunset ARGS[$ARGPOS]\n+\tARGS=(\"${ARGS[@]}\")\n+\t[ -z \"$1\" -o -n \"${ARGS[$ARGPOS]}\" ] || \n+\tdie \"option \\`$1' requires an argument\"\n+}\n+\n+optfail() {\n+\tdie \"unrecognized option \\`${ARGS[$ARGPOS]}'\"\n+}\n+\n+optconflict() {\n+\tdie \"conflicting option \\`$CUROPT'\"\n+}\n+\n+optparse() {\n+\tunset OPTARG\n+\t[ -z \"$1\" ] && case ${ARGS[$ARGPOS]} in\n+\t--)\toptshift; return 1 ;;\n+\t-*)\treturn 0 ;;\n+\t*)\twhile (( ${#ARGS[@]} > ++ARGPOS )); do\n+\t\t\t[[ \"${ARGS[$ARGPOS]}\" == -- ]] && return 1\n+\t\t\t[[ \"${ARGS[$ARGPOS]}\" == -* ]] && return 0\n+\t\tdone; return 1 ;;\n+\tesac\n+\n+\tCUROPT=${ARGS[$ARGPOS]}\n+\tlocal match=${1%=} minmatch=${2:-1} opt=$CUROPT o=$CUROPT val\n+\t[[ $1 == *= ]] && val=$match\n+\tcase $match in\n+\t--*)\t[ \"$val\" ] && o=${o%%=*}\n+\t\t[ ${#o} -ge $((2 + $minmatch)) -a \\\n+\t\t\t\"${match:0:${#o}}\" = \"$o\" ] || return 1\n+\t\t[[ -n \"$val\" && \"$opt\" == *=?* ]] && ARGS[$ARGPOS]=${opt#*=} ||\n+\t\toptshift $val ;;\n+\t-?)\t[[ $o == $match* ]] || return 1\n+\t\t[[ $o != -?-* || -n \"$val\" ]] || optfail\n+\t\tARGS[$ARGPOS]=${o#$match}\n+\t\t[ \"${ARGS[$ARGPOS]}\" ] && \n+\t\t{ [ \"$val\" ] || ARGS[$ARGPOS]=-${ARGS[$ARGPOS]}; } || \n+\t\toptshift $val ;;\n+\t*)\tdie \"optparse cannot handle $1\" ;;\n+\tesac\n+\t[ -z \"$val\" ] || { OPTARG=${ARGS[$ARGPOS]}; optshift; } \n+}\n+\n+maybe_less() {\n+\t# Invoke $PAGER if there is any output\n+\tlocal line\n+\tif read -r line; then\n+\t\t( echo \"$line\"; cat ) | LESS=\"-R $LESS\" ${PAGER:-less}\n+\tfi\n+}\n+\n+setup_colors()\n+{\n+\tlocal C=\"header=32:author=36:signoff=33:committer=35:files=34\"\n+\tC=\"$C:commit=34:date=32:trim=35\"\n+\tC=\"$C:diffhdr=34:diffhdradd=32:diffadd=32:diffhdrmod=35\"\n+\tC=\"$C:diffmod=35:diffhdrrem=31:diffrem=31:diffhunk=36\"\n+\tC=\"$C:diffctx=34:diffcctx=33:default=0\"\n+\t[ -n \"$COGITO_COLORS\" ] && C=\"$C:$COGITO_COLORS\"\n+\n+\tC=${C//=/=\\'$'\\e'[}\n+\tC=col${C//:/m\\'; col}m\\'\n+\t#coldefault=$(tput op)\n+\teval $C\n+\n+\tcolor_rules=\"\n+s,^+++.*,$coldiffhdradd&$coldefault,\n+s,^---.*,$coldiffhdrrem&$coldefault,\n+s,^[+].*,$coldiffadd&$coldefault,\n+s,^[-].*,$coldiffrem&$coldefault,\n+s,^\\\\(@@.*@@\\\\)\\\\(.*\\\\),$coldiffhunk\\\\1$coldiffctx\\\\2$coldefault,\n+s,^=*$',$coldiffhdr&$coldefault,\n+s,^\\\\(Index:\\\\|===\\\\|diff\\\\) .*,$coldiffhdr&$coldefault,\"\n+}\n \n # Check if we have something to work on, unless the script can do w/o it.\n if [ ! \"$_git_repo_unneeded\" ]; then\ndiff --git a/cg-diff b/cg-diff\n--- a/cg-diff\n+++ b/cg-diff\n@@ -5,13 +5,16 @@\n #\n # Outputs a diff for converting the first tree to the second one.\n # By default compares the current working tree to the state at the\n-# last commit. The output will automatically be displayed in a pager\n-# unless it is piped to a program.\n+# last commit.\n #\n # OPTIONS\n # -------\n-# -c::\n-#\tColorize the diff output\n+# -c, --color::\n+#\tColorize the diff output and use a pager for output (less by \n+#\tdefault).\n+#\n+# -d, --diffstat::\n+#\tShow `diffstat' before diff.\n #\n # -p::\n #\tInstead of one ID denotes a parent commit to the specified ID\n@@ -24,152 +27,131 @@\n #\tempty revision which means '-r rev:' compares between 'rev' and\n #\t'HEAD', while '-r rev' compares between 'rev' and working tree.\n #\n+# -R::\n+#\tOutput diff in reverse.\n+#\n+# -M::\n+#\tDetect renames.\n+#\n+# -C::\n+#\tDetect copies (as well as renames).\n+#\n+# -B::\n+#\tDetect rewrites.\n+#\n # -m::\n #\tBase the diff at the merge base of the -r arguments (defaulting\n-#\tto master and origin).\n+#\tto HEAD and origin).\n #\n # ENVIRONMENT VARIABLES\n # ---------------------\n # PAGER::\n #\tThe pager to display log information in, defaults to `less`.\n #\n-# PAGER_FLAGS::\n-#\tFlags to pass to the pager. By default `R` is added to the `LESS`\n-#\tenvironment variable to allow displaying of colorized output.\n+# COGITO_AUTO_COLOR::\n+#\tIf set, colorized output is used automatically on color-capable\n+#\tterminals.\n \n-USAGE=\"cg-diff [-c] [-m] [-p] [-r FROM_ID[:TO_ID]] [FILE]...\"\n+USAGE=\"cg-diff [-c] [-m] [-p] [-r FROM_ID[:TO_ID] [FILE]...\"\n \n . ${COGITO_LIB}cg-Xlib\n \n \n-id1=\" \"\n-id2=\" \"\n-parent=\n-opt_color=\n-mergebase=\n-\n-# TODO: Make cg-log use this too.\n-setup_colors()\n-{\n-\tlocal C=\"diffhdr=1;36:diffhdradd=1;32:diffadd=32:diffhdrmod=1;35:diffmod=35:diffhdrrem=1;31:diffrem=31:diffhunk=36:diffctx=34:diffcctx=33:default=0\"\n-\t[ -n \"$COGITO_COLORS\" ] && C=\"$C:$COGITO_COLORS\"\n-\n-\tC=${C//=/=\\'$'\\e'[}\n-\tC=col${C//:/m\\'; col}m\\'\n-\t#coldefault=$(tput op)\n-\teval $C\n+unset id1 id2 parent diffprog sedprog diffstat difftmp opt_color renames\n+dtargs=()\n+\n+show_diffstat() {\n+\t[ -s \"$difftmp\" ] || return\n+\tgit-apply --stat \"$difftmp\"\n+\techo\n+\tcat \"$difftmp\"\n }\n \n-while [ \"$1\" ]; do\n-\tcase \"$1\" in\n-\t-c)\n-\t\topt_color=1\n-\t\tsetup_colors\n-\t\t;;\n-\t-p)\n+while optparse; do\n+\tif optparse -p; then\n \t\tparent=1\n-\t\t;;\n-\t-r)\n-\t\tshift\n-\t\tif echo \"$1\" | grep -q ':'; then\n-\t\t\tid2=$(echo \"$1\" | cut -d : -f 2)\n-\t\t\t[ \"$id2\" ] || log_end=\"HEAD\"\n-\t\t\tid1=$(echo \"$1\" | cut -d : -f 1)\n-\t\telif [ \"$id1\" = \" \" ]; then\n-\t\t\tid1=\"$1\"\n+\telif optparse -m; then\n+\t\tincoming=1\n+\telif optparse -r=; then\n+\t\tif [ -z \"${id1+set}\" ]; then\n+\t\t\tid1=$OPTARG\n+\t\t\tif [[ \"$id1\" == *:* ]]; then\n+\t\t\t\tid2=${id1#*:}\n+\t\t\t\tid1=${id1%:*}\n+\t\t\tfi\n \t\telse\n-\t\t\tid2=\"$1\"\n+\t\t\t[ -z \"${id2+set}\" ] || die \"too many revisions\"\n+\t\t\tid2=$OPTARG\n \t\tfi\n-\t\t;;\n-\t-m)\n-\t\tmergebase=1\n-\t\t;;\n-\t*)\n-\t\tbreak\n-\t\t;;\n-\tesac\n-\tshift\n-done\n-\n-colorize() {\n-\tif [ \"$opt_color\" ]; then\n-\t\tgawk '\n-\t\t{ if (/^(Index:|diff --git) /)\n-\t\t    print \"'$coldiffhdr'\" $0 \"'$coldefault'\"\n-\t\t  else if (/^======*$/)\n-\t\t    print \"'$coldiffhdr'\" $0 \"'$coldefault'\"\n-\t\t  else if (/^\\+\\+\\+/)\n-\t\t    print \"'$coldiffhdradd'\" $0 \"'$coldefault'\"\n-\t\t  else if (/^\\*\\*\\*/)\n-\t\t    print \"'$coldiffhdrmod'\" $0 \"'$coldefault'\"\n-\t\t  else if (/^---/)\n-\t\t    print \"'$coldiffhdrrem'\" $0 \"'$coldefault'\"\n-\t\t  else if (/^(\\+|new( file)? mode )/)\n-\t\t    print \"'$coldiffadd'\" $0 \"'$coldefault'\"\n-\t\t  else if (/^(-|(deleted file|old) mode )/)\n-\t\t    print \"'$coldiffrem'\" $0 \"'$coldefault'\"\n-\t\t  else if (/^!/)\n-\t\t    print \"'$coldiffmod'\" $0 \"'$coldefault'\"\n-\t\t  else if (/^@@ \\-[0-9]+(,[0-9]+)? \\+[0-9]+(,[0-9]+)? @@/)\n-\t\t    print gensub(/^(@@[^@]*@@)([ \\t]*)(.*)/,\n-\t\t         \"'$coldiffhunk'\" \"\\\\1\" \"'$coldefault'\" \\\n-\t\t\t \"\\\\2\" \\\n-\t\t\t \"'$coldiffctx'\" \"\\\\3\" \"'$coldefault'\", \"\")\n-\t\t  else if (/^\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*/)\n-\t\t    print \"'$coldiffcctx'\" $0 \"'$coldefault'\"\n-\t\t  else\n-\t\t    print\n-\t\t}'\n+\telif optparse -c; then\n+\t\topt_color=1\n+\telif optparse -d || optparse --diffstat; then\n+\t\tdiffstat=1\n+\telif optparse -R; then\n+\t\tdtargs[${#dtargs[@]}]=\"-R\"\n+\telif optparse -M; then\n+\t\t[ \"$renames\" ] && optconflict\n+\t\trenames=1\n+\t\tdtargs[${#dtargs[@]}]=\"-M\"\n+\telif optparse -C; then\n+\t\t[ \"$renames\" ] && optconflict\n+\t\trenames=1\n+\t\tdtargs[${#dtargs[@]}]=\"-C\"\n+\telif optparse -B; then\n+\t\tdtargs[${#dtargs[@]}]=\"-B\"\n \telse\n-\t\tcat\n+\t\toptfail\n \tfi\n-}\n+done\n+\n+[ -n \"$COGITO_AUTO_COLOR\" -a -t 1 ] && [ \"$(tput setaf 1 2>/dev/null)\" ] && \n+opt_color=1\n+\n+LESS=$'+/\\013^@@.*@@|^diff.--git..*$'\" $LESS\"\n+\n+diffprog=git-diff-tree\n \n if [ \"$parent\" ]; then\n+\t[ -z \"${id2+set}\" ] || die \"too many revisions\"\n \tid2=\"$id1\"\n \tid1=$(parent-id \"$id2\" | head -n 1) || exit 1\n+elif [ \"$incoming\" ]; then\n+\ttmp=$id1\n+\tid1=\"$(commit-id \"${id2:-HEAD}\")\" || exit 1\n+\tid2=\"$(commit-id \"${tmp:-origin}\")\" || exit 1\n+\tid1=\"$(git-merge-base \"$id1\" \"$id2\")\" || exit 1\n fi\n \n-if [ \"$mergebase\" ]; then\n-\t[ \"$id1\" != \" \" ] || id1=\"master\"\n-\t[ \"$id2\" != \" \" ] || id2=\"origin\"\n-\tid1=$(git-merge-base $(commit-id \"$id1\") $(commit-id \"$id2\"))\n-fi\n-\n-\n-filter=$(mktemp -t gitdiff.XXXXXX)\n-for file in \"$@\"; do\n-\techo \"$file\" >>$filter\n-done\n-\n-if [ \"$id2\" = \" \" ]; then\n-\tif [ \"$id1\" != \" \" ]; then\n-\t\ttree=$(tree-id \"$id1\") || exit 1\n-\telse\n-\t\ttree=$(tree-id) || exit 1\n-\tfi\n+id1=$(tree-id \"$id1\") || exit 1\n \n+if [ -z \"${id2+set}\" ]; then\n \t# Ensure to only diff modified files\n \tgit-update-cache --refresh >/dev/null\n-\n-\t# FIXME: Update ret based on what did we match. And take \"$@\"\n-\t# to account after all.\n-\tret=\n-\tcat $filter | xargs git-diff-cache -r -p $tree | colorize | pager\n-\n-\trm $filter\n-\n-\t[ \"$ret\" ] && die \"no files matched\"\n-\texit $ret\n+\tdiffprog=git-diff-cache\n+else\n+\tid2=$(tree-id \"$id2\") || exit 1\n fi\n \n-\n-id1=$(tree-id \"$id1\") || exit 1\n-id2=$(tree-id \"$id2\") || exit 1\n-\n [ \"$id1\" = \"$id2\" ] && die \"trying to diff $id1 against itself\"\n+diffopts=(-r -p \"${dtargs[@]}\" $id1 $id2 \"${ARGS[@]}\")\n+\n+if [ \"$diffstat\" ]; then\n+\tdifftmp=$(mktemp -t cgdiff.XXXXXX) || exit 1\n+\ttrap \"rm '$difftmp'\" SIGTERM EXIT\n+\t$diffprog \"${diffopts[@]}\" > $difftmp\n \n-cat $filter | xargs git-diff-tree -r -p $id1 $id2 | colorize | pager\n+\tdiffprog=show_diffstat\n+\tdiffopts=\n+fi\n \n-rm $filter\n-exit 0\n+if [ \"$opt_color\" ]; then\n+\tsetup_colors\n+\tsedprog=\"$color_rules\"\n+\n+\t[ \"$diffstat\" ] && sedprog=\"$sedprog\n+s,^\\\\( [^ ].*\\\\)\\\\( |  *[0-9][0-9]* \\\\),$colfiles\\\\1$coldefault\\\\2,\"\n+\n+\t$diffprog \"${diffopts[@]}\" | sed -e \"$sedprog\" | maybe_less\n+else\n+\t$diffprog \"${diffopts[@]}\"\n+fi\ndiff --git a/cg-log b/cg-log\n--- a/cg-log\n+++ b/cg-log\n@@ -3,6 +3,7 @@\n # Make a log of changes in a GIT branch.\n # Copyright (c) Petr Baudis, 2005.\n # Copyright (c) David Woodhouse, 2005.\n+# Copyright (c) Dan Holmsand, 2005.\n #\n # Display log information for files or a range of commits. The output\n # will automatically be displayed in a pager unless it is piped to\n@@ -13,7 +14,7 @@\n # Arguments not interpreted as options will be interpreted as filenames;\n # cg-log then displays only changes in those files.\n #\n-# -c::\n+# -c, --color::\n #\tColorize to the output. The used colors are listed below together\n #\twith information about which log output (summary, full or both)\n #\tthey apply to:\n@@ -26,8 +27,15 @@\n #\t\t- `date`:\t'green'\t\t(summary)\n #\t\t- `trim_mark`:\t'magenta'\t(summary)\n #\n+# -d, --diffstat::\n+#\tShow `diffstat' for every commit.\n+#\n # -f::\n-#\tList affected files. (No effect when passed along `-s`.)\n+#\tShow list of files modified in each commit.\n+#\n+# -F::\n+#\tShow ChangeLog-style list of modified files, instead of the\n+#\tdefault listing.\n #\n # -r FROM_ID[:TO_ID]::\n #\tLimit the log information to a set of revisions using either\n@@ -37,29 +45,63 @@\n #\tto the initial commit is shown. If no revisions is specified,\n #\tthe log information starting from 'HEAD' will be shown.\n #\n-# -m::\n-#\tEnd the log listing at the merge base of the -r arguments\n-#\t(defaulting to master and origin).\n-#\n-# -s::\n+# -s, --summary::\n #\tShow a one line summary for each log entry. The summary contains\n #\tinformation about the commit date, the author, the first line\n #\tof the commit log and the commit ID. Long author names and commit\n #\tIDs are trimmed and marked with an ending tilde (~).\n #\n-# -uUSERNAME::\n-#\tList only commits where author or committer contains 'USERNAME'.\n-#\tThe search for 'USERNAME' is case-insensitive.\n+# -p, --patches::\n+#\tShow diffs for files modified by each commit.\n+#\n+# -v, --verbose::\n+#\tShow committer, tree and parents for each commit.\n+#\n+# -a, --all::\n+#\tShow merge commits as well. By default merge commits are not\n+#\tshown if you use any of the options that show differences between\n+#\tcommits, or that select some disjoint commits. (-u, -f, -d, etc.)\n+#\n+# -m::\n+#\tEnd the log listing at the merge base of the -r arguments\n+#\t(defaulting to master and origin).\n+#\n+# -u, --search=TEXT::\n+#\tList only commits where author, committer or commit message\n+#\tcontains 'TEXT'. The search for 'TEXT' is case-insensitive.\n+#\n+# -S, --match=TEXT::\n+#\tLook for commits that introduces TEXT in a file.\n+#\n+# -M::\n+#\tDetect renames.\n+#\n+# -C::\n+#\tDetect copies (as well as renames).\n+#\n+# -B::\n+#\tDetect rewrites.\n+#\n+# -y, --max-age=DATE::\n+#\tLimit output to commits younger than DATE.\n+#\n+# -o, --min-age=DATE::\n+#\tLimit output to commits older than DATE.\n+#\n+# --max-count=N::\n+#\tShow at most N commits.\n+#\n+# --stdin::\n+#\tShow commits for sha1s read from stdin.\n #\n # ENVIRONMENT VARIABLES\n # ---------------------\n # PAGER::\n #\tThe pager to display log information in, defaults to `less`.\n #\n-# PAGER_FLAGS::\n-#\tFlags to pass to the pager. By default `R` and `S` is added to the\n-#\t`LESS` environment variable to allow displaying of colorized output\n-#\tand to avoid long lines from wrapping when using `-s`.\n+# COGITO_AUTO_COLOR::\n+#\tIf set, colorized output is used automatically on color-capable\n+#\tterminals.\n #\n # EXAMPLE USAGE\n # -------------\n@@ -75,212 +117,314 @@ USAGE=\"cg-log [-c] [-f] [-m] [-s] [-uUSE\n # at least somewhere it does. Bash is broken.\n trap exit SIGPIPE\n \n-[ \"$COLUMNS\" ] || COLUMNS=\"$(tput cols)\"\n+# speed bash up on utf-8 locales\n+LANG=C\n \n-colheader=\n-colauthor=\n-colcommitter=\n-colfiles=\n-colsignoff=\n-colcommit=\n-coldate=\n-coltrim=\n-coldefault=\n-\n-list_files=\n-log_start=\n-log_end=\n-summary=\n-user=\n-mergebase=\n-files=()\n-\n-while [ \"$1\" ]; do\n-\tcase \"$1\" in\n-\t-c)\n-\t\t# See terminfo(5), \"Color Handling\"\n-\t\tcolheader=\"$(tput setaf 2)\"    # Green\n-\t\tcolauthor=\"$(tput setaf 6)\"    # Cyan\n-\t\tcolcommitter=\"$(tput setaf 5)\" # Magenta\n-\t\tcolfiles=\"$(tput setaf 4)\"     # Blue\n-\t\tcolsignoff=\"$(tput setaf 3)\"   # Yellow\n-\n-\t\tcolcommit=\"$(tput setaf 4)\"\n-\t\tcoldate=\"$(tput setaf 2)\"\n-\t\tcoltrim=\"$(tput setaf 5)\"\n-\n-\t\tcoldefault=\"$(tput op)\"        # Restore default\n-\t\t;;\n-\t-f)\n-\t\tlist_files=1\n-\t\t;;\n-\t-u*)\n-\t\tuser=\"${1#-u}\"\n-\t\t;;\n-\t-r)\n-\t\tshift\n-\t\tif echo \"$1\" | grep -q ':'; then\n-\t\t\tlog_end=$(echo \"$1\" | cut -d : -f 2)\n-\t\t\t[ \"$log_end\" ] || log_end=\"HEAD\"\n-\t\t\tlog_start=$(echo \"$1\" | cut -d : -f 1)\n-\t\telif [ -z \"$log_start\" ]; then\n-\t\t\tlog_start=\"$1\"\n-\t\telse\n-\t\t\tlog_end=\"$1\"\n-\t\tfi\n-\t\t;;\n-\t-m)\n-\t\tmergebase=1\n-\t\t;;\n-\t-s)\n-\t\tsummary=1\n-\t\t;;\n-\t*)\n-\t\tfiles=(\"$@\")\n-\t\tbreak\n-\t\t;;\n-\tesac\n-\tshift\n-done\n+unset id1 id2 user verbose filelist patches sedprog incoming pretty maxn\n+unset diffstat stdin opt_color renames dtmode quiet summary longsummary files\n+unset needparse\n+filemode=-s\n+dtargs=() rlargs=()\n+\n+revlist() {\n+\tif [ \"$stdin\" ]; then\n+\t\t# read sha1s from stdin. remove leading stuff from\n+\t\t# git-rev-tree output.\n+\t\tsed 's/^[0-9]* \\([a-f0-9]\\{40\\}\\)/\\1/'\n+\telif [ \"$user\" ]; then\n+\t\tgit-rev-list --header \"${rlargs[@]}\" |\n+\t\tLANG=C grep -iz \"$user\" | tr '\\n\\0' '\\t\\n' | cut -f1\n+\telse\n+\t\tgit-rev-list \"${rlargs[@]}\" \"$@\"\n+\tfi \n+}\n \n-list_commit_files()\n-{\n-\ttree1=\"$1\"\n-\ttree2=\"$2\"\n-\tline=\n-\tsep=\"    * $colfiles\"\n-\t# List all files for for the initial commit\n-\tif [ -z $tree2 ]; then\n-\t\tlist_cmd=\"git-ls-tree $tree1\"\n+dolog() {\n+\tif [ \"$dtmode\" = diff-tree ]; then\n+\t\trevlist | \n+\t\tgit-diff-tree --stdin -v -r $filemode \"${dtargs[@]}\" \\\n+\t\t\t-- \"${ARGS[@]}\"\n \telse\n-\t\tlist_cmd=\"git-diff-tree -r $tree1 $tree2\"\n+\t\trevlist --pretty${pretty+=}$pretty\n \tfi\n+}\n+\n+showstat() {\n+\tgit-diff-tree -r -p \"${dtargs[@]}\" $1 $2 -- \"${ARGS[@]}\" | \n+\t\tgit-apply --stat 2>/dev/null\n \techo\n-\t$list_cmd | cut -f 2- | while read file; do\n-\t\techo -n \"$sep\"\n-\t\tsep=\", \"\n-\t\tline=\"$line$sep$file\"\n-\t\tif [ ${#line} -le 74 ]; then\n-\t\t\techo -n \"$file\"\n+}\n+\n+showfiles() {\n+\tlocal p=6 sep=\"    * $colfiles\" IFS=$'\\n' file end=\":$coldefault\"\n+\t[ \"$summary\" ] && { end=\"$coldefault\"$'\\n'; }\n+\tfor i in $(git-diff-tree -m -r $1 $2); do\n+\t\t[[ \"$i\" == :* ]] || continue\n+\t\ti=${i##*$'\\t'}\n+\t\tif (( (p += 2 + ${#i}) < 75 )); then\n+\t\t\techo -n \"$sep$i\"\n \t\telse\n-\t\t\tline=\"      $file\"\n-\t\t\techo \"$coldefault\"\n-\t\t\techo -n \"      $colfiles$file\"\n+\t\t\t(( p = 6 + ${#i} ))\n+\t\t\techo \",$coldefault\"\n+\t\t\techo -n \"      $colfiles$i\"\n \t\tfi\n+\t\tsep=\", \"\n \tdone\n-\techo \"$coldefault:\"\n+\techo \"$end\"\n+}\n+\n+todate() {\n+\tlocal secs=$1 tzhours=${2:0:3} tzmins=${2:0:1}${2:3} \n+\tlocal format=\"+%a %b %-d %H:%M:%S %Y $2\"\n+\t# bash doesn't like leading zeros\n+\t[ \"${tzhours:1:1}\" = 0 ] && tzhours=${2:0:1}${2:2:1}\n+\tsecs=$((secs + tzhours * 3600 + tzmins * 60))\n+\tLANG=C date -ud \"1970-01-01 UTC + $secs sec\" \"$format\"\n }\n \n-if [ \"$mergebase\" ]; then\n-\t[ \"$log_start\" ] || log_start=\"master\"\n-\t[ \"$log_end\" ] || log_end=\"origin\"\n-\tlog_start=$(git-merge-base $(commit-id \"$log_start\") $(commit-id \"$log_end\"))\n+toepoch() {\n+\texpr \"$1\" : \"[0-9]*$\" >/dev/null && echo \"$1\" ||\n+\tdate -ud \"$1\" +%s || die \"invalid date $1\"\n+}\n+\n+showsummary() {\n+\tlocal commit=$1 author=$2 date=$3 text=$4 da\n+\tauthor=${author#Author: }\n+\tauthor=${author% <*}\n+\t[ ${#author} -gt 14 ] && author=${author:0:13}$coltrim~\n+\tif [ -z \"$longsummary\" ]; then\n+\t\tcommit=\n+\telif [ \"${COLUMNS:-0}\" -le 90 ]; then\n+\t\tcommit=\"$colcommit${commit:0:12}$coltrim~ \"\n+\telse\n+\t\tcommit=\"$colcommit$commit \"\n+\tfi\n+\t# find suitable short date format, assumes date in \"std linus format\"\n+\tda=(${date#Date:})\n+\tlocal dyear=${da[4]}\n+\tif [ \"$year\" -ne \"$dyear\" ]; then\n+\t\t# year month day\n+\t\tdate=\"${da[1]} ${da[2]} $dyear\"\n+\telif [ \"$month\" != \"${da[1]}\" -o \"$day\" -ne \"${da[2]}\" ]; then\n+\t\t# month day\n+\t\tdate=\"${da[1]} ${da[2]}\"\n+\telse\n+\t\t# time\n+\t\tdate=${da[3]%:*}\n+\tfi\n+\tline=${line#    }\n+\tprintf \"%s$colauthor%-14s $coldate%-6s $coldefault%s\\n\" \\\n+\t\t\"$commit\" \"$author\" \"$date\" \"$line\"\n+}\n+\n+while optparse; do\n+\tif optparse -c || optparse --color; then\n+\t\topt_color=1\n+\telif optparse -f; then\n+\t\t[ \"$patches\" ] && optconflict\n+\t\tfiles=1\n+\t\tfilemode=\n+\telif optparse -F; then\n+\t\tfilelist=1\n+\t\tdtmode=diff-tree\n+\telif optparse -p || optparse --patches; then\n+\t\t[ \"$files\" ] && optconflict\n+\t\tpatches=1\n+\t\tfilemode=-p\n+\telif optparse -d || optparse --diffstat; then\n+\t\tdiffstat=1\n+\t\tdtmode=diff-tree\n+\telif optparse -u= || optparse --search= 2; then\n+\t\tuser=$OPTARG\n+\t\tdtmode=diff-tree\n+\telif optparse -q || optparse --short; then\n+\t\t[ \"$verbose$summary\" ] && optconflict\n+\t\tquiet=1\n+\telif optparse -v || optparse --verbose; then\n+\t\t[ \"$quiet\" ] && optconflict\n+\t\tverbose=1\n+\telif optparse -s || optparse --summary 2; then\n+\t\t[ \"$quiet\" ] && optconflict\n+\t\tsummary=1\n+\telif optparse --stdin 2; then\n+\t\tstdin=1\n+\t\tdtmode=diff-tree\n+\telif optparse -y= || optparse --max-age= 5; then\n+\t\trlargs[${#rlargs[@]}]=--max-age=$(toepoch \"$OPTARG\") || exit 1\n+\telif optparse -o= || optparse --min-age= 2; then\n+\t\trlargs[${#rlargs[@]}]=--min-age=$(toepoch \"$OPTARG\") || exit 1\n+\telif optparse --max-count= 5; then\n+\t\tmaxn=$OPTARG\n+\telif optparse -a || optparse --all; then\n+\t\tdtargs[${#dtargs[@]}]=\"-m\"\n+\t\tdtargs[${#dtargs[@]}]=\"--root\"\n+\telif optparse -m || optparse --mergebase 2; then\n+\t\tincoming=1\n+\telif optparse -S= || optparse --match= 3; then\n+\t\tdtargs[${#dtargs[@]}]=\"-S$OPTARG\"\n+\telif optparse -M; then\n+\t\t[ \"$renames\" ] && optconflict\n+\t\t[ \"$patches\" ] || filemode=\n+\t\tdtargs[${#dtargs[@]}]=\"-M\"\n+\t\trenames=1\n+\telif optparse -C; then\n+\t\t[ \"$renames\" ] && optconflict\n+\t\t[ \"$patches\" ] || filemode=\n+\t\tdtargs[${#dtargs[@]}]=\"-C\"\n+\t\trenames=1\n+\telif optparse -B; then\n+\t\t[ \"$patches\" ] || filemode=\n+\t\tdtargs[${#dtargs[@]}]=\"-B\"\n+\telif optparse -r= || optparse --revision=; then\n+\t\tif [ -z \"${id1+set}\" ]; then\n+\t\t\tid1=$OPTARG\n+\t\t\tif [[ \"$id1\" == *:* ]]; then\n+\t\t\t\tid2=${id1#*:}\n+\t\t\t\tid1=${id1%:*}\n+\t\t\tfi\n+\t\telse\n+\t\t\t[ -z \"${id2+set}\" ] || die \"too many revisions\"\n+\t\t\tid2=$OPTARG\n+\t\tfi\n+\telse\n+\t\toptfail\n+\tfi\n+done\n+\n+[ -n \"$COGITO_AUTO_COLOR\" -a -t 1 ] && [ \"$(tput setaf 1 2>/dev/null)\" ] && \n+\topt_color=1\n+\n+LESS=\"-S $LESS\"\n+[ \"$COLUMNS\" ] || COLUMNS=\"$(tput cols)\"\n+\n+if [ \"$incoming\" ]; then\n+\tid1=\"$(commit-id \"${id1:-origin}\")\" || exit 1\n+\tid2=\"$(commit-id \"${id2:-HEAD}\")\" || exit 1\n+\tid2=\"$(git-merge-base \"$id1\" \"$id2\")\" || exit 1\n fi\n \n-if [ \"$log_end\" ]; then\n-\tid1=\"$(commit-id \"$log_start\")\" || exit 1\n-\tid2=\"$(commit-id \"$log_end\")\" || exit 1\n-\trevls=\"git-rev-tree $id2 ^$id1\"\n-\trevsort=\"sort -rn\"\n-\trevfmt=\"git-rev-tree\"\n+id1=$(commit-id \"$id1\") || exit 1\n+[ -z \"${id2+set}\" ] || id2=$(commit-id \"$id2\") || exit 1\n+rlargs=( \"${rlargs[@]}\" $id1 ${id2+^}$id2 )\n+\n+if [ -n \"${dtargs[*]}${ARGS[*]}\" -o \"$filemode\" != -s -o \"$dtmode\" ]; then\n+\tdtmode=diff-tree\n else\n-\tid1=\"$(commit-id \"$log_start\")\" || exit 1\n-\trevls=\"git-rev-list $id1\"\n-\trevsort=\"cat\"\n-\trevfmt=\"git-rev-list\"\n+\tdtmode=commit\n+\t[ \"$verbose\" -a -z \"$summary\" ] && pretty=raw\n+\t[ \"$quiet\" ] && { pretty=short; quiet=; } \n fi\n \n-print_commit_log() {\n-\tcommit=\"$1\"\n-\tauthor=\n-\tcommitter=\n-\ttree=\n-\tparents=()\n-\n-\tgit-cat-file commit $commit | \\\n-\t\twhile read key rest; do\n-\t\t\ttrap exit SIGPIPE\n-\t\t\tcase \"$key\" in\n-\t\t\t\"author\")\n-\t\t\t\tauthor=\"$rest\"\n-\t\t\t\t;;\n-\t\t\t\"committer\")\n-\t\t\t\tcommitter=\"$rest\"\n-\t\t\t\t;;\n-\t\t\t\"tree\")\n-\t\t\t\ttree=\"$rest\"\n-\t\t\t\t;;\n-\t\t\t\"parent\")\n-\t\t\t\tparents[${#parents[@]}]=\"$rest\"\n-\t\t\t\t;;\n-\t\t\t\"\")\n-\t\t\t\tif [ \"$files\" ]; then\n-\t\t\t\t\tparent=\"${parents[0]}\"\n-\t\t\t\t\tdiff_ops=\n-\t\t\t\t\t[ \"$parent\" ] || diff_ops=--root\n-\t\t\t\t\t[ \"$(git-diff-tree -r $diff_ops $commit $parent \"${files[@]}\")\" ] || return 1\n-\t\t\t\tfi\n-\t\t\t\tif [ \"$user\" ]; then\n-\t\t\t\t\techo -e \"author $author\\ncommitter $committer\" \\\n-\t\t\t\t\t\t| grep -qi \"$user\" || return\n-\t\t\t\tfi\n-\t\t\t\tif [ \"$summary\" ]; then\n-\t\t\t\t\t# Print summary\n-\t\t\t\t\tcommit=\"${commit%:*}\"\n-\t\t\t\t\tauthor=\"${author% <*}\"\n-\t\t\t\t\tdate=(${committer#*> })\n-\t\t\t\t\tdate=\"$(showdate $date '+%F %H:%M')\"\n-\t\t\t\t\tread title\n-\t\t\t\t\tif [ \"${#author}\" -gt 15 ]; then\n-\t\t\t\t\t\tauthor=\"${author:0:14}$coltrim~\"\n-\t\t\t\t\tfi\n-\t\t\t\t\tif [ \"${COLUMNS:-0}\" -le 90 ]; then\n-\t\t\t\t\t\tcommit=\"${commit:0:12}$coltrim~\"\n-\t\t\t\t\tfi\n-\n-\t\t\t\t\tprintf \"$colcommit%s $colauthor%-15s $coldate%s $coldefault%s\\n\" \\\n-\t\t\t\t\t\t\"${commit%:*}\" \"$author\" \"$date\" \"$title\"\n-\t\t\t\t\treturn\n-\t\t\t\tfi\n-\n-\t\t\t\techo ${colheader}commit ${commit%:*} $coldefault\n-\t\t\t\techo ${colheader}tree $tree $coldefault\n-\n-\t\t\t\tfor parent in \"${parents[@]}\"; do\n-\t\t\t\t\techo ${colheader}parent $parent $coldefault\n-\t\t\t\tdone\n-\n-\t\t\t\tdate=(${author#*> })\n-\t\t\t\tpdate=\"$(showdate $date)\"\n-\t\t\t\t[ \"$pdate\" ] && author=\"${author%> *}> $pdate\"\n-\t\t\t\techo ${colauthor}author $author $coldefault\n-\n-\t\t\t\tdate=(${committer#*> })\n-\t\t\t\tpdate=\"$(showdate $date)\"\n-\t\t\t\t[ \"$pdate\" ] && committer=\"${committer%> *}> $pdate\"\n-\t\t\t\techo ${colcommitter}committer $committer $coldefault\n-\n-\t\t\t\tif [ -n \"$list_files\" ]; then\n-\t\t\t\t\tlist_commit_files \"$tree\" \"${parents[0]}\"\n-\t\t\t\tfi\n-\t\t\t\techo; sed -re '\n-\t\t\t\t\t/ *Signed-off-by:.*/Is//'$colsignoff'&'$coldefault'/\n-\t\t\t\t\t/ *Acked-by:.*/Is//'$colsignoff'&'$coldefault'/\n-\t\t\t\t\ts/./    &/\n-\t\t\t\t'\n-\t\t\t\t;;\n-\t\t\tesac\n-\t\tdone\n-}\n+if [ \"$summary\" ]; then\n+\tyear=$(date +%Y)\n+\tmonth=$(LANG=C date +%b)\n+\tday=$(date +%d)\n+\t[ \"$verbose\" ] && { longsummary=1; verbose=; }\n+fi\n+\n+if [ \"$filelist$diffstat$summary\" -o \"$pretty\" = raw -o $dtmode = diff-tree ]\n+then\n+\tneedparse=1\n+else\n+\t[ \"$maxn\" ] && rlargs=(--max-count=\"$maxn\" \"${rlargs[@]}\")\n+fi\n \n-$revls | $revsort | while read time commit parents; do\n-\ttrap exit SIGPIPE\n-\t[ \"$revfmt\" = \"git-rev-list\" ] && commit=\"$time\"\n-\tlog=\"$(print_commit_log $commit)\"\n-\tif [ \"$log\" ]; then\n-\t\techo \"$log\"\n-\t\t[ \"$summary\" ] || echo\n+if [ \"$opt_color\" ]; then\n+\tsetup_colors\n+\n+\tif [ ! \"$summary\" ]; then\n+\t\tLESS=$'+/\\013^Commit:.[a-f0-9]*|^diff.--git..*$'\" $LESS\"\n+\t\tsedprog=\"\n+s,^\\\\(Commit: [^ ]*\\\\)\\\\(.*\\\\),$colheader\\\\1$coldefault\\\\2,\n+s,^Author:.*,$colauthor&$coldefault,\n+s,^Date:.*,$colauthor&$coldefault,\n+s,^Tree:.*,$colheader&$coldefault,\n+s,^Parent:.*,$colheader&$coldefault,\n+s,^Committer:.*,$colcommitter&$coldefault,\n+s,^Commitdate:.*,$colcommitter&$coldefault,\n+s,^    Signed-[Oo]ff[- ][Bb]y:.*,$colsignoff&$coldefault,\n+s,^    Acked[- ][Bb]y:.*,$colsignoff&$coldefault,\"\n \tfi\n-\t# LESS=\"S\" will prevent less to wrap too long titles to multiple lines;\n-\t# you can scroll horizontally.\n-done | LESS=\"S$LESS\" pager\n+\n+\t[ \"$patches\" ] && sedprog=\"$sedprog;$color_rules\"\n+\n+\t[ \"$diffstat\" ] && sedprog=\"$sedprog\n+s,^\\\\( [^ ].*\\\\)\\\\( |  *[0-9][0-9]* \\\\),$colfiles\\\\1$coldefault\\\\2,\"\n+fi\n+\n+if [ $dtmode = diff-tree -a -z \"$filemode\" ]; then\n+\tfilediffstart=$'s,^:[0-9]* [^ ]* [^ ]* [^ ]* \\('\n+\tfilediffend=$'[^\\t]*\\)\\t\\(.*\\)'\n+\tsedprog=\"$sedprog\n+${filediffstart}[NCR]$filediffend,$coldiffadd\\\\1 \\\\2$coldefault,\n+${filediffstart}D$filediffend,$coldiffrem\\\\1 \\\\2$coldefault,\n+${filediffstart}.$filediffend,$colfiles\\\\1 \\\\2$coldefault,\"\n+fi\n+\n+if [ \"$needparse\" ]; then\n+\t# Slow version, parsing output from diff-tree or rev-list\n+\tunset commit showds from lineno line\n+\tn=0\n+\tdolog | ( trap exit SIGPIPE\n+\twhile [ \"$line\" ] || IFS='' read -r line; do \n+\tcase $line in \n+\t\t$dtmode\\ *)\n+\t\t[ \"$maxn\" ] && (( ++n > maxn )) && exit\n+\t\t[ \"$showds\" ] && showstat $commit $from\n+\t\tline=${line#$dtmode } f=\"%s\\n\" showds=$diffstat lineno=0\n+\t\tcommit=${line% (*} from=${line#*(from }; from=${from%)}\n+\t\t[ \"$summary\" ] && f= || echo \"Commit: $line\" ;;\n+\n+\t\tAuthor:*) printf \"$f\" \"$line\"; author=$line ;;\n+\n+\t\tDate:*) printf \"$f\" \"$line\"; date=$line ;;\n+\n+\t\tauthor\\ *)\n+\t\tline=${line#author }; author=${line% [0-9]*}; date=${line##*> }\n+\t\tif [ \"$f\" ]; then\n+\t\t\tprintf \"$f\" \"Author: $author\"\n+\t\t\t[ \"$quiet\" ] || printf \"$f\" \"Date:   $(todate $date)\" \n+\t\telif [ \"$summary\" ]; then\n+\t\t\tdate=$(todate $date)\n+\t\tfi ;;\n+\n+\t\tcommitter\\ *)\n+\t\tif [ \"$verbose\" ]; then\n+\t\t\tline=${line#committer }\n+\t\t\techo \"Committer:  ${line% [0-9]*}\"\n+\t\t\techo \"Commitdate: $(todate ${line##*> })\"\n+\t\tfi ;;\n+\n+\t\ttree\\ *) [ \"$verbose\" ] && echo \"Tree: ${line#tree }\" ;;\n+\n+\t\tparent\\ *) [ \"$verbose\" ] && echo \"Parent: ${line#parent }\" ;;\n+\n+\t\t\\ \\ \\ \\ * | '')\n+\t\tif (( ++lineno == 2 )); then\n+\t\t\t[ \"$summary\" ] && \n+\t\t\tshowsummary $commit \"$author\" \"$date\" \"$line\"\n+\t\t\t[ \"$filelist\" ] && showfiles $commit $from\n+\t\t\tprintf \"$f\" \"$line\"\n+\t\t\t[ \"$quiet\" ] && { f=; echo; }\n+\t\telse\n+\t\t\tprintf \"$f\" \"$line\"\n+\t\tfi ;;\n+\n+\t\t*)\n+\t\t[ \"$showds\" ] && { showstat $commit $from; showds=; }\n+\t\tprintf \"%s\\n\" \"$line\"\n+\t\twhile IFS='' read -r line; do\n+\t\t\tcase $line in $dtmode\\ *) break ;; esac\n+\t\t\tprintf \"%s\\n\" \"$line\"\n+\t\tdone\n+\t\tcontinue ;;\n+\tesac\n+\tline=\n+\tdone\n+\t[ \"$showds\" ] && showstat $commit $from\n+\t) | LANG=C sed -e \"$sedprog\" | maybe_less\n+else\n+\t# Fast version, using sed only.\n+\tsedprog=\"s,^$dtmode ,Commit: ,;$sedprog\"\n+\tdolog | LANG=C sed -e \"$sedprog\" | maybe_less\n+fi \n"},{"id":"4721","messageId":"20050608204012.GN982@pasky.ji.cz","threadId":"861","inReplyTo":"42A754D5.10705@gmail.com","subject":"Re: [PATCH] Many new features for cg-diff and cg-log","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-06-08T20:40:13Z","receivedAt":"2005-06-08T20:40:13Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, Jun 08, 2005 at 10:28:05PM CEST, I got a letter\nwhere Dan Holmsand <holmsand@gmail.com> told me that...\n> Petr Baudis wrote:\n> >FYI, I plan to release 0.11.2 this evening. I'll try to go through some\n> >more queued patches before and update cg-log to fully use git-rev-list.\n> \n> In that case, you might want to have a look at this patch. I've been \n> tinkering with cg-log and cg-diff for some time, and just about got \n> ready to send you a patch.\n> \n> Sorry about the monster patch, but I wanted to get it to you quickly...\n\nWell, it can always go to 0.11.3 or something.  I probably wouldn't take\nit to the tree just before release anyway even if you sent it split up,\nsince due to the size of the changes, it's bound to have some hidden\nbugs. ;-)\n\n> [PATCH] Many new features for cg-diff and cg-log\n\nOk, this is really too big. Could you please split it up some? Also,\nI've been hacking on cg-log too (and will make it use git-diff-tree -v\nyet this evening), so you'll need to update it to apply to the latest\nversion.\n\nI like what's inside (at least from the description), though! (Well,\nmostly. But I'll comment on specific patches. No major objections.)\n\n> - Selection of ranges by date or maximum number of commits to show.\n\nAd date, isn't that already supported now? The -r arguments can be a\ndate. Ad maximum number of commits, what'd be its use?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"4725","messageId":"20050608210301.GP982@pasky.ji.cz","threadId":"861","inReplyTo":"20050608204012.GN982@pasky.ji.cz","subject":"Re: [PATCH] Many new features for cg-diff and cg-log","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-06-08T21:03:01Z","receivedAt":"2005-06-08T21:03:01Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, Jun 08, 2005 at 10:40:13PM CEST, I got a letter\nwhere Petr Baudis <pasky@ucw.cz> told me that...\n> will make [cg-log] use git-diff-tree -v yet this evening\n\nOk, it turns out I won't. Feel free to hack on that. :-)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n<Espy> be careful, some twit might quote you out of context..\n"},{"id":"4726","messageId":"42A75D1C.1060102@gmail.com","threadId":"861","inReplyTo":"20050608204012.GN982@pasky.ji.cz","subject":"Re: [PATCH] Many new features for cg-diff and cg-log","fromName":"Dan Holmsand","fromEmail":"holmsand@gmail.com","sentAt":"2005-06-08T21:03:24Z","receivedAt":"2005-06-08T21:03:24Z","isPatch":true,"sender":{"key":"holmsand@gmail.com","avatar":"https://gravatar.com/avatar/5c722084bafd85e754a02efad01fe69107eb6f393253c49232c5c9f7faa974df?d=mp&s=160"},"body":"Petr Baudis wrote:\n> Dear diary, on Wed, Jun 08, 2005 at 10:28:05PM CEST, I got a letter\n> where Dan Holmsand <holmsand@gmail.com> told me that...\n>>Sorry about the monster patch, but I wanted to get it to you quickly...\n> \n> \n> Well, it can always go to 0.11.3 or something.  I probably wouldn't take\n> it to the tree just before release anyway even if you sent it split up,\n> since due to the size of the changes, it's bound to have some hidden\n> bugs. ;-)\n\nNah... Seriously, that's a wise decision. I just saw that you we're \nworking on cg-log, and wanted to save you some potential doublework by \nsending what I've got in a hurry.\n\nI have, however, been using this myself for quite some time, so it's \nreasonably well tested.\n\n>>[PATCH] Many new features for cg-diff and cg-log\n> \n> \n> Ok, this is really too big. Could you please split it up some? Also,\n> I've been hacking on cg-log too (and will make it use git-diff-tree -v\n> yet this evening), so you'll need to update it to apply to the latest\n> version.\n\nSure. I'll try to split it up, somewhat (but the changes *are* pretty \ninter-related...).\n> \n> I like what's inside (at least from the description), though! (Well,\n> mostly. But I'll comment on specific patches. No major objections.)\n> \n> \n>>- Selection of ranges by date or maximum number of commits to show.\n> \n> \n> Ad date, isn't that already supported now? The -r arguments can be a\n> date. Ad maximum number of commits, what'd be its use?\n> \n\nThe new date thing doesn't work very well for cg-log: it's hardcoded to \nHEAD. That means that attempts to do, say, \"cg-log -rorigin:-1day\" will \nnot at all do what you want. Not to mention \"cg-log -m -r-1day\". And I \nthink it's a little clearer to separate the two: \"cg-log -rorigin \n--max-age=-1day\" (there's a short option too).\n\nMax number of commits is perhaps not all that useful, unless you want to \nsave cg-log output to file, for example. But it's easy to do :-)\n\nOh, and I forgot to mention the \"pickaxe\" support. \"cg-log -S foobar\" \nuses git-diff-tree -S to \"search in diffs\". Really very, very useful.\n\n/dan\n\n"}]}