Skip to content

Commit f99175e

Browse files
committed
fix: fix remaining refs to Sorting::ByCommitNewest*
1 parent d8b0919 commit f99175e

File tree

9 files changed

+42
-33
lines changed

9 files changed

+42
-33
lines changed

examples/log.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn run(args: Args) -> anyhow::Result<()> {
7979
Sorting::BreadthFirst
8080
} else {
8181
// else if args.newest_first {
82-
Sorting::ByCommitTimeNewestFirst
82+
Sorting::ByCommitTime(Default::default())
8383
};
8484

8585
let mut min_parents = args.min_parents.unwrap_or(0);

gitoxide-core/src/repository/commitgraph/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub(crate) mod function {
3030
.context("Need committish as starting point")?
3131
.id()
3232
.ancestors()
33-
.sorting(Sorting::ByCommitTimeNewestFirst)
33+
.sorting(Sorting::ByCommitTime(Default::default()))
3434
.all()?;
3535
for commit in commits {
3636
let commit = commit?;

gitoxide-core/src/repository/revision/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub(crate) mod function {
5252
.context("Need committish as starting point")?
5353
.id()
5454
.ancestors()
55-
.sorting(Sorting::ByCommitTimeNewestFirst)
55+
.sorting(Sorting::ByCommitTime(Default::default()))
5656
.all()?;
5757

5858
let mut vg = match text {

gix-traverse/src/commit/simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub enum Sorting {
5151
/// This mode benefits greatly from having an object_cache in `find()`
5252
/// to avoid having to lookup each commit twice.
5353
ByCommitTime(CommitTimeOrder),
54-
/// This sorting is similar to `ByCommitTimeNewestFirst`, but adds a cutoff to not return commits older than
54+
/// This sorting is similar to `ByCommitTime`, but adds a cutoff to not return commits older than
5555
/// a given time, stopping the iteration once no younger commits is queued to be traversed.
5656
///
5757
/// As the query is usually repeated with different cutoff dates, this search mode benefits greatly from an object cache.

gix-traverse/tests/commit/simple.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ mod different_date_intermixed {
134134
"65d6af66f60b8e39fd1ba6a1423178831e764ec5", /* c1 */
135135
],
136136
)
137-
.with_sorting(Sorting::ByCommitTimeNewestFirst)
137+
.with_sorting(Sorting::ByCommitTime(Default::default()))
138138
.check()
139139
}
140140
}
@@ -186,7 +186,7 @@ mod different_date {
186186
"65d6af66f60b8e39fd1ba6a1423178831e764ec5", /* c1 */
187187
],
188188
)
189-
.with_sorting(Sorting::ByCommitTimeNewestFirst)
189+
.with_sorting(Sorting::ByCommitTime(Default::default()))
190190
.check()
191191
}
192192
}
@@ -247,7 +247,7 @@ mod same_date {
247247
"134385f6d781b7e97062102c6a483440bfda2a03", /* c1 */
248248
],
249249
)
250-
.with_sorting(Sorting::ByCommitTimeNewestFirst)
250+
.with_sorting(Sorting::ByCommitTime(Default::default()))
251251
.check()
252252
}
253253

@@ -368,7 +368,7 @@ mod adjusted_dates {
368368
"134385f6d781b7e97062102c6a483440bfda2a03", /* c1 */
369369
],
370370
)
371-
.with_sorting(Sorting::ByCommitTimeNewestFirst)
371+
.with_sorting(Sorting::ByCommitTime(Default::default()))
372372
.check()
373373
}
374374

