summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 3d56746a9b..aab1872b4c 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -36,6 +36,7 @@
static inline uintmax_t sz_fmt(size_t s) { return s; }
const unsigned char null_sha1[20];
+const struct object_id null_oid;
/*
* This is meant to hold a *small* number of objects that you would
@@ -395,7 +396,7 @@ void add_to_alternates_file(const char *reference)
struct strbuf line = STRBUF_INIT;
int found = 0;
- while (strbuf_getline(&line, in, '\n') != EOF) {
+ while (strbuf_getline(&line, in) != EOF) {
if (!strcmp(reference, line.buf)) {
found = 1;
break;
@@ -3216,6 +3217,11 @@ int has_sha1_file_with_flags(const unsigned char *sha1, int flags)
return find_pack_entry(sha1, &e);
}
+int has_object_file(const struct object_id *oid)
+{
+ return has_sha1_file(oid->hash);
+}
+
static void check_tree(const void *buf, size_t size)
{
struct tree_desc desc;
@@ -3499,12 +3505,12 @@ static int for_each_file_in_obj_subdir(int subdir_nr,
break;
}
}
- strbuf_setlen(path, baselen);
+ closedir(dir);
+ strbuf_setlen(path, baselen);
if (!r && subdir_cb)
r = subdir_cb(subdir_nr, path->buf, data);
- closedir(dir);
return r;
}