t / t3429-rebase-edit-todo.shon commit Merge branch 'jc/denoise-rm-to-resolve' (5e9d978)
   1#!/bin/sh
   2
   3test_description='rebase should reread the todo file if an exec modifies it'
   4
   5. ./test-lib.sh
   6
   7test_expect_success 'rebase exec modifies rebase-todo' '
   8        test_commit initial &&
   9        todo=.git/rebase-merge/git-rebase-todo &&
  10        git rebase HEAD -x "echo exec touch F >>$todo" &&
  11        test -e F
  12'
  13
  14test_expect_success SHA1 'loose object cache vs re-reading todo list' '
  15        GIT_REBASE_TODO=.git/rebase-merge/git-rebase-todo &&
  16        export GIT_REBASE_TODO &&
  17        write_script append-todo.sh <<-\EOS &&
  18        # For values 5 and 6, this yields SHA-1s with the same first two digits
  19        echo "pick $(git rev-parse --short \
  20                $(printf "%s\\n" \
  21                        "tree $EMPTY_TREE" \
  22                        "author A U Thor <author@example.org> $1 +0000" \
  23                        "committer A U Thor <author@example.org> $1 +0000" \
  24                        "" \
  25                        "$1" |
  26                  git hash-object -t commit -w --stdin))" >>$GIT_REBASE_TODO
  27
  28        shift
  29        test -z "$*" ||
  30        echo "exec $0 $*" >>$GIT_REBASE_TODO
  31        EOS
  32
  33        git rebase HEAD -x "./append-todo.sh 5 6"
  34'
  35
  36test_done