t / t3428-rebase-signoff.shon commit fsck: handle NULL return of lookup_blob() and lookup_tree() (2720f6d)
   1#!/bin/sh
   2
   3test_description='git rebase --signoff
   4
   5This test runs git rebase --signoff and make sure that it works.
   6'
   7
   8. ./test-lib.sh
   9
  10# A simple file to commit
  11cat >file <<EOF
  12a
  13EOF
  14
  15# Expected commit message after rebase --signoff
  16cat >expected-signed <<EOF
  17first
  18
  19Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/")
  20EOF
  21
  22# Expected commit message after rebase without --signoff (or with --no-signoff)
  23cat >expected-unsigned <<EOF
  24first
  25EOF
  26
  27
  28# We configure an alias to do the rebase --signoff so that
  29# on the next subtest we can show that --no-signoff overrides the alias
  30test_expect_success 'rebase --signoff adds a sign-off line' '
  31        git commit --allow-empty -m "Initial empty commit" &&
  32        git add file && git commit -m first &&
  33        git config alias.rbs "rebase --signoff" &&
  34        git rbs HEAD^ &&
  35        git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
  36        test_cmp expected-signed actual
  37'
  38
  39test_expect_success 'rebase --no-signoff does not add a sign-off line' '
  40        git commit --amend -m "first" &&
  41        git rbs --no-signoff HEAD^ &&
  42        git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
  43        test_cmp expected-unsigned actual
  44'
  45
  46test_done