@@ -52,34 +52,46 @@ impl ProductVersionContext<'_> {
5252 . context ( ParseConfigSnafu { path } )
5353 }
5454
55- fn root ( & self ) -> PathBuf {
55+ /// The root directory for files related to the product (across all versions).
56+ fn product_dir ( & self ) -> PathBuf {
5657 self . images_repo_root . join ( & self . pv . product )
5758 }
5859
60+ /// The directory containing patches for the product version.
5961 fn patch_dir ( & self ) -> PathBuf {
60- self . root ( ) . join ( "stackable/patches" ) . join ( & self . pv . version )
62+ self . product_dir ( )
63+ . join ( "stackable/patches" )
64+ . join ( & self . pv . version )
6165 }
6266
67+ /// The patchable configuration file for the product version.
6368 fn config_path ( & self ) -> PathBuf {
6469 self . patch_dir ( ) . join ( "patchable.toml" )
6570 }
6671
72+ /// The directory containing all ephemeral data used by patchable for the product (across all versions).
73+ ///
74+ /// Should be gitignored, and can safely be deleted as long as all relevant versions have been `patchable export`ed.
6775 fn work_root ( & self ) -> PathBuf {
68- self . root ( ) . join ( "patchable-work" )
76+ self . product_dir ( ) . join ( "patchable-work" )
6977 }
7078
71- fn repo ( & self ) -> PathBuf {
79+ /// The repository for the product (across all versions).
80+ fn product_repo ( & self ) -> PathBuf {
7281 self . work_root ( ) . join ( "product-repo" )
7382 }
7483
84+ /// The worktree root for the product version.
7585 fn worktree_root ( & self ) -> PathBuf {
7686 self . work_root ( ) . join ( "worktree" ) . join ( & self . pv . version )
7787 }
7888
89+ /// Branch pointing at the upstream base commit for the product version.
7990 fn base_branch ( & self ) -> String {
8091 format ! ( "patchable/base/{}" , self . pv. version)
8192 }
8293
94+ /// branch pointing at the last commit in the patch series for the product version.
8395 fn worktree_branch ( & self ) -> String {
8496 format ! ( "patchable/{}" , self . pv. version)
8597 }
@@ -235,13 +247,9 @@ fn main() -> Result<()> {
235247 images_repo_root,
236248 } ;
237249 let config = ctx. load_config ( ) ?;
238- let product_repo_root = ctx. repo ( ) ;
239- let product_repo = tracing:: info_span!(
240- "finding product repository" ,
241- product. repository = ?product_repo_root,
242- )
243- . in_scope ( || repo:: ensure_bare_repo ( & product_repo_root) )
244- . context ( OpenProductRepoForCheckoutSnafu ) ?;
250+ let product_repo_root = ctx. product_repo ( ) ;
251+ let product_repo = repo:: ensure_bare_repo ( & product_repo_root)
252+ . context ( OpenProductRepoForCheckoutSnafu ) ?;
245253
246254 let base_commit = repo:: resolve_and_fetch_commitish (
247255 & product_repo,
@@ -357,7 +365,7 @@ fn main() -> Result<()> {
357365 images_repo_root,
358366 } ;
359367
360- let product_repo_root = ctx. repo ( ) ;
368+ let product_repo_root = ctx. product_repo ( ) ;
361369 let product_repo = tracing:: info_span!(
362370 "finding product repository" ,
363371 product. repository = ?product_repo_root,
0 commit comments