]> Nutra Git (v2) - gamesguru/git-remote-gcrypt.git/commitdiff
Automatically forward-port repository config
authorroot <root@localhost>
Thu, 14 Feb 2013 00:00:00 +0000 (00:00 +0000)
committerroot <root@localhost>
Thu, 14 Feb 2013 00:00:00 +0000 (00:00 +0000)
Change remote configurations when encountered:

* gcrypt::ssh -> gcrypt::rsync
* repo/G.XXXX -> #XXX
* gitception:// -> ""

git-remote-gcrypt

index 93665dd70693efd0e8b7fd9b4648ff69181e5251..b96889fd23f0edd47085ce6cfae9a9ed07786b1a 100755 (executable)
@@ -389,11 +389,33 @@ ensure_connected()
        # Fixup ssh:// -> rsync://
        if isurl ssh "$URL"; then
                URL="rsync://${URL#ssh://}"
+               isnull "$r_name" || {
+                       git config "remote.$r_name.url" "gcrypt::$URL"
+                       echo_info "Updated URL for $r_name, ssh: -> rsync:"
+               }
+       fi
+       if isurl gitception "$URL" && isnonnull "$r_name"; then
+               git config "remote.$r_name.url" "gcrypt::${URL#gitception://}"
+               echo_info "Updated URL for $r_name, gitception:// -> ()"
        fi
 
        # Find the URL fragment
        Urlfrag=${URL##*"#"}
        isnoteq "$Urlfrag" "$URL" || Urlfrag=
+       isnonnull "$Urlfrag" || {
+               # find old style  /G.XXXXXX fragment
+               Urlfrag=${URL##*/G.}
+               if isnoteq "$Urlfrag" "$URL"; then
+                       URL=${URL%/G."$Urlfrag"}
+                       isnull "$r_name" || {
+                               git config "remote.$r_name.url" \
+                                       "gcrypt::$URL#$Urlfrag"
+                               echo_info "Updated URL for $r_name, use #fragment"
+                       }
+               else
+                       Urlfrag=
+               fi
+       }
        URL=${URL%"#$Urlfrag"}
 
        # manifestfile -- sha224 hash if we can, else the default location