summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-09-14 18:53:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-09-14 18:53:53 (GMT)
commit8c11b25de41857e5a44325046dd55d3751f740c6 (patch)
tree066d739a7361b0341b84ad19ad0d62ad04c1f366 /builtin
parent0ca416f166df7e96d9115a1fe213720f09a1417b (diff)
parent4e2d094dde4f078245d057dd6111ab9d013ae6d0 (diff)
downloadgit-8c11b25de41857e5a44325046dd55d3751f740c6.zip
git-8c11b25de41857e5a44325046dd55d3751f740c6.tar.gz
git-8c11b25de41857e5a44325046dd55d3751f740c6.tar.bz2
Merge branch 'rj/path-cleanup'
* rj/path-cleanup: Call mkpathdup() rather than xstrdup(mkpath(...)) Call git_pathdup() rather than xstrdup(git_path("...")) path.c: Use vsnpath() in the implementation of git_path() path.c: Don't discard the return value of vsnpath() path.c: Remove the 'git_' prefix from a file scope function
Diffstat (limited to 'builtin')
-rw-r--r--builtin/add.c3
-rw-r--r--builtin/branch.c2
-rw-r--r--builtin/clone.c4
-rw-r--r--builtin/prune.c2
4 files changed, 6 insertions, 5 deletions
diff --git a/builtin/add.c b/builtin/add.c
index 2816789..e664100 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -260,7 +260,7 @@ int interactive_add(int argc, const char **argv, const char *prefix, int patch)
static int edit_patch(int argc, const char **argv, const char *prefix)
{
- char *file = xstrdup(git_path("ADD_EDIT.patch"));
+ char *file = git_pathdup("ADD_EDIT.patch");
const char *apply_argv[] = { "apply", "--recount", "--cached",
NULL, NULL };
struct child_process child;
@@ -303,6 +303,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
die (_("Could not apply '%s'"), file);
unlink(file);
+ free(file);
return 0;
}
diff --git a/builtin/branch.c b/builtin/branch.c
index 5cb6d78..ffd2684 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -197,7 +197,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
free(name);
- name = xstrdup(mkpath(fmt, bname.buf));
+ name = mkpathdup(fmt, bname.buf);
if (read_ref(name, sha1)) {
error(remote_branch
? _("remote branch '%s' not found.")
diff --git a/builtin/clone.c b/builtin/clone.c
index 5e8f3ba..5a9b2bc 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -236,7 +236,7 @@ static int add_one_reference(struct string_list_item *item, void *cb_data)
/* Beware: real_path() and mkpath() return static buffer */
ref_git = xstrdup(real_path(item->string));
if (is_directory(mkpath("%s/.git/objects", ref_git))) {
- char *ref_git_git = xstrdup(mkpath("%s/.git", ref_git));
+ char *ref_git_git = mkpathdup("%s/.git", ref_git);
free(ref_git);
ref_git = ref_git_git;
} else if (!is_directory(mkpath("%s/objects", ref_git)))
@@ -700,7 +700,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
git_dir = xstrdup(dir);
else {
work_tree = dir;
- git_dir = xstrdup(mkpath("%s/.git", dir));
+ git_dir = mkpathdup("%s/.git", dir);
}
if (!option_bare) {
diff --git a/builtin/prune.c b/builtin/prune.c
index 9a03d24..8cb8b91 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -169,7 +169,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
prune_packed_objects(show_only);
remove_temporary_files(get_object_directory());
- s = xstrdup(mkpath("%s/pack", get_object_directory()));
+ s = mkpathdup("%s/pack", get_object_directory());
remove_temporary_files(s);
free(s);
return 0;