Pretty cool idea, and definitely simpler than writing code to spit out HTML/Atom feeds for your co-workers. Couple of comments...
The first one-liner can be replaced with:
echo last_message | sed 's,^[^ ]* ,,'
or if you /bin/sh is always bash:
sed 's,^[^ ]* ,,' <<< $last_message
And the second one-liner is just basename, so os.path.basename if you really want to use Python or simply the basename command if you don't. Again, if your /bin/sh is bash/ksh you can use ${last_message##*/}
And a question; What version of git has an info command by the way? Don't have it on my systems.
Comment
Pretty cool idea, and definitely simpler than writing code to spit out HTML/Atom feeds for your co-workers. Couple of comments...
The first one-liner can be replaced with:
echo last_message | sed 's,^[^ ]* ,,'
or if you /bin/sh is always bash:
sed 's,^[^ ]* ,,' <<< $last_message
And the second one-liner is just basename, so os.path.basename if you
really want to use Python or simply the basename command if you don't. Again, if your /bin/sh is bash/ksh you can use ${last_message##*/}
And a question; What version of git has an info command by the way? Don't have it on my systems.
Replies
Great! Thank you for that sed command.
About the second one-liner, it's the git info returns this:
"== Remote URL: origin ssh://root@git.fry-it.com/var/cache/git/waf"
So basename wouldn't work on that.
I'm using 1.5.6.3 from Ubuntu to get git info.
Python's os.path.basename, basename from coreutils and busybox's basename all do the "right thing" with your example string.
On my systems, running 1.6.2.3, I'd use `git config --get remote.origin.url' to get for example "git@github.com:JNRowe/misc-overlay.git"
I think I know what you mean but the whole string starts with "== Remote URL: " which means that basename fails on it.
$ repo_name=`git info | head -n1`
$ basename $repo_name
basename: extra operand `URL:'
Try `basename --help' for more information.
My fault, I should have used an example.
basename "$repo_name"
it is the quoting that is important, it makes basename treat the string as an ugly space and symbol including filename