diff options
Diffstat (limited to 'builtin/revert.c')
-rw-r--r-- | builtin/revert.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/builtin/revert.c b/builtin/revert.c index b61c8e5c52..544e8c3057 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -288,17 +288,18 @@ static char *get_encoding(const char *message) static void write_cherry_pick_head(struct commit *commit) { + const char *filename; int fd; struct strbuf buf = STRBUF_INIT; strbuf_addf(&buf, "%s\n", sha1_to_hex(commit->object.sha1)); - fd = open(git_path("CHERRY_PICK_HEAD"), O_WRONLY | O_CREAT, 0666); + filename = git_path("CHERRY_PICK_HEAD"); + fd = open(filename, O_WRONLY | O_CREAT, 0666); if (fd < 0) - die_errno(_("Could not open '%s' for writing"), - git_path("CHERRY_PICK_HEAD")); + die_errno(_("Could not open '%s' for writing"), filename); if (write_in_full(fd, buf.buf, buf.len) != buf.len || close(fd)) - die_errno(_("Could not write to '%s'"), git_path("CHERRY_PICK_HEAD")); + die_errno(_("Could not write to '%s'"), filename); strbuf_release(&buf); } |