aboutsummaryrefslogtreecommitdiff
path: root/rev-list.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-10-05 14:49:54 -0700
committerJunio C Hamano <junkio@cox.net>2005-10-05 14:49:54 -0700
commite091eb93258f05a58bc5d1c60f058f5f57dd92b6 (patch)
tree721f2ffe2e2fccfc6bf10be1e7db644a1907659f /rev-list.c
parentdf34297af1fe5da786e41bd2fee58e10dd810cc4 (diff)
downloadgit-e091eb93258f05a58bc5d1c60f058f5f57dd92b6.tar.gz
git-e091eb93258f05a58bc5d1c60f058f5f57dd92b6.tar.xz
upload-pack: Do not choke on too many heads request.
Cloning from a repository with more than 256 refs (heads and tags included) will choke, because upload-pack has a built-in limit of feeding not more than MAX_NEEDS (currently 256) heads to underlying git-rev-list. This is a problem when cloning a repository with many tags, like http://www.linux-mips.org/pub/scm/linux.git, which has 290+ tags. This commit introduces a new flag, --all, to git-rev-list, to include all refs in the repository. Updated upload-pack detects requests that ask more than MAX_NEEDS refs, and sends everything back instead. We may probably want to tweak the definitions of MAX_NEEDS and MAX_HAS, but that is a separate topic. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'rev-list.c')
-rw-r--r--rev-list.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/rev-list.c b/rev-list.c
index 5ec9ccb60..c60aa7295 100644
--- a/rev-list.c
+++ b/rev-list.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "refs.h"
#include "tag.h"
#include "commit.h"
#include "tree.h"
@@ -489,6 +490,22 @@ static void handle_one_commit(struct commit *com, struct commit_list **lst)
commit_list_insert(com, lst);
}
+/* for_each_ref() callback does not allow user data -- Yuck. */
+static struct commit_list **global_lst;
+
+static int include_one_commit(const char *path, const unsigned char *sha1)
+{
+ struct commit *com = get_commit_reference(path, 0);
+ handle_one_commit(com, global_lst);
+ return 0;
+}
+
+static void handle_all(struct commit_list **lst)
+{
+ global_lst = lst;
+ for_each_ref(include_one_commit);
+ global_lst = NULL;
+}
int main(int argc, char **argv)
{
@@ -542,6 +559,10 @@ int main(int argc, char **argv)
bisect_list = 1;
continue;
}
+ if (!strcmp(arg, "--all")) {
+ handle_all(&list);
+ continue;
+ }
if (!strcmp(arg, "--objects")) {
tag_objects = 1;
tree_objects = 1;