@@ -379,7 +379,8 @@ mod adjusted_dates {
379379
&["288e509293165cb5630d08f4185bdf2445bf6170"], /* m1b1 */
380380
&["bcb05040a6925f2ff5e10d3ae1f9264f2e8c43ac"], /* b1c1 */
381381
)
382-
.with_sorting(Sorting::ByCommitTimeNewestFirstCutoffOlderThan {
382+
.with_sorting(Sorting::ByCommitTimeCutoff {
383+
order: Default::default(),
383384
seconds: 978393600, // =2001-01-02 00:00:00 +0000
384385
})
385386
.check()
@@ -394,7 +395,8 @@ mod adjusted_dates {
394395
Some(hex_to_id("9902e3c3e8f0c569b4ab295ddf473e6de763e1e7" /* c2 */)),
395396
&store,
396397
)
397-
.sorting(Sorting::ByCommitTimeNewestFirstCutoffOlderThan {
398+
.sorting(Sorting::ByCommitTimeCutoff {
399+
order: Default::default(),
398400
seconds: 978393600, // =2001-01-02 00:00:00 +0000
399401
})?;
400402
assert_eq!(
@@ -415,7 +417,7 @@ mod adjusted_dates {
415417
"134385f6d781b7e97062102c6a483440bfda2a03", /* c1 */
416418
],
417419
)
418-
.with_sorting(Sorting::ByCommitTimeNewestFirst)
420+
.with_sorting(Sorting::ByCommitTime(Default::default()))
419421
.with_parents(Parents::First)
420422
.check()
421423
}

gix/src/remote/connection/fetch/update_refs/mod.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,19 @@ pub(crate) fn update(
154154
.find_object(local_id)?
155155
.try_into_commit()
156156
.map_err(|_| ())
157-
.and_then(|c| {
158-
c.committer().map(|a| a.time.seconds).map_err(|_| ())
159-
}).and_then(|local_commit_time|
160-
remote_id
161-
.to_owned()
162-
.ancestors(&repo.objects)
163-
.sorting(
164-
gix_traverse::commit::simple::Sorting::ByCommitTimeNewestFirstCutoffOlderThan {
165-
seconds: local_commit_time
166-
},
167-
)
168-
.map_err(|_| ())
169-
);
157+
.and_then(|c| c.committer().map(|a| a.time.seconds).map_err(|_| ()))
158+
.and_then(|local_commit_time| {
159+
remote_id
160+
.to_owned()
161+
.ancestors(&repo.objects)
162+
.sorting(
163+
gix_traverse::commit::simple::Sorting::ByCommitTimeCutoff {
164+
order: Default::default(),
165+
seconds: local_commit_time,
166+
},
167+
)
168+
.map_err(|_| ())
169+
});
170170
match ancestors {
171171
Ok(mut ancestors) => {
172172
ancestors.any(|cid| cid.map_or(false, |c| c.id == local_id))

gix/src/revision/walk.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub enum Sorting {
5252
/// This mode benefits greatly from having an object_cache in `find()`
5353
/// to avoid having to lookup each commit twice.
5454
ByCommitTime(CommitTimeOrder),
55-
/// This sorting is similar to `ByCommitTimeNewestFirst`, but adds a cutoff to not return commits older than
55+
/// This sorting is similar to `ByCommitTime`, but adds a cutoff to not return commits older than
5656
/// a given time, stopping the iteration once no younger commits is queued to be traversed.
5757
///
5858
/// As the query is usually repeated with different cutoff dates, this search mode benefits greatly from an object cache.
@@ -212,7 +212,7 @@ impl<'repo> Platform<'repo> {
212212
/// Prune the commit with the given `ids` such that they won't be returned, and such that none of their ancestors is returned either.
213213
///
214214
/// Note that this forces the [sorting](Self::sorting) to
215-
/// [`ByCommitTimeNewestFirstCutoffOlderThan`](Sorting::ByCommitTimeNewestFirstCutoffOlderThan) configured with
215+
/// [`ByCommitTimeCutoff`](Sorting::ByCommitTimeCutoff) configured with
216216
/// the oldest available commit time, ensuring that no commits older than the oldest of `ids` will be returned either.
217217
///
218218
/// Also note that commits that can't be accessed or are missing are simply ignored for the purpose of obtaining the cutoff date.

gix/tests/id/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ mod ancestors {
8585
let commits_by_commit_date = head
8686
.ancestors()
8787
.use_commit_graph(!use_commit_graph)
88-
.sorting(gix::revision::walk::Sorting::ByCommitTimeNewestFirst)
88+
.sorting(gix::revision::walk::Sorting::ByCommitTime(Default::default()))
8989
.all()?
9090
.map(|c| c.map(gix::revision::walk::Info::detach))
9191
.collect::<Result<Vec<_>, _>>()?;
@@ -119,7 +119,7 @@ mod ancestors {
119119
let head = repo.head()?.into_peeled_id()?;
120120
let commits = head
121121
.ancestors()
122-
.sorting(gix::revision::walk::Sorting::ByCommitTimeNewestFirst) // assure we have time set
122+
.sorting(gix::revision::walk::Sorting::ByCommitTime(Default::default())) // assure we have time set
123123
.use_commit_graph(use_commit_graph)
124124
.all()?
125125
.collect::<Result<Vec<_>, _>>()?;
@@ -162,8 +162,11 @@ mod ancestors {
162162
for use_commit_graph in [false, true] {
163163
for sorting in [
164164
gix::revision::walk::Sorting::BreadthFirst,
165-
gix::revision::walk::Sorting::ByCommitTimeNewestFirst,
166-
gix::revision::walk::Sorting::ByCommitTimeNewestFirstCutoffOlderThan { seconds: 0 },
165+
gix::revision::walk::Sorting::ByCommitTime(Default::default()),
166+
gix::revision::walk::Sorting::ByCommitTimeCutoff {
167+
order: Default::default(),
168+
seconds: 0,
169+
},
167170
] {
168171
let commits_graph_order = head
169172
.ancestors()

gix/tests/repository/shallow.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ fn yes() -> crate::Result {
4444
}
4545

4646
mod traverse {
47+
use gix_traverse::commit::simple::CommitTimeOrder;
4748
use serial_test::parallel;
4849

4950
use crate::util::{hex_to_id, named_subrepo_opts};
@@ -53,8 +54,11 @@ mod traverse {
5354
fn boundary_is_detected_triggering_no_error() -> crate::Result {
5455
for sorting in [
5556
gix::revision::walk::Sorting::BreadthFirst,
56-
gix::revision::walk::Sorting::ByCommitTimeNewestFirst,
57-
gix::revision::walk::Sorting::ByCommitTimeNewestFirstCutoffOlderThan { seconds: 0 },
57+
gix::revision::walk::Sorting::ByCommitTime(CommitTimeOrder::NewestFirst),
58+
gix::revision::walk::Sorting::ByCommitTimeCutoff {
59+
order: CommitTimeOrder::NewestFirst,
60+
seconds: 0,
61+
},
5862
] {
5963
for toggle in [false, true] {
6064
for name in ["shallow.git", "shallow"] {
@@ -97,7 +101,7 @@ mod traverse {
97101
.head_id()?
98102
.ancestors()
99103
.use_commit_graph(toggle)
100-
.sorting(gix::revision::walk::Sorting::ByCommitTimeNewestFirst)
104+
.sorting(gix::revision::walk::Sorting::ByCommitTime(CommitTimeOrder::NewestFirst))
101105
.all()?
102106
.map(|c| c.map(|c| c.id))
103107
.collect::<Result<_, _>>()?;

0 commit comments

Comments
 (0)