summaryrefslogtreecommitdiff
path: root/builtin-apply.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-02-22 20:11:21 +0100
committerJunio C Hamano <junkio@cox.net>2007-02-22 20:58:36 -0800
commitaeabfa072564d9261fa80b1314949bdfd9b78632 (patch)
tree70e266f92c804dd98aa6b4c6fa33f083b7e8b400 /builtin-apply.c
parent437b1b20df4b356c9342dac8d38849f24ef44f27 (diff)
downloadgit-aeabfa072564d9261fa80b1314949bdfd9b78632.tar.gz
apply: make --verbose a little more useful
When a patch fails, I automatically add '-v' to the command line to see what fails. This patch makes -v a synonym to --verbose, and actually tells the user which text was not found. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-apply.c')
-rw-r--r--builtin-apply.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index 3fefdacd94..17f4ad595e 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1655,6 +1655,8 @@ static int apply_one_fragment(struct buffer_desc *desc, struct fragment *frag, i
/* Ignore it, we already handled it */
break;
default:
+ if (apply_verbosely)
+ error("invalid start of line: '%c'", first);
return -1;
}
patch += len;
@@ -1752,6 +1754,9 @@ static int apply_one_fragment(struct buffer_desc *desc, struct fragment *frag, i
}
}
+ if (offset && apply_verbosely)
+ error("while searching for:\n%.*s", oldsize, oldlines);
+
free(old);
free(new);
return offset;
@@ -2692,7 +2697,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
apply = apply_with_reject = apply_verbosely = 1;
continue;
}
- if (!strcmp(arg, "--verbose")) {
+ if (!strcmp(arg, "-v") || !strcmp(arg, "--verbose")) {
apply_verbosely = 1;
continue;
}