From: Ramkumar Ramachandra <artag...@gmail.com>

The @-parsing loop unnecessarily checks for the sequence "@{" from len -
2 unnecessarily. We can safely check from len - 4.

[fc: remove cruft]

Signed-off-by: Felipe Contreras <felipe.contre...@gmail.com>
---
 sha1_name.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sha1_name.c b/sha1_name.c
index 93c4e8c..0acc6e0 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -445,7 +445,7 @@ static int get_sha1_basic(const char *str, int len, 
unsigned char *sha1)
        /* basic@{time or number or -number} format to query ref-log */
        reflog_len = at = 0;
        if (len && str[len-1] == '}') {
-               for (at = len-2; at >= 0; at--) {
+               for (at = len-4; at >= 0; at--) {
                        if (str[at] == '@' && str[at+1] == '{') {
                                if (!upstream_mark(str + at, len - at)) {
                                        reflog_len = (len-1) - (at+2);
-- 
1.8.3.rc0.401.g45bba44

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to