aboutsummaryrefslogtreecommitdiffstats
path: root/path.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-04-29 09:52:17 +0200
committerJunio C Hamano <gitster@pobox.com>2025-04-29 10:08:12 -0700
commit0b8ed25b66aedc9f4fe44d1a5cab2719290b22a9 (patch)
tree65a7f303e6d38747541900fc449abc43288a70a1 /path.h
parentobject-store: drop `loose_object_path()` (diff)
downloadgit-0b8ed25b66aedc9f4fe44d1a5cab2719290b22a9.tar.gz
git-0b8ed25b66aedc9f4fe44d1a5cab2719290b22a9.zip
object-store: move and rename `odb_pack_keep()`
The function `odb_pack_keep()` creates a file at the passed-in path. If this fails, then the function re-tries by first creating any potentially missing leading directories and then trying to create the file once again. As such, this function doesn't host any kind of logic that is specific to the object store, but is rather a generic helper function. Rename the function to `safe_create_file_with_leading_directories()` and move it into "path.c". While at it, refactor it so that it loses its dependency on `the_repository`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'path.h')
-rw-r--r--path.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/path.h b/path.h
index fd1a194b06..e67348f253 100644
--- a/path.h
+++ b/path.h
@@ -266,6 +266,13 @@ enum scld_error safe_create_leading_directories_const(struct repository *repo,
const char *path);
enum scld_error safe_create_leading_directories_no_share(char *path);
+/*
+ * Create a file, potentially creating its leading directories in case they
+ * don't exist. Returns the return value of the open(3p) call.
+ */
+int safe_create_file_with_leading_directories(struct repository *repo,
+ const char *path);
+
# ifdef USE_THE_REPOSITORY_VARIABLE
# include "strbuf.h"
# include "repository.h"