commit 0d486432bb90c030ac51cbc80a2ef2d69263e98f from: Stefan Sperling via: Thomas Adam date: Wed Aug 14 21:51:02 2024 UTC make info commands show the work tree format version, too ok op@ commit - 088ea0a1b34b1a9d038a2d0d0e48bb70cd9bcc04 commit + 0d486432bb90c030ac51cbc80a2ef2d69263e98f blob - 5924258df05176135368876cf7f2787c9264c9da blob + 1c7aaaaefc2d61283655a217cb662c8a496bf909 --- cvg/cvg.c +++ cvg/cvg.c @@ -9106,6 +9106,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 - b335b04da4d3f018da9b53453f1b3c7c82e5bfb1 blob + 1b8a8ec0ecfb46325de632ebb24ebd9ade5dd4c2 --- got/got.c +++ got/got.c @@ -14704,6 +14704,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 - 7a75e7fcc5708ed78a01f8a89bf3bd3d6b5af636 blob + 492a1fd47f4ac6c4626b2aa128bed2da6f039385 --- lib/worktree_open.c +++ lib/worktree_open.c @@ -170,6 +170,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) { @@ -362,3 +363,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; +}