Git fork

Merge branch 'ds/commit-graph-on-fetch'

Regression fix.

* ds/commit-graph-on-fetch:
commit-graph: fix writing first commit-graph during fetch
t5510-fetch.sh: demonstrate fetch.writeCommitGraph bug

+25 -6
+7 -4
commit-graph.c
··· 41 41 #define GRAPH_MIN_SIZE (GRAPH_HEADER_SIZE + 4 * GRAPH_CHUNKLOOKUP_WIDTH \ 42 42 + GRAPH_FANOUT_SIZE + the_hash_algo->rawsz) 43 43 44 + /* Remember to update object flag allocation in object.h */ 45 + #define REACHABLE (1u<<15) 46 + 44 47 char *get_commit_graph_filename(const char *obj_dir) 45 48 { 46 49 char *filename = xstrfmt("%s/info/commit-graph", obj_dir); ··· 1030 1033 { 1031 1034 struct commit_list *parent; 1032 1035 for (parent = commit->parents; parent; parent = parent->next) { 1033 - if (!(parent->item->object.flags & UNINTERESTING)) { 1036 + if (!(parent->item->object.flags & REACHABLE)) { 1034 1037 ALLOC_GROW(ctx->oids.list, ctx->oids.nr + 1, ctx->oids.alloc); 1035 1038 oidcpy(&ctx->oids.list[ctx->oids.nr], &(parent->item->object.oid)); 1036 1039 ctx->oids.nr++; 1037 - parent->item->object.flags |= UNINTERESTING; 1040 + parent->item->object.flags |= REACHABLE; 1038 1041 } 1039 1042 } 1040 1043 } ··· 1052 1055 display_progress(ctx->progress, i + 1); 1053 1056 commit = lookup_commit(ctx->r, &ctx->oids.list[i]); 1054 1057 if (commit) 1055 - commit->object.flags |= UNINTERESTING; 1058 + commit->object.flags |= REACHABLE; 1056 1059 } 1057 1060 stop_progress(&ctx->progress); 1058 1061 ··· 1089 1092 commit = lookup_commit(ctx->r, &ctx->oids.list[i]); 1090 1093 1091 1094 if (commit) 1092 - commit->object.flags &= ~UNINTERESTING; 1095 + commit->object.flags &= ~REACHABLE; 1093 1096 } 1094 1097 stop_progress(&ctx->progress); 1095 1098 }
-1
commit-reach.c
··· 10 10 #include "commit-reach.h" 11 11 12 12 /* Remember to update object flag allocation in object.h */ 13 - #define REACHABLE (1u<<15) 14 13 #define PARENT1 (1u<<16) 15 14 #define PARENT2 (1u<<17) 16 15 #define STALE (1u<<18)
+2 -1
object.h
··· 68 68 * bisect.c: 16 69 69 * bundle.c: 16 70 70 * http-push.c: 16-----19 71 - * commit-reach.c: 15-------19 71 + * commit-graph.c: 15 72 + * commit-reach.c: 16-----19 72 73 * sha1-name.c: 20 73 74 * list-objects-filter.c: 21 74 75 * builtin/fsck.c: 0--3
+16
t/t5510-fetch.sh
··· 583 583 ) 584 584 ' 585 585 586 + test_expect_success 'fetch.writeCommitGraph with submodules' ' 587 + git clone dups super && 588 + ( 589 + cd super && 590 + git submodule add "file://$TRASH_DIRECTORY/three" && 591 + git commit -m "add submodule" 592 + ) && 593 + git clone "super" super-clone && 594 + ( 595 + cd super-clone && 596 + rm -rf .git/objects/info && 597 + git -c fetch.writeCommitGraph=true fetch origin && 598 + test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain 599 + ) 600 + ' 601 + 586 602 # configured prune tests 587 603 588 604 set_config_tristate () {