summaryrefslogtreecommitdiffstats
path: root/environment.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-09-12 13:29:48 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-12 19:15:40 +0200
commit26b4df907bca4829df44dc7eee23ccf7720898f7 (patch)
treefb4884c5b126cfbeabaf78644d74976581519cd0 /environment.c
parentconfig: make dependency on repo in `read_early_config()` explicit (diff)
downloadgit-26b4df907bca4829df44dc7eee23ccf7720898f7.tar.xz
git-26b4df907bca4829df44dc7eee23ccf7720898f7.zip
environment: move object database functions into object layer
The `odb_mkstemp()` and `odb_pack_keep()` functions are quite clearly tied to the object store, but regardless of that they are located in "environment.c". Move them over, which also helps to get rid of dependencies on `the_repository` in the environment subsystem. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r--environment.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/environment.c b/environment.c
index 4d0637b382..f337efd1dd 100644
--- a/environment.c
+++ b/environment.c
@@ -23,7 +23,6 @@
#include "commit.h"
#include "strvec.h"
#include "object-file.h"
-#include "object-store-ll.h"
#include "path.h"
#include "replace-object.h"
#include "tmp-objdir.h"
@@ -268,39 +267,6 @@ void set_git_work_tree(const char *new_work_tree)
repo_set_worktree(the_repository, new_work_tree);
}
-int odb_mkstemp(struct strbuf *temp_filename, const char *pattern)
-{
- int fd;
- /*
- * we let the umask do its job, don't try to be more
- * restrictive except to remove write permission.
- */
- int mode = 0444;
- git_path_buf(temp_filename, "objects/%s", pattern);
- fd = git_mkstemp_mode(temp_filename->buf, mode);
- if (0 <= fd)
- return fd;
-
- /* slow path */
- /* some mkstemp implementations erase temp_filename on failure */
- git_path_buf(temp_filename, "objects/%s", pattern);
- safe_create_leading_directories(temp_filename->buf);
- 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(name);
- return open(name, O_RDWR|O_CREAT|O_EXCL, 0600);
-}
-
static void set_git_dir_1(const char *path)
{
xsetenv(GIT_DIR_ENVIRONMENT, path, 1);