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>
Johannes Schindelin committed
Feb 22, 2007 at 20:11 UTC
aeabfa072564d9261fa80b1314949bdfd9b78632
1 file changed
+6
-1
builtin-apply.c
+6
-1
@@ -1655,6 +1655,8 @@ static int apply_one_fragment(struct buffer_desc *desc, struct fragment *frag, i
1655
/* Ignore it, we already handled it */
1656
break;
1657
default:
1658
+ if (apply_verbosely)
1659
+ error("invalid start of line: '%c'", first);
1660
return -1;
1661
}
1662
patch += len;
@@ -1752,6 +1754,9 @@ static int apply_one_fragment(struct buffer_desc *desc, struct fragment *frag, i
1754
}
1755
}
1756
1757
+ if (offset && apply_verbosely)
1758
+ error("while searching for:\n%.*s", oldsize, oldlines);
1759
+
1760
free(old);
1761
free(new);
1762
return offset;
@@ -2692,7 +2697,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
2697
apply = apply_with_reject = apply_verbosely = 1;
2698
continue;
2699
}
2695
- if (!strcmp(arg, "--verbose")) {
2700
+ if (!strcmp(arg, "-v") || !strcmp(arg, "--verbose")) {
2701
apply_verbosely = 1;
2702
continue;
2703
}