Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Made DetachedHead public #188

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

Haacked commented Jun 19, 2012

We need to be able to determine whether the current "branch" is a detached
head. But we can't compare it if the type is internal.

For example,

if (someBranch is DetachedHead) {...}

This commit makes it public and mockable.

Made DetachedHead public
We need to be able to determine whether the current "branch" is a detached
head. But we can't compare it if the type is internal.

For example,

    if (someBranch is DetachedHead) {...}

This commit makes it public and mockable.
Member

nulltoken commented Jun 20, 2012

@Haacked

In order to retrieve a DetachedHead, there's currently no other way than querying the content of the repo.Head property.

DetachedHead is an internal type used to reflect that HEAD is no longer a symbolic reference, but has been turned into a direct reference. As the type is rather an implementation detail, I'm not willing to expose it and I won't merge this PR.

However, you should already be able to achieve similar behavior than if (someBranch is DetachedHead) {...} by leveraging the two following properties

  • branch.IsCurrentRepositoryHead
  • repo.Info.IsHeadDetached

Thanks a lot!

@nulltoken nulltoken closed this Jun 20, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment