Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error ls remote #351

Merged
merged 15 commits into from Apr 10, 2019

Conversation

Projects
None yet
3 participants
@dinosaure
Copy link
Member

commented Apr 4, 2019

Continuation of #350 to handle, this time, error when we want to clone/push/pull/ls-remote a non-existing git repository or a repository where we did not have right.

Use p_report_status inside p_http_report_status to parse PKT-line ins…
…ide PKT-line and use p_http_report_status in TCP flow (wip)

This was referenced Apr 4, 2019

@hannesm

This comment has been minimized.

Copy link
Member

commented Apr 4, 2019

with ke and encore from master each, I run into:

File "src/git/smart.ml", line 1183, characters 10-72:
Error: This expression has type ('a, [> Rresult.R.msg ] as 'b) result state
       but an expression was expected of type Common.advertised_refs state
       Type ('a, 'b) result is not compatible with type
         Common.advertised_refs 

when attempting to compile this... (edit: CI says same)

Handle error when we want to clone/push/ls-remote/pull a non-existing…
… repository or a repository where we did not have rights

@dinosaure dinosaure force-pushed the dinosaure:error-ls-remote branch from 9249ede to 08e5082 Apr 4, 2019

@dinosaure

This comment has been minimized.

Copy link
Member Author

commented Apr 4, 2019

Fixed sorry for the noise.

@hannesm

This comment has been minimized.

Copy link
Member

commented Apr 4, 2019

ok, tests with this PR (08e5082 and ke & encore from their master branches):

  • https remote with username + password
    • pull works fine
    • push reports now:
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 0] byte(s).
2019-04-04 12:03:33 -00:00: DBG [git.gc] Add the object 078437c0ebe67cf2583fa70c6b613b14b2fdb247 in the new PACK file.
2019-04-04 12:03:33 -00:00: DBG [git.gc] Add the object 88c2893ef8df18fd38034deab08cfee24dfb26fe in the new PACK file.
2019-04-04 12:03:33 -00:00: DBG [git.gc] Add the object a4deab8cfe3ffadde4cbf7fbfd4355fc27e2acc0 in the new PACK file.
2019-04-04 12:03:33 -00:00: DBG [git.gc] Ask to try to delta-ify the object a4deab8cfe3ffadde4cbf7fbfd4355fc27e2acc0.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 0] byte(s).
2019-04-04 12:03:33 -00:00: DBG [git.gc] Ask to try to delta-ify the object 078437c0ebe67cf2583fa70c6b613b14b2fdb247.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 220] byte(s).
2019-04-04 12:03:33 -00:00: DBG [cohttp] Send a request to https://github.com/miragebot/testdata.git/git-receive-pack.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 5] byte(s).
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 0] byte(s).
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 220] byte(s).
2019-04-04 12:03:35 -00:00: ERR [application] error while pushing data (`Smart (`Unexpected_char ))
  • git remote (no auth, access denied)
    • pull works
    • push:
2019-04-04 12:06:37 -00:00: DBG [irmin.tree] Tree.find_tree /foo
2019-04-04 12:06:37 -00:00: DBG [irmin.sync] push
2019-04-04 12:06:37 -00:00: DBG [irmin.git] push git://github.com/miragebot/testdata.git
2019-04-04 12:06:37 -00:00: ERR [application] error while pushing data {`Sync Unexpected result: (`SmartError "ERR \n  You can't push to git://github.com/miragebot/testdata.git\n  Use https://github.com/miragebot/testdata.git")}
  • git, local where push is allowed:
    • pull works
    • push works
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 0] byte(s).
2019-04-04 12:08:32 -00:00: DBG [git.gc] Ask to try to delta-ify the object 1c32c2dffd014be4532fba3a7c1bb8e9cbff8be6.
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 220] byte(s).
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 8] byte(s).
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 0] byte(s).
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 220] byte(s).
2019-04-04 12:08:32 -00:00: DBG [irmin.git] push result: XX
2019-04-04 12:08:32 -00:00: APP [application] pushed data
@hannesm

This comment has been minimized.

Copy link
Member

commented Apr 4, 2019

