@@ -8,8 +8,9 @@ TEST_PASSES_SANITIZE_LEAK=true
8
8
test_expect_success ' setup' '
9
9
test_commit foo &&
10
10
11
- git cat-file commit HEAD |
12
- sed "/^author /s/>/>-<>/" >broken_email.commit &&
11
+ git cat-file commit HEAD >ok.commit &&
12
+ sed "s/>/>-<>/" <ok.commit >broken_email.commit &&
13
+
13
14
git hash-object --literally -w -t commit broken_email.commit >broken_email.hash &&
14
15
git update-ref refs/heads/broken_email $(cat broken_email.hash)
15
16
'
@@ -43,6 +44,11 @@ test_expect_success 'git log --format with broken author email' '
43
44
test_must_be_empty actual.err
44
45
'
45
46
47
+ test_expect_success ' --until handles broken email' '
48
+ git rev-list --until=1980-01-01 broken_email >actual &&
49
+ test_must_be_empty actual
50
+ '
51
+
46
52
munge_author_date () {
47
53
git cat-file commit " $1 " > commit.orig &&
48
54
sed " s/^\(author .*>\) [0-9]*/\1 $2 /" < commit.orig > commit.munge &&
@@ -86,4 +92,45 @@ test_expect_success 'absurdly far-in-future date' '
86
92
git log -1 --format=%ad $commit
87
93
'
88
94
95
+ test_expect_success ' create commits with whitespace committer dates' '
96
+ # It is important that this subject line is numeric, since we want to
97
+ # be sure we are not confused by skipping whitespace and accidentally
98
+ # parsing the subject as a timestamp.
99
+ #
100
+ # Do not use munge_author_date here. Besides not hitting the committer
101
+ # line, it leaves the timezone intact, and we want nothing but
102
+ # whitespace.
103
+ #
104
+ # We will make two munged commits here. The first, ws_commit, will
105
+ # be purely spaces. The second contains a vertical tab, which is
106
+ # considered a space by strtoumax(), but not by our isspace().
107
+ test_commit 1234567890 &&
108
+ git cat-file commit HEAD >commit.orig &&
109
+ sed "s/>.*/> /" <commit.orig >commit.munge &&
110
+ ws_commit=$(git hash-object --literally -w -t commit commit.munge) &&
111
+ sed "s/>.*/> $(printf "\013")/" <commit.orig >commit.munge &&
112
+ vt_commit=$(git hash-object --literally -w -t commit commit.munge)
113
+ '
114
+
115
+ test_expect_success ' --until treats whitespace date as sentinel' '
116
+ echo $ws_commit >expect &&
117
+ git rev-list --until=1980-01-01 $ws_commit >actual &&
118
+ test_cmp expect actual &&
119
+
120
+ echo $vt_commit >expect &&
121
+ git rev-list --until=1980-01-01 $vt_commit >actual &&
122
+ test_cmp expect actual
123
+ '
124
+
125
+ test_expect_success ' pretty-printer handles whitespace date' '
126
+ # as with the %ad test above, we will show these as the empty string,
127
+ # not the 1970 epoch date. This is intentional; see 7d9a281941 (t4212:
128
+ # test bogus timestamps with git-log, 2014-02-24) for more discussion.
129
+ echo : >expect &&
130
+ git log -1 --format="%at:%ct" $ws_commit >actual &&
131
+ test_cmp expect actual &&
132
+ git log -1 --format="%at:%ct" $vt_commit >actual &&
133
+ test_cmp expect actual
134
+ '
135
+
89
136
test_done
0 commit comments