diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-10-23 23:56:37 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-10-23 23:56:37 +0300 |
commit | 626f689f7903b51342cf31ad3792ba5e9e41586d (patch) | |
tree | f0ce5154751f6b09c184a8f9f7b73ae23d2aee36 /builtin/stash.c | |
parent | 755fb09163ec71b784b1bd9db5cb73de7a01d078 (diff) | |
parent | d9b6634589d5c59b49fd2fc41953469173a40ff5 (diff) |
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
Diffstat (limited to 'builtin/stash.c')
-rw-r--r-- | builtin/stash.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/stash.c b/builtin/stash.c index 1ad496985a..4a6771c9f4 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -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\"."; |