From: Taylor Blau Date: Thu, 30 Apr 2020 19:48:43 GMT Subject: [PATCH v2 0/4] shallow: extract a header file Message-ID: Hi, Here's a reroll of my series to introduce 'shallow.h' after some very helpful review from yesterday evening and early this morning. Not a ton has changed since last time, but here are the main points. A range-diff since v1 is included below for a more detailed look at the changes. * The #include in 'builtin.h' was dropped and instead the burden of including 'shallow.h' falls on the callers. Six builtins needed to be updated to include 'shallow.h', so this seems a net positive for the others that don't need to include it. * Comments were updated in the final two patches for increased readability and helpfulness. * The third patch was folded into the second patch to make the refactoring occur in a single step. * A comment was added to 'commit_graft_pos' to indicate what position is being returned. Like last time, this is based on my earlier series 'tb/reset-shallow', which should be on master shortly (perhaps in the next push-out? Not sure.). Thanks in advance for a re-review :). Taylor Blau (4): commit: make 'commit_graft_pos' non-static shallow: extract a header file for shallow-related functions shallow.h: document '{commit,rollback}_shallow_file' shallow: use struct 'shallow_lock' for additional safety builtin/fetch.c | 1 + builtin/pack-objects.c | 1 + builtin/prune.c | 1 + builtin/receive-pack.c | 3 +- builtin/repack.c | 1 + builtin/rev-parse.c | 1 + commit-graph.c | 1 + commit.c | 16 ++------- commit.h | 49 +------------------------ environment.c | 1 + fetch-pack.c | 3 +- git.c | 1 + send-pack.c | 1 + shallow.c | 36 +++++++++++++------ shallow.h | 81 ++++++++++++++++++++++++++++++++++++++++++ upload-pack.c | 1 + 16 files changed, 123 insertions(+), 75 deletions(-) create mode 100644 shallow.h Range-diff against v1: 1: 8ac4c63735 = 1: cb8dde2ae2 commit: make 'commit_graft_pos' non-static 2: 8ee7ed0666 < -: ---------- shallow: take 'unregister_shallow' from 'commit.c' 3: 3fb71045b6 ! 2: 0631e2a87d shallow: extract a header file for shallow-related functions @@ Commit message But, now there are a good number of shallow-related functions, and placing them all in 'commit.h' doesn't make sense. - This patch extracts a 'shallow.h', which takes all of the headers from - 'commit.h' for functions which already exist in 'shallow.c'. We will - bring the remaining shallow-related functions defined in 'commit.c' in a - subsequent patch. + This patch extracts a 'shallow.h', which takes all of the declarations + from 'commit.h' for functions which already exist in 'shallow.c'. We + will bring the remaining shallow-related functions defined in 'commit.c' + in a subsequent patch. For now, move only the ones that already are implemented in 'shallow.c', and update the necessary includes. Signed-off-by: Taylor Blau - ## builtin.h ## + ## builtin/fetch.c ## @@ - #include "strbuf.h" - #include "cache.h" - #include "commit.h" + #include "branch.h" + #include "promisor-remote.h" + #include "commit-graph.h" +#include "shallow.h" - /* - * builtin API + #define FORCED_UPDATES_DELAY_WARNING_IN_MS (10 * 1000) + + + ## builtin/pack-objects.c ## +@@ + #include "dir.h" + #include "midx.h" + #include "trace2.h" ++#include "shallow.h" + + #define IN_PACK(obj) oe_in_pack(&to_pack, obj) + #define SIZE(obj) oe_size(&to_pack, obj) + + ## builtin/prune.c ## +@@ + #include "parse-options.h" + #include "progress.h" + #include "object-store.h" ++#include "shallow.h" + + static const char * const prune_usage[] = { + N_("git prune [-n] [-v] [--progress] [--expire