From 04247fb4d01dcc2dc4226f19be11ae341004b4e2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 8 Aug 2022 11:57:24 -0400 Subject: [PATCH] avoid surprising "not found" error when copying to a http remote MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-annex copy --to a http remote will of course fail, as that's not supported. But git-annex copy first checks if the content is already present in the remote, and that threw a "not found". Looks to me like other remotes that use Url.checkBoth in their checkPresent do just return false when it fails. And Url.checkBoth does display errors when unusual errors occur. So I'm pretty sure removing this error message is ok. Sponsored-by: Jarkko Kniivilä on Patreon --- Remote/Git.hs | 7 ++-- ..._f97de485f97d8016a5ab4e276799d230._comment | 36 +++++++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 doc/bugs/GIN_is_not_recognized_as_a_git-annex_enabled_repos/comment_4_f97de485f97d8016a5ab4e276799d230._comment diff --git a/Remote/Git.hs b/Remote/Git.hs index 0af5a3eb98..48f2422cd8 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -407,10 +407,9 @@ inAnnex' repo rmt st@(State connpool duc _ _ _) key where checkhttp = do gc <- Annex.getGitConfig - ifM (Url.withUrlOptionsPromptingCreds $ \uo -> anyM (\u -> Url.checkBoth u (fromKey keySize key) uo) (keyUrls gc repo rmt key)) - ( return True - , giveup "not found" - ) + Url.withUrlOptionsPromptingCreds $ \uo -> + anyM (\u -> Url.checkBoth u (fromKey keySize key) uo) + (keyUrls gc repo rmt key) checkremote = P2PHelper.checkpresent (Ssh.runProto rmt connpool (cantCheck rmt)) key checklocal = ifM duc ( guardUsable repo (cantCheck repo) $ diff --git a/doc/bugs/GIN_is_not_recognized_as_a_git-annex_enabled_repos/comment_4_f97de485f97d8016a5ab4e276799d230._comment b/doc/bugs/GIN_is_not_recognized_as_a_git-annex_enabled_repos/comment_4_f97de485f97d8016a5ab4e276799d230._comment new file mode 100644 index 0000000000..d2d44cd9cd --- /dev/null +++ b/doc/bugs/GIN_is_not_recognized_as_a_git-annex_enabled_repos/comment_4_f97de485f97d8016a5ab4e276799d230._comment @@ -0,0 +1,36 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 4""" + date="2022-08-08T15:27:21Z" + content=""" +Well, that is a different problem than the problem you reported, isn't it? +You seem to have shown that git-annex does in fact recognize your GIN +remote as a git-annex repo. + +git-annex does not support uploading files to a git repo on GIN using http. + +The datalad documentation says to add a remote using the ssh url of the GIN +repository, which git-annex can store files on. See + + +Without using datalad, the equivilant commands would be something like: + + git remote add gin git@gin.g-node.org:/ivis-mizuguchi/https.git + git-annex copy --to gin + +--- + +So this leaves the question of why git-annex tries to do a http request +when you ask it to copy the content to the http repo. That http request +failing is what results in the "(not found)" message. + +Looks like that is due to `git-annex copy` checking to see if the content +exists on the remote. It does not. So it ought to try to send it, +which would fail with a better "copying to non-ssh repo not supported" error message. +However, intstead it displays the error. + +I've fixed this bug, and now it fails with this message: + + copy test3.txt (to origin...) + copying to non-ssh repo not supported +"""]] -- 2.30.2