From 0a1bc12b6e401825f009ac8bb14fc438f77e2d9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Thu, 5 Dec 2013 20:02:47 +0700 Subject: receive-pack: allow pushes that update .git/shallow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The basic 8 steps to update .git/shallow does not fully apply here because the user may choose to accept just a few refs (while fetch always accepts all refs). The steps are modified a bit. 1-6. same as before. After calling assign_shallow_commits_to_refs at step 6, each shallow commit has a bitmap that marks all refs that require it. 7. mark all "ours" shallow commits that are reachable from any refs. We will need to do the original step 7 on them later. 8. go over all shallow commit bitmaps, mark refs that require new shallow commits. 9. setup a strict temporary shallow file to plug all the holes, even if it may cut some of our history short. This file is used by all hooks. The hooks could use --shallow-file=$GIT_DIR/shallow to overcome this and reach everything in current repo. 10. go over the new refs one by one. For each ref, do the reachability test if it needs a shallow commit on the list from step 7. Remove it if it's reachable from our refs. Gather all required shallow commits, run check_everything_connected() with the new ref, then install them to .git/shallow. This mode is disabled by default and can be turned on with receive.shallowupdate Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- commit.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'commit.h') diff --git a/commit.h b/commit.h index 79649efc7c..a1f2d49433 100644 --- a/commit.h +++ b/commit.h @@ -216,6 +216,14 @@ struct shallow_info { int *ours, nr_ours; int *theirs, nr_theirs; struct sha1_array *ref; + + /* for receive-pack */ + uint32_t **used_shallow; + int *need_reachability_test; + int *reachable; + int *shallow_ref; + struct commit **commits; + int nr_commits; }; extern void prepare_shallow_info(struct shallow_info *, struct sha1_array *); @@ -226,6 +234,7 @@ extern void remove_nonexistent_ours_in_pack(struct shallow_info *, extern void assign_shallow_commits_to_refs(struct shallow_info *info, uint32_t **used, int *ref_status); +extern int delayed_reachability_test(struct shallow_info *si, int c); int is_descendant_of(struct commit *, struct commit_list *); int in_merge_bases(struct commit *, struct commit *); -- cgit v1.2.3