aboutsummaryrefslogtreecommitdiff
path: root/builtin-apply.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-07-02 15:28:22 -0700
committerJunio C Hamano <gitster@pobox.com>2008-07-02 15:28:22 -0700
commit8ee4a6c2ec6738cfbc815dc59e44825f2a9b9f15 (patch)
tree16528347bad184d2439fa0e9b6fc559e9bf53b95 /builtin-apply.c
parentc4730f35cc6507bc117a08885d88668fe02b1a7d (diff)
downloadgit-8ee4a6c2ec6738cfbc815dc59e44825f2a9b9f15.tar.gz
git-8ee4a6c2ec6738cfbc815dc59e44825f2a9b9f15.tar.xz
apply --root: thinkofix.
The end of a string is string[length-1], not string[length+1]. I pointed it out during the review, but I forgot about it when applying the patch. This should fix it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-apply.c')
-rw-r--r--builtin-apply.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index bf528966c..6c3db60b6 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -3130,10 +3130,10 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
inaccurate_eof = 1;
continue;
}
- if (!strncmp(arg, "--root=", strlen("--root="))) {
+ if (!prefixcmp(arg, "--root=")) {
arg += strlen("--root=");
root_len = strlen(arg);
- if (root_len && arg[root_len + 1] != '/') {
+ if (root_len && arg[root_len - 1] != '/') {
char *new_root;
root = new_root = xmalloc(root_len + 2);
strcpy(new_root, arg);