summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2015-08-10 09:47:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-10 19:57:14 (GMT)
commitb4fb09e4da53bfc6c720337142af5db3204736d5 (patch)
treeee21234e6668f9a03d08d0713b3a27df4e3d444a /builtin/commit.c
parentc99a4c2db3053e4fb6a43870f5c747f858b0f58f (diff)
downloadgit-b4fb09e4da53bfc6c720337142af5db3204736d5.zip
git-b4fb09e4da53bfc6c720337142af5db3204736d5.tar.gz
git-b4fb09e4da53bfc6c720337142af5db3204736d5.tar.bz2
lockfile: add accessor get_lock_file_path()
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
-rw-r--r--builtin/commit.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 254477f..96aee0c 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -324,6 +324,7 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
struct string_list partial;
struct pathspec pathspec;
int refresh_flags = REFRESH_QUIET;
+ const char *ret;
if (is_status)
refresh_flags |= REFRESH_UNMERGED;
@@ -344,7 +345,7 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
die(_("unable to create temporary index"));
old_index_env = getenv(INDEX_ENVIRONMENT);
- setenv(INDEX_ENVIRONMENT, index_lock.filename.buf, 1);
+ setenv(INDEX_ENVIRONMENT, get_lock_file_path(&index_lock), 1);
if (interactive_add(argc, argv, prefix, patch_interactive) != 0)
die(_("interactive add failed"));
@@ -355,7 +356,7 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
unsetenv(INDEX_ENVIRONMENT);
discard_cache();
- read_cache_from(index_lock.filename.buf);
+ read_cache_from(get_lock_file_path(&index_lock));
if (update_main_cache_tree(WRITE_TREE_SILENT) == 0) {
if (reopen_lock_file(&index_lock) < 0)
die(_("unable to write index file"));
@@ -365,7 +366,7 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
warning(_("Failed to update main cache tree"));
commit_style = COMMIT_NORMAL;
- return index_lock.filename.buf;
+ return get_lock_file_path(&index_lock);
}
/*
@@ -388,7 +389,7 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
if (write_locked_index(&the_index, &index_lock, CLOSE_LOCK))
die(_("unable to write new_index file"));
commit_style = COMMIT_NORMAL;
- return index_lock.filename.buf;
+ return get_lock_file_path(&index_lock);
}
/*
@@ -475,9 +476,9 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
die(_("unable to write temporary index file"));
discard_cache();
- read_cache_from(false_lock.filename.buf);
-
- return false_lock.filename.buf;
+ ret = get_lock_file_path(&false_lock);
+ read_cache_from(ret);
+ return ret;
}
static int run_status(FILE *fp, const char *index_file, const char *prefix, int nowarn,