Commit 35be1456d63733ac069f13cc4b0b75b1f922ae70

Stefan Sperling 2018-03-11T14:27:53

implement got_worktree_get_head_ref_name()

diff --git a/include/got_worktree.h b/include/got_worktree.h
index e3dda9b..190780e 100644
--- a/include/got_worktree.h
+++ b/include/got_worktree.h
@@ -21,7 +21,7 @@ const struct got_error *got_worktree_init(const char *, struct got_reference *,
 const struct got_error *got_worktree_open(struct got_worktree **, const char *);
 void got_worktree_close(struct got_worktree *);
 char *got_worktree_get_repo_path(struct got_worktree *);
-struct got_reference *got_worktree_get_head(struct got_worktree *);
+char  *got_worktree_get_head_ref_name(struct got_worktree *);
 const struct got_error *got_worktree_change_head(struct got_worktree *,
     struct got_reference *, struct got_repository *);
 const struct got_error *got_worktree_checkout_files(struct got_worktree *,
diff --git a/lib/worktree.c b/lib/worktree.c
index a561e0b..70a5f97 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -334,10 +334,10 @@ got_worktree_get_repo_path(struct got_worktree *worktree)
 	return strdup(worktree->repo_path);
 }
 
-struct got_reference *
-got_worktree_get_head(struct got_worktree *worktree)
+char *
+got_worktree_get_head_ref_name(struct got_worktree *worktree)
 {
-	return NULL;
+	return strdup(worktree->head_ref);
 }
 
 const struct got_error *