path: root/builtin/reset.c
diff options
authorJeff King <>2014-06-10 21:39:30 (GMT)
committerJunio C Hamano <>2014-06-12 17:29:43 (GMT)
commitb000c59b0c80fc187e5e0e48dc9396cd60576c4e (patch)
treeeceae4f00fdd8ddc384ec7d04739686e7b3ea4e1 /builtin/reset.c
parent10322a0aaf84382d8901f9ab59e59c39f0c035bb (diff)
logmsg_reencode: return const buffer
The return value from logmsg_reencode may be either a newly allocated buffer or a pointer to the existing commit->buffer. We would not want the caller to accidentally free() or modify the latter, so let's mark it as const. We can cast away the constness in logmsg_free, but only once we have determined that it is a free-able buffer. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/reset.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/reset.c b/builtin/reset.c
index f4e0875..b5312c4 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -93,7 +93,7 @@ static int reset_index(const unsigned char *sha1, int reset_type, int quiet)
static void print_new_head_line(struct commit *commit)
const char *hex, *body;
- char *msg;
+ const char *msg;
hex = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);
printf(_("HEAD is now at %s"), hex);