Merge branch 'jk/stash-require-clean-index' into maint
authorJunio C Hamano <gitster@pobox.com>
Fri, 26 Jun 2015 06:03:26 +0000 (23:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 26 Jun 2015 06:03:27 +0000 (23:03 -0700)
A hotfix for the topic already in 'master'.

* jk/stash-require-clean-index:
Revert "stash: require a clean index to apply"

1  2 
git-stash.sh
t/t3903-stash.sh
diff --combined git-stash.sh
index 0fddd5424b3846aaa6d9189841dae13c764468cd,d4cf818be9488f1b94fdf4766a8f73db6bfd1029..23bd1d3db2a8097e901726add2476dd7090ee337
@@@ -219,9 -219,6 +219,9 @@@ save_stash () 
                -a|--all)
                        untracked=all
                        ;;
 +              --help)
 +                      show_help
 +                      ;;
                --)
                        shift
                        break
@@@ -304,17 -301,11 +304,17 @@@ list_stash () 
  }
  
  show_stash () {
 +      ALLOW_UNKNOWN_FLAGS=t
        assert_stash_like "$@"
  
        git diff ${FLAGS:---stat} $b_commit $w_commit
  }
  
 +show_help () {
 +      exec git help stash
 +      exit 1
 +}
 +
  #
  # Parses the remaining options looking for flags and
  # at most one revision defaulting to ${ref_stash}@{0}
  #
  #   GIT_QUIET is set to t if -q is specified
  #   INDEX_OPTION is set to --index if --index is specified.
 -#   FLAGS is set to the remaining flags
 +#   FLAGS is set to the remaining flags (if allowed)
  #
  # dies if:
  #   * too many revisions specified
  #   * no revision is specified and there is no stash stack
  #   * a revision is specified which cannot be resolve to a SHA1
  #   * a non-existent stash reference is specified
 +#   * unknown flags were set and ALLOW_UNKNOWN_FLAGS is not "t"
  #
  
  parse_flags_and_rev()
                        --index)
                                INDEX_OPTION=--index
                        ;;
 +                      --help)
 +                              show_help
 +                      ;;
                        -*)
 +                              test "$ALLOW_UNKNOWN_FLAGS" = t ||
 +                                      die "$(eval_gettext "unknown option: \$opt")"
                                FLAGS="${FLAGS}${FLAGS:+ }$opt"
                        ;;
                esac
@@@ -457,8 -442,6 +457,6 @@@ apply_stash () 
        assert_stash_like "$@"
  
        git update-index -q --refresh || die "$(gettext "unable to refresh index")"
-       git diff-index --cached --quiet --ignore-submodules HEAD -- ||
-               die "$(gettext "Cannot apply stash: Your index contains uncommitted changes.")"
  
        # current index state
        c_tree=$(git write-tree) ||
diff --combined t/t3903-stash.sh
index 7396ca991132a88012955a281a71c330eab2092b,f179c93ddfade2034273ab15ad2054c36ad313b2..f5f18b7d21c00da258125a9125a46b32cf9e8504
@@@ -45,13 -45,6 +45,6 @@@ test_expect_success 'applying bogus sta
        test_cmp expect file
  '
  
- test_expect_success 'apply requires a clean index' '
-       test_when_finished "git reset --hard" &&
-       echo changed >other-file &&
-       git add other-file &&
-       test_must_fail git stash apply
- '
  test_expect_success 'apply does not need clean working directory' '
        echo 4 >other-file &&
        git stash apply &&
@@@ -100,10 -93,6 +93,10 @@@ test_expect_success 'unstashing in a su
        )
  '
  
 +test_expect_success 'stash drop complains of extra options' '
 +      test_must_fail git stash drop --foo
 +'
 +
  test_expect_success 'drop top stash' '
        git reset --hard &&
        git stash list > stashlist1 &&