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

[PATCH v2 05/22] copy.h: move declarations for copy.c functions from cache.h

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 22, 2023, 20:17 UTC
Message-ID
<513ffafa597f18363bdcd308cf8159c21e66ecb0.1682194651.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1517.v2.git.1682194649.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
---
 builtin/bisect.c     |  1 +
 builtin/clone.c      |  1 +
 builtin/difftool.c   |  1 +
 builtin/init-db.c    |  1 +
 builtin/worktree.c   |  1 +
 bundle-uri.c         |  1 +
 cache.h              |  6 ------
 convert.c            |  1 +
 copy.c               |  1 +
 copy.h               | 10 ++++++++++
 pkt-line.c           |  1 +
 refs/files-backend.c |  1 +
 rerere.c             |  1 +
 sequencer.c          |  1 +
 14 files changed, 22 insertions(+), 6 deletions(-)
 create mode 100644 copy.h
diff --git a/builtin/bisect.c b/builtin/bisect.c
index 4b2143d4557..4812450c393 100644
--- a/builtin/bisect.c
+++ b/builtin/bisect.c
@@ -1,5 +1,6 @@
 #include "builtin.h"
 #include "cache.h"
+#include "copy.h"
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
diff --git a/builtin/clone.c b/builtin/clone.c
index 4ed0a1d5aad..017ebc3faa8 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -13,6 +13,7 @@
 #include "abspath.h"
 #include "advice.h"
 #include "config.h"
+#include "copy.h"
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
diff --git a/builtin/difftool.c b/builtin/difftool.c
index 3ffb0524be7..409507983f2 100644
--- a/builtin/difftool.c
+++ b/builtin/difftool.c
@@ -15,6 +15,7 @@
 #include "cache.h"
 #include "abspath.h"
 #include "config.h"
+#include "copy.h"
 #include "builtin.h"
 #include "run-command.h"
 #include "environment.h"
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 6183f3fb3ff..cda6ee75eb5 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -6,6 +6,7 @@
 #include "cache.h"
 #include "abspath.h"
 #include "config.h"
+#include "copy.h"
 #include "environment.h"
 #include "gettext.h"
 #include "refs.h"
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 0621f6f708e..0b411e9deee 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -2,6 +2,7 @@
 #include "abspath.h"
 #include "checkout.h"
 #include "config.h"
+#include "copy.h"
 #include "builtin.h"
 #include "dir.h"
 #include "environment.h"
diff --git a/bundle-uri.c b/bundle-uri.c
index 1ff1cf51dad..6d44662ee1f 100644
--- a/bundle-uri.c
+++ b/bundle-uri.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "bundle-uri.h"
 #include "bundle.h"
+#include "copy.h"
 #include "environment.h"
 #include "gettext.h"
 #include "object-store.h"
diff --git a/cache.h b/cache.h
index 2eb4546473f..2b661764794 100644
--- a/cache.h
+++ b/cache.h
@@ -593,12 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,
 int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);
 int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);
 
-#define COPY_READ_ERROR (-2)
-#define COPY_WRITE_ERROR (-3)
-int copy_fd(int ifd, int ofd);
-int copy_file(const char *dst, const char *src, int mode);
-int copy_file_with_time(const char *dst, const char *src, int mode);
-
 /* base85 */
 int decode_85(char *dst, const char *line, int linelen);
 void encode_85(char *buf, const unsigned char *data, int bytes);
diff --git a/convert.c b/convert.c
index 5a2ea5308d6..7cf7bd0c883 100644
--- a/convert.c
+++ b/convert.c
@@ -2,6 +2,7 @@
 #include "advice.h"
 #include "config.h"
 #include "convert.h"
+#include "copy.h"
 #include "gettext.h"
 #include "hex.h"
 #include "object-store.h"
diff --git a/copy.c b/copy.c
index c3250f08221..db6b615c188 100644
--- a/copy.c
+++ b/copy.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "copy.h"
 #include "wrapper.h"
 
 int copy_fd(int ifd, int ofd)
