Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
sha1_file.c: split has_loose_object() into local and non-local counterparts
author
Brandon Casey
<drafnel@gmail.com>
Mon, 10 Nov 2008 05:59:57 +0000
(23:59 -0600)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 12 Nov 2008 18:29:22 +0000
(10:29 -0800)
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
patch
|
blob
|
history
sha1_file.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
3c3df42
)
diff --git
a/cache.h
b/cache.h
index 1a5740f5899628b2d2b3ed063b81f89a21308d67..7595c149ea10aa847f01235a2c1ca17129d43fe4 100644
(file)
--- a/
cache.h
+++ b/
cache.h
@@
-565,6
+565,7
@@
extern int move_temp_to_file(const char *tmpfile, const char *filename);
extern int has_sha1_pack(const unsigned char *sha1, const char **ignore);
extern int has_sha1_file(const unsigned char *sha1);
extern int has_sha1_pack(const unsigned char *sha1, const char **ignore);
extern int has_sha1_file(const unsigned char *sha1);
+extern int has_loose_object_nonlocal(const unsigned char *sha1);
extern int has_pack_file(const unsigned char *sha1);
extern int has_pack_index(const unsigned char *sha1);
extern int has_pack_file(const unsigned char *sha1);
extern int has_pack_index(const unsigned char *sha1);
diff --git
a/sha1_file.c
b/sha1_file.c
index adb116350bd38db0390f4f731e509f3fe703a1c1..0203de5855cde2de6268ffb0ec90985490080ece 100644
(file)
--- a/
sha1_file.c
+++ b/
sha1_file.c
@@
-410,23
+410,30
@@
void prepare_alt_odb(void)
read_info_alternates(get_object_directory(), 0);
}
read_info_alternates(get_object_directory(), 0);
}
-static int has_loose_object(const unsigned char *sha1)
+static int has_loose_object
_local
(const unsigned char *sha1)
{
char *name = sha1_file_name(sha1);
{
char *name = sha1_file_name(sha1);
- struct alternate_object_database *alt;
+ return !access(name, F_OK);
+}
- if (!access(name, F_OK))
- return 1;
+int has_loose_object_nonlocal(const unsigned char *sha1)
+{
+ struct alternate_object_database *alt;
prepare_alt_odb();
for (alt = alt_odb_list; alt; alt = alt->next) {
prepare_alt_odb();
for (alt = alt_odb_list; alt; alt = alt->next) {
- name = alt->name;
- fill_sha1_path(name, sha1);
+ fill_sha1_path(alt->name, sha1);
if (!access(alt->base, F_OK))
return 1;
}
return 0;
}
if (!access(alt->base, F_OK))
return 1;
}
return 0;
}
+static int has_loose_object(const unsigned char *sha1)
+{
+ return has_loose_object_local(sha1) ||
+ has_loose_object_nonlocal(sha1);
+}
+
static unsigned int pack_used_ctr;
static unsigned int pack_mmap_calls;
static unsigned int peak_pack_open_windows;
static unsigned int pack_used_ctr;
static unsigned int pack_mmap_calls;
static unsigned int peak_pack_open_windows;