1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
| | #!/bin/sh
test_description='hunk edit with "commit -p -m"'
. ./test-lib.sh
if ! test_have_prereq PERL
then
skip_all="skipping '$test_description' tests, perl not available"
test_done
fi
test_expect_success 'setup (initial)' '
echo line1 >file &&
git add file &&
git commit -m commit1
'
test_expect_success 'edit hunk "commit -p -m message"' '
test_when_finished "rm -f editor_was_started" &&
rm -f editor_was_started &&
echo more >>file &&
echo e | env GIT_EDITOR=": >editor_was_started" git commit -p -m commit2 file &&
test -r editor_was_started
'
test_expect_success 'edit hunk "commit --dry-run -p -m message"' '
test_when_finished "rm -f editor_was_started" &&
rm -f editor_was_started &&
echo more >>file &&
echo e | env GIT_EDITOR=": >editor_was_started" git commit -p -m commit3 file &&
test -r editor_was_started
'
test_expect_success 'commit with --date shows timezone offset -0000 when no-record-time-zone is specified' '
echo test1 >>file &&
git add file &&
TZ=UTC-09 git commit --date=@1600000000 -m "test1" --no-record-time-zone &&
git show -s --format='%aI' >output &&
echo 2020-09-13T12:26:40-00:00 >expect &&
test_cmp output expect
'
test_expect_success 'commit with GIT_AUTHOR_DATE shows timezone offset -0000 when no-record-time-zone is specified' '
echo test2 >>file &&
git add file &&
export GIT_AUTHOR_DATE=@1600000000 TZ=UTC-09 &&
git commit -m "test2" --no-record-time-zone &&
git show -s --format='%aI' >output &&
echo 2020-09-13T12:26:40-00:00 >expect &&
test_cmp output expect
'
test_expect_success 'commit with unset GIT_AUTHOR_DATE shows timezone offset -0000 when no-record-time-zone is specified' '
echo test2 >>file &&
git add file &&
unset GIT_AUTHOR_DATE &&
TZ=UTC-09 git commit -m "test2" --no-record-time-zone &&
git show -s --format='%aI' >output &&
grep "\-00:00" output
'
test_done
|