mirror of
https://github.com/git/git
synced 2024-08-24 02:11:08 +00:00
Merge branch 'ph/stash-save-m-option-fix'
In addition to "git stash -m message", the command learned to accept "git stash -mmessage" form. * ph/stash-save-m-option-fix: stash: learn to parse -m/--message like commit does
This commit is contained in:
commit
714485c7de
18
git-stash.sh
18
git-stash.sh
|
@ -76,6 +76,12 @@ create_stash () {
|
|||
shift
|
||||
stash_msg=${1?"BUG: create_stash () -m requires an argument"}
|
||||
;;
|
||||
-m*)
|
||||
stash_msg=${1#-m}
|
||||
;;
|
||||
--message=*)
|
||||
stash_msg=${1#--message=}
|
||||
;;
|
||||
-u|--include-untracked)
|
||||
shift
|
||||
untracked=${1?"BUG: create_stash () -u requires an argument"}
|
||||
|
@ -193,6 +199,12 @@ store_stash () {
|
|||
shift
|
||||
stash_msg="$1"
|
||||
;;
|
||||
-m*)
|
||||
stash_msg=${1#-m}
|
||||
;;
|
||||
--message=*)
|
||||
stash_msg=${1#--message=}
|
||||
;;
|
||||
-q|--quiet)
|
||||
quiet=t
|
||||
;;
|
||||
|
@ -251,6 +263,12 @@ push_stash () {
|
|||
test -z ${1+x} && usage
|
||||
stash_msg=$1
|
||||
;;
|
||||
-m*)
|
||||
stash_msg=${1#-m}
|
||||
;;
|
||||
--message=*)
|
||||
stash_msg=${1#--message=}
|
||||
;;
|
||||
--help)
|
||||
show_help
|
||||
;;
|
||||
|
|
|
@ -804,6 +804,99 @@ test_expect_success 'push -m shows right message' '
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'push -m also works without space' '
|
||||
>foo &&
|
||||
git add foo &&
|
||||
git stash push -m"unspaced test message" &&
|
||||
echo "stash@{0}: On master: unspaced test message" >expect &&
|
||||
git stash list -1 >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'store -m foo shows right message' '
|
||||
git stash clear &&
|
||||
git reset --hard &&
|
||||
echo quux >bazzy &&
|
||||
git add bazzy &&
|
||||
STASH_ID=$(git stash create) &&
|
||||
git stash store -m "store m" $STASH_ID &&
|
||||
echo "stash@{0}: store m" >expect &&
|
||||
git stash list -1 >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'store -mfoo shows right message' '
|
||||
git stash clear &&
|
||||
git reset --hard &&
|
||||
echo quux >bazzy &&
|
||||
git add bazzy &&
|
||||
STASH_ID=$(git stash create) &&
|
||||
git stash store -m"store mfoo" $STASH_ID &&
|
||||
echo "stash@{0}: store mfoo" >expect &&
|
||||
git stash list -1 >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'store --message=foo shows right message' '
|
||||
git stash clear &&
|
||||
git reset --hard &&
|
||||
echo quux >bazzy &&
|
||||
git add bazzy &&
|
||||
STASH_ID=$(git stash create) &&
|
||||
git stash store --message="store message=foo" $STASH_ID &&
|
||||
echo "stash@{0}: store message=foo" >expect &&
|
||||
git stash list -1 >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'store --message foo shows right message' '
|
||||
git stash clear &&
|
||||
git reset --hard &&
|
||||
echo quux >bazzy &&
|
||||
git add bazzy &&
|
||||
STASH_ID=$(git stash create) &&
|
||||
git stash store --message "store message foo" $STASH_ID &&
|
||||
echo "stash@{0}: store message foo" >expect &&
|
||||
git stash list -1 >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'push -mfoo uses right message' '
|
||||
>foo &&
|
||||
git add foo &&
|
||||
git stash push -m"test mfoo" &&
|
||||
echo "stash@{0}: On master: test mfoo" >expect &&
|
||||
git stash list -1 >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'push --message foo is synonym for -mfoo' '
|
||||
>foo &&
|
||||
git add foo &&
|
||||
git stash push --message "test message foo" &&
|
||||
echo "stash@{0}: On master: test message foo" >expect &&
|
||||
git stash list -1 >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'push --message=foo is synonym for -mfoo' '
|
||||
>foo &&
|
||||
git add foo &&
|
||||
git stash push --message="test message=foo" &&
|
||||
echo "stash@{0}: On master: test message=foo" >expect &&
|
||||
git stash list -1 >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'push -m shows right message' '
|
||||
>foo &&
|
||||
git add foo &&
|
||||
git stash push -m "test m foo" &&
|
||||
echo "stash@{0}: On master: test m foo" >expect &&
|
||||
git stash list -1 >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'create stores correct message' '
|
||||
>foo &&
|
||||
git add foo &&
|
||||
|
|
Loading…
Reference in a new issue