diff --git a/Git/Config.hs b/Git/Config.hs index 7e12a568e0..c76794bf1d 100644 --- a/Git/Config.hs +++ b/Git/Config.hs @@ -104,19 +104,23 @@ global = do hRead :: Repo -> ConfigStyle -> Handle -> IO Repo hRead repo st h = do 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. - The git config may be multiple lines, or a single line. - Config settings can be updated incrementally. -} store :: S.ByteString -> ConfigStyle -> Repo -> IO Repo -store s st repo = do - let c = parse s st - updateLocation $ repo - { config = (M.map Prelude.head c) `M.union` config repo - , fullconfig = M.unionWith (++) c (fullconfig repo) - } +store s st = storeParsed (parse s st) + +storeParsed :: M.Map ConfigKey [ConfigValue] -> Repo -> IO Repo +storeParsed c repo = updateLocation $ repo + { config = (M.map Prelude.head c) `M.union` config repo + , fullconfig = M.unionWith (++) c (fullconfig repo) + } {- Stores a single config setting in a Repo, returning the new version of - the Repo. Config settings can be updated incrementally. -} diff --git a/Utility/Process.hs b/Utility/Process.hs index e768c13367..07f035d342 100644 --- a/Utility/Process.hs +++ b/Utility/Process.hs @@ -189,11 +189,13 @@ withCreateProcess p action = bracket (createProcess p) cleanupProcess debugProcess :: CreateProcess -> ProcessHandle -> IO () debugProcess p h = do pid <- getPid h - debug "Utility.Process" $ unwords + debug "Utility.Process" $ unwords $ [ describePid pid , action ++ ":" , showCmd p - ] + ] ++ case cwd p of + Nothing -> [] + Just c -> ["in", show c] where action | piped (std_in p) && piped (std_out p) = "chat" diff --git a/doc/bugs/need_more_debug_for_failing_to_get_uuid_or_key_.mdwn b/doc/bugs/need_more_debug_for_failing_to_get_uuid_or_key_.mdwn index ad785991e0..9ba5498631 100644 --- a/doc/bugs/need_more_debug_for_failing_to_get_uuid_or_key_.mdwn +++ b/doc/bugs/need_more_debug_for_failing_to_get_uuid_or_key_.mdwn @@ -36,3 +36,10 @@ originally in some older 8.2022 but now in 10.20230407 [[!meta author=yoh]] [[!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]] diff --git a/doc/bugs/need_more_debug_for_failing_to_get_uuid_or_key_/comment_1_6c3efd1922015a20daf93bea54fc6431._comment b/doc/bugs/need_more_debug_for_failing_to_get_uuid_or_key_/comment_1_6c3efd1922015a20daf93bea54fc6431._comment new file mode 100644 index 0000000000..9c4abc90eb --- /dev/null +++ b/doc/bugs/need_more_debug_for_failing_to_get_uuid_or_key_/comment_1_6c3efd1922015a20daf93bea54fc6431._comment @@ -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"]) [...] +"""]]