]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
contrib: Clean up outdated parts of gcc-git-customization.sh
authorJonathan Wakely <jwakely@redhat.com>
Thu, 6 Mar 2025 20:28:07 +0000 (20:28 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 11 Mar 2025 17:32:37 +0000 (17:32 +0000)
It's very unlikely that anybody is still using the old remotes/$user Git
repo setup and still needs this script to be able to migrate it to the
remotes/users/$user structure. Simplify the script by removing those
parts.

This fixes an error that gets displayed in some circumstances:
fatal: no such section: remote.me

contrib/ChangeLog:

* gcc-git-customization.sh: Delete outdated commands for
migrating from very old git setups.

contrib/gcc-git-customization.sh

index 54bd35ea1aab351f205baeafdc46c30dfd307a1d..e58220fb342695dfa23cc04de1c73cdcb5cb0ae6 100755 (executable)
@@ -156,45 +156,7 @@ if [ "x$dohook" = xyes ]; then
     fi
 fi
 
-# Scan the existing settings to see if there are any we need to rewrite.
-vendors=$(git config --get-all "remote.${upstream}.fetch" "refs/vendors/" | sed 's:.*refs/vendors/\([^/][^/]*\)/.*:\1:' | sort | uniq)
 url=$(git config --get "remote.${upstream}.url")
-pushurl=$(git config --get "remote.${upstream}.pushurl")
-for v in $vendors
-do
-    echo "Migrating vendor \"$v\" to new remote \"vendors/$v\""
-    git config --unset-all "remote.${upstream}.fetch" "refs/vendors/$v/"
-    git config --unset-all "remote.${upstream}.push" "refs/vendors/$v/"
-    git config "remote.vendors/${v}.url" "${url}"
-    if [ "x$pushurl" != "x" ]
-    then
-       git config "remote.vendors/${v}.pushurl" "${pushurl}"
-    fi
-    git config --add "remote.vendors/${v}.fetch" "+refs/vendors/$v/heads/*:refs/remotes/vendors/${v}/*"
-    git config --add "remote.vendors/${v}.fetch" "+refs/vendors/$v/tags/*:refs/tags/vendors/${v}/*"
-done
-
-# Convert the remote 'pfx' to users/pfx to avoid problems with ambiguous refs
-# on user branches
-old_remote=$(git config --get "remote.${old_pfx}.url")
-if [ -n "${old_remote}" ]
-then
-    echo "Migrating remote \"${old_pfx}\" to new remote \"users/${new_pfx}\""
-    # Create a dummy fetch rule that will cause the subsequent prune to remove the old remote refs.
-    git config --replace-all "remote.${old_pfx}.fetch" "+refs/empty/*:refs/remotes/${old_pfx}/*"
-    # Remove any remotes
-    git remote prune ${old_pfx}
-    git config --remove-section "remote.${old_pfx}"
-    for br in $(git branch --list "${old_pfx}/*")
-    do
-       old_remote=$(git config --get "branch.${br}.remote")
-       if [ "${old_remote}" = "${old_pfx}" ]
-       then
-           git config "branch.${br}.remote" "users/${new_pfx}"
-       fi
-    done
-fi
-
 echo "Setting up tracking for personal namespace $remote_id in remotes/users/${new_pfx}"
 git config "remote.users/${new_pfx}.url" "${url}"
 if [ "x$pushurl" != "x" ]
@@ -205,12 +167,4 @@ git config --replace-all "remote.users/${new_pfx}.fetch" "+refs/users/${remote_i
 git config --replace-all "remote.users/${new_pfx}.fetch" "+refs/users/${remote_id}/tags/*:refs/tags/users/${new_pfx}/*" "refs/users/${remote_id}/tags/"
 git config --replace-all "remote.users/${new_pfx}.push" "refs/heads/${new_pfx}/*:refs/users/${remote_id}/heads/*" "refs/users/${remote_id}"
 
-if [ "$old_pfx" != "$new_pfx" -a "$old_pfx" != "${upstream}" ]
-then
-    git config --remove-section "remote.${old_pfx}"
-fi
-
-git config --unset-all "remote.${upstream}.fetch" "refs/users/${remote_id}/"
-git config --unset-all "remote.${upstream}.push" "refs/users/${remote_id}/"
-
 git fetch "users/${new_pfx}"