Web lists-archives.com

[PATCH 044/194] pack: move struct pack_window and pack_entry to packfile.h




From: Jonathan Nieder <jrnieder@xxxxxxxxx>

This should make these functions easier to find and cache.h less
overwhelming to read.

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
---
 builtin/pack-objects.c |  1 +
 cache.h                | 15 ---------------
 object-store.h         |  1 +
 pack.h                 |  1 +
 packfile.c             |  1 +
 packfile.h             | 19 +++++++++++++++++++
 6 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index b998e139d1..7cb73c29ac 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -10,6 +10,7 @@
 #include "commit.h"
 #include "tag.h"
 #include "tree.h"
+#include "packfile.h"
 #include "delta.h"
 #include "pack.h"
 #include "pack-revindex.h"
diff --git a/cache.h b/cache.h
index 7be9a8ad27..c66e59733d 100644
--- a/cache.h
+++ b/cache.h
@@ -1544,21 +1544,6 @@ extern int has_dirs_only_path(const char *name, int len, int prefix_len);
 extern void schedule_dir_for_removal(const char *name, int len);
 extern void remove_scheduled_dirs(void);
 
-struct pack_window {
-	struct pack_window *next;
-	unsigned char *base;
-	off_t offset;
-	size_t len;
-	unsigned int last_used;
-	unsigned int inuse_cnt;
-};
-
-struct pack_entry {
-	off_t offset;
-	unsigned char sha1[20];
-	struct packed_git *p;
-};
-
 /*
  * Create a temporary file rooted in the object database directory, or
  * die on failure. The filename is taken from "pattern", which should have the
diff --git a/object-store.h b/object-store.h
index 7a372baa79..3475e22021 100644
--- a/object-store.h
+++ b/object-store.h
@@ -5,6 +5,7 @@
 #include "mru.h"
 #include "replace-object.h"
 #include "alternates.h"
+#include "packfile.h"
 
 struct object_store {
 	struct packed_git *packed_git;
diff --git a/pack.h b/pack.h
index 8294341af1..c0ea2b6499 100644
--- a/pack.h
+++ b/pack.h
@@ -2,6 +2,7 @@
 #define PACK_H
 
 #include "object.h"
+#include "packfile.h"
 #include "csum-file.h"
 
 /*
diff --git a/packfile.c b/packfile.c
index a7504debe5..b73814f2ce 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "mru.h"
+#include "packfile.h"
 #include "pack.h"
 #include "repository.h"
 #include "alternates.h"
diff --git a/packfile.h b/packfile.h
index b3138816e7..1163fc7bb4 100644
--- a/packfile.h
+++ b/packfile.h
@@ -1,6 +1,25 @@
 #ifndef PACKFILE_H
 #define PACKFILE_H
 
+/* in cache.h */
+enum object_type;
+struct object_info;
+
+struct pack_window {
+	struct pack_window *next;
+	unsigned char *base;
+	off_t offset;
+	size_t len;
+	unsigned int last_used;
+	unsigned int inuse_cnt;
+};
+
+struct pack_entry {
+	off_t offset;
+	unsigned char sha1[20];
+	struct packed_git *p;
+};
+
 /*
  * Generate the filename to be used for a pack file with checksum "sha1" and
  * extension "ext". The result is written into the strbuf "buf", overwriting
-- 
2.15.1.433.g936d1b9894.dirty