History

Merge branch 'fix-gix-rev'

Sebastian Thiel committed 3 years ago

Commit d3fb5372 parents c197cbf 045dd9d3 files · +10 −3Browse files

Unified · Split

3 files
  1. gix-date/src/time/write.rs +2 −2
  2. gix-revision/src/spec/parse/function.rs +1 −1
  3. gix-revision/tests/spec/parse/anchor/at_symbol.rs +7 −0
gix-date/src/time/write.rs+2−2
@@ -23,8 +23,8 @@ impl Time { · 22 unmodified lines
23 23
24 const ZERO: &[u8; 1] = b"0";24 const ZERO: &[u8; 1] = b"0";
25 25
26 const SECONDS_PER_HOUR: i32 = 60 * 60;26 const SECONDS_PER_HOUR: u32 = 60 * 60;
27 let offset = self.offset.abs();27 let offset = self.offset.unsigned_abs();
28 let hours = offset / SECONDS_PER_HOUR;28 let hours = offset / SECONDS_PER_HOUR;
29 assert!(hours < 25, "offset is more than a day: {hours}");29 assert!(hours < 25, "offset is more than a day: {hours}");
30 let minutes = (offset - (hours * SECONDS_PER_HOUR)) / 60;30 let minutes = (offset - (hours * SECONDS_PER_HOUR)) / 60;
gix-revision/src/spec/parse/function.rs+1−1
@@ -422,7 +422,7 @@ where · 421 unmodified lines
422 if n < 0 {422 if n < 0 {
423 if name.is_empty() {423 if name.is_empty() {
424 delegate424 delegate
425 .nth_checked_out_branch(n.abs().try_into().expect("non-negative isize fits usize"))425 .nth_checked_out_branch(n.unsigned_abs())
426 .ok_or(Error::Delegate)?;426 .ok_or(Error::Delegate)?;
427 } else {427 } else {
428 return Err(Error::RefnameNeedsPositiveReflogEntries { nav: nav.into() });428 return Err(Error::RefnameNeedsPositiveReflogEntries { nav: nav.into() });
gix-revision/tests/spec/parse/anchor/at_symbol.rs+7−0
@@ -10,6 +10,13 @@ fn braces_must_be_closed() { · 9 unmodified lines
10 }10 }
11}11}
12 12
13#[test]
14#[cfg_attr(target_pointer_width = "32", ignore = "Only works this way on 64 bit systems")]
15fn fuzzed() {
16 let rec = parse("@{-9223372036854775808}");
17 assert_eq!(rec.nth_checked_out_branch, [Some(9223372036854775808), None]);
18}
19
13#[test]20#[test]
14fn reflog_by_entry_for_current_branch() {21fn reflog_by_entry_for_current_branch() {
15 for (spec, expected_entry) in [("@{0}", 0), ("@{42}", 42), ("@{00100}", 100)] {22 for (spec, expected_entry) in [("@{0}", 0), ("@{42}", 42), ("@{00100}", 100)] {