t / t9162-git-svn-dcommit-interactive.shon commit archive: support filtering paths with glob (ed22b41)
   1#!/bin/sh
   2#
   3# Copyright (c) 2011 Frédéric Heitzmann
   4
   5test_description='git svn dcommit --interactive series'
   6. ./lib-git-svn.sh
   7
   8test_expect_success 'initialize repo' '
   9        svn_cmd mkdir -m"mkdir test-interactive" "$svnrepo/test-interactive" &&
  10        git svn clone "$svnrepo/test-interactive" test-interactive &&
  11        cd test-interactive &&
  12        touch foo && git add foo && git commit -m"foo: first commit" &&
  13        git svn dcommit
  14        '
  15
  16test_expect_success 'answers: y [\n] yes' '
  17        (
  18                echo "change #1" >> foo && git commit -a -m"change #1" &&
  19                echo "change #2" >> foo && git commit -a -m"change #2" &&
  20                echo "change #3" >> foo && git commit -a -m"change #3" &&
  21                ( echo "y
  22
  23y" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&
  24                test $(git rev-parse HEAD) = $(git rev-parse remotes/git-svn)
  25        )
  26        '
  27
  28test_expect_success 'answers: yes yes no' '
  29        (
  30                echo "change #1" >> foo && git commit -a -m"change #1" &&
  31                echo "change #2" >> foo && git commit -a -m"change #2" &&
  32                echo "change #3" >> foo && git commit -a -m"change #3" &&
  33                ( echo "yes
  34yes
  35no" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&
  36                test $(git rev-parse HEAD^^^) = $(git rev-parse remotes/git-svn) &&
  37                git reset --hard remotes/git-svn
  38        )
  39        '
  40
  41test_expect_success 'answers: yes quit' '
  42        (
  43                echo "change #1" >> foo && git commit -a -m"change #1" &&
  44                echo "change #2" >> foo && git commit -a -m"change #2" &&
  45                echo "change #3" >> foo && git commit -a -m"change #3" &&
  46                ( echo "yes
  47quit" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&
  48                test $(git rev-parse HEAD^^^) = $(git rev-parse remotes/git-svn) &&
  49                git reset --hard remotes/git-svn
  50        )
  51        '
  52
  53test_expect_success 'answers: all' '
  54        (
  55                echo "change #1" >> foo && git commit -a -m"change #1" &&
  56                echo "change #2" >> foo && git commit -a -m"change #2" &&
  57                echo "change #3" >> foo && git commit -a -m"change #3" &&
  58                ( echo "all" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&
  59                test $(git rev-parse HEAD) = $(git rev-parse remotes/git-svn) &&
  60                git reset --hard remotes/git-svn
  61        )
  62        '
  63
  64test_done