mirror of
https://github.com/git/git.git
synced 2026-01-11 21:33:13 +09:00
Merge branch 'jc/fail-stash-to-store-non-stash'
Feeding "git stash store" with a random commit that was not created by "git stash create" now errors out. * jc/fail-stash-to-store-non-stash: stash: be careful what we store
This commit is contained in:
commit
626f689f79
@ -989,6 +989,12 @@ usage:
|
||||
static int do_store_stash(const struct object_id *w_commit, const char *stash_msg,
|
||||
int quiet)
|
||||
{
|
||||
struct stash_info info;
|
||||
char revision[GIT_MAX_HEXSZ];
|
||||
|
||||
oid_to_hex_r(revision, w_commit);
|
||||
assert_stash_like(&info, revision);
|
||||
|
||||
if (!stash_msg)
|
||||
stash_msg = "Created via \"git stash store\".";
|
||||
|
||||
|
||||
@ -931,6 +931,10 @@ test_expect_success 'store called with invalid commit' '
|
||||
test_must_fail git stash store foo
|
||||
'
|
||||
|
||||
test_expect_success 'store called with non-stash commit' '
|
||||
test_must_fail git stash store HEAD
|
||||
'
|
||||
|
||||
test_expect_success 'store updates stash ref and reflog' '
|
||||
git stash clear &&
|
||||
git reset --hard &&
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user