summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-08-03 11:01:27 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-08-03 11:01:27 -0700
commitd939af12bd96db7ad3e671a0585ad8570aa7e9d3 (patch)
tree5772ac1192ed299db657ffcfbc71c318521db653 /t
parentMerge branch 'pt/am-tests' (diff)
parentstrbuf: make strbuf_addftime more robust (diff)
downloadtgif-d939af12bd96db7ad3e671a0585ad8570aa7e9d3.tar.xz
Merge branch 'jk/date-mode-format'
Teach "git log" and friends a new "--date=format:..." option to format timestamps using system's strftime(3). * jk/date-mode-format: strbuf: make strbuf_addftime more robust introduce "format" date-mode convert "enum date_mode" into a struct show-branch: use DATE_RELATIVE instead of magic number
Diffstat (limited to 't')
-rwxr-xr-xt/t6300-for-each-ref.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 24fc2ba55d..7c9bec7630 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -227,6 +227,24 @@ test_expect_success 'Check format "rfc2822" date fields output' '
test_cmp expected actual
'
+test_expect_success 'Check format of strftime date fields' '
+ echo "my date is 2006-07-03" >expected &&
+ git for-each-ref \
+ --format="%(authordate:format:my date is %Y-%m-%d)" \
+ refs/heads >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success 'exercise strftime with odd fields' '
+ echo >expected &&
+ git for-each-ref --format="%(authordate:format:)" refs/heads >actual &&
+ test_cmp expected actual &&
+ long="long format -- $_z40$_z40$_z40$_z40$_z40$_z40$_z40" &&
+ echo $long >expected &&
+ git for-each-ref --format="%(authordate:format:$long)" refs/heads >actual &&
+ test_cmp expected actual
+'
+
cat >expected <<\EOF
refs/heads/master
refs/remotes/origin/master