Skip to content

Commit 36026a0

Browse files
pks-tgitster
authored andcommitted
refs: avoid include cycle with "repository.h"
There is an include cycle between "refs.h" and "repository.h" via "commit.h", "object.h" and "hash.h". This has the effect that several definitions of structs and enums will not be visible once we merge "hash-ll.h" back into "hash.h" in the next commit. The only reason that "repository.h" includes "refs.h" is the definition of `enum ref_storage_format`. Move it into "repository.h" and have "refs.h" include "repository.h" instead to fix the cycle. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e7da938 commit 36026a0

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

refs.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,15 @@
22
#define REFS_H
33

44
#include "commit.h"
5+
#include "repository.h"
56

67
struct object_id;
78
struct ref_store;
8-
struct repository;
99
struct strbuf;
1010
struct string_list;
1111
struct string_list_item;
1212
struct worktree;
1313

14-
enum ref_storage_format {
15-
REF_STORAGE_FORMAT_UNKNOWN,
16-
REF_STORAGE_FORMAT_FILES,
17-
REF_STORAGE_FORMAT_REFTABLE,
18-
};
19-
2014
enum ref_storage_format ref_storage_format_by_name(const char *name);
2115
const char *ref_storage_format_to_name(enum ref_storage_format ref_storage_format);
2216

repository.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef REPOSITORY_H
22
#define REPOSITORY_H
33

4-
#include "refs.h"
54
#include "strmap.h"
65

76
struct config_set;
@@ -27,6 +26,12 @@ enum fetch_negotiation_setting {
2726
FETCH_NEGOTIATION_NOOP,
2827
};
2928

29+
enum ref_storage_format {
30+
REF_STORAGE_FORMAT_UNKNOWN,
31+
REF_STORAGE_FORMAT_FILES,
32+
REF_STORAGE_FORMAT_REFTABLE,
33+
};
34+
3035
struct repo_settings {
3136
int initialized;
3237

0 commit comments

Comments
 (0)