Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-01-31 01:17:10 +0300
committerJunio C Hamano <gitster@pobox.com>2020-01-31 01:17:10 +0300
commitf0940743facd619f251009e0307d8d6452cc582e (patch)
tree2e2aa47257c3b6f3b1a55c842d0c5c9fcf21fd23 /add-interactive.c
parent0afeb3fdf4be28189a26df1d9158bc182da637cd (diff)
parent849e43cc18a8aef639b92c5df9b66af3eb983b2a (diff)
Merge branch 'js/builtin-add-i-cmds'
Minor bugfixes to "git add -i" that has recently been rewritten in C. * js/builtin-add-i-cmds: built-in add -i: accept open-ended ranges again built-in add -i: do not try to `patch`/`diff` an empty list of files
Diffstat (limited to 'add-interactive.c')
-rw-r--r--add-interactive.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/add-interactive.c b/add-interactive.c
index 6a5048c83e..143e694724 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -326,7 +326,10 @@ static ssize_t list_and_choose(struct add_i_state *s,
if (endp == p + sep)
to = from + 1;
else if (*endp == '-') {
- to = strtoul(++endp, &endp, 10);
+ if (isdigit(*(++endp)))
+ to = strtoul(endp, &endp, 10);
+ else
+ to = items->items.nr;
/* extra characters after the range? */
if (endp != p + sep)
from = -1;
@@ -913,7 +916,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
opts->prompt = N_("Patch update");
count = list_and_choose(s, files, opts);
- if (count >= 0) {
+ if (count > 0) {
struct argv_array args = ARGV_ARRAY_INIT;
struct pathspec ps_selected = { 0 };
@@ -954,7 +957,7 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,
opts->flags = IMMEDIATE;
count = list_and_choose(s, files, opts);
opts->flags = 0;
- if (count >= 0) {
+ if (count > 0) {
struct argv_array args = ARGV_ARRAY_INIT;
argv_array_pushl(&args, "git", "diff", "-p", "--cached",