-
-
Notifications
You must be signed in to change notification settings - Fork 933
Progression not functional once a single error / fatal line was encountered #1233
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
Comments
Thanks a lot for putting in the time to make this issue reproducible. With the latest GitPython from import creds
from git import Repo, RemoteProgress
from pathlib import Path
import uuid
username = "gitpython-developers"
repo_name = "GitPython"
uuid = uuid.uuid4().hex[:20]
# ---------------
class Progress(RemoteProgress):
def update(self, op_code, cur_count, max_count=None, message=''):
print(f"{op_code} {cur_count} {max_count} {message}")
repo_url = f'https://{creds.token}:[email protected]/{username}/{repo_name}'
repo_path = Path('.tmp') / Path(uuid)
print(f'Cloning the commits history of {repo_name}...')
err = None
try:
#Repo.clone_from("https://github.com/gitpython-developers/GitPython", repo_path, progress=Progress(), multi_options=["--filter=tree:0"])
Repo.clone_from(repo_url, repo_path, progress=Progress(), multi_options=["--filter=tree:0"])
except Exception as error:
err = error
print(err) Thus I was unable to reproduce the issue, running on python 3.8 on MacOS. This is something I would expect as there is no special case for the URL at all. Lines 1012 to 1016 in 96f8f17
Maybe there is something else that influences whether or not progress is sent that isn't present in my particular setup? |
Thanks for your answer. |
Maybe it's the way you get the stream that doesn't work the same way on Windows. |
Thanks for sorting this out, very helpful! It's definitely something the next major release of GitPython will fix. |
I'll let you know, thank you, for the moment I'm trying to understand all your pumps / streams things aha 😄 |
I added a print in this function, before the two handlers : Lines 78 to 89 in 96f8f17
And the stream is well received in the two case, here is the x-oauth-basic case : And with a normal link : So the issue should be in the output processing. |
I can't confirm it nor deny it. My spotty memory tells me this isn't the first time I hear about an issue like it though, if that helps. |
I finally figured out the issue ! GitPython printed this line at the end so I didn't think it was the issue, but it was : "fatal: credential-cache unavailable; no unix socket support" and the stream got it at the beginning. Lines 426 to 446 in 96f8f17
if there is only one line that starts with "error:" or "fatal:", it put all the next output in the "self.error_lines" variable even if they are not errors, and so that condition still True until the end. My solution was to fix the error itself by doing it : git config --global credential.helper wincred But what do you think about editing the parsing function to let the progress going on even if there was an error at the beginning ? |
Fantastic! I think it shouldn’t consider everything else an error just beca It found one. Maybe worth a try removing that check and see what breaks in CI. A PR is definitely welcome. |
To reactivate this error case, we can do this command : I submitted a PR to avoid this issue ! #1248 |
To run the script properly, just create a creds.py file with a token variable, and a .tmp folder
If you comment the 1st Repo.clone_from and uncomment the 2nd, the progress will not work anymore, even though the progress is showing up using the git binary.
The text was updated successfully, but these errors were encountered: