diff options
author | Jerry Zhang <jerry@skydio.com> | 2021-12-13 14:03:27 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-13 14:30:25 -0800 |
commit | 324eb77ee76277be99bdc54ef0b74ff30f5f567b (patch) | |
tree | d9eecb504b5d4c671fe2cde24a7110b53de5b632 /stable-qsort.c | |
parent | git-apply: add --quiet flag (diff) | |
download | tgif-324eb77ee76277be99bdc54ef0b74ff30f5f567b.tar.xz |
git-apply: add --allow-empty flag
Some users or scripts will pipe "git diff"
output to "git apply" when replaying diffs
or commits. In these cases, they will rely
on the return value of "git apply" to know
whether the diff was applied successfully.
However, for empty commits, "git apply" will
fail. This complicates scripts since they
have to either buffer the diff and check
its length, or run diff again with "exit-code",
essentially doing the diff twice.
Add the "--allow-empty" flag to "git apply"
which allows it to handle both empty diffs
and empty commits created by "git format-patch
--always" by doing nothing and returning 0.
Add tests for both with and without --allow-empty.
Signed-off-by: Jerry Zhang <jerry@skydio.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'stable-qsort.c')
0 files changed, 0 insertions, 0 deletions