Skip to content

Commit e883a05

Browse files
artagnongitster
authored andcommitted
sha1_name: don't waste cycles in the @-parsing loop
The @-parsing loop unnecessarily checks for the sequence "@{" from (len - 2) unnecessarily. We can safely check from (len - 4). Signed-off-by: Ramkumar Ramachandra <[email protected]> Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b5f769a commit e883a05

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sha1_name.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
445445
/* basic@{time or number or -number} format to query ref-log */
446446
reflog_len = at = 0;
447447
if (len && str[len-1] == '}') {
448-
for (at = len-2; at >= 0; at--) {
448+
for (at = len-4; at >= 0; at--) {
449449
if (str[at] == '@' && str[at+1] == '{') {
450450
if (!upstream_mark(str + at, len - at)) {
451451
reflog_len = (len-1) - (at+2);

0 commit comments

Comments
 (0)