File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,12 @@ pub mod main_worktree {
65
65
///
66
66
/// Note that this is a no-op if the remote was empty, leaving this repository empty as well. This can be validated by checking
67
67
/// if the `head()` of the returned repository is *not* unborn.
68
+ ///
69
+ /// # Panics
70
+ ///
71
+ /// If called after it was successful. The reason here is that it auto-deletes the contained repository,
72
+ /// and keeps track of this by means of keeping just one repository instance, which is passed to the user
73
+ /// after success.
68
74
pub fn main_worktree < P > (
69
75
& mut self ,
70
76
mut progress : P ,
@@ -86,7 +92,7 @@ pub mod main_worktree {
86
92
let repo = self
87
93
. repo
88
94
. as_ref ( )
89
- . expect ( "still present as we never succeeded the worktree checkout yet " ) ;
95
+ . expect ( "BUG: this method may only be called until it is successful " ) ;
90
96
let workdir = repo. work_dir ( ) . ok_or_else ( || Error :: BareRepository {
91
97
git_dir : repo. git_dir ( ) . to_owned ( ) ,
92
98
} ) ?;
@@ -138,7 +144,7 @@ pub mod main_worktree {
138
144
bytes. show_throughput ( start) ;
139
145
140
146
index. write ( Default :: default ( ) ) ?;
141
- Ok ( ( self . repo . take ( ) . expect ( "still present" ) , outcome) )
147
+ Ok ( ( self . repo . take ( ) . expect ( "still present" ) . clone ( ) , outcome) )
142
148
}
143
149
}
144
150
}
Original file line number Diff line number Diff line change @@ -140,13 +140,13 @@ impl PrepareFetch {
140
140
}
141
141
}
142
142
143
- /// A utility to collect configuration on how to perform a checkout into a working tree, and when dropped without checking out successfully
144
- /// the fetched repository will be dropped .
143
+ /// A utility to collect configuration on how to perform a checkout into a working tree,
144
+ /// and when dropped without checking out successfully the fetched repository will be deleted from disk .
145
145
#[ must_use]
146
146
#[ cfg( feature = "worktree-mutation" ) ]
147
147
#[ derive( Debug ) ]
148
148
pub struct PrepareCheckout {
149
- /// A freshly initialized repository which is owned by us, or `None` if it was handed to the user
149
+ /// A freshly initialized repository which is owned by us, or `None` if it was successfully checked out.
150
150
pub ( self ) repo : Option < crate :: Repository > ,
151
151
/// The name of the reference to check out. If `None`, the reference pointed to by `HEAD` will be checked out.
152
152
pub ( self ) ref_name : Option < gix_ref:: PartialName > ,
You can’t perform that action at this time.
0 commit comments