]> git.ipfire.org Git - thirdparty/git.git/blobdiff - read-cache.c
treewide: be explicit about dependence on trace.h & trace2.h
[thirdparty/git.git] / read-cache.c
index 7bd12afb38ca300e2177f1e46a9982ea3de80a58..a744eb89e4e638df8a3e44891576672a1ccd7c4f 100644 (file)
@@ -4,9 +4,11 @@
  * Copyright (C) Linus Torvalds, 2005
  */
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "diff.h"
 #include "diffcore.h"
+#include "hex.h"
 #include "tempfile.h"
 #include "lockfile.h"
 #include "cache-tree.h"
 #include "tree.h"
 #include "commit.h"
 #include "blob.h"
+#include "environment.h"
+#include "gettext.h"
 #include "resolve-undo.h"
 #include "run-command.h"
 #include "strbuf.h"
+#include "trace2.h"
 #include "varint.h"
 #include "split-index.h"
 #include "utf8.h"
@@ -29,6 +34,7 @@
 #include "csum-file.h"
 #include "promisor-remote.h"
 #include "hook.h"
+#include "wrapper.h"
 
 /* Mask for the name length in ce_flags in the on-disk index */
 
@@ -263,7 +269,7 @@ static int ce_compare_link(const struct cache_entry *ce, size_t expected_size)
        if (strbuf_readlink(&sb, ce->name, expected_size))
                return -1;
 
-       buffer = read_object_file(&ce->oid, &type, &size);
+       buffer = repo_read_object_file(the_repository, &ce->oid, &type, &size);
        if (buffer) {
                if (size == sb.len)
                        match = memcmp(buffer, sb.buf, size);
@@ -488,11 +494,11 @@ int ie_modified(struct index_state *istate,
        return 0;
 }
 
-int base_name_compare(const char *name1, int len1, int mode1,
-                     const char *name2, int len2, int mode2)
+int base_name_compare(const char *name1, size_t len1, int mode1,
+                     const char *name2, size_t len2, int mode2)
 {
        unsigned char c1, c2;
-       int len = len1 < len2 ? len1 : len2;
+       size_t len = len1 < len2 ? len1 : len2;
        int cmp;
 
        cmp = memcmp(name1, name2, len);
@@ -517,11 +523,12 @@ int base_name_compare(const char *name1, int len1, int mode1,
  * This is used by routines that want to traverse the git namespace
  * but then handle conflicting entries together when possible.
  */
-int df_name_compare(const char *name1, int len1, int mode1,
-                   const char *name2, int len2, int mode2)
+int df_name_compare(const char *name1, size_t len1, int mode1,
+                   const char *name2, size_t len2, int mode2)
 {
-       int len = len1 < len2 ? len1 : len2, cmp;
        unsigned char c1, c2;
+       size_t len = len1 < len2 ? len1 : len2;
+       int cmp;
 
        cmp = memcmp(name1, name2, len);
        if (cmp)
@@ -2627,7 +2634,7 @@ int repo_index_has_changes(struct repository *repo,
 
        if (tree)
                cmp = tree->object.oid;
-       if (tree || !get_oid_tree("HEAD", &cmp)) {
+       if (tree || !repo_get_oid_tree(repo, "HEAD", &cmp)) {
                struct diff_options opt;
 
                repo_diff_setup(repo, &opt);
@@ -2946,7 +2953,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
        }
 
        if (!istate->version)
-               istate->version = get_index_format_default(the_repository);
+               istate->version = get_index_format_default(r);
 
        /* demote version 3 to version 2 when the latter suffices */
        if (istate->version == 3 || istate->version == 2)
@@ -3552,7 +3559,8 @@ void *read_blob_data_from_index(struct index_state *istate,
        }
        if (pos < 0)
                return NULL;
-       data = read_object_file(&istate->cache[pos]->oid, &type, &sz);
+       data = repo_read_object_file(the_repository, &istate->cache[pos]->oid,
+                                    &type, &sz);
        if (!data || type != OBJ_BLOB) {
                free(data);
                return NULL;