From af12dc0839a74e06e1a632956e970f1d13dad616 Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Wed, 29 Apr 2020 10:25:56 -0700 Subject: [PATCH] Add more debug print --- build_tools/format-diff.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build_tools/format-diff.sh b/build_tools/format-diff.sh index 4a13d4238..e8c2800f5 100755 --- a/build_tools/format-diff.sh +++ b/build_tools/format-diff.sh @@ -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!"