Skip to content

Commit 7957987

Browse files
committed
doc: improve docs and be more clear about ordering.
1 parent 752ba0c commit 7957987

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

src/index/diff/mod.rs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ impl Index {
8686
)
8787
}
8888

89-
/// Return all `Change`s that are observed between the last time `peek_changes*(…)` was called
89+
/// Return all [`Change`]s that are observed between the last time `peek_changes*(…)` was called
9090
/// and the latest state of the `crates.io` index repository, which is obtained by fetching
9191
/// the remote called `origin` or whatever is configured for the current `HEAD` branch and lastly
9292
/// what it should be based on knowledge about he crates index.
93-
/// The `last_seen_reference()` will not be created or updated.
93+
/// The [`Self::last_seen_reference()`] will not be created or updated.
9494
/// The second field in the returned tuple is the commit object to which the changes were provided.
95-
/// If one would set the `last_seen_reference()` to that object, the effect is exactly the same
96-
/// as if `fetch_changes(…)` had been called.
95+
/// If one would set the [`Self::last_seen_reference()`] to that object, the effect is exactly the same
96+
/// as if [`Self::fetch_changes()`] had been called.
9797
///
9898
/// The `progress` and `should_interrupt` parameters are used to provide progress for fetches and allow
9999
/// these operations to be interrupted gracefully.
@@ -204,13 +204,16 @@ impl Index {
204204
))
205205
}
206206

207-
/// Similar to `changes()`, but requires `from` and `to` objects to be provided. They may point
207+
/// Similar to [`Self::changes()`], but requires `from` and `to` objects to be provided. They may point
208208
/// to either `Commit`s or `Tree`s.
209209
///
210210
/// # Returns
211211
///
212212
/// A list of atomic changes that were performed on the index
213213
/// between the two revisions.
214+
///
215+
/// # Grouping and Ordering
216+
///
214217
/// The changes are grouped by the crate they belong to.
215218
/// The order of the changes for each crate are **non-deterministic**.
216219
/// The order of crates is also **non-deterministic**.
@@ -238,7 +241,7 @@ impl Index {
238241
delegate.into_result()
239242
}
240243

241-
/// Similar to `changes()`, but requires `ancestor_commit` and `current_commit` objects to be provided
244+
/// Similar to [`Self::changes()`], but requires `ancestor_commit` and `current_commit` objects to be provided
242245
/// with `ancestor_commit` being in the ancestry of `current_commit`.
243246
///
244247
/// If the invariants regarding `ancestor_commit` and `current_commit` are not upheld, we fallback
@@ -250,6 +253,13 @@ impl Index {
250253
/// A list of atomic changes that were performed on the index
251254
/// between the two revisions, but looking at it one commit at a time, along with the `Order`
252255
/// that the changes are actually in in case one of the invariants wasn't met.
256+
///
257+
/// # Grouping and Ordering
258+
///
259+
/// Note that the order of the changes for each crate are **non-deterministic**, should they happen within one commit.
260+
/// Typically one commit does not span multiple crates, but if it does, for instance when rollups happen,
261+
/// then the order of crates is also **non-deterministic**.
262+
///
253263
pub fn changes_between_ancestor_commits(
254264
&self,
255265
ancestor_commit: impl Into<gix::hash::ObjectId>,
@@ -337,10 +347,10 @@ impl Index {
337347
)
338348
}
339349

340-
/// Return all `Change`s that are observed between the last time this method was called
350+
/// Return all [`Change`]s that are observed between the last time this method was called
341351
/// and the latest state of the `crates.io` index repository, which is obtained by fetching
342352
/// the remote called `origin`.
343-
/// The `last_seen_reference()` will be created or adjusted to point to the latest fetched
353+
/// The [`Self::last_seen_reference()`] will be created or adjusted to point to the latest fetched
344354
/// state, which causes this method to have a different result each time it is called.
345355
///
346356
/// The `progress` and `should_interrupt` parameters are used to provide progress for fetches and allow
@@ -392,6 +402,9 @@ impl Index {
392402
///
393403
/// A list of atomic chanes that were performed on the index
394404
/// between the two revisions.
405+
///
406+
/// # Grouping and Ordering
407+
///
395408
/// The changes are grouped by the crate they belong to.
396409
/// The order of the changes for each crate are **non-deterministic**.
397410
/// The order of crates is also **non-deterministic**.

0 commit comments

Comments
 (0)