contrib: show diff of git subtrees in "git-subtree-reimport.sh" script

This commit is contained in:
Thomas Haller
2022-07-20 11:03:11 +02:00
parent 37db132320
commit 0f1cc3e954

View File

@@ -1,6 +1,6 @@
#!/bin/bash
set -ex
set -e
cd "$(dirname "$(readlink -f "$0")")/../.."
@@ -17,17 +17,38 @@ reimport() {
branch=master
fi
git subtree pull --prefix "src/$d" "git@github.com:$project/$d.git" "$branch" --squash -m \
CMD=( git subtree pull --prefix "src/$d" "git@github.com:$project/$d.git" "$branch" --squash -m \
"$d: re-import git-subtree for 'src/$d'
git subtree pull --prefix src/$d git@github.com:$project/$d.git $branch --squash
"
" )
printf '\n>>>> %s >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n' "$d"
printf '>>>'
for c in "${CMD[@]}"; do
printf ' %q' "$c"
done
printf '\n'
"${CMD[@]}" 2>&1
local REMOTE_COMMIT="$(git rev-parse FETCH_HEAD)"
echo ">>>>> RESULT:"
printf ">>> git diff %s: HEAD:src/%s\n" "$REMOTE_COMMIT" "$d"
GIT_PAGER=cat git diff --color=always "$REMOTE_COMMIT:" "HEAD:src/$d"
}
reimport_all() {
for d in c-list c-rbtree c-siphash c-stdaux n-acd n-dhcp4 ; do
local ARGS
ARGS=( "$@" )
if [ "${#ARGS[@]}" = 0 ]; then
ARGS=( c-list c-rbtree c-siphash c-stdaux n-acd n-dhcp4 )
fi
for d in "${ARGS[@]}" ; do
reimport "$d"
done
}
reimport_all
reimport_all "$@"