display exception as part of warnings

and comment that led to this change
This commit is contained in:
Joey Hess 2021-01-19 12:27:42 -04:00
parent 4d51c9f148
commit 7ccddd4aea
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 24 additions and 4 deletions

View file

@ -93,8 +93,8 @@ fixupUnusualRepos r@(Repo { location = l@(Local { worktree = Just w, gitdir = d
| needsSubmoduleFixup r = do
when (coreSymlinks c) $
(replacedotgit >> unsetcoreworktree)
`catchNonAsync` \_e -> hPutStrLn stderr
"warning: unable to convert submodule to form that will work with git-annex"
`catchNonAsync` \e -> hPutStrLn stderr $
"warning: unable to convert submodule to form that will work with git-annex: " ++ show e
return $ r'
{ config = M.delete "core.worktree" (config r)
}
@ -102,8 +102,8 @@ fixupUnusualRepos r@(Repo { location = l@(Local { worktree = Just w, gitdir = d
( do
when (coreSymlinks c) $
(replacedotgit >> worktreefixup)
`catchNonAsync` \_e -> hPutStrLn stderr
"warning: unable to convert .git file to symlink that will work with git-annex"
`catchNonAsync` \e -> hPutStrLn stderr $
"warning: unable to convert .git file to symlink that will work with git-annex: " ++ show e
return r'
, return r
)

View file

@ -0,0 +1,20 @@
[[!comment format=mdwn
username="joey"
subject="""comment 2"""
date="2021-01-19T16:14:38Z"
content="""
Hmm, that happens if it somehow gets an exception while fixing up the .git
file and unsetting core.worktree in the git config. I've modified the code
so it now will display the exception as part of that message.
If by "get for every file" you mean the same run of git-annex is displaying
it repeatedly, that would be weird -- it's run in early startup not later.
One way I can see this failing is if core.worktree is not actually set.
Then unsetting it would fail and it would display this message. But it
would not even try to unset core.worktree unless something tells
git-annex that the git directory is located under the parent repo's
.git/modules/ Despite the `git rev-parse` you show, something is
making git-annex still think that is the case. Likely because .git
is not a symlink.
"""]]