summaryrefslogtreecommitdiff
path: root/notes-merge.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-04-20 21:09:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-21 04:04:20 (GMT)
commit8c2ca3a6d6d0bf51332f92d25b7902f9943aaaf2 (patch)
tree239417b4ea3d79c3fb2561a6c28d8f367bb6508c /notes-merge.c
parentd9c69644b27eb59fe16c1931580e6fce4abbdc65 (diff)
downloadgit-8c2ca3a6d6d0bf51332f92d25b7902f9943aaaf2.zip
git-8c2ca3a6d6d0bf51332f92d25b7902f9943aaaf2.tar.gz
git-8c2ca3a6d6d0bf51332f92d25b7902f9943aaaf2.tar.bz2
replace strbuf_addstr(git_path()) with git_path_buf()
Writing directly into the strbuf avoids a useless copy of the data, and dropping calls to git_path() makes it easier to audit for dangerous calls. Note that git_path() does an implicit strbuf_reset(), but in each of these cases we were either already doing that reset, or writing into a fresh strbuf anyway. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'notes-merge.c')
-rw-r--r--notes-merge.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/notes-merge.c b/notes-merge.c
index 5998605..32caaaf 100644
--- a/notes-merge.c
+++ b/notes-merge.c
@@ -676,7 +676,7 @@ int notes_merge_commit(struct notes_merge_options *o,
const char *msg = strstr(buffer, "\n\n");
int baselen;
- strbuf_addstr(&path, git_path(NOTES_MERGE_WORKTREE));
+ git_path_buf(&path, NOTES_MERGE_WORKTREE);
if (o->verbosity >= 3)
printf("Committing notes in notes merge worktree at %s\n",
path.buf);
@@ -741,7 +741,7 @@ int notes_merge_abort(struct notes_merge_options *o)
struct strbuf buf = STRBUF_INIT;
int ret;
- strbuf_addstr(&buf, git_path(NOTES_MERGE_WORKTREE));
+ git_path_buf(&buf, NOTES_MERGE_WORKTREE);
if (o->verbosity >= 3)
printf("Removing notes merge worktree at %s/*\n", buf.buf);
ret = remove_dir_recursively(&buf, REMOVE_DIR_KEEP_TOPLEVEL);