Re: [RFC PATCH 09/12] fsck: check commit-graph
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Apr 20, 2018, 16:59 UTC
- Message-ID
- <86bmedervj.fsf@gmail.com>
- In-Reply-To
- <20180417181028.198397-10-dstolee@microsoft.com>
Derrick Stolee <dstolee@microsoft.com> writes:
> If a commit-graph file exists, check its contents during 'git fsck'.
Is it "if a commit-graph file exists", or is it core.commitGraph feature is turned on?
Show 15 quoted lines
> > Signed-off-by: Derrick Stolee <dstolee@microsoft.com> > --- > builtin/fsck.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/builtin/fsck.c b/builtin/fsck.c > index ef78c6c00c..9712f230ba 100644 > --- a/builtin/fsck.c > +++ b/builtin/fsck.c > @@ -16,6 +16,7 @@ > #include "streaming.h" > #include "decorate.h" > #include "packfile.h" > +#include "run-command.h"
Couln't this be done internally, without run-command? Or is it just preliminary implementation?
Show 8 quoted lines
> > #define REACHABLE 0x0001 > #define SEEN 0x0002 > @@ -45,6 +46,7 @@ static int name_objects; > #define ERROR_REACHABLE 02 > #define ERROR_PACK 04 > #define ERROR_REFS 010 > +#define ERROR_COMMIT_GRAPH 020
I see that these error status codes are not documented anywhere. Still, I would expect at least mentioning commit-graph in the git-fsck manpage.
Show 20 quoted lines
>
> static const char *describe_object(struct object *obj)
> {
> @@ -815,5 +817,16 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
> }
>
> check_connectivity();
> +
> + if (core_commit_graph) {
> + struct child_process commit_graph_check = CHILD_PROCESS_INIT;
> + const char *check_argv[] = { "commit-graph", "check", NULL, NULL };
> + commit_graph_check.argv = check_argv;
> + commit_graph_check.git_cmd = 1;
> +
> + if (run_command(&commit_graph_check))
> + errors_found |= ERROR_COMMIT_GRAPH;
> + }
> +
> return errors_found;
> }