cogito-0.10 broken for cg-commit < logmessagefile
The command in the subject prepends the log message with a blank line. This ain't good because it messes up commit messages as per Linus' requirements (the first line must be a summary.)
Is this known about / has this been fixed in 0.11 ?
(It's presently a blocking bug...)
Signature · 1 line
Russell King
Quoted 3 lines · Russell King
The command in the subject prepends the log message with a blank line. This ain't good because it messes up commit messages as per Linus' requirements (the first line must be a summary.)
The patch below should fix the problem. There is no point in writing the status information in a file which is read from stdin.
Signature · 1 line
Catalin
Fix the log file when read from stdin
Log messages read from stdin shouldn't have additional lines.
cg-commit +1 -1
@@ -215,7 +215,7 @@ if tty -s; then fi fi else - cat >>$LOGMSG2 + cat >$LOGMSG2 fi # Remove heading and trailing blank lines. grep -v ^CG: $LOGMSG2 | git-stripspace >$LOGMSG
Dear diary, on Wed, Jun 08, 2005 at 06:28:22PM CEST, I got a letter where Catalin Marinas <[email protected]> told me that...
Quoted 7 lines
Quoted 3 lines · Russell King
The command in the subject prepends the log message with a blank line. This ain't good because it messes up commit messages as per Linus' requirements (the first line must be a summary.)
The patch below should fix the problem. There is no point in writing the status information in a file which is read from stdin.
Oh, yes. Thanks, applied.
FYI, I plan to release 0.11.2 this evening. I'll try to go through some more queued patches before and update cg-log to fully use git-rev-list.
Signature · 3 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
PATCH 1/1 Many new features for cg-diff and cg-log
Quoted 2 lines · Petr Baudis
FYI, I plan to release 0.11.2 this evening. I'll try to go through some more queued patches before and update cg-log to fully use git-rev-list.
In that case, you might want to have a look at this patch. I've been tinkering with cg-log and cg-diff for some time, and just about got ready to send you a patch.
Sorry about the monster patch, but I wanted to get it to you quickly...
...
[PATCH] Many new features for cg-diff and cg-log
Both cg-diff and cg-log get:
- A common infrastructure for option parsing, that allows for combinations of options like all getopt-using programs. So you can say:
cg-log -cfm
cg-diff foo --color
cg-log -sfrlinus foobar
At the same time, you get decent error reporting on illegal options.
- A common infrastructure for colorization. cg-log and cg-diff share setup, and sed scripts for colorization.
- diffstat (or rather, git-apply --stat) support.
- Support for the new -M, -C and -B switches to the git-diff-* brothers.
- Automatic search in less, so you can jump to the next commit/diff chunk by "n".
- Automatic color if the COGITO_AUTO_COLOR environment variable is set.
- "Smart pager" support - less isn't invoked unless there's actually some output. This is useful is COGITO_AUTO_COLOR is set.
cg-log also gets:
- Vast speedup. It uses git-rev-list and git-diff-tree to do most of the heavy lifting.
- A new default "-f" format, that allows deletions, renames etc. to be shown (the old format is still available as -F). Deletions and new files are color-coded.
- Diff output. cg-log -p shows diff output between commits. Colorized as in cg-diff.
- New, more compact summary, that's readable on 80-column terminals. By
default, sha1's are hidden, and the date is more compact (and readable). It can also be combined with the other options: for example "cg-log -sf" gives a nice overview of commits and the files they touch.
- Slightly new behaviour, thanks to use of git-diff-tree: when you use any of the options that shows differences between revisions, or that gives a subset of revisions, merge commits are hidden by default. They are visible if the "-a/--all" option is given.
- The default log format is also shorter. The full version is available with "-v". An even shorter format is available with "-q".
- Selection of ranges by date or maximum number of commits to show.
cg-Xlib | 83 +++++++++ cg-diff | 220 +++++++++++-------------- cg-log | 556 ++++++++++++++++++++++++++++++++++++++++----------------------- 3 files changed, 534 insertions(+), 325 deletions(-)
cg-Xlib +83 -0
@@ -119,11 +119,94 @@ print_help () { } for option in "$@"; do + [ "$option" = -- ] && break if [ "$option" = "-h" -o "$option" = "--help" ]; then print_help ${_cg_cmd##cg-} fi done +# option parsing + +ARGS=("$@") +ARGPOS=0 + +optshift() { + unset ARGS[$ARGPOS] + ARGS=("${ARGS[@]}") + [ -z "$1" -o -n "${ARGS[$ARGPOS]}" ] || + die "option \`$1' requires an argument" +} + +optfail() { + die "unrecognized option \`${ARGS[$ARGPOS]}'" +} + +optconflict() { + die "conflicting option \`$CUROPT'" +} + +optparse() { + unset OPTARG + [ -z "$1" ] && case ${ARGS[$ARGPOS]} in + --) optshift; return 1 ;; + -*) return 0 ;; + *) while (( ${#ARGS[@]} > ++ARGPOS )); do + [[ "${ARGS[$ARGPOS]}" == -- ]] && return 1 + [[ "${ARGS[$ARGPOS]}" == -* ]] && return 0 + done; return 1 ;; + esac + + CUROPT=${ARGS[$ARGPOS]} + local match=${1%=} minmatch=${2:-1} opt=$CUROPT o=$CUROPT val + [[ $1 == *= ]] && val=$match + case $match in + --*) [ "$val" ] && o=${o%%=*} + [ ${#o} -ge $((2 + $minmatch)) -a \ + "${match:0:${#o}}" = "$o" ] || return 1 + [[ -n "$val" && "$opt" == *=?* ]] && ARGS[$ARGPOS]=${opt#*=} || + optshift $val ;; + -?) [[ $o == $match* ]] || return 1 + [[ $o != -?-* || -n "$val" ]] || optfail + ARGS[$ARGPOS]=${o#$match} + [ "${ARGS[$ARGPOS]}" ] && + { [ "$val" ] || ARGS[$ARGPOS]=-${ARGS[$ARGPOS]}; } || + optshift $val ;; + *) die "optparse cannot handle $1" ;; + esac + [ -z "$val" ] || { OPTARG=${ARGS[$ARGPOS]}; optshift; } +} + +maybe_less() { + # Invoke $PAGER if there is any output + local line + if read -r line; then + ( echo "$line"; cat ) | LESS="-R $LESS" ${PAGER:-less} + fi +} + +setup_colors() +{ + local C="header=32:author=36:signoff=33:committer=35:files=34" + C="$C:commit=34:date=32:trim=35" + C="$C:diffhdr=34:diffhdradd=32:diffadd=32:diffhdrmod=35" + C="$C:diffmod=35:diffhdrrem=31:diffrem=31:diffhunk=36" + C="$C:diffctx=34:diffcctx=33:default=0" + [ -n "$COGITO_COLORS" ] && C="$C:$COGITO_COLORS" + + C=${C//=/=\'$'\e'[} + C=col${C//:/m\'; col}m\' + #coldefault=$(tput op) + eval $C + + color_rules=" +s,^+++.*,$coldiffhdradd&$coldefault, +s,^---.*,$coldiffhdrrem&$coldefault, +s,^[+].*,$coldiffadd&$coldefault, +s,^[-].*,$coldiffrem&$coldefault, +s,^\\(@@.*@@\\)\\(.*\\),$coldiffhunk\\1$coldiffctx\\2$coldefault, +s,^=*$',$coldiffhdr&$coldefault, +s,^\\(Index:\\|===\\|diff\\) .*,$coldiffhdr&$coldefault," +} # Check if we have something to work on, unless the script can do w/o it. if [ ! "$_git_repo_unneeded" ]; then
cg-diff +101 -119
266 lines not on this page · raw message
cg-log +350 -206
612 lines not on this page · raw message
Re: [PATCH] Many new features for cg-diff and cg-log
Dear diary, on Wed, Jun 08, 2005 at 10:28:05PM CEST, I got a letter where Dan Holmsand <[email protected]> told me that...
Quoted 9 lines
Quoted 2 lines · Petr Baudis
FYI, I plan to release 0.11.2 this evening. I'll try to go through some more queued patches before and update cg-log to fully use git-rev-list.
In that case, you might want to have a look at this patch. I've been tinkering with cg-log and cg-diff for some time, and just about got ready to send you a patch.
Sorry about the monster patch, but I wanted to get it to you quickly...
Well, it can always go to 0.11.3 or something. I probably wouldn't take it to the tree just before release anyway even if you sent it split up, since due to the size of the changes, it's bound to have some hidden bugs. ;-)
Quoted 1 line
[PATCH] Many new features for cg-diff and cg-log
Ok, this is really too big. Could you please split it up some? Also, I've been hacking on cg-log too (and will make it use git-diff-tree -v yet this evening), so you'll need to update it to apply to the latest version.
I like what's inside (at least from the description), though! (Well, mostly. But I'll comment on specific patches. No major objections.)
Quoted 1 line
- Selection of ranges by date or maximum number of commits to show.
Ad date, isn't that already supported now? The -r arguments can be a date. Ad maximum number of commits, what'd be its use?
Signature · 3 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Re: [PATCH] Many new features for cg-diff and cg-log
Dear diary, on Wed, Jun 08, 2005 at 10:40:13PM CEST, I got a letter where Petr Baudis <[email protected]> told me that...
Quoted 1 line
will make [cg-log] use git-diff-tree -v yet this evening
Ok, it turns out I won't. Feel free to hack on that. :-)
Signature · 3 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ <Espy> be careful, some twit might quote you out of context..
Re: [PATCH] Many new features for cg-diff and cg-log
In reply to Petr BaudisQuoted 9 lines · Petr Baudis
Dear diary, on Wed, Jun 08, 2005 at 10:28:05PM CEST, I got a letter where Dan Holmsand <[email protected]> told me that...
Quoted 1 line
Sorry about the monster patch, but I wanted to get it to you quickly...
Well, it can always go to 0.11.3 or something. I probably wouldn't take it to the tree just before release anyway even if you sent it split up, since due to the size of the changes, it's bound to have some hidden bugs. ;-)
Nah... Seriously, that's a wise decision. I just saw that you we're working on cg-log, and wanted to save you some potential doublework by sending what I've got in a hurry.
I have, however, been using this myself for quite some time, so it's reasonably well tested.
Quoted 7 lines
Quoted 1 line
[PATCH] Many new features for cg-diff and cg-log
Ok, this is really too big. Could you please split it up some? Also, I've been hacking on cg-log too (and will make it use git-diff-tree -v yet this evening), so you'll need to update it to apply to the latest version.
Sure. I'll try to split it up, somewhat (but the changes *are* pretty inter-related...).
Quoted 11 lines
I like what's inside (at least from the description), though! (Well, mostly. But I'll comment on specific patches. No major objections.)
Quoted 1 line
- Selection of ranges by date or maximum number of commits to show.
Ad date, isn't that already supported now? The -r arguments can be a date. Ad maximum number of commits, what'd be its use?
The new date thing doesn't work very well for cg-log: it's hardcoded to HEAD. That means that attempts to do, say, "cg-log -rorigin:-1day" will not at all do what you want. Not to mention "cg-log -m -r-1day". And I think it's a little clearer to separate the two: "cg-log -rorigin --max-age=-1day" (there's a short option too).
Max number of commits is perhaps not all that useful, unless you want to save cg-log output to file, for example. But it's easy to do :-)
Oh, and I forgot to mention the "pickaxe" support. "cg-log -S foobar" uses git-diff-tree -S to "search in diffs". Really very, very useful.
/dan