diff --git a/copy.h b/copy.h
new file mode 100644
index 00000000000..2af77cba864
--- /dev/null
+++ b/copy.h
@@ -0,0 +1,10 @@
+#ifndef COPY_H
+#define COPY_H
+
+#define COPY_READ_ERROR (-2)
+#define COPY_WRITE_ERROR (-3)
+int copy_fd(int ifd, int ofd);
+int copy_file(const char *dst, const char *src, int mode);
+int copy_file_with_time(const char *dst, const char *src, int mode);
+
+#endif /* COPY_H */
diff --git a/pkt-line.c b/pkt-line.c
index 3561d853584..8b5fa788517 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "copy.h"
 #include "pkt-line.h"
 #include "gettext.h"
 #include "hex.h"
diff --git a/refs/files-backend.c b/refs/files-backend.c
index d0581ee41ac..1128a9af292 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1,5 +1,6 @@
 #include "../cache.h"
 #include "../config.h"
+#include "../copy.h"
 #include "../environment.h"
 #include "../gettext.h"
 #include "../hex.h"
diff --git a/rerere.c b/rerere.c
index 7abc94bf444..e968d413d65 100644
--- a/rerere.c
+++ b/rerere.c
@@ -2,6 +2,7 @@
 #include "abspath.h"
 #include "alloc.h"
 #include "config.h"
+#include "copy.h"
 #include "gettext.h"
 #include "hex.h"
 #include "lockfile.h"
diff --git a/sequencer.c b/sequencer.c
index fcca3b81447..c16df514434 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3,6 +3,7 @@
 #include "advice.h"
 #include "alloc.h"
 #include "config.h"
