ndimiduk commented on a change in pull request #1725:
URL: https://github.com/apache/hbase/pull/1725#discussion_r429421666



##########
File path: dev-support/create-release/release-util.sh
##########
@@ -389,6 +389,40 @@ function configure_maven {
 EOF
 }
 
+# force a clone of the repo, optionally with auth details for pushing.
+function git_force_clone {

Review comment:
       it's a nit, but yeah, that could help. I found it initially confusing 
because many git commands support a `--force` flag.

##########
File path: dev-support/create-release/release-util.sh
##########
@@ -389,6 +389,40 @@ function configure_maven {
 EOF
 }
 
+# force a clone of the repo, optionally with auth details for pushing.
+function git_force_clone {
+  local asf_repo
+  if [ -d "${PROJECT}" ]; then
+    rm -rf "${PROJECT}"
+  fi
+
+  if [[ -z "${GIT_REPO}" ]]; then
+    asf_repo="gitbox.apache.org/repos/asf/${PROJECT}.git"
+    echo "[INFO] clone will be of the gitbox repo for ${PROJECT}."
+    if [ -n "${ASF_USERNAME}" ] && [ -n "${ASF_PASSWORD}" ]; then
+      # Ugly!
+      encoded_username=$(python -c "import urllib; print 
urllib.quote('''$ASF_USERNAME''')")
+      encoded_password=$(python -c "import urllib; print 
urllib.quote('''$ASF_PASSWORD''')")
+      GIT_REPO="https://$encoded_username:$encoded_password@${asf_repo}";
+    else
+      GIT_REPO="https://${asf_repo}";
+    fi
+  else
+    echo "[INFO] clone will be of provided git repo."
+  fi
+  # N.B. we use the shared flag because the clone is short lived and if a 
local repo repo was

Review comment:
       thank you!

##########
File path: dev-support/create-release/release-util.sh
##########
@@ -389,6 +389,40 @@ function configure_maven {
 EOF
 }
 
+# force a clone of the repo, optionally with auth details for pushing.
+function git_force_clone {
+  local asf_repo
+  if [ -d "${PROJECT}" ]; then
+    rm -rf "${PROJECT}"
+  fi
+
+  if [[ -z "${GIT_REPO}" ]]; then
+    asf_repo="gitbox.apache.org/repos/asf/${PROJECT}.git"
+    echo "[INFO] clone will be of the gitbox repo for ${PROJECT}."
+    if [ -n "${ASF_USERNAME}" ] && [ -n "${ASF_PASSWORD}" ]; then
+      # Ugly!
+      encoded_username=$(python -c "import urllib; print 
urllib.quote('''$ASF_USERNAME''')")
+      encoded_password=$(python -c "import urllib; print 
urllib.quote('''$ASF_PASSWORD''')")
+      GIT_REPO="https://$encoded_username:$encoded_password@${asf_repo}";
+    else
+      GIT_REPO="https://${asf_repo}";
+    fi
+  else
+    echo "[INFO] clone will be of provided git repo."
+  fi
+  # N.B. we use the shared flag because the clone is short lived and if a 
local repo repo was
+  #      given this will let us refer to objects there directly instead of 
hardlinks or copying.
+  #      The option is silently ignored for non-local repositories. see the 
note on git help clone
+  #      for the --shared option for details.
+  git clone --shared -b "${GIT_BRANCH}" -- "${GIT_REPO}" "${PROJECT}"
+  # If this was a host local git repo then add in an alterntes and remote that 
will
+  # work back on the host if the RM needs to do any post-processing steps, 
i.e. pushing the git tag

Review comment:
       Reading it again, what you have here is sufficient to let me know that i 
could trip over a pot-hole. A `git-help` invocation that documents the feature 
you're using would be helpful, if you want to go the extra mile.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to