summaryrefslogtreecommitdiff
path: root/builtin/am.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-04-26 06:39:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-26 06:39:08 (GMT)
commitb80f629f5bcf798a3c9b37651d2369ad555e7382 (patch)
tree0a7ed758d7a74b96cb4bb713dbf66f9362a40b22 /builtin/am.c
parent6cbc478d83b5773d1925869e50bf6067306f4817 (diff)
parent16d2676c9ee996208277772fdf81dda212355440 (diff)
downloadgit-b80f629f5bcf798a3c9b37651d2369ad555e7382.zip
git-b80f629f5bcf798a3c9b37651d2369ad555e7382.tar.gz
git-b80f629f5bcf798a3c9b37651d2369ad555e7382.tar.bz2
Merge branch 'jk/war-on-git-path'
While handy, "git_path()" is a dangerous function to use as a callsite that uses it safely one day can be broken by changes to other code that calls it. Reduction of its use continues. * jk/war-on-git-path: am: drop "dir" parameter from am_state_init replace strbuf_addstr(git_path()) with git_path_buf() replace xstrdup(git_path(...)) with git_pathdup(...) use git_path_* helper functions branch: add edit_description() helper bisect: add git_path_bisect_terms helper
Diffstat (limited to 'builtin/am.c')
-rw-r--r--builtin/am.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/builtin/am.c b/builtin/am.c
index f08b7e6..a95dd8b 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -134,17 +134,15 @@ struct am_state {
};
/**
- * Initializes am_state with the default values. The state directory is set to
- * dir.
+ * Initializes am_state with the default values.
*/
-static void am_state_init(struct am_state *state, const char *dir)
+static void am_state_init(struct am_state *state)
{
int gpgsign;
memset(state, 0, sizeof(*state));
- assert(dir);
- state->dir = xstrdup(dir);
+ state->dir = git_pathdup("rebase-apply");
state->prec = 4;
@@ -2323,7 +2321,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
git_config(git_am_config, NULL);
- am_state_init(&state, git_path("rebase-apply"));
+ am_state_init(&state);
in_progress = am_in_progress(&state);
if (in_progress)