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"

0 commit comments

Comments
 (0)