Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

My git fetch command is broken after updating from 3.1.20 to 3.1.30 #1538

Closed
gpxricky opened this issue Jan 13, 2023 · 2 comments
Closed

My git fetch command is broken after updating from 3.1.20 to 3.1.30 #1538

gpxricky opened this issue Jan 13, 2023 · 2 comments

Comments

@gpxricky
Copy link

gpxricky commented Jan 13, 2023

Hi,
in gitpython version 3.1.20 I was using the following construct:

# The list is filled with information from an external source like a configuration file, current content is just an example
fetch_options = [ "--depth", "1", "tag", tag_to_fetch ] 
remote.fetch(fetch_options)

It worked fine, although I wasn't sure if I used the function properly. After updating to version 3.1.30 the following git error is raised: 'fatal: couldn't find remote ref --depth'. This is because the git cmd command changed to:

git fetch -v -- origin --depth 1 tag MY_TEST_TAG

Which is obviously wrong now. How do I need to change my fetch call in order to fetch a tag with some additional options for the command that may be read from a text file?

Many thanks and best regards,
Markus

@stsewd
Copy link
Contributor

stsewd commented Jan 13, 2023

Hi, similar to #1528, you were relying on a security vulnerability that allowed positional arguments to be interpreted as options (the first argument from fetch is meant to be a list of refs)

refspec: Union[str, List[str], None] = None,

You need to pass additional options as kwargs.

@gpxricky
Copy link
Author

gpxricky commented Jan 13, 2023

@stsewd Thanks for the information. So at the end, if I need to remain backwards compatible and can't change the input file, then the only solution is to change my command to

fetch_options = [ "-v", "origin", "--depth", "1", "tag", tag_to_fetch ] 
repo.git.fetch(fetch_options)

? I think converting the list to a dictionary is quite complicated as an option may be used with short name or long name, may be written as "--depth=1" or "--depth 1" and may contain multiple values, a single value or no value.

Best regards,
Markus

@gitpython-developers gitpython-developers locked and limited conversation to collaborators Jan 14, 2023
@Byron Byron converted this issue into discussion #1540 Jan 14, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Development

No branches or pull requests

2 participants