+#include "copy.h"
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
-- 
gitgitgadget
Previous: Elijah Newren via GitGitGadgetNext: Elijah Newren via GitGitGadget
Message 40 of 81 in “Header cleanups (more splitting of cache.h and simplifying a few other deps)”
  1. 00/23 Header cleanups (more splitting of cache.h and simplifying a few other deps)Elijah Newren via GitGitGadget, Apr 16, 2023
  2. 06/23 copy.h: move declarations for copy.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  3. 03/23 protocol.h: move definition of DEFAULT_GIT_PORT from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  4. 02/23 symlinks.h: move declarations for symlinks.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  5. 01/23 treewide: be explicit about dependence on strbuf.hElijah Newren via GitGitGadget, Apr 16, 2023
  6. 04/23 packfile.h: move pack_window and pack_entry from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  7. 05/23 server-info.h: move declarations for server-info.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  8. 07/23 base85.h: move declarations for base85.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  9. 08/23 pkt-line.h: move declarations for pkt-line.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  10. 09/23 match-trees.h: move declarations for match-trees.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  11. 11/23 versioncmp.h: move declarations for versioncmp.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  12. 10/23 ws.h: move declarations for ws.c functions from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  13. 12/23 dir.h: move DTYPE defines from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  14. 15/23 cache,tree: move cmp_cache_name_compare from tree.[ch] to read-cache.cElijah Newren via GitGitGadget, Apr 16, 2023
  15. 16/23 cache,tree: move basic name compare functions from read-cache to treeElijah Newren via GitGitGadget, Apr 16, 2023
  16. 18/23 cache.h: remove unnecessary headersElijah Newren via GitGitGadget, Apr 16, 2023
  17. 13/23 tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  18. 19/23 fsmonitor: reduce includes of cache.hElijah Newren via GitGitGadget, Apr 16, 2023
  19. 17/23 treewide: remove cache.h inclusion due to previous changesElijah Newren via GitGitGadget, Apr 16, 2023
  20. 14/23 hash.h, repository.h: reverse the order of these dependenciesElijah Newren via GitGitGadget, Apr 16, 2023
  21. Derrick StoleeApr 17, 2023
  22. Elijah NewrenApr 18, 2023
  23. Junio C HamanoApr 18, 2023
  24. Elijah NewrenApr 20, 2023
  25. Derrick StoleeApr 20, 2023
  26. Junio C HamanoApr 20, 2023
  27. Glen ChooApr 20, 2023
  28. 21/23 object-store.h: reduce unnecessary includesElijah Newren via GitGitGadget, Apr 16, 2023
  29. 20/23 commit.h: reduce unnecessary includesElijah Newren via GitGitGadget, Apr 16, 2023
  30. 22/23 diff.h: reduce unnecessary includesElijah Newren via GitGitGadget, Apr 16, 2023
  31. 23/23 reftable: ensure git-compat-util.h is the first (indirect) includeElijah Newren via GitGitGadget, Apr 16, 2023
  32. Derrick StoleeApr 17, 2023
  33. Elijah NewrenApr 18, 2023
  34. 00/22 Header cleanups (more splitting of cache.h and simplifying a few other deps)Elijah Newren via GitGitGadget, Apr 22, 2023
  35. 01/22 treewide: be explicit about dependence on strbuf.hElijah Newren via GitGitGadget, Apr 22, 2023
  36. 02/22 symlinks.h: move declarations for symlinks.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  37. 03/22 packfile.h: move pack_window and pack_entry from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  38. 07/22 pkt-line.h: move declarations for pkt-line.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  39. 04/22 server-info.h: move declarations for server-info.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  40. 05/22 copy.h: move declarations for copy.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  41. 08/22 match-trees.h: move declarations for match-trees.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  42. 06/22 base85.h: move declarations for base85.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  43. 09/22 ws.h: move declarations for ws.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  44. 10/22 versioncmp.h: move declarations for versioncmp.c functions from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  45. 11/22 dir.h: move DTYPE defines from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  46. 14/22 cache,tree: move cmp_cache_name_compare from tree.[ch] to read-cache.cElijah Newren via GitGitGadget, Apr 22, 2023
  47. 15/22 cache,tree: move basic name compare functions from read-cache to treeElijah Newren via GitGitGadget, Apr 22, 2023
  48. 12/22 tree-diff.c: move S_DIFFTREE_IFXMIN_NEQ define from cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  49. Ævar Arnfjörð BjarmasonMay 1, 2023
  50. Junio C HamanoMay 1, 2023
  51. Elijah NewrenMay 2, 2023
  52. Elijah NewrenMay 2, 2023
  53. Junio C HamanoMay 2, 2023
  54. Elijah NewrenMay 2, 2023
  55. 16/22 treewide: remove cache.h inclusion due to previous changesElijah Newren via GitGitGadget, Apr 22, 2023
  56. Ævar Arnfjörð BjarmasonMay 1, 2023
  57. Elijah NewrenMay 2, 2023
  58. 17/22 cache.h: remove unnecessary headersElijah Newren via GitGitGadget, Apr 22, 2023
  59. Ævar Arnfjörð BjarmasonMay 1, 2023
  60. Elijah NewrenMay 2, 2023
  61. 18/22 fsmonitor: reduce includes of cache.hElijah Newren via GitGitGadget, Apr 22, 2023
  62. 20/22 object-store.h: reduce unnecessary includesElijah Newren via GitGitGadget, Apr 22, 2023
  63. Ævar Arnfjörð BjarmasonMay 1, 2023
  64. Elijah NewrenMay 2, 2023
  65. 13/22 hash-ll.h: split out of hash.h to remove dependency on repository.hElijah Newren via GitGitGadget, Apr 22, 2023
  66. Glen ChooApr 24, 2023
  67. Elijah NewrenApr 26, 2023
  68. Glen ChooApr 26, 2023
  69. Junio C HamanoApr 24, 2023
  70. Ævar Arnfjörð BjarmasonMay 1, 2023
  71. Elijah NewrenMay 2, 2023
  72. 19/22 commit.h: reduce unnecessary includesElijah Newren via GitGitGadget, Apr 22, 2023
  73. Ævar Arnfjörð BjarmasonMay 1, 2023
  74. Elijah NewrenMay 2, 2023
  75. 22/22 reftable: ensure git-compat-util.h is the first (indirect) includeElijah Newren via GitGitGadget, Apr 22, 2023
  76. 21/22 diff.h: reduce unnecessary includesElijah Newren via GitGitGadget, Apr 22, 2023
  77. Ævar Arnfjörð BjarmasonMay 1, 2023
  78. Derrick StoleeApr 24, 2023
  79. Junio C HamanoApr 24, 2023
  80. Glen ChooApr 26, 2023
  81. Junio C HamanoApr 26, 2023

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.