webapp: Fix renaming of special remotes.

Working around what seems to me to be a git bug. Surely there are valid
setups of real git remotes that don't have fetch set?
This commit is contained in:
Joey Hess 2012-10-31 14:39:02 -04:00
parent cc15d6f3d5
commit c03d9b2310
2 changed files with 12 additions and 0 deletions

View file

@ -27,6 +27,7 @@ import Types.StandardGroups
import qualified Config import qualified Config
import qualified Git import qualified Git
import qualified Git.Command import qualified Git.Command
import qualified Git.Config
import Yesod import Yesod
import Data.Text (Text) import Data.Text (Text)
@ -72,6 +73,16 @@ setRepoConfig uuid mremote oldc newc = do
when (isJust mremote && repoName oldc /= repoName newc) $ do when (isJust mremote && repoName oldc /= repoName newc) $ do
runAnnex undefined $ do runAnnex undefined $ do
name <- fromRepo $ uniqueRemoteName (T.unpack $ repoName newc) 0 name <- fromRepo $ uniqueRemoteName (T.unpack $ repoName newc) 0
{- git remote rename expects there to be a
- remote.<name>.fetch, and exits nonzero if
- there's not. Special remotes don't normally
- have that, and don't use it. Temporarily add
- it if it's missing. -}
let remotefetch = "remote." ++ T.unpack (repoName oldc) ++ ".fetch"
needfetch <- isNothing <$> fromRepo (Git.Config.getMaybe remotefetch)
when needfetch $
inRepo $ Git.Command.run "config"
[Param remotefetch, Param ""]
inRepo $ Git.Command.run "remote" inRepo $ Git.Command.run "remote"
[ Param "rename" [ Param "rename"
, Param $ T.unpack $ repoName oldc , Param $ T.unpack $ repoName oldc

1
debian/changelog vendored
View file

@ -36,6 +36,7 @@ git-annex (3.20121018) UNRELEASED; urgency=low
* webapp: Make an initial, empty commit so there is a master branch * webapp: Make an initial, empty commit so there is a master branch
* assistant: Fix syncing local drives. * assistant: Fix syncing local drives.
* webapp: Fix creation of rsync.net repositories. * webapp: Fix creation of rsync.net repositories.
* webapp: Fix renaming of special remotes.
-- Joey Hess <joeyh@debian.org> Wed, 17 Oct 2012 14:24:10 -0400 -- Joey Hess <joeyh@debian.org> Wed, 17 Oct 2012 14:24:10 -0400