t / t8008-blame-formats.shon commit Sync with 1.8.1.1 (eacf011)
   1#!/bin/sh
   2
   3test_description='blame output in various formats on a simple case'
   4. ./test-lib.sh
   5
   6test_expect_success 'setup' '
   7        echo a >file &&
   8        git add file
   9        test_tick &&
  10        git commit -m one &&
  11        echo b >>file &&
  12        echo c >>file &&
  13        echo d >>file &&
  14        test_tick &&
  15        git commit -a -m two
  16'
  17
  18cat >expect <<'EOF'
  19^baf5e0b (A U Thor 2005-04-07 15:13:13 -0700 1) a
  208825379d (A U Thor 2005-04-07 15:14:13 -0700 2) b
  218825379d (A U Thor 2005-04-07 15:14:13 -0700 3) c
  228825379d (A U Thor 2005-04-07 15:14:13 -0700 4) d
  23EOF
  24test_expect_success 'normal blame output' '
  25        git blame file >actual &&
  26        test_cmp expect actual
  27'
  28
  29ID1=baf5e0b3869e0b2b2beb395a3720c7b51eac94fc
  30COMMIT1='author A U Thor
  31author-mail <author@example.com>
  32author-time 1112911993
  33author-tz -0700
  34committer C O Mitter
  35committer-mail <committer@example.com>
  36committer-time 1112911993
  37committer-tz -0700
  38summary one
  39boundary
  40filename file'
  41ID2=8825379dfb8a1267b58e8e5bcf69eec838f685ec
  42COMMIT2='author A U Thor
  43author-mail <author@example.com>
  44author-time 1112912053
  45author-tz -0700
  46committer C O Mitter
  47committer-mail <committer@example.com>
  48committer-time 1112912053
  49committer-tz -0700
  50summary two
  51previous baf5e0b3869e0b2b2beb395a3720c7b51eac94fc file
  52filename file'
  53
  54cat >expect <<EOF
  55$ID1 1 1 1
  56$COMMIT1
  57        a
  58$ID2 2 2 3
  59$COMMIT2
  60        b
  61$ID2 3 3
  62        c
  63$ID2 4 4
  64        d
  65EOF
  66test_expect_success 'blame --porcelain output' '
  67        git blame --porcelain file >actual &&
  68        test_cmp expect actual
  69'
  70
  71cat >expect <<EOF
  72$ID1 1 1 1
  73$COMMIT1
  74        a
  75$ID2 2 2 3
  76$COMMIT2
  77        b
  78$ID2 3 3
  79$COMMIT2
  80        c
  81$ID2 4 4
  82$COMMIT2
  83        d
  84EOF
  85test_expect_success 'blame --line-porcelain output' '
  86        git blame --line-porcelain file >actual &&
  87        test_cmp expect actual
  88'
  89
  90test_done