t / t1411-reflog-show.shon commit Merge branch 'rb/maint-python-path' (4de113c)
   1#!/bin/sh
   2
   3test_description='Test reflog display routines'
   4. ./test-lib.sh
   5
   6test_expect_success 'setup' '
   7        echo content >file &&
   8        git add file &&
   9        test_tick &&
  10        git commit -m one
  11'
  12
  13cat >expect <<'EOF'
  14Reflog: HEAD@{0} (C O Mitter <committer@example.com>)
  15Reflog message: commit (initial): one
  16EOF
  17test_expect_success 'log -g shows reflog headers' '
  18        git log -g -1 >tmp &&
  19        grep ^Reflog <tmp >actual &&
  20        test_cmp expect actual
  21'
  22
  23cat >expect <<'EOF'
  24e46513e HEAD@{0}: commit (initial): one
  25EOF
  26test_expect_success 'oneline reflog format' '
  27        git log -g -1 --oneline >actual &&
  28        test_cmp expect actual
  29'
  30
  31cat >expect <<'EOF'
  32Reflog: HEAD@{Thu Apr 7 15:13:13 2005 -0700} (C O Mitter <committer@example.com>)
  33Reflog message: commit (initial): one
  34EOF
  35test_expect_success 'using @{now} syntax shows reflog date (multiline)' '
  36        git log -g -1 HEAD@{now} >tmp &&
  37        grep ^Reflog <tmp >actual &&
  38        test_cmp expect actual
  39'
  40
  41cat >expect <<'EOF'
  42e46513e HEAD@{Thu Apr 7 15:13:13 2005 -0700}: commit (initial): one
  43EOF
  44test_expect_success 'using @{now} syntax shows reflog date (oneline)' '
  45        git log -g -1 --oneline HEAD@{now} >actual &&
  46        test_cmp expect actual
  47'
  48
  49cat >expect <<'EOF'
  50Reflog: HEAD@{1112911993 -0700} (C O Mitter <committer@example.com>)
  51Reflog message: commit (initial): one
  52EOF
  53test_expect_success 'using --date= shows reflog date (multiline)' '
  54        git log -g -1 --date=raw >tmp &&
  55        grep ^Reflog <tmp >actual &&
  56        test_cmp expect actual
  57'
  58
  59cat >expect <<'EOF'
  60e46513e HEAD@{1112911993 -0700}: commit (initial): one
  61EOF
  62test_expect_success 'using --date= shows reflog date (oneline)' '
  63        git log -g -1 --oneline --date=raw >actual &&
  64        test_cmp expect actual
  65'
  66
  67: >expect
  68test_expect_success 'empty reflog file' '
  69        git branch empty &&
  70        : >.git/logs/refs/heads/empty &&
  71
  72        git log -g empty >actual &&
  73        test_cmp expect actual
  74'
  75
  76test_done