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

Git clone button is disabled in main directory #809

Closed
stefaneidelloth opened this issue Oct 28, 2020 · 5 comments · Fixed by #810
Closed

Git clone button is disabled in main directory #809

stefaneidelloth opened this issue Oct 28, 2020 · 5 comments · Fixed by #810

Comments

@stefaneidelloth
Copy link

stefaneidelloth commented Oct 28, 2020

If I restart the server, the git clone button is enabled.
If I navigate into a folder that is connected with a repo and navigate
back to the main folder, the git clone button is disabled.

=> I am not able to git clone additional repositories.

image

Expected behavior: git clone button should be enabled if no ".git" folder exists in the current directory
nor in a parent directory.

image

After restart of Server:

image

@adammclaurin
Copy link

We're having the same problem. Refreshing the browser page seems to be a workaround but definitely should be fixed.

@wdalrymple
Copy link

Having the same issue as well, please fix!

@ianhi
Copy link
Collaborator

ianhi commented Oct 28, 2020

Can someone who is experiencing this issue fill out the information from the issue template:

- Python package version:
<!-- Results of `conda list jupyterlab-git` or `pip show jupyterlab-git` -->
- Extension version:
<!-- Results of `jupyter labextension list` -->
- Git version:
<!-- Results of `git --version` -->
- Operating System and its version:

as well as post the output from the command line where you ran jupyter lab

@ianhi
Copy link
Collaborator

ianhi commented Oct 29, 2020

Ok I see this error on version 0.22.2 but not on 0.22.1 so I suspect it was introduced by 1a9c004, in particular the set_status here:

if show_top_level["code"] != 0:
self.set_status(500)
self.finish(json.dumps(show_top_level))

which will be set if not in a git repo and the frontend doesn't know how to handle that.

javascript console output:

Fail to find Git top level for path .
Error: fatal: not a git repository (or any of the parent directories): .git
model.js:133:41
XHRPOSThttp://localhost:8891/git/show_top_level?1603944462921
[HTTP/1.1 500 Internal Server Error 7ms]

Fail to find Git top level for path Documents.
Error: fatal: not a git repository (or any of the parent directories): .git
model.js:133:41
XHRPOSThttp://localhost:8891/git/show_top_level?1603944472237
[HTTP/1.1 500 Internal Server Error 6ms]

Fail to find Git top level for path Documents.
Error: fatal: not a git repository (or any of the parent directories): .git
model.js:133:41

terminal output:

[E 00:07:42.939 LabApp] 500 POST /git/show_top_level?1603944462921 (::1) 6.65ms referer=http://localhost:8891/lab/workspaces/auto-H
[E 00:07:52.247 LabApp] {
      "Host": "localhost:8891",
      "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0",
      "Accept": "*/*",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept-Encoding": "gzip, deflate",
      "Referer": "http://localhost:8891/lab/workspaces/auto-H",
      "Content-Type": "text/plain;charset=UTF-8",
      "Authorization": "token 5f2efe9cc3484c36d0a475af8081297c5b7381186f7394da",
      "X-Xsrftoken": "2|98253b0e|e5772faf1c4638634133dc21bb2dff18|1603428018",
      "Origin": "http://localhost:8891",
      "Content-Length": "28",
      "Dnt": "1",
      "Connection": "keep-alive",
      "Cookie": "username-localhost-8892=\"2|1:0|10:1601400096|23:username-localhost-8892|44:YmMyMDNlMzI3MzViNDY0Mzk2ZjY3MzEyMDg2NTc1YTI=|c9983aa082f4dfb13f14b2ded027bd22bc287de768997737128edd49d9614aba\"; username-localhost-8889=\"2|1:0|10:1603942592|23:username-localhost-8889|44:ZWJiMThlZWEyNmE5NDQ0YjgwZWViN2E5Y2IzZDA3MWQ=|9de9a225bab6cbd27b2c2dbcd725d49fd0894d9d3e3c2770e1bf5842bf463d54\"; username-localhost-8890=\"2|1:0|10:1603943434|23:username-localhost-8890|44:M2RmM2ZjNjM2MGYwNDE3MWIwNGVmMDQxOTE1ZjJhZmM=|6ad42cd415b50e946cd4aa7dd25895f86d4ca80a989d332a3be1b63b82cd0174\"; username-localhost-8888=\"2|1:0|10:1603912063|23:username-localhost-8888|44:ZTE2OGE2MDA0NzE0NDkxNzkxMjc2NTc2NzNkMGJiOGY=|18c43c5db5f4544c1e417174cc41507f560b0c351eb5a244bfc50475e66c7c71\"; username-localhost-8821=\"2|1:0|10:1601517324|23:username-localhost-8821|44:OGMyNTAxZGYwYzcwNDQ3OWExZGMxYjQyMzZlZDkwZDk=|3e9d8dedef5a29d86920579c926629d8bfea8cc6376d7691b5e5782f4fffcf74\"; _xsrf=2|98253b0e|e5772faf1c4638634133dc21bb2dff18|1603428018; username-localhost-8891=\"2|1:0|10:1603944472|23:username-localhost-8891|44:NzhkNTNlOWNiMDhkNDU1ZGI4ZDdiOTY0ZjM2YzM2NTg=|38c3a2aa881e88065cd3057fd1cb477a341344a71d9652e20b7ac9af1962c497\"",
      "Sec-Gpc": "1",
      "Pragma": "no-cache",
      "Cache-Control": "no-cache"
    }
[E 00:07:52.247 LabApp] 500 POST /git/show_top_level?1603944472237 (::1) 5.17ms referer=http://localhost:8891/lab/workspaces/auto-H

@fcollonval
Copy link
Member

@ianhi Yep this is the bug source. Thanks for investigating.
The correction should not be to revert this. The fix should correct the showTopLevel (and showPrefix) method in the frontend to return a string or null (in case of error). This will abstract the method from the underlining git subprocess call as it should.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants