Skip to content
\n

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:

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

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?

\n

Many thanks and best regards,
\nMarkus

","upvoteCount":1,"answerCount":3,"acceptedAnswer":{"@type":"Answer","text":"

@Byron Many thanks. I think it is clear now for me how to use the \"new\" fetch function. Unfortunately, I don't know which options are provided to my function as they are read from an input file and I can't change the input file due to compatibility issues and other problems. Therefore my function still looks as follows:

\n
def fetch_tag(remote, tag, fetch_options):\n    remote.fetch(?)\n
\n

In the past I was using the fetch method of a Remote, but I think I need to change that to use git directly:

\n
def fetch_tag(remote, tag, fetch_options):\n    remote.repo.git.fetch([\"-v\", remote.name, \"tag\", tag] + fetch_options)\n
\n

This is more or less fine for me, although using the official method feels somehow better.

\n

Another option would be to convert my list of fetch_options to a dictionary, but I think it is not worth the effort and it may also get a little bit complicated.

","upvoteCount":1,"url":"https://github.com/gitpython-developers/GitPython/discussions/1540#discussioncomment-4683984"}}}

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

Answered by gpxricky
gpxricky asked this question in Q&A
Discussion options

You must be logged in to vote

@Byron Many thanks. I think it is clear now for me how to use the "new" fetch function. Unfortunately, I don't know which options are provided to my function as they are read from an input file and I can't change the input file due to compatibility issues and other problems. Therefore my function still looks as follows:

def fetch_tag(remote, tag, fetch_options):
    remote.fetch(?)

In the past I was using the fetch method of a Remote, but I think I need to change that to use git directly:

def fetch_tag(remote, tag, fetch_options):
    remote.repo.git.fetch(["-v", remote.name, "tag", tag] + fetch_options)

This is more or less fine for me, although using the official method feels somehow …

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Byron
Comment options

Comment options

You must be logged in to vote
1 reply
@Byron
Comment options

Answer selected by gpxricky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1538 on January 14, 2023 07:28.