common: simplify logic to find git
From chroot-git 2.33.1, we always have an executable named git for other build infrastructure and lints. Let's remove the shenanegan to find which git to be used, prepend the path to chroot-git's git into $PATH, and let's the shell call the correct git for us instead.
This commit is contained in:
parent
77db514078
commit
7510b96218
5 changed files with 20 additions and 34 deletions
|
@ -5,18 +5,18 @@ die() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
GIT_CMD=$(command -v chroot-git 2>/dev/null) ||
|
||||
GIT_CMD=$(command -v git 2>/dev/null) ||
|
||||
PATH="/usr/libexec/chroot-git:$PATH"
|
||||
command -v git >/dev/null 2>&1 ||
|
||||
die "neither chroot-git nor git could be found!"
|
||||
|
||||
rev_parse() {
|
||||
if [ -n "$1" ]; then
|
||||
"$GIT_CMD" rev-parse --verify "$1"
|
||||
git rev-parse --verify "$1"
|
||||
else
|
||||
shift
|
||||
while test "$#" != 0
|
||||
do
|
||||
"$GIT_CMD" rev-parse --verify "$1" 2>/dev/null && return
|
||||
git rev-parse --verify "$1" 2>/dev/null && return
|
||||
shift
|
||||
done
|
||||
return 1
|
||||
|
@ -27,9 +27,9 @@ base=$(rev_parse "$1" FETCH_HEAD ORIG_HEAD) || die "base commit not found"
|
|||
tip=$(rev_parse "$2" HEAD) || die "tip commit not found"
|
||||
status=0
|
||||
|
||||
for cmt in $("$GIT_CMD" rev-list --abbrev-commit $base..$tip)
|
||||
for cmt in $(git rev-list --abbrev-commit $base..$tip)
|
||||
do
|
||||
"$GIT_CMD" cat-file commit "$cmt" |
|
||||
git cat-file commit "$cmt" |
|
||||
awk -vC="$cmt" '
|
||||
# skip header
|
||||
/^$/ && !msg { msg = 1; next }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue