Specify the comparison branch other than GERRIT_BRANCH

Change-Id: I45538bd4b5d6118dc5c1d6995afad48fcb4556d9
diff --git a/chart_version_check.sh b/chart_version_check.sh
index e070375..d00cd9e 100755
--- a/chart_version_check.sh
+++ b/chart_version_check.sh
@@ -29,10 +29,11 @@
 WORKSPACE=${WORKSPACE:-.}
 
 # branch to compare against, defaults to master
-GERRIT_BRANCH=${GERRIT_BRANCH:-opencord/master}
+COMPARISON_BRANCH="${COMPARISON_BRANCH:-opencord/master}"
+echo "# Comparing with branch: $COMPARISON_BRANCH"
 
 # Create list of changed files compared to branch
-changed_files=$(git diff --name-only "${GERRIT_BRANCH}")
+changed_files=$(git diff --name-only "${COMPARISON_BRANCH}")
 
 # Create list of untracked by git files
 untracked_files=$(git ls-files -o --exclude-standard)
@@ -45,7 +46,7 @@
 else
   if [ -n "$changed_files" ]
   then
-    echo "Changed files compared with $GERRIT_BRANCH:"
+    echo "Changed files compared with $COMPARISON_BRANCH:"
     # Search and replace per SC2001 doesn't recognize ^ (beginning of line)
     # shellcheck disable=SC2001
     echo "${changed_files}" | sed 's/^/  /'
@@ -88,7 +89,7 @@
   done
 
   # See if chart version changed using 'git diff', and is SemVer
-  chart_yaml_diff=$(git diff -p "$GERRIT_BRANCH" "${chartdir}/Chart.yaml")
+  chart_yaml_diff=$(git diff -p "$COMPARISON_BRANCH" -- "${chartdir}/Chart.yaml")
 
   if [ -n "$chart_yaml_diff" ]
   then
diff --git a/helmrepo.sh b/helmrepo.sh
index 8fdb354..0fdb3ec 100755
--- a/helmrepo.sh
+++ b/helmrepo.sh
@@ -25,14 +25,10 @@
 # when not running under Jenkins, use current dir as workspace
 WORKSPACE=${WORKSPACE:-.}
 
-# branch to compare against, defaults to master
-GERRIT_BRANCH=${GERRIT_BRANCH:-opencord/master}
-
 # directory to compare against, doesn't need to be present
 OLD_REPO_DIR="${OLD_REPO_DIR:-cord-charts-repo}"
 NEW_REPO_DIR="${NEW_REPO_DIR:-chart_repo}"
 
-GERRIT_BRANCH="${GERRIT_BRANCH:-$(git symbolic-ref --short HEAD)}"
 PUBLISH_URL="${PUBLISH_URL:-charts.opencord.org}"
 
 # create and clean NEW_REPO_DIR
@@ -64,7 +60,7 @@
     chartdir=$(dirname "${chart#${WORKSPACE}/}")
 
     # See if chart version changed from previous HEAD commit
-    chart_yaml_diff=$(git diff -p HEAD^ "${chartdir}/Chart.yaml")
+    chart_yaml_diff=$(git diff -p HEAD^ -- "${chartdir}/Chart.yaml")
 
     if [ -n "$chart_yaml_diff" ]
     then