@@ -268,6 +268,29 @@ impl Index {
268
268
Ok ( changes)
269
269
}
270
270
271
+ /// Return all `Change`s that are observed between the last time this method was called
272
+ /// and the latest state of the `crates.io` index repository, which is obtained by fetching
273
+ /// the remote called `origin`.
274
+ /// The `last_seen_reference()` will be created or adjusted to point to the latest fetched
275
+ /// state, which causes this method to have a different result each time it is called.
276
+ ///
277
+ /// # Resource Usage
278
+ ///
279
+ /// As this method fetches the git repository, loose objects or small packs may be created. Over time,
280
+ /// these will accumulate and either slow down subsequent operations, or cause them to fail due to exhaustion
281
+ /// of the maximum number of open file handles as configured with `ulimit`.
282
+ ///
283
+ /// Thus it is advised for the caller to run `git gc` occasionally based on their own requirements and usage patterns.
284
+ pub fn fetch_changes_with_options2 (
285
+ & self ,
286
+ progress : impl git:: Progress ,
287
+ should_interrupt : & AtomicBool ,
288
+ ) -> Result < Vec < Change > , Error > {
289
+ let ( changes, to) = self . peek_changes_with_options2 ( progress, should_interrupt) ?;
290
+ self . set_last_seen_reference ( to) ?;
291
+ Ok ( changes)
292
+ }
293
+
271
294
/// Set the last seen reference to the given Oid. It will be created if it does not yet exists.
272
295
pub fn set_last_seen_reference ( & self , to : git:: hash:: ObjectId ) -> Result < ( ) , Error > {
273
296
let repo = self . repository ( ) ;
0 commit comments