commit 73119b9106d98ab78deb20d3c60c3d4d80ac8688 from: Stefan Sperling date: Wed Aug 14 13:00:30 2024 UTC make info commands show the work tree format version, too ok op@ commit - 088a1c3b8187114bdc9d9f4ee98c2c8dceb97172 commit + 73119b9106d98ab78deb20d3c60c3d4d80ac8688 blob - 0c373141b94712c86b5183baed684811237bfdc0 blob + e845257c2f89b568c18f692452aa7168844627b5 --- cvg/cvg.c +++ cvg/cvg.c @@ -9108,6 +9108,8 @@ cmd_info(int argc, char *argv[]) printf("work tree branch reference: %s\n", got_worktree_get_head_ref_name(worktree)); printf("work tree UUID: %s\n", uuidstr); + printf("work tree format version: %d\n", + got_worktree_get_format_version(worktree)); printf("file index version: %u\n", got_worktree_fileindex_version(fileindex)); printf("repository: %s\n", got_worktree_get_repo_path(worktree)); blob - 2affb7860e6b084436d9adf95c331abd8fcfc8f6 blob + 98f2a80a699255349e7df2084f6196ddce1d4d10 --- got/got.c +++ got/got.c @@ -14705,6 +14705,8 @@ cmd_info(int argc, char *argv[]) printf("work tree branch reference: %s\n", got_worktree_get_head_ref_name(worktree)); printf("work tree UUID: %s\n", uuidstr); + printf("work tree format version: %d\n", + got_worktree_get_format_version(worktree)); printf("file index version: %u\n", got_worktree_fileindex_version(fileindex)); printf("repository: %s\n", got_worktree_get_repo_path(worktree)); blob - 2ffc0c695b85896305072307f75db7799c0e05a6 blob + 746372d5909f4e6c88f43542fc445638af1b4f4a --- include/got_worktree.h +++ include/got_worktree.h @@ -91,6 +91,11 @@ const char *got_worktree_get_path_prefix(struct got_wo const struct got_error *got_worktree_get_uuid(char **, struct got_worktree *); /* + * Get the work tree's format version number. + */ +int got_worktree_get_format_version(struct got_worktree *); + +/* * Check if a user-provided path prefix matches that of the worktree. */ const struct got_error *got_worktree_match_path_prefix(int *, blob - 2f9d146493695f5d0f999c4ccca8b981ffdf7c9d blob + b1acd87d261a238419bf3f34736ce810f1efd4b8 --- lib/got_lib_worktree.h +++ lib/got_lib_worktree.h @@ -23,6 +23,7 @@ struct got_worktree { struct got_object_id *base_commit_id; char *head_ref_name; uuid_t uuid; + int format_version; /* * File descriptor for the lock file, open while a work tree is open. blob - 4b99863a5f6d3ae6dcce8b52c6d2a93a1a80b3d3 blob + 1855ba0c1a557ce16cfae9790d6cff44a4b71846 --- lib/worktree_open.c +++ lib/worktree_open.c @@ -171,6 +171,7 @@ open_worktree(struct got_worktree **worktree, const ch goto done; } (*worktree)->lockfd = -1; + (*worktree)->format_version = version; (*worktree)->root_path = realpath(path, NULL); if ((*worktree)->root_path == NULL) { @@ -363,3 +364,9 @@ got_worktree_get_path_prefix(struct got_worktree *work { return worktree->path_prefix; } + +int +got_worktree_get_format_version(struct got_worktree *worktree) +{ + return worktree->format_version; +}