git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCHv4 3/6] Move definition of enum branch_track from cache.h to branch.h

From
Elijah Newren <newren@gmail.com>
Date
Aug 15, 2018, 17:54 UTC
Message-ID
<20180815175410.5726-4-newren@gmail.com>
In-Reply-To
<20180815175410.5726-1-newren@gmail.com>

'branch_track' feels more closely related to branching, and it is needed later in branch.h; rather than #include'ing cache.h in branch.h for this small enum, just move the enum and the external declaration for git_branch_track to branch.h.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
---
 branch.h      | 11 +++++++++++
 cache.h       | 10 ----------
 config.c      |  1 +
 environment.c |  1 +
 4 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/branch.h b/branch.h
index 7d9b330eba..5cace4581f 100644
--- a/branch.h
+++ b/branch.h
@@ -3,6 +3,17 @@
 
 struct strbuf;
 
+enum branch_track {
+	BRANCH_TRACK_UNSPECIFIED = -1,
+	BRANCH_TRACK_NEVER = 0,
+	BRANCH_TRACK_REMOTE,
+	BRANCH_TRACK_ALWAYS,
+	BRANCH_TRACK_EXPLICIT,
+	BRANCH_TRACK_OVERRIDE
+};
+
+extern enum branch_track git_branch_track;
+
 /* Functions for acting on the information about branches. */
 
 /*
diff --git a/cache.h b/cache.h
index 8dc7134f00..a1c0c594fb 100644
--- a/cache.h
+++ b/cache.h
@@ -919,15 +919,6 @@ enum log_refs_config {
 };
 extern enum log_refs_config log_all_ref_updates;
 
-enum branch_track {
-	BRANCH_TRACK_UNSPECIFIED = -1,
-	BRANCH_TRACK_NEVER = 0,
-	BRANCH_TRACK_REMOTE,
-	BRANCH_TRACK_ALWAYS,
-	BRANCH_TRACK_EXPLICIT,
-	BRANCH_TRACK_OVERRIDE
-};
-
 enum rebase_setup_type {
 	AUTOREBASE_NEVER = 0,
 	AUTOREBASE_LOCAL,
@@ -944,7 +935,6 @@ enum push_default_type {
 	PUSH_DEFAULT_UNSPECIFIED
 };
 
-extern enum branch_track git_branch_track;
 extern enum rebase_setup_type autorebase;
 extern enum push_default_type push_default;
 
diff --git a/config.c b/config.c
index 66645047eb..66dca7978a 100644
--- a/config.c
+++ b/config.c
@@ -6,6 +6,7 @@
  *
  */
 #include "cache.h"
+#include "branch.h"
 #include "config.h"
 #include "repository.h"
 #include "lockfile.h"
diff --git a/environment.c b/environment.c
index 6cf0079389..0c04a6da7a 100644
--- a/environment.c
+++ b/environment.c
@@ -8,6 +8,7 @@
  * are.
  */
 #include "cache.h"
+#include "branch.h"
 #include "repository.h"
 #include "config.h"
 #include "refs.h"
-- 
2.18.0.553.g74975b7909
Previous: Elijah NewrenNext: Elijah Newren
Message 8 of 14 in “[PATCHv4 0/6] Add missing includes and forward declares”
  1. Elijah NewrenAug 15, 2018
  2. 6/6 Remove forward declaration of an enumElijah Newren, Aug 15, 2018
  3. Jonathan NiederAug 15, 2018
  4. 4/6 urlmatch.h: fix include guardElijah Newren, Aug 15, 2018
  5. 2/6 alloc: make allocate_alloc_state and clear_alloc_state more consistentElijah Newren, Aug 15, 2018
  6. Jonathan NiederAug 15, 2018
  7. 5/6 compat/precompose_utf8.h: use more common include guard styleElijah Newren, Aug 15, 2018
  8. 3/6 Move definition of enum branch_track from cache.h to branch.hElijah Newren, Aug 15, 2018
  9. 1/6 Add missing includes and forward declarationsElijah Newren, Aug 15, 2018
  10. Jonathan NiederAug 15, 2018
  11. Jonathan NiederAug 15, 2018
  12. Ramsay JonesAug 16, 2018
  13. Junio C HamanoAug 16, 2018
  14. Jeff KingAug 16, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.