Teach Remote to transform references using its default fetchspec #349

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@jamill
libgit2 member

Expose the refspec transform for a remote's default fetchspec.

@nulltoken
libgit2 member

@jamill Could you please share some information describing when this feature should be used from the consumer standpoint?

@jamill
libgit2 member

@nulltoken This can be used to identify the remote branch that a local branch would track when it is pushed up to the server. With the current API to set the upstream tracking branch, you have to pass in the reference to the tracked branch. This means to push up a new branch (refs/heads/new_branch) and set the upstream, you need to know the upstream branch that it will correspond to (through this transformation).

After pushing this up, I think a better way to achieve this is to expose a way to set the upstream remote / merge branch directly on a local branch (so, I could set the merge branch directly as refs/heads/new_branch on a local branch). I will submit a new PR exposing this functionality shortly.

This method still could still be useful if you wanted to check what a local branch's remote branch would be...

@jamill
libgit2 member

@nulltoken - with #353, I don't think this functionality is explicity required for my scenario - but it does work and might be useful later on (or to someone else). Howe would you like to proceed? Is this functionality something that might be useful?

@nulltoken
libgit2 member

It looks a little bit low level, but I'd hate ditching this. Can you think about a user scenario which would require such feature?
On a different topic, I'm not a huge fan of the names of the functions. How about something like MapTo[Source|Target]Reference?

/cc @carlosmn @dahlbyk

@yorah yorah referenced this pull request Apr 5, 2013
Merged

Add Push overloads #385

1 of 2 tasks complete
@yorah

@jamill I included part of this PR in #385 (Remote.FetchSpecTransformToSource()). Do you see other use cases for which we would need to implement Remote.FetchSpecTransformToTarget() in libgit2sharp?

If the answer is no, maybe we could close this issue :)

@jamill
libgit2 member

I don't have other use cases for this at this time. I will close it now. Thanks.

@jamill jamill closed this Jul 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment