libgit2 / pygit2

Python bindings for libgit2

Home Page:https://www.pygit2.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for remote refspecs

jdavid opened this issue · comments

There is a regression in the master branch regarding the 0.18.1 release. After the changes in libgit2 0.19 we have lost the Remote.fetchspec setter. To get back the ability to modify remote's refspecs, and to do so properly, we need to:

  • Implement a Refspec type, in a new file src/refspec.c
  • Wrap more libgit2 functions in the Remote type

Volunteers?

Hi, @jdavid I will do this.
Can you show more details?

Hi @xtao and thank you for volunteering!

This is the API to implement.

Constants:

GIT_DIRECTION_FETCH
GIT_DIRECTION_PUSH

Refspec type, src/refspec.c:

Refspec.direction => GIT_DIRECTION_FETCH / GIT_DIRECTION_PUSH
Refspec.dst => <str>
Refspec.dst_matches(refname:<str>) => True / False
Refspec.force => True/False
Refspec.src => <str>
Refspec.src_matches(refname:<str>) => True/False
Refspec.string => <str>

Remote type, remote.c:

Remote.add_fetch(refspec:<str>) => None
Remote.add_push(refspec:<str>) => None
Remote.clear_refspecs() => None
Remote.get_fetch_refspecs() => [<str>, ...]
Remote.get_push_refspecs() => [<str>, ...]
Remote.get_refspec(n:<int>) => <Refspec>
Remote.remove_refspec(n:<int>) => None

Note that:

Do you have questions?

With libgit2 v0.20, we have the ability to set the fetch and push refspecs again. Removing the nth refspec isn't something we want to do anyway, so the only parts missing should be add_fetch, and add_push.

Fixed #318

With the PRs that got merged recently, this can be closed, no?

yes, thanks!