diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2008-09-25 09:39:24 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2008-09-25 09:39:24 -0700 |
commit | 1ad6d46235d135582d5cbb91ec0186b485c7b5c1 (patch) | |
tree | e4a98d08b88862305d9f13ccef82180de33e8bcc /sha1_file.c | |
parent | 6ef1daf77202aee71056771d91dd12121c6061fd (diff) | |
parent | d79796bcf05b89774671a75b3285000c43129823 (diff) | |
download | git-1ad6d46235d135582d5cbb91ec0186b485c7b5c1.tar.gz |
Merge branch 'jc/alternate-push'
* jc/alternate-push:
push: receiver end advertises refs from alternate repositories
push: prepare sender to receive extended ref information from the receiver
receive-pack: make it a builtin
is_directory(): a generic helper function
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c index 7d4f24d564..70ff904717 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -254,7 +254,6 @@ static void read_info_alternates(const char * alternates, int depth); */ static int link_alt_odb_entry(const char * entry, int len, const char * relative_base, int depth) { - struct stat st; const char *objdir = get_object_directory(); struct alternate_object_database *ent; struct alternate_object_database *alt; @@ -285,7 +284,7 @@ static int link_alt_odb_entry(const char * entry, int len, const char * relative ent->base[pfxlen] = ent->base[entlen-1] = 0; /* Detect cases where alternate disappeared */ - if (stat(ent->base, &st) || !S_ISDIR(st.st_mode)) { + if (!is_directory(ent->base)) { error("object directory %s does not exist; " "check .git/objects/info/alternates.", ent->base); @@ -398,6 +397,16 @@ void add_to_alternates_file(const char *reference) link_alt_odb_entries(alt, alt + strlen(alt), '\n', NULL, 0); } +void foreach_alt_odb(alt_odb_fn fn, void *cb) +{ + struct alternate_object_database *ent; + + prepare_alt_odb(); + for (ent = alt_odb_list; ent; ent = ent->next) + if (fn(ent, cb)) + return; +} + void prepare_alt_odb(void) { const char *alt; |