diff options
author | Adam Johnson <me@adamj.eu> | 2024-04-22 12:28:14 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-04-22 22:57:18 +0200 |
commit | 5fb768640976a9f004925045e51d60ba5a903490 (patch) | |
tree | b1a0d5090516842aae61292de4f833254d0d194a /builtin/stash.c | |
parent | Git 2.35.8 (diff) | |
download | git-5fb768640976a9f004925045e51d60ba5a903490.tar.xz git-5fb768640976a9f004925045e51d60ba5a903490.zip |
stash: fix "--staged" with binary files
"git stash --staged" errors out when given binary files, after saving the
stash.
This behaviour dates back to the addition of the feature in 41a28eb6c1
(stash: implement '--staged' option for 'push' and 'save', 2021-10-18).
Adding the "--binary" option of "diff-tree" fixes this. The "diff-tree" call
in stash_patch() also omits "--binary", but that is fine since binary files
cannot be selected interactively.
Helped-By: Jeff King <peff@peff.net>
Helped-By: Randall S. Becker <randall.becker@nexbridge.ca>
Signed-off-by: Adam Johnson <me@adamj.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/stash.c')
-rw-r--r-- | builtin/stash.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/stash.c b/builtin/stash.c index 86cd0b456e..f4ec21e515 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -1147,8 +1147,8 @@ static int stash_staged(struct stash_info *info, struct strbuf *out_patch, } cp_diff_tree.git_cmd = 1; - strvec_pushl(&cp_diff_tree.args, "diff-tree", "-p", "-U1", "HEAD", - oid_to_hex(&info->w_tree), "--", NULL); + strvec_pushl(&cp_diff_tree.args, "diff-tree", "-p", "--binary", + "-U1", "HEAD", oid_to_hex(&info->w_tree), "--", NULL); if (pipe_command(&cp_diff_tree, NULL, 0, out_patch, 0, NULL, 0)) { ret = -1; goto done; |