1
0
mirror of https://github.com/git/git synced 2024-07-05 00:58:49 +00:00

Clean up output of "for_each_ref()" when GIT_DIR is "."

Remove the "./" at the head, it just looks much nicer.
This commit is contained in:
Linus Torvalds 2005-07-04 15:28:19 -07:00
parent def88e9afb
commit 6cada6a98d

5
refs.c
View File

@ -26,6 +26,11 @@ static int do_for_each_ref(const char *base, int (*fn)(const char *path, const u
struct dirent *de;
int baselen = strlen(base);
char *path = xmalloc(baselen + 257);
if (!strncmp(base, "./", 2)) {
base += 2;
baselen -= 2;
}
memcpy(path, base, baselen);
if (baselen && base[baselen-1] != '/')
path[baselen++] = '/';