Skip to content
Snippets Groups Projects

Make lb-use overwrite the current remote if necessary

Closed Igor Babuschkin requested to merge ibabusch/LbScripts:master into master

This allows you to override the current remote using lb-use, instead of having to do git remote rm

Users will end up doing this if there is a problem when running lb-use, for example when they don't have access to the repo, or they abort the git fetch

Merge request reports

Closed by avatar (Jul 16, 2025 8:44am UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
14 14 if [ -z "$url" ] ; then
15 15 url=https://:@gitlab.cern.ch:8443/LHCb-SVN-mirrors/$name.git
16 16 fi
17
17 18 echo "calling: git remote add -f '$name' '$url'"
19
20 # define a remote "$name", overwrite it if it already exists
21 output=$(git remote add "$name" "$url" 2>&1)
22 if [ $? -eq 128 ]; then
  • Two questions:

    • would it not be better to do $? -ne 0?
    • what about
      if git remote | grep -q "^${name}\$" ; then
          git remote rm "$name"
      fi
      git remote add "$name" "$url"
      ?
  • I thought that the 128 return code was specific to this error. Will check up on that. (Catching the exact error would have the benefit of forwarding the other ones). Grepping for the name is probably better as well.

  • Reassigned to @clemenci

  • Marco Clemencic Milestone changed to v8r6

    Milestone changed to v8r6

  • Marco Clemencic mentioned in merge request !56 (merged)

    mentioned in merge request !56 (merged)

  • Igor Babuschkin Status changed to closed

    Status changed to closed

  • Marco Clemencic mentioned in commit 7355a029

    mentioned in commit 7355a029

  • Marco Clemencic mentioned in commit 630e4de3

    mentioned in commit 630e4de3

  • Please register or sign in to reply
    Loading