Add more debug print

This commit is contained in:
Yanqin Jin 2020-04-29 10:25:56 -07:00
parent f646eb00e8
commit af12dc0839

View File

@ -102,14 +102,18 @@ if [ -z "$uncommitted_code" ]
then
# Attempt to get name of facebook/rocksdb.git remote.
[ "$FORMAT_REMOTE" ] || FORMAT_REMOTE="$(git remote -v | grep 'facebook/rocksdb.git' | head -n 1 | cut -f 1)"
echo FORMAT_REMOTE is $FORMAT_REMOTE
# Fall back on 'origin' if that fails
[ "$FORMAT_REMOTE" ] || FORMAT_REMOTE=origin
echo FORMAT_REMOTE is $FORMAT_REMOTE
# Use master branch from that remote
[ "$FORMAT_UPSTREAM" ] || FORMAT_UPSTREAM="$FORMAT_REMOTE/master"
echo FORMAT_UPSTREAM is $FORMAT_UPSTREAM
# Get the common ancestor with that remote branch. Everything after that
# common ancestor would be considered the contents of a pull request, so
# should be relevant for formatting fixes.
FORMAT_UPSTREAM_MERGE_BASE="$(git merge-base "$FORMAT_UPSTREAM" HEAD)"
echo FORMAT_UPSTREAM_MERGE_BASE is $FORMAT_UPSTREAM_MERGE_BASE
# Get the differences
diffs=$(git diff -U0 "$FORMAT_UPSTREAM_MERGE_BASE" | $CLANG_FORMAT_DIFF -p 1)
else
@ -117,6 +121,8 @@ else
diffs=$(git diff -U0 HEAD | $CLANG_FORMAT_DIFF -p 1)
fi
diffs_line_one=$($diffs | head -n 1)
echo $diffs_line_one
if [ -z "$diffs" ]
then
echo "Nothing needs to be reformatted!"