Skip to content

Commit 03eae9a

Browse files
john-caigitster
authored andcommitted
builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h
Instead of including USE_THE_REPOSITORY_VARIABLE by default on every builtin, remove it from builtin.h and add it to all the builtins that include builtin.h (by definition, that means all builtins/*.c). Also, remove the include statement for repository.h since it gets brought in through builtin.h. The next step will be to migrate each builtin from having to use the_repository. Signed-off-by: John Cai <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9b1cb50 commit 03eae9a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+147
-92
lines changed

builtin.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
#ifndef BUILTIN_H
22
#define BUILTIN_H
33

4-
/*
5-
* TODO: Almost all of our builtins access `the_repository` by necessity
6-
* because they do not get passed a pointer to it. We should adapt the function
7-
* signature of those main functions to accept a `struct repository *` and then
8-
* remove the macro here.
9-
*/
10-
#define USE_THE_REPOSITORY_VARIABLE
11-
124
#include "git-compat-util.h"
135
#include "repository.h"
146

builtin/add.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (C) 2006 Linus Torvalds
55
*/
6-
6+
#define USE_THE_REPOSITORY_VARIABLE
77
#include "builtin.h"
88
#include "advice.h"
99
#include "config.h"
@@ -18,7 +18,6 @@
1818
#include "preload-index.h"
1919
#include "diff.h"
2020
#include "read-cache.h"
21-
#include "repository.h"
2221
#include "revision.h"
2322
#include "bulk-checkin.h"
2423
#include "strvec.h"

builtin/am.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Based on git-am.sh by Junio C Hamano.
55
*/
66

7+
#define USE_THE_REPOSITORY_VARIABLE
78
#include "builtin.h"
89
#include "abspath.h"
910
#include "advice.h"
@@ -38,7 +39,6 @@
3839
#include "string-list.h"
3940
#include "pager.h"
4041
#include "path.h"
41-
#include "repository.h"
4242
#include "pretty.h"
4343

4444
/**

builtin/annotate.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*
44
* Copyright (C) 2006 Ryan Anderson
55
*/
6+
7+
#define USE_THE_REPOSITORY_VARIABLE
68
#include "git-compat-util.h"
79
#include "builtin.h"
810
#include "strvec.h"

builtin/apply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "gettext.h"
3-
#include "repository.h"
44
#include "hash.h"
55
#include "apply.h"
66

builtin/archive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
* Copyright (c) 2006 Franck Bui-Huu
33
* Copyright (c) 2006 Rene Scharfe
44
*/
5+
#define USE_THE_REPOSITORY_VARIABLE
56
#include "builtin.h"
67
#include "archive.h"
78
#include "gettext.h"
89
#include "transport.h"
910
#include "parse-options.h"
1011
#include "pkt-line.h"
11-
#include "repository.h"
1212

1313
static void create_output_file(const char *output_file)
1414
{

builtin/bisect.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "copy.h"
34
#include "environment.h"

builtin/blame.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
* Copyright (c) 2006, 2014 by its authors
55
* See COPYING for licensing conditions
66
*/
7-
7+
#define USE_THE_REPOSITORY_VARIABLE
88
#include "builtin.h"
99
#include "config.h"
1010
#include "color.h"
1111
#include "builtin.h"
1212
#include "environment.h"
1313
#include "gettext.h"
1414
#include "hex.h"
15-
#include "repository.h"
1615
#include "commit.h"
1716
#include "diff.h"
1817
#include "revision.h"

builtin/branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Copyright (c) 2006 Kristian Høgsberg <[email protected]>
55
* Based on git-branch.sh by Junio C Hamano.
66
*/
7-
7+
#define USE_THE_REPOSITORY_VARIABLE
88
#include "builtin.h"
99
#include "config.h"
1010
#include "color.h"

builtin/bugreport.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "abspath.h"
34
#include "editor.h"

builtin/bundle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "abspath.h"
34
#include "gettext.h"
45
#include "setup.h"
56
#include "strvec.h"
67
#include "parse-options.h"
78
#include "pkt-line.h"
8-
#include "repository.h"
99
#include "bundle.h"
1010

1111
/*

builtin/cat-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (C) Linus Torvalds, 2005
55
*/
6-
6+
#define USE_THE_REPOSITORY_VARIABLE
77
#include "builtin.h"
88
#include "config.h"
99
#include "convert.h"

builtin/check-attr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "config.h"
34
#include "attr.h"
45
#include "environment.h"
56
#include "gettext.h"
67
#include "object-name.h"
78
#include "quote.h"
8-
#include "repository.h"
99
#include "setup.h"
1010
#include "parse-options.h"
1111
#include "write-or-die.h"

builtin/check-ignore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "config.h"
34
#include "dir.h"
45
#include "gettext.h"
56
#include "quote.h"
67
#include "pathspec.h"
78
#include "parse-options.h"
8-
#include "repository.h"
99
#include "submodule.h"
1010
#include "write-or-die.h"
1111

builtin/check-mailmap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "config.h"
34
#include "gettext.h"

builtin/check-ref-format.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* GIT - The information manager from hell
33
*/
4-
4+
#define USE_THE_REPOSITORY_VARIABLE
55
#include "builtin.h"
66
#include "refs.h"
77
#include "setup.h"

builtin/checkout--worker.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "config.h"
34
#include "entry.h"

builtin/checkout-index.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
* Copyright (C) 2005 Linus Torvalds
55
*
66
*/
7-
7+
#define USE_THE_REPOSITORY_VARIABLE
88
#include "builtin.h"
99
#include "config.h"
1010
#include "gettext.h"
1111
#include "lockfile.h"
1212
#include "quote.h"
13-
#include "repository.h"
1413
#include "cache-tree.h"
1514
#include "parse-options.h"
1615
#include "entry.h"

builtin/checkout.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "advice.h"
34
#include "branch.h"

builtin/clean.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Based on git-clean.sh by Pavel Roskin
77
*/
8-
8+
#define USE_THE_REPOSITORY_VARIABLE
99
#include "builtin.h"
1010
#include "abspath.h"
1111
#include "config.h"
@@ -14,7 +14,6 @@
1414
#include "parse-options.h"
1515
#include "path.h"
1616
#include "read-cache-ll.h"
17-
#include "repository.h"
1817
#include "setup.h"
1918
#include "string-list.h"
2019
#include "quote.h"

builtin/clone.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
*
88
* Clone a repository into a different directory that does not yet exist.
99
*/
10-
10+
#define USE_THE_REPOSITORY_VARIABLE
1111
#include "builtin.h"
12+
1213
#include "abspath.h"
1314
#include "advice.h"
1415
#include "config.h"

builtin/column.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "config.h"
34
#include "gettext.h"

builtin/commit-graph.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "commit.h"
34
#include "config.h"
45
#include "environment.h"
56
#include "gettext.h"
67
#include "hex.h"
78
#include "parse-options.h"
8-
#include "repository.h"
99
#include "commit-graph.h"
1010
#include "object-store-ll.h"
1111
#include "progress.h"

builtin/commit-tree.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
*
44
* Copyright (C) Linus Torvalds, 2005
55
*/
6+
#define USE_THE_REPOSITORY_VARIABLE
67
#include "builtin.h"
78
#include "config.h"
89
#include "gettext.h"
910
#include "hex.h"
1011
#include "object-name.h"
1112
#include "object-store-ll.h"
12-
#include "repository.h"
13+
1314
#include "commit.h"
1415
#include "parse-options.h"
1516

builtin/commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Copyright (c) 2007 Kristian Høgsberg <[email protected]>
55
* Based on git-commit.sh by Junio C Hamano and Linus Torvalds
66
*/
7-
7+
#define USE_THE_REPOSITORY_VARIABLE
88
#include "builtin.h"
99
#include "advice.h"
1010
#include "config.h"

builtin/config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "abspath.h"
34
#include "config.h"
45
#include "color.h"
56
#include "editor.h"
67
#include "environment.h"
7-
#include "repository.h"
88
#include "gettext.h"
99
#include "ident.h"
1010
#include "parse-options.h"

builtin/count-objects.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
*
44
* Copyright (c) 2006 Junio C Hamano
55
*/
6-
6+
#define USE_THE_REPOSITORY_VARIABLE
77
#include "builtin.h"
88
#include "config.h"
99
#include "dir.h"
1010
#include "environment.h"
1111
#include "gettext.h"
1212
#include "path.h"
13-
#include "repository.h"
1413
#include "parse-options.h"
1514
#include "quote.h"
1615
#include "packfile.h"

builtin/credential-cache--daemon.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "abspath.h"
34
#include "gettext.h"

builtin/credential-cache.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "credential.h"
34
#include "gettext.h"

builtin/credential-store.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "config.h"
34
#include "gettext.h"

builtin/credential.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
2+
13
#include "git-compat-util.h"
24
#include "credential.h"
35
#include "builtin.h"

builtin/describe.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "config.h"
34
#include "environment.h"

builtin/diagnose.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "abspath.h"
34
#include "gettext.h"

builtin/diff-files.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
*
44
* Copyright (C) Linus Torvalds, 2005
55
*/
6+
#define USE_THE_REPOSITORY_VARIABLE
67
#include "builtin.h"
78
#include "config.h"
89
#include "diff.h"
910
#include "diff-merges.h"
1011
#include "commit.h"
1112
#include "preload-index.h"
12-
#include "repository.h"
1313
#include "revision.h"
1414

1515
static const char diff_files_usage[] =

builtin/diff-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "config.h"
34
#include "diff.h"
45
#include "diff-merges.h"
56
#include "commit.h"
67
#include "preload-index.h"
7-
#include "repository.h"
88
#include "revision.h"
99
#include "setup.h"
1010

builtin/diff-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
12
#include "builtin.h"
23
#include "config.h"
34
#include "diff.h"
@@ -6,7 +7,6 @@
67
#include "hex.h"
78
#include "log-tree.h"
89
#include "read-cache-ll.h"
9-
#include "repository.h"
1010
#include "revision.h"
1111
#include "tmp-objdir.h"
1212
#include "tree.h"

builtin/diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2006 Junio C Hamano
55
*/
6-
6+
#define USE_THE_REPOSITORY_VARIABLE
77
#include "builtin.h"
88
#include "config.h"
99
#include "ewah/ewok.h"

builtin/difftool.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
*
1212
* Copyright (C) 2016 Johannes Schindelin
1313
*/
14-
14+
#define USE_THE_REPOSITORY_VARIABLE
1515
#include "builtin.h"
16+
1617
#include "abspath.h"
1718
#include "config.h"
1819
#include "copy.h"

0 commit comments

Comments
 (0)