Commit Diff


commit - e350ead34f47da102e6936f902c68f38131d315a
commit + fdf001a7fe7090e3571dfbbfd1d49159c2416756
blob - 3d6209819562b277b9a1e0894932474a4270b345
blob + 206bddffe16837ad2826addc8148245913869383
--- lib/got_worktree_priv.h
+++ lib/got_worktree_priv.h
@@ -37,6 +37,7 @@ struct got_worktree {
 #define GOT_WORKTREE_REPOSITORY		"repository"
 #define GOT_WORKTREE_PATH_PREFIX	"path-prefix"
 #define GOT_WORKTREE_BASE_COMMIT	"base-commit"
+#define GOT_WORKTREE_HEAD		"head"
 #define GOT_WORKTREE_LOCK		"lock"
 #define GOT_WORKTREE_FORMAT		"format"
 
blob - d4385a5b8e1514fa9e72dbff1f8d43cf442aacab
blob + 39e5396de674d23b30ab7cdcfc555a29b0187952
--- lib/worktree.c
+++ lib/worktree.c
@@ -173,7 +173,7 @@ got_worktree_init(const char *path, struct got_referen
 	if (err)
 		goto done;
 
-	/* Create an empty base commit file. */
+	/* Set base commit to empty. */
 	err = create_meta_file(gotpath, GOT_WORKTREE_BASE_COMMIT, NULL);
 	if (err)
 		goto done;
@@ -184,7 +184,7 @@ got_worktree_init(const char *path, struct got_referen
 		err = got_error(GOT_ERR_NO_MEM);
 		goto done;
 	}
-	err = create_meta_file(gotpath, GOT_REF_HEAD, refstr);
+	err = create_meta_file(gotpath, GOT_WORKTREE_HEAD, refstr);
 	if (err)
 		goto done;
 
blob - fc196217ddd8038adaa56e6ce10ad4fb6ff9a239
blob + 5bacfa8cc12585d35d6d04e64c705ab147e87f6e
--- regress/worktree/worktree_test.c
+++ regress/worktree/worktree_test.c
@@ -81,7 +81,7 @@ remove_meta_file(const char *worktree_path, const char
 static int
 remove_worktree(const char *worktree_path)
 {
-	if (!remove_meta_file(worktree_path, GOT_REF_HEAD))
+	if (!remove_meta_file(worktree_path, GOT_WORKTREE_HEAD))
 		return 0;
 	if (!remove_meta_file(worktree_path, GOT_WORKTREE_FILE_INDEX))
 		return 0;
@@ -170,7 +170,7 @@ worktree_init(const char *repo_path)
 		goto done;
 
 	/* Ensure required files were created. */
-	if (!check_meta_file_exists(worktree_path, GOT_REF_HEAD))
+	if (!check_meta_file_exists(worktree_path, GOT_WORKTREE_HEAD))
 		goto done;
 	if (!check_meta_file_exists(worktree_path, GOT_WORKTREE_LOCK))
 		goto done;
@@ -274,7 +274,7 @@ worktree_init_exists(const char *repo_path)
 
 	/* Create files which got_worktree_init() will try to create as well. */
 	if (!obstruct_meta_file_and_init(&ok, repo, worktree_path,
-	    GOT_REF_HEAD))
+	    GOT_WORKTREE_HEAD))
 		goto done;
 	if (!obstruct_meta_file_and_init(&ok, repo, worktree_path,
 	    GOT_WORKTREE_LOCK))