summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2012-06-28 03:03:43 -0700
committerVicent Martí <vicent@github.com>2012-06-28 03:03:43 -0700
commit1de44c24936ecf39915913ddf26f68f78c7963d3 (patch)
treee08bb3bff814fe9614d607c0c03a4e562ec3ebdb /src
parented754a75e145352c02da62b5d56df5866d7eec26 (diff)
parent371599576a82b43ab30fe66feadcfb3045e649ff (diff)
downloadlibgit2-1de44c24936ecf39915913ddf26f68f78c7963d3.tar.gz
Merge pull request #791 from carlosmn/index-path
indexer: don't use '/objects/pack/' unconditionally
Diffstat (limited to 'src')
-rw-r--r--src/fetch.c9
-rw-r--r--src/indexer.c2
-rw-r--r--src/transports/http.c7
3 files changed, 14 insertions, 4 deletions
diff --git a/src/fetch.c b/src/fetch.c
index 96b263faa..603284842 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -118,7 +118,8 @@ int git_fetch__download_pack(
int recvd;
char buff[1024];
gitno_buffer buf;
- git_indexer_stream *idx;
+ git_buf path = GIT_BUF_INIT;
+ git_indexer_stream *idx = NULL;
gitno_buffer_setup(t, &buf, buff, sizeof(buff));
@@ -127,9 +128,12 @@ int git_fetch__download_pack(
return -1;
}
- if (git_indexer_stream_new(&idx, git_repository_path(repo)) < 0)
+ if (git_buf_joinpath(&path, git_repository_path(repo), "objects/pack") < 0)
return -1;
+ if (git_indexer_stream_new(&idx, git_buf_cstr(&path)) < 0)
+ goto on_error;
+
memset(stats, 0, sizeof(git_indexer_stats));
if (git_indexer_stream_add(idx, buffered, buffered_size, stats) < 0)
goto on_error;
@@ -154,6 +158,7 @@ int git_fetch__download_pack(
return 0;
on_error:
+ git_buf_free(&path);
git_indexer_stream_free(idx);
return -1;
}
diff --git a/src/indexer.c b/src/indexer.c
index 1b0a20321..b4312e15a 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -142,7 +142,7 @@ int git_indexer_stream_new(git_indexer_stream **out, const char *prefix)
{
git_indexer_stream *idx;
git_buf path = GIT_BUF_INIT;
- static const char suff[] = "/objects/pack/pack-received";
+ static const char suff[] = "/pack";
int error;
idx = git__calloc(1, sizeof(git_indexer_stream));
diff --git a/src/transports/http.c b/src/transports/http.c
index 4139a2fa6..f25d639f3 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -545,6 +545,7 @@ static int http_download_pack(git_transport *transport, git_repository *repo, gi
http_parser_settings settings;
char buffer[1024];
gitno_buffer buf;
+ git_buf path = GIT_BUF_INIT;
git_indexer_stream *idx = NULL;
download_pack_cbdata data;
@@ -555,7 +556,10 @@ static int http_download_pack(git_transport *transport, git_repository *repo, gi
return -1;
}
- if (git_indexer_stream_new(&idx, git_repository_path(repo)) < 0)
+ if (git_buf_joinpath(&path, git_repository_path(repo), "objects/pack") < 0)
+ return -1;
+
+ if (git_indexer_stream_new(&idx, git_buf_cstr(&path)) < 0)
return -1;
/*
@@ -600,6 +604,7 @@ static int http_download_pack(git_transport *transport, git_repository *repo, gi
on_error:
git_indexer_stream_free(idx);
+ git_buf_free(&path);
return -1;
}