-
Notifications
You must be signed in to change notification settings - Fork 50
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
Expose HEAD branch in RemoteConfig #106
Comments
The default branch of a remote repository is not stored in the static remote configuration of the git client. Run the ls-remote command which returns all refs. The list starts with the value of the symbolic ref
Refer to the class If you are running |
but why can't it be exposed in note: talking on the git list about fixing places where this HEAD ref is not automatically present. There is ongoing work even before this conversation. I'm not as frustrated with |
Description
The value I'm looking for, given this command would be
main
which from source diving I think being retrieved using
Constant.HEAD
but doesn't appear to be publicly exposed in any way.RemoteConfig::getHeadBranch
feels appropriate, I'm not certain whether it should return aString
or aRef
Motivation
I need this so I can find the default branch and do describe like behavior to count its distance from the last tag. More complexly, I want to find the distance of the most common ancestor of a branch from the "HEAD branch" from its most recent tag.
I am not trying to clone.
Alternatives considered
I guess I could copy/paste this implementation to get it, accessing
FetchResult
myself. In the mean time I'm probably going to do an educated guess heuristic, or have a user explicitly set it. Both of which are fragile, and would not change if the remote actually changed. I might actually just invokegit
but I'm trying to avoid that due to the lack of happyness of gradle regarding invoking external processes when using the configuration cache.Additional context
The text was updated successfully, but these errors were encountered: