From 995618ec619739cb7c54e809d6d817be4e9ed2de Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 31 Oct 2019 14:24:50 +1000 Subject: scripts/git: Make a master symlink in the worktree directory When running git-setup-dirs.sh. Part of 32347. --- scripts/git/git-setup-dirs.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'scripts/git') diff --git a/scripts/git/git-setup-dirs.sh b/scripts/git/git-setup-dirs.sh index 495b22b261..a1e465818d 100755 --- a/scripts/git/git-setup-dirs.sh +++ b/scripts/git/git-setup-dirs.sh @@ -254,6 +254,25 @@ function make_directory fi } +# Create a symlink from the first argument to the second argument +# If the link already exists: fail if $USE_EXISTING is 0, otherwise skip. +function make_symlink +{ + local cmd="ln -s '$1' '$2'" + printf " %s Creating symlink from %s to %s..." "$MARKER" "$1" "$2" + local check_cmd="[ ! -e '$2' ]" + msg=$( eval "$check_cmd" 2>&1 ) + if validate_ret_skip $? "File already exists."; then + return + fi + if [ $DRY_RUN -eq 0 ]; then + msg=$( eval "$cmd" 2>&1 ) + validate_ret $? "$msg" + else + printf "\\n %s\\n" "${IWTH}$cmd${CNRM}" + fi +} + # Go into the directory or repository, even if $DRY_RUN is non-zero. # If the directory does not exist, fail and log an error. # Otherwise, silently succeed. @@ -496,7 +515,12 @@ for ((i=0; i Date: Thu, 31 Oct 2019 14:25:43 +1000 Subject: scripts/git: Add TOR_EXTRA_CLONE_ARGS for git clone When running git-setup-dirs.sh. Part of 32347. --- scripts/git/git-setup-dirs.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts/git') diff --git a/scripts/git/git-setup-dirs.sh b/scripts/git/git-setup-dirs.sh index a1e465818d..12355af8da 100755 --- a/scripts/git/git-setup-dirs.sh +++ b/scripts/git/git-setup-dirs.sh @@ -40,6 +40,8 @@ function usage() echo " (current: $GITHUB_PULL)" echo " TOR_GITHUB_PUSH: the tor-github remote push URL" echo " (current: $GITHUB_PUSH)" + echo " TOR_EXTRA_CLONE_ARGS: extra arguments to git clone" + echo " (current: $TOR_EXTRA_CLONE_ARGS)" echo " we recommend that you set these env vars in your ~/.profile" } @@ -288,7 +290,7 @@ function goto_dir # If the directory already exists: fail if $USE_EXISTING is 0, otherwise skip. function clone_repo { - local cmd="git clone '$1' '$2'" + local cmd="git clone $TOR_EXTRA_CLONE_ARGS '$1' '$2'" printf " %s Cloning %s into %s..." "$MARKER" "$1" "$2" local check_cmd="[ ! -d '$2' ]" msg=$( eval "$check_cmd" 2>&1 ) -- cgit v1.2.3-54-g00ecf From 1ffb3b549f9bc88e3eb51bf281720c26f7bd6016 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 31 Oct 2019 14:28:27 +1000 Subject: scripts/git: Add TOR_EXTRA_REMOTE_* for an extra git remote When running git-setup-dirs.sh. Part of 32347. --- scripts/git/git-setup-dirs.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'scripts/git') diff --git a/scripts/git/git-setup-dirs.sh b/scripts/git/git-setup-dirs.sh index 12355af8da..d1ae6a4f99 100755 --- a/scripts/git/git-setup-dirs.sh +++ b/scripts/git/git-setup-dirs.sh @@ -42,6 +42,14 @@ function usage() echo " (current: $GITHUB_PUSH)" echo " TOR_EXTRA_CLONE_ARGS: extra arguments to git clone" echo " (current: $TOR_EXTRA_CLONE_ARGS)" + echo " TOR_EXTRA_REMOTE_NAME: the name of an extra remote" + echo " This remote is not pulled by this script or git-pull-all.sh." + echo " This remote is not pushed by git-push-all.sh." + echo " (current: $TOR_EXTRA_REMOTE_NAME)" + echo " TOR_EXTRA_REMOTE_PULL: the extra remote pull URL." + echo " (current: $TOR_EXTRA_REMOTE_PULL)" + echo " TOR_EXTRA_REMOTE_PUSH: the extra remote push URL" + echo " (current: $TOR_EXTRA_REMOTE_PUSH)" echo " we recommend that you set these env vars in your ~/.profile" } @@ -510,6 +518,17 @@ set_tor_github_pr_fetch_config # Now fetch them all fetch_remote "tor-github" +# Extra remote +if [ "$TOR_EXTRA_REMOTE_NAME" ]; then + printf "%s Setting up remote %s\\n" "$MARKER" \ + "${BYEL}$TOR_EXTRA_REMOTE_NAME${CNRM}" + # Add remote + add_remote "$TOR_EXTRA_REMOTE_NAME" "$TOR_EXTRA_REMOTE_PULL" + set_remote_push "$TOR_EXTRA_REMOTE_NAME" "$TOR_EXTRA_REMOTE_PUSH" + # But leave it to the user to decide if they want to fetch it + #fetch_remote "$TOR_EXTRA_REMOTE_NAME" +fi + # Go over all configured worktree. for ((i=0; i