summaryrefslogtreecommitdiff
path: root/src/sha1_lookup.h
diff options
context:
space:
mode:
authorMarc Pegon <pegon.marc@gmail.com>2011-05-27 22:46:41 +0200
committerVicent Marti <tanoku@gmail.com>2011-06-01 23:40:41 +0200
commitdd453c4dbf9a1fa38530b1f51e079852736b8f66 (patch)
tree19a16a4248757e21b700e27231fb334fe468861a /src/sha1_lookup.h
parent53c0bd81a2915d6f82ef2f9c0703770783a3dc89 (diff)
downloadlibgit2-dd453c4dbf9a1fa38530b1f51e079852736b8f66.tar.gz
Added git.git sha1 lookup method to replace simple binary search in pack backend.
Implemented find_unique_short_oid for pack backend, based on git sha1 lookup method; finding an object given its full oid is just a particular case of searching the unique object matching an oid prefix (short oid). Added git_odb_read_unique_short_oid, which iterates over all the backends to find and read the unique object matching the given oid prefix. Added a git_object_lookup_short_oid method to find the unique object in the repository matching a given oid prefix : it generalizes git_object_lookup which now does nothing but calls git_object_lookup_short_oid.
Diffstat (limited to 'src/sha1_lookup.h')
-rw-r--r--src/sha1_lookup.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/sha1_lookup.h b/src/sha1_lookup.h
new file mode 100644
index 000000000..5caa2f5ed
--- /dev/null
+++ b/src/sha1_lookup.h
@@ -0,0 +1,12 @@
+#ifndef INCLUDE_sha1_lookup_h__
+#define INCLUDE_sha1_lookup_h__
+
+#include <stdlib.h>
+
+int sha1_entry_pos(const void *table,
+ size_t elem_size,
+ size_t key_offset,
+ unsigned lo, unsigned hi, unsigned nr,
+ const unsigned char *key);
+
+#endif