+15
-26
lines changedFilter options
+15
-26
lines changed Original file line number Diff line number Diff line change
@@ -145,11 +145,6 @@ pub(crate) mod function {
145
145
/// * `2 minutes ago` (October 27, 2023 at 09:58:00 UTC)
146
146
/// * `3 hours ago` (October 27, 2023 at 07:00:00 UTC)
147
147
pub fn parse(input: &str, now: Option<SystemTime>) -> Result<Time, Error> {
148
-
// TODO: actual implementation, this is just to not constantly fail
149
-
if input == "1979-02-26 18:30:00" {
150
-
return Ok(Time::new(42, 1800));
151
-
}
152
-
153
148
Ok(if let Ok(val) = Date::strptime(SHORT.0, input) {
154
149
let val = val
155
150
.to_zoned(TimeZone::UTC)
Original file line number Diff line number Diff line change
@@ -3,13 +3,10 @@ use std::time::SystemTime;
3
3
use gix_date::Time;
4
4
5
5
#[test]
6
-
fn special_time_is_ok_for_now() {
7
-
assert_eq!(
8
-
gix_date::parse("1979-02-26 18:30:00", Some(SystemTime::now())).unwrap(),
9
-
Time {
10
-
seconds: 42,
11
-
offset: 1800,
12
-
}
6
+
fn time_without_offset_is_not_parsed_yet() {
7
+
assert!(
8
+
gix_date::parse("1979-02-26 18:30:00", Some(SystemTime::now())).is_err(),
9
+
"This was a special time with special handling, but it is not anymore"
13
10
);
14
11
}
15
12
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ fn reflog_by_entry_for_current_branch() {
35
35
36
36
#[test]
37
37
fn reflog_by_date_for_current_branch() {
38
-
let rec = parse("@{1979-02-26 18:30:00}");
38
+
let rec = parse("@{42 +0030}");
39
39
40
40
assert!(rec.kind.is_none());
41
41
assert_eq!(rec.find_ref[0], None);
@@ -81,9 +81,9 @@ fn reflog_by_date_with_date_parse_failure() {
81
81
#[test]
82
82
fn reflog_by_date_for_hash_is_invalid() {
83
83
for (spec, full_name) in [
84
-
("1234@{1979-02-26 18:30:00}", "1234"),
85
-
("abcd-dirty@{1979-02-26 18:30:00}", "abcd-dirty"),
86
-
("v1.2.3-0-g1234@{1979-02-26 18:30:00}", "v1.2.3-0-g1234"),
84
+
("1234@{42 +0030}", "1234"),
85
+
("abcd-dirty@{42 +0030}", "abcd-dirty"),
86
+
("v1.2.3-0-g1234@{42 +0030}", "v1.2.3-0-g1234"),
87
87
] {
88
88
let err = try_parse(spec).unwrap_err();
89
89
assert!(matches!(err, spec::parse::Error::ReflogLookupNeedsRefName {name} if name == full_name));
@@ -93,12 +93,9 @@ fn reflog_by_date_for_hash_is_invalid() {
93
93
#[test]
94
94
fn reflog_by_date_for_given_ref_name() {
95
95
for (spec, expected_ref) in [
96
-
("main@{1979-02-26 18:30:00}", "main"),
97
-
("refs/heads/other@{1979-02-26 18:30:00}", "refs/heads/other"),
98
-
(
99
-
"refs/worktree/feature/a@{1979-02-26 18:30:00}",
100
-
"refs/worktree/feature/a",
101
-
),
96
+
("main@{42 +0030}", "main"),
97
+
("refs/heads/other@{42 +0030}", "refs/heads/other"),
98
+
("refs/worktree/feature/a@{42 +0030}", "refs/worktree/feature/a"),
102
99
] {
103
100
let rec = parse(spec);
104
101
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ mod with_overrides {
26
26
#[test]
27
27
#[serial]
28
28
fn order_from_api_and_cli_and_environment() -> gix_testtools::Result {
29
-
let default_date = "1979-02-26 18:30:00";
29
+
let default_date = "42 +0030";
30
30
let _env = Env::new()
31
31
.set("GIT_HTTP_USER_AGENT", "agent-from-env")
32
32
.set("GIT_HTTP_LOW_SPEED_LIMIT", "1")
Original file line number Diff line number Diff line change
@@ -141,7 +141,7 @@ fn author_from_different_config_sections() -> crate::Result {
141
141
let _env = Env::new()
142
142
.set("GIT_CONFIG_GLOBAL", work_dir.join("global.config").to_str().unwrap())
143
143
.set("GIT_CONFIG_SYSTEM", work_dir.join("system.config").to_str().unwrap())
144
-
.set("GIT_AUTHOR_DATE", "1979-02-26 18:30:00")
144
+
.set("GIT_AUTHOR_DATE", "42 +0030")
145
145
.unset("GIT_AUTHOR_NAME")
146
146
.set("GIT_COMMITTER_DATE", "1980-02-26 18:30:00 +0000")
147
147
.unset("GIT_COMMITTER_NAME")
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ fn by_index() {
78
78
fn by_date() {
79
79
let repo = repo("complex_graph").unwrap();
80
80
81
-
let spec = parse_spec_no_baseline("main@{1979-02-26 18:30:00}", &repo).unwrap();
81
+
let spec = parse_spec_no_baseline("main@{42 +0030}", &repo).unwrap();
82
82
83
83
assert_eq!(
84
84
spec,
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ pub fn hex_to_id(hex: &str) -> gix_hash::ObjectId {
9
9
}
10
10
11
11
pub fn freeze_time() -> gix_testtools::Env<'static> {
12
-
let frozen_time = "1979-02-26 18:30:00";
12
+
let frozen_time = "42 +0030";
13
13
gix_testtools::Env::new()
14
14
.unset("GIT_AUTHOR_NAME")
15
15
.unset("GIT_AUTHOR_EMAIL")
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4