aboutsummaryrefslogtreecommitdiffstats
path: root/object-store.c
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 /object-store.c
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 'object-store.c')
-rw-r--r--object-store.c13
1 files changed, 0 insertions, 13 deletions
diff --git a/object-store.c b/object-store.c
index e5cfb8c007..0cbad5a19a 100644
--- a/object-store.c
+++ b/object-store.c
@@ -83,19 +83,6 @@ int odb_mkstemp(struct strbuf *temp_filename, const char *pattern)
return xmkstemp_mode(temp_filename->buf, mode);
}
-int odb_pack_keep(const char *name)
-{
- int fd;
-
- fd = open(name, O_RDWR|O_CREAT|O_EXCL, 0600);
- if (0 <= fd)
- return fd;
-
- /* slow path */
- safe_create_leading_directories_const(the_repository, name);
- return open(name, O_RDWR|O_CREAT|O_EXCL, 0600);
-}
-
/*
* Return non-zero iff the path is usable as an alternate object database.
*/