mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 15:36:21 -04:00
It was a bug on my setup, the test did no detect the
branch name, so I change:
if [[ $arg != -* ]]; then
by
if [ -n "${arg}" ]; then
According to test man page, -n:
«True if the length of string is non-zero.»
I also added quote and {} around the param,
to prevent bash expension around strange char.
22 lines
579 B
Bash
Executable file
22 lines
579 B
Bash
Executable file
#!/bin/sh
|
|
|
|
# grab first two non-option arguments
|
|
for arg in $*; do
|
|
if [ -n "${arg}" ]; then
|
|
test -z "$firstbranch" && firstbranch="${arg}" && continue
|
|
test -z "$secondbranch" && secondbranch="${arg}" && continue
|
|
else
|
|
# add anything else to a passthrough
|
|
passthrough="$passthrough $arg"
|
|
fi
|
|
done
|
|
|
|
test -z "$firstbranch" && echo "at least one branch required" && exit 1
|
|
|
|
if test -z "$secondbranch"; then
|
|
secondbranch=$firstbranch
|
|
firstbranch=
|
|
fi
|
|
|
|
git log $passthrough $firstbranch...$secondbranch --format="%m %h %s" --left-right
|