Skip to content

Commit 6e7c46b

Browse files
derrickstoleedscho
authored andcommitted
backfill: add builtin boilerplate
In anticipation of implementing 'git backfill', populate the necessary files with the boilerplate of a new builtin. RFC TODO: When preparing this for a full implementation, make sure it is based on the newest standards introduced by [1]. [1] https://lore.kernel.org/git/[email protected]/T/#m606036ea2e75a6d6819d6b5c90e729643b0ff7f7 [PATCH 1/3] builtin: add a repository parameter for builtin functions Signed-off-by: Derrick Stolee <[email protected]>
1 parent e001506 commit 6e7c46b

File tree

7 files changed

+57
-0
lines changed

7 files changed

+57
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
/git-apply
2020
/git-archimport
2121
/git-archive
22+
/git-backfill
2223
/git-bisect
2324
/git-blame
2425
/git-branch

Documentation/git-backfill.txt

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
git-backfill(1)
2+
===============
3+
4+
NAME
5+
----
6+
git-backfill - Download missing objects in a partial clone
7+
8+
9+
SYNOPSIS
10+
--------
11+
[verse]
12+
'git backfill' [<options>]
13+
14+
DESCRIPTION
15+
-----------
16+
17+
SEE ALSO
18+
--------
19+
linkgit:git-clone[1].
20+
21+
GIT
22+
---
23+
Part of the linkgit:git[1] suite

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,7 @@ BUILTIN_OBJS += builtin/am.o
12041204
BUILTIN_OBJS += builtin/annotate.o
12051205
BUILTIN_OBJS += builtin/apply.o
12061206
BUILTIN_OBJS += builtin/archive.o
1207+
BUILTIN_OBJS += builtin/backfill.o
12071208
BUILTIN_OBJS += builtin/bisect.o
12081209
BUILTIN_OBJS += builtin/blame.o
12091210
BUILTIN_OBJS += builtin/branch.o

builtin.h

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ int cmd_am(int argc, const char **argv, const char *prefix, struct repository *r
120120
int cmd_annotate(int argc, const char **argv, const char *prefix, struct repository *repo);
121121
int cmd_apply(int argc, const char **argv, const char *prefix, struct repository *repo);
122122
int cmd_archive(int argc, const char **argv, const char *prefix, struct repository *repo);
123+
int cmd_backfill(int argc, const char **argv, const char *prefix, struct repository *repo);
123124
int cmd_bisect(int argc, const char **argv, const char *prefix, struct repository *repo);
124125
int cmd_blame(int argc, const char **argv, const char *prefix, struct repository *repo);
125126
int cmd_branch(int argc, const char **argv, const char *prefix, struct repository *repo);

builtin/backfill.c

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include "builtin.h"
2+
#include "config.h"
3+
#include "parse-options.h"
4+
#include "repository.h"
5+
#include "object.h"
6+
7+
static const char * const builtin_backfill_usage[] = {
8+
N_("git backfill [<options>]"),
9+
NULL
10+
};
11+
12+
int cmd_backfill(int argc, const char **argv, const char *prefix, struct repository *repo)
13+
{
14+
struct option options[] = {
15+
OPT_END(),
16+
};
17+
18+
if (argc == 2 && !strcmp(argv[1], "-h"))
19+
usage_with_options(builtin_backfill_usage, options);
20+
21+
argc = parse_options(argc, argv, prefix, options, builtin_backfill_usage,
22+
0);
23+
24+
repo_config(repo, git_default_config, NULL);
25+
26+
die(_("not implemented"));
27+
28+
return 0;
29+
}

command-list.txt

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ git-annotate ancillaryinterrogators
6060
git-apply plumbingmanipulators complete
6161
git-archimport foreignscminterface
6262
git-archive mainporcelain
63+
git-backfill mainporcelain history
6364
git-bisect mainporcelain info
6465
git-blame ancillaryinterrogators complete
6566
git-branch mainporcelain history

git.c

+1
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ static struct cmd_struct commands[] = {
506506
{ "annotate", cmd_annotate, RUN_SETUP },
507507
{ "apply", cmd_apply, RUN_SETUP_GENTLY },
508508
{ "archive", cmd_archive, RUN_SETUP_GENTLY },
509+
{ "backfill", cmd_backfill, RUN_SETUP },
509510
{ "bisect", cmd_bisect, RUN_SETUP },
510511
{ "blame", cmd_blame, RUN_SETUP },
511512
{ "branch", cmd_branch, RUN_SETUP | DELAY_PAGER_CONFIG },

0 commit comments

Comments
 (0)