From: Patrick Steinhardt Date: Mon, 12 May 2025 09:19:51 +0000 (+0200) Subject: contrib: remove "remotes2config.sh" X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a8f959cbf6581a6b124a502139c8d750a2fa6a0e;p=thirdparty%2Fgit.git contrib: remove "remotes2config.sh" Remotes can be configured either via a repository's config or by using the ".git/branches/" or ".git/remotes/" directories. Back when the new config-based mechanism has been introduced we also introduced a helper script that migrates from the old-style remote configuration to the new config-based mechanism. With the recent removal announcement for the two directories we also started to instruct users to migrate repositories that still use these mechanism to use config-based remotes. Notably though, the migration path doesn't even use the migration script. Instead, git-remote(1) itself knows how to migrate any such remote via `git remote rename`. In fact, a full migration _cannot_ use the script as it only knows to migrate remotes from ".git/remotes/", but not ".git/branches/". As such, the migration path via `git remote rename` is the only feasible way to fully migrate repositories over to the new format. Last but not least, the script doesn't even work as-is as it sources "git-sh-setup". For this to work it would need to be invoked either via Git so that this script is in our PATH, users would have to manually call it with an adjusted PATH, or distributions need to install the script into "$prefix/libexec/git-core" with a "git-" prefix. All of these steps are unlikely enough to underpin the claim that this script is not used at all. So given that: - The script cannot perform a full migration of all deprecated remote types. - We don't advertise it anywhere. - It has been basically untouched since 2007. - It doesn't even work unless users do manual steps. It should be safe enough to just remove it. Do so. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- diff --git a/contrib/remotes2config.sh b/contrib/remotes2config.sh deleted file mode 100755 index 1cda19f66a..0000000000 --- a/contrib/remotes2config.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -# Use this tool to rewrite your .git/remotes/ files into the config. - -. git-sh-setup - -if [ -d "$GIT_DIR"/remotes ]; then - echo "Rewriting $GIT_DIR/remotes" >&2 - error=0 - # rewrite into config - { - cd "$GIT_DIR"/remotes - ls | while read f; do - name=$(printf "$f" | tr -c "A-Za-z0-9-" ".") - sed -n \ - -e "s/^URL:[ ]*\(.*\)$/remote.$name.url \1 ./p" \ - -e "s/^Pull:[ ]*\(.*\)$/remote.$name.fetch \1 ^$ /p" \ - -e "s/^Push:[ ]*\(.*\)$/remote.$name.push \1 ^$ /p" \ - < "$f" - done - echo done - } | while read key value regex; do - case $key in - done) - if [ $error = 0 ]; then - mv "$GIT_DIR"/remotes "$GIT_DIR"/remotes.old - fi ;; - *) - echo "git config $key "$value" $regex" - git config $key "$value" $regex || error=1 ;; - esac - done -fi