From a5f598a6aa942eed1631bf0e2ec51264e0487383 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 5 Jun 2018 13:03:42 -0400 Subject: [PATCH] remove use of remoteGitConfig Unfortunately one more use remains.. This should be just as fast as the other method. The remote's Git.Repo has already had its config read, so Annex.new's call to Git.Config.read is a noop. Thid commit was sponsored by andrea rota. --- Command/Sync.hs | 30 ++++++++++--------- ...remoteGitConfig_for_checkuuid_support.mdwn | 10 +++---- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Command/Sync.hs b/Command/Sync.hs index 97a65452ab..0fb3bdc3fa 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -454,25 +454,27 @@ pushRemote o remote (Just branch, _) = stopUnless (pure (pushOption o) <&&> need showLongNote "(non-fast-forward problems can be solved by setting receive.denyNonFastforwards to false in the remote's git config)" return ok where + gc = Remote.gitconfig remote needpush | remoteAnnexReadOnly gc = return False | not (remoteAnnexPush gc) = return False | otherwise = anyM (newer remote) [syncBranch branch, Annex.Branch.name] -- Do updateInstead emulation for remotes on eg removable drives - -- formatted FAT, where the post-update hook won't run. - postpushupdate repo - | annexCrippledFileSystem (remoteGitConfig (Remote.gitconfig remote)) = - case Git.repoWorkTree repo of - Nothing -> return True - Just wt -> ifM (Remote.Git.onLocal repo remote needUpdateInsteadEmulation) - ( liftIO $ do - p <- readProgramFile - boolSystem' p [Param "post-receive"] - (\cp -> cp { cwd = Just wt }) - , return True - ) - | otherwise = return True - gc = Remote.gitconfig remote + -- formatted FAT, where the post-receive hook won't run. + postpushupdate repo = case Git.repoWorkTree repo of + Nothing -> return True + Just wt -> ifM needemulation + ( liftIO $ do + p <- readProgramFile + boolSystem' p [Param "post-receive"] + (\cp -> cp { cwd = Just wt }) + , return True + ) + where + needemulation = Remote.Git.onLocal repo remote $ + (annexCrippledFileSystem <$> Annex.getGitConfig) + <&&> + needUpdateInsteadEmulation {- Pushes a regular branch like master to a remote. Also pushes the git-annex - branch. diff --git a/doc/todo/need_to_remove_remoteGitConfig_for_checkuuid_support.mdwn b/doc/todo/need_to_remove_remoteGitConfig_for_checkuuid_support.mdwn index 9a8a821600..81a1f9ba68 100644 --- a/doc/todo/need_to_remove_remoteGitConfig_for_checkuuid_support.mdwn +++ b/doc/todo/need_to_remove_remoteGitConfig_for_checkuuid_support.mdwn @@ -1,12 +1,10 @@ annex-checkuuid=false prevents the git config of a remote from being read. So, the remoteGitConfig will be an empty config when that's set. -Only a few things use remoteGitConfig. Annex.Ssh uses it, but is not -impacted by the problem. - -And `git annex sync` looks at it to determine -if the remote is a FAT-formatted drive, and does updateInstead emulation. -So, that's broken for remotes with annex-checkuuid=false +I've mostly removed uses of remoteGitConfig, but there are two in +Remote.Git, which are needed for annexDifferences. +So, `annex.tune.*` config the remote won't be honored when +annex-checkuuid=false. The best thing would be to remove remoteGitConfig, to avoid such problems in the future. --[[Joey]]