t / t3406-rebase-message.shon commit t3406: modernize style (9e2248e)
   1#!/bin/sh
   2
   3test_description='messages from rebase operation'
   4
   5. ./test-lib.sh
   6
   7test_expect_success 'setup' '
   8        test_commit O fileO &&
   9        test_commit X fileX &&
  10        test_commit A fileA &&
  11        test_commit B fileB &&
  12        test_commit Y fileY &&
  13
  14        git checkout -b topic O &&
  15        git cherry-pick A B &&
  16        test_commit Z fileZ &&
  17        git tag start
  18'
  19
  20cat >expect <<\EOF
  21Already applied: 0001 A
  22Already applied: 0002 B
  23Committed: 0003 Z
  24EOF
  25
  26test_expect_success 'rebase -m' '
  27        git rebase -m master >report &&
  28        sed -n -e "/^Already applied: /p" \
  29                -e "/^Committed: /p" report >actual &&
  30        test_cmp expect actual
  31'
  32
  33test_expect_success 'rebase --stat' '
  34        git reset --hard start &&
  35        git rebase --stat master >diffstat.txt &&
  36        grep "^ fileX |  *1 +$" diffstat.txt
  37'
  38
  39test_expect_success 'rebase w/config rebase.stat' '
  40        git reset --hard start &&
  41        git config rebase.stat true &&
  42        git rebase master >diffstat.txt &&
  43        grep "^ fileX |  *1 +$" diffstat.txt
  44'
  45
  46test_expect_success 'rebase -n overrides config rebase.stat config' '
  47        git reset --hard start &&
  48        git config rebase.stat true &&
  49        git rebase -n master >diffstat.txt &&
  50        ! grep "^ fileX |  *1 +$" diffstat.txt
  51'
  52
  53# Output to stderr:
  54#
  55#     "Does not point to a valid commit: invalid-ref"
  56#
  57# NEEDSWORK: This "grep" is fine in real non-C locales, but
  58# GETTEXT_POISON poisons the refname along with the enclosing
  59# error message.
  60test_expect_success 'rebase --onto outputs the invalid ref' '
  61        test_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err &&
  62        test_i18ngrep "invalid-ref" err
  63'
  64
  65test_done