(NB, if https and no proper user + password (the above one was using a user+pass in the url which I removed from the output manually):

2019-04-04 12:13:46 -00:00: DBG [irmin.git] write_index
2019-04-04 12:13:46 -00:00: DBG [irmin.git] write_index/if bare=true head=refs/heads/master
2019-04-04 12:13:46 -00:00: DBG [irmin.sync] push
2019-04-04 12:13:46 -00:00: DBG [irmin.git] push https://github.com/miragebot/testdata.git
2019-04-04 12:13:46 -00:00: DBG [git.sync.http] Launch the GET request to https://github.com/miragebot/testdata.git/info/refs?service=git-receive-pack.
2019-04-04 12:13:46 -00:00: DBG [cohttp] Send a request to https://github.com/miragebot/testdata.git/info/refs?service=git-receive-pack.
2019-04-04 12:13:46 -00:00: ERR [git.sync.http] The HTTP decoder returns an error: (`No_assert_predicate #predicate).
2019-04-04 12:13:46 -00:00: ERR [application] error while pushing data (`Smart (`No_assert_predicate #predicate))
@dinosaure

This comment has been minimized.

Copy link
Member Author

commented Apr 4, 2019

Yes the last one bug is the big and final boss 👍

@dinosaure

This comment has been minimized.

Copy link
Member Author

commented Apr 4, 2019

I just want to say, all of these bugs come from only one problem: a non existing documentation about the Smart protocol

@dinosaure dinosaure force-pushed the dinosaure:error-ls-remote branch from 0caa6d8 to 067371f Apr 4, 2019

@hannesm

This comment has been minimized.

Copy link
Member

commented Apr 4, 2019

ok, with 067371f:

  • git protocol pull works fine!

  • git protocol and (not valid) push works
    2019-04-04 15:38:10 -00:00: ERR [application] error while pushing data {`Sync Unexpected result: (`SmartError "ERR \n You can't push to git://github.com/miragebot/testdata.git\n Use https://github.com/miragebot/testdata.git")}

  • git protocol and valid push works!

  • git protocol and non-existing repository: errors with `SmartError \"ERR access denied or repository not exported

  • https protocol and pull works fine!

  • if repository does not exist, i get:

2019-04-04 15:40:44 -00:00: ERR [git.sync.http] The HTTP decoder returns an error: (`No_assert_predicate #predicate).
2019-04-04 15:40:44 -00:00: ERR [netif] [listen] error while handling (Invalid_argument "Sync.pull_exn: (`Sync Repository not found.)"), continuing. bt: Raised at file "format.ml" (inlined), line 242, characters 35-52
  • https and push to a non-existing repository
2019-04-04 15:43:44 -00:00: ERR [git.sync.http] The HTTP decoder returns an error: (`No_assert_predicate #predicate).
2019-04-04 15:43:44 -00:00: ERR [netif] [listen] error while handling (Invalid_argument "Sync.pull_exn: (`Sync Repository not found.)"), continuing. bt: Raised at file "format.ml" (inlined), line 242, characters 35-52
  • https and unauthenticated push
2019-04-04 15:42:18 -00:00: ERR [git.sync.http] The HTTP decoder returns an error: (`No_assert_predicate #predicate).
2019-04-04 15:42:18 -00:00: ERR [application] error while pushing data (`Smart (`No_assert_predicate #predicate))
2019-04-04 15:44:26 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 220] byte(s).
2019-04-04 15:44:28 -00:00: ERR [application] error while pushing data (`Smart (`Unexpected_char ))

so it seems the success answer for https/smart-http needs to be parsed more politely...

dinosaure and others added some commits Apr 5, 2019

@dinosaure

This comment has been minimized.

Copy link
Member Author

commented Apr 8, 2019

I cherry-pick commit from @clecat when it fits under the topic of this PR. I will add some regression tests to this PR. It will take a time when it's not easy to mimic a Git server but I found a way to do that properly.

@hannesm

This comment has been minimized.

Copy link
Member

commented Apr 9, 2019

nice tests! :)

@dinosaure

This comment has been minimized.

Copy link
Member Author

commented Apr 9, 2019

I need to write the last tests about @clecat fix and it's ready to merge. These tests does not cover HTTP however ... Simulate an HTTP flow is little bit annoying. Good news. this test check some assertions about git in general, mostly about the PACK file. We are more constrained about the way to generate a PACK file (which differs from git - git use a multi-thread to generate a PACK file, and, btw generation is not deterministic) .

@dinosaure

This comment has been minimized.

Copy link
Member Author

commented Apr 10, 2019

The last regression test fails, as expected, in master and works in this PR. Waiting CI and ready to merge.

@dinosaure dinosaure merged commit 5ca10c0 into mirage:master Apr 10, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.