summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 101d15e)
raw | patch | inline | side by side (parent: 101d15e)
author | Junio C Hamano <gitster@pobox.com> | |
Wed, 21 Jan 2009 08:37:38 +0000 (00:37 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 21 Jan 2009 08:42:22 +0000 (00:42 -0800) |
We only accept "checkout: moving from A to B" newer style reflog entries,
in order to pick up A. There is no point computing where B begins at
after running strstr to locate " to ", nor adding 4 and then subtracting 4
from the same pointer.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
in order to pick up A. There is no point computing where B begins at
after running strstr to locate " to ", nor adding 4 and then subtracting 4
from the same pointer.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c | patch | blob | history |
diff --git a/sha1_name.c b/sha1_name.c
index 38c9f1b19e89401b24204b4daac26f327a8f8d8f..7d95bbb27ae7485525d89281fb79f8f1fbc3da51 100644 (file)
--- a/sha1_name.c
+++ b/sha1_name.c
if (!prefixcmp(message, "checkout: moving from ")) {
match = message + strlen("checkout: moving from ");
- if ((target = strstr(match, " to ")) != NULL)
- target += 4;
+ target = strstr(match, " to ");
}
if (!match || !target)
return 0;
- len = target - match - 4;
- if (target[len] == '\n' && !strncmp(match, target, len))
- return 0;
-
+ len = target - match;
nth = cb->cnt++ % cb->alloc;
strbuf_reset(&cb->buf[nth]);
strbuf_add(&cb->buf[nth], match, len);