diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-07-09 13:54:28 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-07-09 14:27:10 -0400 |
commit | 97a9966b04bde2f6a86dea0fb674db16442b2605 (patch) | |
tree | 5183c87af67cbbfced2f2479b0f720136e9db011 /scripts/git/git-setup-dirs.sh | |
parent | 2eb7673a8c9c370a8cc6eb86daea82baab4bc5d5 (diff) | |
download | tor-97a9966b04bde2f6a86dea0fb674db16442b2605.tar.gz tor-97a9966b04bde2f6a86dea0fb674db16442b2605.zip |
Update git scripts to include tor-gitlab repository
Analogously to tor-github, we now make a tor-gitlab repository. It
is set up to disable push direct attempts, and to fetch merge
requests into appropriate branches.
git-pull-all.sh knows how to fetch this repository.
Diffstat (limited to 'scripts/git/git-setup-dirs.sh')
-rwxr-xr-x | scripts/git/git-setup-dirs.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/git/git-setup-dirs.sh b/scripts/git/git-setup-dirs.sh index 1f61eb8b83..3cc184dafb 100755 --- a/scripts/git/git-setup-dirs.sh +++ b/scripts/git/git-setup-dirs.sh @@ -40,6 +40,10 @@ function usage() echo " (current: $GITHUB_PULL)" echo " TOR_GITHUB_PUSH: the tor-github remote push URL" echo " (current: $GITHUB_PUSH)" + echo " TOR_GITLAB_PULL: the tor-gitlab remote pull URL" + echo " (current: $GITLAB_PULL)" + echo " TOR_GITLAB_PUSH: the tor-gitlab remote push URL" + echo " (current: $GITLAB_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" @@ -83,6 +87,10 @@ fi GITHUB_PULL=${TOR_GITHUB_PULL:-"https://github.com/torproject/tor.git"} GITHUB_PUSH=${TOR_GITHUB_PUSH:-"No_Pushing_To_GitHub"} +# GitLab repositories +GITLAB_PULL=${TOR_GITLAB_PULL:-"https://gitlab.torproject.org/tpo/core/tor.git"} +GITLAB_PUSH=${TOR_GITLAB_PUSH:-"No_Pushing_To_GitLab"} + ########################## # Git branches to manage # ########################## @@ -343,6 +351,20 @@ function set_tor_github_pr_fetch_config "refs/pull.*pr" } +# Set up the tor-github PR config, so tor-gitlab/mr/NNNN points to GitHub +# MR NNNN. In some repositories, "/head" is optional. +function set_tor_gitlab_mr_fetch_config +{ + # standard branches + replace_fetch_config tor-gitlab \ + "+refs/heads/*:refs/remotes/tor-gitlab/*" \ + "refs/heads" + # MRs + replace_fetch_config tor-gitlab \ + "+refs/merge-requests/*/head:refs/remotes/tor-gitlab/mr/*" \ + "refs/merge-requests.*mr" +} + # Add a new worktree for branch at path. # If the directory already exists: fail if $USE_EXISTING is 0, otherwise skip. function add_worktree @@ -471,6 +493,15 @@ set_tor_github_pr_fetch_config # Now fetch them all fetch_remote "tor-github" +# GitLab remote +printf "%s Seting up remote %s\\n" "$MARKER" "${BYEL}tor-gitlab${CNRM}" +add_remote "tor-gitlab" "$GITLAB_PULL" +set_remote_push "tor-gitlab" "$GITLAB_PUSH" +# Add custom fetch for MRs +set_tor_gitlab_mr_fetch_config +# Now fetch them all +fetch_remote "tor-gitlab" + # Extra remote if [ "$TOR_EXTRA_REMOTE_NAME" ]; then printf "%s Setting up remote %s\\n" "$MARKER" \ |