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.
This commit is contained in:
Joey Hess 2018-06-05 13:03:42 -04:00
parent b94294a43d
commit a5f598a6aa
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 20 additions and 20 deletions

View file

@ -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)" showLongNote "(non-fast-forward problems can be solved by setting receive.denyNonFastforwards to false in the remote's git config)"
return ok return ok
where where
gc = Remote.gitconfig remote
needpush needpush
| remoteAnnexReadOnly gc = return False | remoteAnnexReadOnly gc = return False
| not (remoteAnnexPush gc) = return False | not (remoteAnnexPush gc) = return False
| otherwise = anyM (newer remote) [syncBranch branch, Annex.Branch.name] | otherwise = anyM (newer remote) [syncBranch branch, Annex.Branch.name]
-- Do updateInstead emulation for remotes on eg removable drives -- Do updateInstead emulation for remotes on eg removable drives
-- formatted FAT, where the post-update hook won't run. -- formatted FAT, where the post-receive hook won't run.
postpushupdate repo postpushupdate repo = case Git.repoWorkTree repo of
| annexCrippledFileSystem (remoteGitConfig (Remote.gitconfig remote)) = Nothing -> return True
case Git.repoWorkTree repo of Just wt -> ifM needemulation
Nothing -> return True ( liftIO $ do
Just wt -> ifM (Remote.Git.onLocal repo remote needUpdateInsteadEmulation) p <- readProgramFile
( liftIO $ do boolSystem' p [Param "post-receive"]
p <- readProgramFile (\cp -> cp { cwd = Just wt })
boolSystem' p [Param "post-receive"] , return True
(\cp -> cp { cwd = Just wt }) )
, return True where
) needemulation = Remote.Git.onLocal repo remote $
| otherwise = return True (annexCrippledFileSystem <$> Annex.getGitConfig)
gc = Remote.gitconfig remote <&&>
needUpdateInsteadEmulation
{- Pushes a regular branch like master to a remote. Also pushes the git-annex {- Pushes a regular branch like master to a remote. Also pushes the git-annex
- branch. - branch.

View file

@ -1,12 +1,10 @@
annex-checkuuid=false prevents the git config of a remote from being read. 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. 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 I've mostly removed uses of remoteGitConfig, but there are two in
impacted by the problem. Remote.Git, which are needed for annexDifferences.
So, `annex.tune.*` config the remote won't be honored when
And `git annex sync` looks at it to determine annex-checkuuid=false.
if the remote is a FAT-formatted drive, and does updateInstead emulation.
So, that's broken for remotes with annex-checkuuid=false
The best thing would be to remove remoteGitConfig, to avoid such problems The best thing would be to remove remoteGitConfig, to avoid such problems
in the future. --[[Joey]] in the future. --[[Joey]]