Fix reversion that broke passing git configs with -c

Reverting commit c8fec6ab0
This commit is contained in:
Joey Hess 2020-07-02 12:42:13 -04:00
parent 1ecf6d239e
commit ec0f8a6e74
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 28 additions and 6 deletions

View file

@ -17,6 +17,8 @@ git-annex (8.20200618) UNRELEASED; urgency=medium
which allows dropping from other special remotes in some situations
where it was not possible before.
S3 (with versioning=yes), git-lfs, tahoe
* Fix reversion that broke passing git configs with -c.
(Since version 8.20200330.)
-- Joey Hess <id@joeyh.name> Thu, 18 Jun 2020 12:21:14 -0400

View file

@ -94,11 +94,9 @@ gitAnnexGlobalOptions = commonGlobalOptions ++
where
setnumcopies n = Annex.changeState $ \s -> s { Annex.forcenumcopies = Just $ NumCopies n }
setuseragent v = Annex.changeState $ \s -> s { Annex.useragent = Just v }
setgitconfig v = Annex.adjustGitRepo $ \r ->
if Param v `elem` gitGlobalOpts r
then return r
else Git.Config.store (encodeBS' v) Git.Config.ConfigList $
r { gitGlobalOpts = gitGlobalOpts r ++ [Param "-c", Param v] }
setgitconfig v = Annex.adjustGitRepo $ \r ->
Git.Config.store (encodeBS' v) Git.Config.ConfigList $
r { gitGlobalOpts = gitGlobalOpts r ++ [Param "-c", Param v] }
setdesktopnotify v = Annex.changeState $ \s -> s { Annex.desktopnotify = Annex.desktopnotify s <> v }
{- Parser that accepts all non-option params. -}

View file

@ -38,4 +38,16 @@ worth filing in case there's a simple fix.
[[!meta author=kyle]]
[[!tag projects/datalad]]
> [[fixed|done]] --[[Joey]]
> Fix was attempted in [[!commit c8fec6ab0]] but that
> caused [[annex-ssh-options_dropped_since_8.20200330]]
> so it was reverted.
>
> The cause of the problem is that the action passed to adjustGitRepo
> gets run more than once in some cases where the Repo has changed
> and the adjustment needs to be re-done, so if it appends a value,
> the value may get appended to a Repo that already had it appended.
>
> So that commit made it check if the value was present and not add it.
> I don't currently understand why, but that prevented the value getting
> added.
> --[[Joey]]

View file

@ -0,0 +1,10 @@
[[!comment format=mdwn
username="joey"
subject="""comment 1"""
date="2020-07-02T16:30:03Z"
content="""
Yeah, this adjustGitRepo that re-runs the code repeatedly sometimes is very
hard to understand and I guess needs to be redone entirely somehow.
I've reverted the commit, reopened the old bug which I prefer to this one.
"""]]