libgit2

git_repository_head_detached_for_worktree

Version:

Check if a worktree's HEAD is detached

A worktree's HEAD is detached when it points directly to a commit instead of a branch.

Signature

int git_repository_head_detached_for_worktree(git_repository *repo, const char *name);

Parameters

In
repo

a repository object

const char *
In
name

name of the worktree to retrieve HEAD for

Returns

int

1 if HEAD is detached, 0 if its not; error code if there was an error

Versions