ls: remove redundant logic
find_unique_abbrev() already returns the full SHA-1 if abbrev = 0, so we can remove the logic that avoids the call. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
28a53178fc
commit
531e758d9c
@ -153,8 +153,7 @@ static void show_ce_entry(const char *tag, struct cache_entry *ce)
|
|||||||
printf("%s%06o %s %d\t",
|
printf("%s%06o %s %d\t",
|
||||||
tag,
|
tag,
|
||||||
ce->ce_mode,
|
ce->ce_mode,
|
||||||
abbrev ? find_unique_abbrev(ce->sha1,abbrev)
|
find_unique_abbrev(ce->sha1,abbrev),
|
||||||
: sha1_to_hex(ce->sha1),
|
|
||||||
ce_stage(ce));
|
ce_stage(ce));
|
||||||
}
|
}
|
||||||
write_name_quoted(ce->name + offset, stdout, line_terminator);
|
write_name_quoted(ce->name + offset, stdout, line_terminator);
|
||||||
@ -176,9 +175,7 @@ static int show_one_ru(struct string_list_item *item, void *cbdata)
|
|||||||
if (!ui->mode[i])
|
if (!ui->mode[i])
|
||||||
continue;
|
continue;
|
||||||
printf("%s%06o %s %d\t", tag_resolve_undo, ui->mode[i],
|
printf("%s%06o %s %d\t", tag_resolve_undo, ui->mode[i],
|
||||||
abbrev
|
find_unique_abbrev(ui->sha1[i], abbrev),
|
||||||
? find_unique_abbrev(ui->sha1[i], abbrev)
|
|
||||||
: sha1_to_hex(ui->sha1[i]),
|
|
||||||
i + 1);
|
i + 1);
|
||||||
write_name_quoted(path + offset, stdout, line_terminator);
|
write_name_quoted(path + offset, stdout, line_terminator);
|
||||||
}
|
}
|
||||||
|
@ -103,13 +103,11 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen,
|
|||||||
} else
|
} else
|
||||||
strcpy(size_text, "-");
|
strcpy(size_text, "-");
|
||||||
printf("%06o %s %s %7s\t", mode, type,
|
printf("%06o %s %s %7s\t", mode, type,
|
||||||
abbrev ? find_unique_abbrev(sha1, abbrev)
|
find_unique_abbrev(sha1, abbrev),
|
||||||
: sha1_to_hex(sha1),
|
|
||||||
size_text);
|
size_text);
|
||||||
} else
|
} else
|
||||||
printf("%06o %s %s\t", mode, type,
|
printf("%06o %s %s\t", mode, type,
|
||||||
abbrev ? find_unique_abbrev(sha1, abbrev)
|
find_unique_abbrev(sha1, abbrev));
|
||||||
: sha1_to_hex(sha1));
|
|
||||||
}
|
}
|
||||||
write_name_quotedpfx(base + chomp_prefix, baselen - chomp_prefix,
|
write_name_quotedpfx(base + chomp_prefix, baselen - chomp_prefix,
|
||||||
pathname, stdout, line_termination);
|
pathname, stdout, line_termination);
|
||||||
|
Loading…
Reference in New Issue
Block a user