stash: fix "--staged" with binary filesaj/stash-staged-fix
commit5fb768640976a9f004925045e51d60ba5a903490
authorAdam Johnson <me@adamj.eu>
Mon, 22 Apr 2024 10:28:14 +0000 (22 10:28 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Apr 2024 20:57:18 +0000 (22 13:57 -0700)
treeb1a0d5090516842aae61292de4f833254d0d194a
parent7380a72f6b4da51f6db975f4a37c4ea9dadbf477
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>
builtin/stash.c
t/t3903-stash.sh