IMPALA-4294: Make check-schema-diff.sh executable from anywhere.

Fixes a regression in the data load process that had been introduced
by commit 75a857c. To making check-schema-diff.sh work from anywhere.
we need to specify the git-dir and work-tree arguments everywhere we
call git.

Change-Id: I32e0dce2c10c443763a038aa3b64b1c123ed62ad
Reviewed-on: http://gerrit.cloudera.org:8080/4726
Reviewed-by: Taras Bobrovytsky <tbobrovyt...@cloudera.com>
Tested-by: Internal Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/05b91a97
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/05b91a97
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/05b91a97

Branch: refs/heads/master
Commit: 05b91a973c3aa23ef049761ef6d240482bb86c11
Parents: ca3fd40
Author: David Knupp <dkn...@cloudera.com>
Authored: Thu Oct 13 15:58:45 2016 -0700
Committer: Internal Jenkins <cloudera-hud...@gerrit.cloudera.org>
Committed: Sat Oct 15 04:05:04 2016 +0000

----------------------------------------------------------------------
 testdata/bin/check-schema-diff.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/05b91a97/testdata/bin/check-schema-diff.sh
----------------------------------------------------------------------
diff --git a/testdata/bin/check-schema-diff.sh 
b/testdata/bin/check-schema-diff.sh
index f2cabc5..4eb8172 100755
--- a/testdata/bin/check-schema-diff.sh
+++ b/testdata/bin/check-schema-diff.sh
@@ -31,11 +31,17 @@ trap 'echo Error in $0 at line $LINENO: $(cd "'$PWD'" && 
awk "NR == $LINENO" $0)
 DATASET=${1-}
 hdfs dfs -test -e  ${WAREHOUSE_LOCATION_PREFIX}/test-warehouse/githash.txt || 
{ exit 0; }
 GIT_HASH=$(echo $(hdfs dfs -cat 
${WAREHOUSE_LOCATION_PREFIX}/test-warehouse/githash.txt))
-if ! git show $GIT_HASH &>/dev/null; then
+
+# To ensure this script works when executed from anywhere, even outside the 
Impala repo,
+# we specifiy the git-dir and work-tree for all git commands.
+if ! git --git-dir ${IMPALA_HOME}/.git --work-tree=${IMPALA_HOME} \
+  show $GIT_HASH &>/dev/null; then
   echo The git commit used to create the test warehouse snapshot is not 
available \
       locally. Fetching the latest commits from remotes.
-  git fetch --all &>/dev/null
+  git --git-dir ${IMPALA_HOME}/.git --work-tree=${IMPALA_HOME} fetch --all 
&>/dev/null
 fi
 # Check whether a non-empty diff exists.
-git diff --exit-code ${GIT_HASH}..HEAD 
${IMPALA_HOME}/testdata/datasets/$DATASET
-git diff --exit-code ${GIT_HASH}..HEAD 
${IMPALA_HOME}/testdata/avro_schema_resolution
+git --git-dir ${IMPALA_HOME}/.git --work-tree=${IMPALA_HOME} \
+  diff --exit-code ${GIT_HASH}..HEAD ${IMPALA_HOME}/testdata/datasets/$DATASET
+git --git-dir ${IMPALA_HOME}/.git --work-tree=${IMPALA_HOME} \
+  diff --exit-code ${GIT_HASH}..HEAD 
${IMPALA_HOME}/testdata/avro_schema_resolution

Reply via email to