commit - 3962e86afd3ac8e3cd0d102c91b7fb4bc436fea4
commit + e350ead34f47da102e6936f902c68f38131d315a
blob - 621a020293d6051bf22facd02ba75e02d422ba59
blob + 3d6209819562b277b9a1e0894932474a4270b345
--- lib/got_worktree_priv.h
+++ lib/got_worktree_priv.h
#define GOT_WORKTREE_FILE_INDEX "fileindex"
#define GOT_WORKTREE_REPOSITORY "repository"
#define GOT_WORKTREE_PATH_PREFIX "path-prefix"
+#define GOT_WORKTREE_BASE_COMMIT "base-commit"
#define GOT_WORKTREE_LOCK "lock"
#define GOT_WORKTREE_FORMAT "format"
blob - cdfcd000a8660c94d153db4902677bbfc283eafa
blob + d4385a5b8e1514fa9e72dbff1f8d43cf442aacab
--- lib/worktree.c
+++ lib/worktree.c
if (err)
goto done;
+ /* Create an empty base commit file. */
+ err = create_meta_file(gotpath, GOT_WORKTREE_BASE_COMMIT, NULL);
+ if (err)
+ goto done;
+
/* Write the HEAD reference. */
refstr = got_ref_to_str(head_ref);
if (refstr == NULL) {
blob - 280103eade2f9a6bb4b039407d36286b71588f0c
blob + fc196217ddd8038adaa56e6ce10ad4fb6ff9a239
--- regress/worktree/worktree_test.c
+++ regress/worktree/worktree_test.c
return 0;
if (!remove_meta_file(worktree_path, GOT_WORKTREE_PATH_PREFIX))
return 0;
+ if (!remove_meta_file(worktree_path, GOT_WORKTREE_BASE_COMMIT))
+ return 0;
if (!remove_meta_file(worktree_path, GOT_WORKTREE_LOCK))
return 0;
if (!remove_meta_file(worktree_path, GOT_WORKTREE_FORMAT))
goto done;
if (!check_meta_file_exists(worktree_path, GOT_WORKTREE_LOCK))
goto done;
+ if (!check_meta_file_exists(worktree_path, GOT_WORKTREE_BASE_COMMIT))
+ goto done;
if (!check_meta_file_exists(worktree_path, GOT_WORKTREE_FILE_INDEX))
goto done;
if (!check_meta_file_exists(worktree_path, GOT_WORKTREE_REPOSITORY))
GOT_WORKTREE_LOCK))
goto done;
if (!obstruct_meta_file_and_init(&ok, repo, worktree_path,
+ GOT_WORKTREE_BASE_COMMIT))
+ goto done;
+ if (!obstruct_meta_file_and_init(&ok, repo, worktree_path,
GOT_WORKTREE_FILE_INDEX))
goto done;
if (!obstruct_meta_file_and_init(&ok, repo, worktree_path,
if (repo)
got_repo_close(repo);
free(gotpath);
- if (ok == 6)
+ if (ok == 7)
remove_worktree(worktree_path);
- return (ok == 6);
+ return (ok == 7);
}
#define RUN_TEST(expr, name) \