[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] scripts: Allow git-push-all.sh to be run from any directory
commit 51b792b000d8560cf5b61b887eadcd9aece27d04
Author: teor <teor@xxxxxxxxxxxxxx>
Date: Tue Sep 10 12:07:13 2019 +1000
scripts: Allow git-push-all.sh to be run from any directory
Closes 31678.
---
changes/ticket31678 | 4 ++++
scripts/git/git-push-all.sh | 18 ++++++++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/changes/ticket31678 b/changes/ticket31678
new file mode 100644
index 000000000..157f1db7f
--- /dev/null
+++ b/changes/ticket31678
@@ -0,0 +1,4 @@
+ o Minor features (git scripts):
+ - Allow git-push-all.sh to be run from any directory. Previously, the
+ script only worked if run from an upstream worktree directory.
+ Closes ticket 31678.
diff --git a/scripts/git/git-push-all.sh b/scripts/git/git-push-all.sh
index 8e49e81b9..701fea40f 100755
--- a/scripts/git/git-push-all.sh
+++ b/scripts/git/git-push-all.sh
@@ -30,6 +30,13 @@ set -e
# Don't change this configuration - set the env vars in your .profile
#
+# The tor master git repository directory from which all the worktree have
+# been created.
+TOR_MASTER_NAME=${TOR_MASTER_NAME:-"tor"}
+# Which directory do we push from?
+if [ "$TOR_FULL_GIT_PATH" ]; then
+ TOR_GIT_PUSH_PATH=${TOR_GIT_PUSH_PATH:-"$TOR_FULL_GIT_PATH/$TOR_MASTER_NAME"}
+fi
# git push command and default arguments
GIT_PUSH=${TOR_GIT_PUSH:-"git push --atomic"}
# The upstream remote which git.torproject.org/tor.git points to.
@@ -91,8 +98,6 @@ if [ "$1" = "--" ]; then
shift
fi
-echo "Calling $GIT_PUSH" "$@" "<branches>"
-
if [ "$TEST_BRANCH_PREFIX" ]; then
if [ "$UPSTREAM_REMOTE" = "${TOR_UPSTREAM_REMOTE_NAME:-upstream}" ]; then
echo "Pushing test branches ${TEST_BRANCH_PREFIX}_nnn to " \
@@ -102,6 +107,15 @@ if [ "$TEST_BRANCH_PREFIX" ]; then
fi
fi
+if [ "$TOR_GIT_PUSH_PATH" ]; then
+ echo "Changing to $GIT_PUSH_PATH before pushing"
+ cd "$TOR_GIT_PUSH_PATH"
+else
+ echo "Pushing from the current directory"
+fi
+
+echo "Calling $GIT_PUSH" "$@" "<branches>"
+
################################
# Git upstream remote branches #
################################
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits