Merge branch 'jk/commit-date-approxidate'

* jk/commit-date-approxidate:
  commit: accept more date formats for "--date"
  commit: print "Date" line when the user has set date
  pretty: make show_ident_date public
  commit: use split_ident_line to compare author/committer
This commit is contained in:
Junio C Hamano
2014-06-03 12:06:46 -07:00
6 changed files with 97 additions and 23 deletions

View File

@ -65,12 +65,15 @@ test_expect_success 'output to keep user entertained during multi-pick' '
cat <<-\EOF >expected &&
[master OBJID] second
Author: A U Thor <author@example.com>
Date: Thu Apr 7 15:14:13 2005 -0700
1 file changed, 1 insertion(+)
[master OBJID] third
Author: A U Thor <author@example.com>
Date: Thu Apr 7 15:15:13 2005 -0700
1 file changed, 1 insertion(+)
[master OBJID] fourth
Author: A U Thor <author@example.com>
Date: Thu Apr 7 15:16:13 2005 -0700
1 file changed, 1 insertion(+)
EOF
@ -98,14 +101,17 @@ test_expect_success 'output during multi-pick indicates merge strategy' '
Trying simple merge.
[master OBJID] second
Author: A U Thor <author@example.com>
Date: Thu Apr 7 15:14:13 2005 -0700
1 file changed, 1 insertion(+)
Trying simple merge.
[master OBJID] third
Author: A U Thor <author@example.com>
Date: Thu Apr 7 15:15:13 2005 -0700
1 file changed, 1 insertion(+)
Trying simple merge.
[master OBJID] fourth
Author: A U Thor <author@example.com>
Date: Thu Apr 7 15:16:13 2005 -0700
1 file changed, 1 insertion(+)
EOF

View File

@ -346,8 +346,21 @@ test_expect_success 'amend commit to fix date' '
'
test_expect_success 'commit complains about bogus date' '
test_must_fail git commit --amend --date=10.11.2010
test_expect_success 'commit mentions forced date in output' '
git commit --amend --date=2010-01-02T03:04:05 >output &&
grep "Date: *Sat Jan 2 03:04:05 2010" output
'
test_expect_success 'commit complains about completely bogus dates' '
test_must_fail git commit --amend --date=seventeen
'
test_expect_success 'commit --date allows approxidate' '
git commit --amend \
--date="midnight the 12th of october, anno domini 1979" &&
echo "Fri Oct 12 00:00:00 1979 +0000" >expect &&
git log -1 --format=%ad >actual &&
test_cmp expect actual
'
test_expect_success 'sign off (1)' '

View File

@ -344,6 +344,13 @@ test_expect_success 'message shows author when it is not equal to committer' '
.git/COMMIT_EDITMSG
'
test_expect_success 'message shows date when it is explicitly set' '
git commit --allow-empty -e -m foo --date="2010-01-02T03:04:05" &&
test_i18ngrep \
"^# Date: *Sat Jan 2 03:04:05 2010 +0000" \
.git/COMMIT_EDITMSG
'
test_expect_success AUTOIDENT 'message shows committer when it is automatic' '
echo >>negative &&