Debian Codegraph @

scripts/developer/git/setup-remotes

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2
3 # SPDX-FileCopyrightText: 2026 Oak Ridge National Laboratory and Contributors
4 #
5 # SPDX-License-Identifier: Apache-2.0
6
7 GH_UPSTREAM_URL=$(gitscip-shell system . . git. remote show origin | grepscip-shell system . . grep. "Fetch URL" | sedscip-shell system . . sed. 's|.*: \(.*\)|\1|')
8 BRANCH="$(gitscip-shell system . . git. branch | sedscip-shell system . . sed. -n 's|^\* \(.*\)|\1|p')"
9 if [scip-shell system . . `[`. "${GH_UPSTREAM_URL}" != "https://github.com/ornladios/ADIOS2.git" ] || \
10 [ "${BRANCH}" != "master" ]
11 then
12 echoscip-shell system . . echo. " Warning: This script is intended to run off of the master branch"
13 echoscip-shell system . . echo. " of the upstream repository. Setup might not work as"
14 echoscip-shell system . . echo. " expected otherwise."
15 fi
16
17 read -p "Enter your GitHub username: " GH_USERNAME
18 if [scip-shell system . . `[`. -z "${GH_USERNAME}" ]
19 then
20 echoscip-shell system . . echo. " Error: GitHub username cannot be empty."
21 exit 1
22 fi
23 gitscip-shell system . . git. remote set-url origin https://github.com/${GH_USERNAME}/ADIOS2.git
24
25 echoscip-shell system . . echo. "Testing SSH access to GitHub..."
26 sshscip-shell system . . ssh. -o ConnectTimeout=10 -T [email protected] 2>/dev/nullscip-shell filesystem . . `/dev/null`.
27 if [scip-shell system . . `[`. $? -eq 1 ]
28 then
29 echoscip-shell system . . echo. "Success! Setting up SSH push access to your fork."
30 gitscip-shell system . . git. config remote.origin.pushurl "[email protected]:${GH_USERNAME}/ADIOS2.git"
31 else
32 echoscip-shell system . . echo. "SSH access failed. Setting up HTTPS push access instead"
33 gitscip-shell system . . git. config remote.origin.pushurl https://${GH_USERNAME}@github.com/${GH_USERNAME}/ADIOS2.git
34 fi
35
36
37 if gitscip-shell system . . git. remote show upstream > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
38 then
39 echoscip-shell system . . echo. " Warning: upstream remote already exists; replacing..."
40 gitscip-shell system . . git. remote rm upstream
41 fi
42 gitscip-shell system . . git. remote add upstream https://github.com/ornladios/ADIOS2.git
43
44 echoscip-shell system . . echo. "Re-configuring local master branch to use upstream"
45 gitscip-shell system . . git. config branch.master.remote upstream
46 gitscip-shell system . . git. config branch.master.mergeOptions "--ff-only"
47 gitscip-shell system . . git. config merge.log 100
48 gitscip-shell system . . git. fetch --all -p
49
50 exit 0