summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d079837)
raw | patch | inline | side by side (parent: d079837)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sat, 26 May 2007 05:24:40 +0000 (01:24 -0400) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 27 May 2007 03:28:08 +0000 (20:28 -0700) |
Calling getenv() is not that expensive, but its also not free,
and its certainly not cheaper than testing to see if alt_odb_tail
is not null.
Because we are calling prepare_alt_odb() from within find_sha1_file
every time we cannot find an object file locally we want to skip out
of prepare_alt_odb() as early as possible once we have initialized
our alternate list.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
and its certainly not cheaper than testing to see if alt_odb_tail
is not null.
Because we are calling prepare_alt_odb() from within find_sha1_file
every time we cannot find an object file locally we want to skip out
of prepare_alt_odb() as early as possible once we have initialized
our alternate list.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
sha1_file.c | patch | blob | history |
diff --git a/sha1_file.c b/sha1_file.c
index 6a5ba635003858d70e449122351b502b823de13a..a3637d7e5b7763b97b5325923e586722f5e431bf 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
{
const char *alt;
+ if (alt_odb_tail)
+ return;
+
alt = getenv(ALTERNATE_DB_ENVIRONMENT);
if (!alt) alt = "";
- if (alt_odb_tail)
- return;
alt_odb_tail = &alt_odb_list;
link_alt_odb_entries(alt, alt + strlen(alt), ':', NULL, 0);