add git config debugging
(and process cwd debugging) Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
parent
ee23c540ea
commit
0da0e2efcc
4 changed files with 46 additions and 9 deletions
|
@ -104,16 +104,20 @@ global = do
|
||||||
hRead :: Repo -> ConfigStyle -> Handle -> IO Repo
|
hRead :: Repo -> ConfigStyle -> Handle -> IO Repo
|
||||||
hRead repo st h = do
|
hRead repo st h = do
|
||||||
val <- S.hGetContents h
|
val <- S.hGetContents h
|
||||||
store val st repo
|
let c = parse val st
|
||||||
|
debug (DebugSource "Git.Config") $ "git config read: " ++
|
||||||
|
show (map (\(k, v) -> (show k, map show v)) (M.toList c))
|
||||||
|
storeParsed c repo
|
||||||
|
|
||||||
{- Stores a git config into a Repo, returning the new version of the Repo.
|
{- Stores a git config into a Repo, returning the new version of the Repo.
|
||||||
- The git config may be multiple lines, or a single line.
|
- The git config may be multiple lines, or a single line.
|
||||||
- Config settings can be updated incrementally.
|
- Config settings can be updated incrementally.
|
||||||
-}
|
-}
|
||||||
store :: S.ByteString -> ConfigStyle -> Repo -> IO Repo
|
store :: S.ByteString -> ConfigStyle -> Repo -> IO Repo
|
||||||
store s st repo = do
|
store s st = storeParsed (parse s st)
|
||||||
let c = parse s st
|
|
||||||
updateLocation $ repo
|
storeParsed :: M.Map ConfigKey [ConfigValue] -> Repo -> IO Repo
|
||||||
|
storeParsed c repo = updateLocation $ repo
|
||||||
{ config = (M.map Prelude.head c) `M.union` config repo
|
{ config = (M.map Prelude.head c) `M.union` config repo
|
||||||
, fullconfig = M.unionWith (++) c (fullconfig repo)
|
, fullconfig = M.unionWith (++) c (fullconfig repo)
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,11 +189,13 @@ withCreateProcess p action = bracket (createProcess p) cleanupProcess
|
||||||
debugProcess :: CreateProcess -> ProcessHandle -> IO ()
|
debugProcess :: CreateProcess -> ProcessHandle -> IO ()
|
||||||
debugProcess p h = do
|
debugProcess p h = do
|
||||||
pid <- getPid h
|
pid <- getPid h
|
||||||
debug "Utility.Process" $ unwords
|
debug "Utility.Process" $ unwords $
|
||||||
[ describePid pid
|
[ describePid pid
|
||||||
, action ++ ":"
|
, action ++ ":"
|
||||||
, showCmd p
|
, showCmd p
|
||||||
]
|
] ++ case cwd p of
|
||||||
|
Nothing -> []
|
||||||
|
Just c -> ["in", show c]
|
||||||
where
|
where
|
||||||
action
|
action
|
||||||
| piped (std_in p) && piped (std_out p) = "chat"
|
| piped (std_in p) && piped (std_out p) = "chat"
|
||||||
|
|
|
@ -36,3 +36,10 @@ originally in some older 8.2022 but now in 10.20230407
|
||||||
|
|
||||||
[[!meta author=yoh]]
|
[[!meta author=yoh]]
|
||||||
[[!tag projects/datalad]]
|
[[!tag projects/datalad]]
|
||||||
|
|
||||||
|
> Hard to know when there is *enough* debugging, but with what I've added,
|
||||||
|
> I can't think of any more I could add that would help with a problem of
|
||||||
|
> this kind. Unless of course git-annex has a deep dark bug where it reads
|
||||||
|
> an annex.uuid from git config, but then somehow misplaces it. But I can't
|
||||||
|
> imagine such a bug so it's hard to add debugging for it. So, I suppose
|
||||||
|
> this is [[done]] --[[Joey]]
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 1"""
|
||||||
|
date="2023-05-15T17:43:21Z"
|
||||||
|
content="""
|
||||||
|
Something that prevents `git config` from working, or prevents it from
|
||||||
|
listing an annex.uuid for the remote, seems like the overridingly likely
|
||||||
|
reason for their problem. (You were asking the right questions
|
||||||
|
[here](https://github.com/datalad/datalad/issues/7371#issuecomment-1545975295)
|
||||||
|
and I don't think they really answered them, unless it happened in your office
|
||||||
|
hours.)
|
||||||
|
|
||||||
|
I've made --debug include the output of `git config --list`,
|
||||||
|
which allows seeing if a problem prevents git from reading the config of
|
||||||
|
the remote.
|
||||||
|
|
||||||
|
I also made the debug output tell what directory it's running a command in
|
||||||
|
when it's not the pwd.
|
||||||
|
|
||||||
|
So, for example:
|
||||||
|
|
||||||
|
[2023-05-15 15:16:01.414302245] (Utility.Process) process [59665] read: git ["config","--null","--list"] in "/home/joey/tmp/a"
|
||||||
|
[2023-05-15 15:16:01.419396816] (Git.Config) git config read: [("",[]),("annex.uuid",["9553f51c-87ad-4321-86fb-de4aa630e997"]) [...]
|
||||||
|
"""]]
|
Loading…
Add table
Reference in a new issue