tj.git-extras/bin/git-missing
Guillaume Seren db0f610bc1
Fix #267, git-missing did not catch branch name.
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.
2014-10-14 16:24:18 +02:00

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