Reputation: 193
Is it possible to fetch only new branches with libgit2? This would mean that no refs/remotes/<existing_branch>
would be updated, just that new refs/remotes/<new_branch>
would be created. Not sure what should be done with refs/heads/<new_branch>
, but it probably should also be created, correct?
Currently, the only way I see of obtaining any new-branch-fetch behavior is to call git_remote_fetch()
with NULL for refspecs. This will however update whole repository. Or, should I call git_remote_ls()
and create explicit refspec for *fetch
?
Upvotes: 0
Views: 184
Reputation: 5277
Those are not semantics which exist anywhere within Git, so you'd have to do it yourself. If you want to figure out which branches are new, you have to use git_remote_ls()
before the fetch itself, figure out which are the new branches and then use a list of refspecs to download only those.
I don't know what you mean by using a NULL
achieving this behaviour, because there's no way to set the default refspecs to do that. That will just behave like git fetch
and use the configured refspecs for the given remote.
Upvotes: 2