From: Junio C Hamano Date: Wed, 27 Dec 2006 10:43:46 +0000 (-0800) Subject: Merge branch 'master' into js/shallow X-Git-Tag: v1.5.0-rc1~172^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=37818d7db070f67a20df58ac7d5e04cc63ef1867;p=git.git Merge branch 'master' into js/shallow This is to adjust to: count-objects -v: show number of packs as well. which will break a test in this series. Signed-off-by: Junio C Hamano --- 37818d7db070f67a20df58ac7d5e04cc63ef1867 diff --cc Makefile index ea5d2cf72,52d4a3a86..c21b91bfa --- a/Makefile +++ b/Makefile @@@ -260,7 -250,8 +250,7 @@@ LIB_OBJS = revision.o pager.o tree-walk.o xdiff-interface.o \ write_or_die.o trace.o list-objects.o grep.o \ alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \ - color.o wt-status.o archive-zip.o archive-tar.o shallow.o - color.o wt-status.o archive-zip.o archive-tar.o \ - utf8.o ++ color.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o BUILTIN_OBJS = \ builtin-add.o \ diff --cc commit.h index e9e158f4e,10eea9f26..936f8fce3 --- a/commit.h +++ b/commit.h @@@ -107,11 -107,5 +107,12 @@@ int read_graft_file(const char *graft_f extern struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2, int cleanup); +extern int register_shallow(const unsigned char *sha1); +extern int unregister_shallow(const unsigned char *sha1); +extern int write_shallow_commits(int fd, int use_pack_protocol); +extern int is_repository_shallow(); +extern struct commit_list *get_shallow_commits(struct object_array *heads, + int depth, int shallow_flag, int not_shallow_flag); + + int in_merge_bases(struct commit *rev1, struct commit *rev2); #endif /* COMMIT_H */ diff --cc git-clone.sh index 8c0a93ebd,490f3e48d..f37eb9d10 --- a/git-clone.sh +++ b/git-clone.sh @@@ -14,7 -14,7 +14,7 @@@ die() } usage() { - die "Usage: $0 [--template=] [--use-immingled-remote] [--reference ] [--bare] [-l [-s]] [-q] [-u ] [--origin ] [--depth ] [-n] []" - die "Usage: $0 [--template=] [--reference ] [--bare] [-l [-s]] [-q] [-u ] [--origin ] [-n] []" ++ die "Usage: $0 [--template=] [--reference ] [--bare] [-l [-s]] [-q] [-u ] [--origin ] [--depth ] [-n] []" } get_repo_base() { diff --cc git-fetch.sh index f0645d97c,ffbd44f0e..5f316053f --- a/git-fetch.sh +++ b/git-fetch.sh @@@ -461,9 -451,7 +463,9 @@@ case "$no_tags$tags" i case "$taglist" in '') ;; ?*) + # do not deepen a shallow tree when following tags + shallow_depth= - fetch_main "$taglist" ;; + fetch_main "$taglist" || exit ;; esac esac diff --cc t/t5500-fetch-pack.sh index fa1084030,f7625a6f4..77c3c575d --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@@ -128,49 -128,4 +128,54 @@@ pull_to_client 2nd "B" $((64*3) pull_to_client 3rd "A" $((1*3)) # old fails +test_expect_success "clone shallow" "git-clone --depth 2 . shallow" + +(cd shallow; git-count-objects -v) > count.shallow + +test_expect_success "clone shallow object count" \ + "test \"in-pack: 18\" = \"$(grep in-pack count.shallow)\"" + - test_expect_success "clone shallow object count (part 2)" \ - "test -z \"$(grep -v in-pack count.shallow | sed "s/^.*: 0//")\"" ++count_output () { ++ sed -e '/^in-pack:/d' -e '/^packs:/d' -e '/: 0$/d' "$1" ++} ++ ++test_expect_success "clone shallow object count (part 2)" ' ++ test -z "$(count_output count.shallow)" ++' + +test_expect_success "fsck in shallow repo" \ + "(cd shallow; git-fsck-objects --full)" + +#test_done; exit + +add B66 $B65 +add B67 $B66 + +test_expect_success "pull in shallow repo" \ + "(cd shallow; git pull .. B)" + +(cd shallow; git-count-objects -v) > count.shallow +test_expect_success "clone shallow object count" \ + "test \"count: 6\" = \"$(grep count count.shallow)\"" + +add B68 $B67 +add B69 $B68 + +test_expect_success "deepening pull in shallow repo" \ + "(cd shallow; git pull --depth 4 .. B)" + +(cd shallow; git-count-objects -v) > count.shallow +test_expect_success "clone shallow object count" \ + "test \"count: 12\" = \"$(grep count count.shallow)\"" + +test_expect_success "deepening fetch in shallow repo" \ + "(cd shallow; git fetch --depth 4 .. A:A)" + +(cd shallow; git-count-objects -v) > count.shallow +test_expect_success "clone shallow object count" \ + "test \"count: 18\" = \"$(grep count count.shallow)\"" + +test_expect_failure "pull in shallow repo with missing merge base" \ + "(cd shallow; git pull --depth 4 .. A)" + test_done