Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-05-02 19:14:05 +0400
committerCarlos Martín Nieto <cmn@dwim.me>2013-05-02 19:14:05 +0400
commit34bd59992e9e11107d16837b671f867e2a5e77ef (patch)
tree642337a4be2b5ded0ed2f85939d8af00806bb2c2 /src/pack.c
parentd966310cab4da6a1f30dfdf61842e84ecbdac22e (diff)
Revert "Protect sha1_entry_pos call with mutex"
This reverts commit 8c535f3f6879c6796d8107d7eb80dd8b2105621b.
Diffstat (limited to 'src/pack.c')
-rw-r--r--src/pack.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/pack.c b/src/pack.c
index 1ffad29ae..47534f195 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -1050,24 +1050,24 @@ static int pack_entry_find_offset(
const git_oid *short_oid,
size_t len)
{
- const uint32_t *level1_ofs;
- const unsigned char *index;
+ const uint32_t *level1_ofs = p->index_map.data;
+ const unsigned char *index = p->index_map.data;
unsigned hi, lo, stride;
int pos, found = 0;
const unsigned char *current = 0;
*offset_out = 0;
- if (!p->index_map.data && pack_index_open(p) < 0)
- return git_odb__error_notfound("failed to open packfile", NULL);
-
- if (git_mutex_lock(&p->lock) < 0)
- return packfile_error("failed to get lock for finding entry offset");
+ if (index == NULL) {
+ int error;
- assert(p->index_map.data);
+ if ((error = pack_index_open(p)) < 0)
+ return error;
+ assert(p->index_map.data);
- index = p->index_map.data;
- level1_ofs = p->index_map.data;
+ index = p->index_map.data;
+ level1_ofs = p->index_map.data;
+ }
if (p->index_version > 1) {
level1_ofs += 2;
@@ -1093,8 +1093,6 @@ static int pack_entry_find_offset(
/* Use git.git lookup code */
pos = sha1_entry_pos(index, stride, 0, lo, hi, p->num_objects, short_oid->id);
- git_mutex_unlock(&p->lock);
-
if (pos >= 0) {
/* An object matching exactly the oid was found */
found = 1;