Download raw body.
got/cvg info: print work tree version
On Tue, Aug 13, 2024 at 12:08:05PM +0200, Omar Polo wrote: > I'm extending got_worktree_path_info() to resemble what we do in other > cases: have a prepare() routine that opens the fileindex and a complete > one that frees it. These two also take care of locking[0]. > > This way, we can open the fileindex only once, and this allows to expose > a (misnamed but couldn't come up with something better) > got_worktree_path_info_version() that returns the fileindex version. > > Here's how it looks: > > % got info > work tree: /home/op/w/got > work tree base commit: 4775b069530ea249dcfbc877685bf55700ca6423 > work tree path prefix: / > work tree branch reference: refs/heads/main > work tree UUID: 4c4c2b26-415d-4f9f-b9aa-9b584d0ec64c > file index version: 3 > repository: /home/op/git/got.git You could rename got_worktree_path_info_version() to got_worktree_fileindex_version() for clarity. While we're at it we could also print the work tree format version, stored in .got/format. So I was thinking we would provide a function which returns two output arguments, the work tree format version and the file index version. That said, your patch is fine, too. The easiest way to extend the approach you took would be another got_worktree_format_version() function which returns the number stored in .got/format.`
got/cvg info: print work tree version