Code

git-checkout: Test for relative path use.
[git.git] / builtin-log.c
index 60819d15c52dc8cb13ac08ba23986e4be56279a4..8b2bf632c534c5a9b5295884e517d70c7d2d9e86 100644 (file)
@@ -441,8 +441,6 @@ static const char *clean_message_id(const char *msg_id)
 {
        char ch;
        const char *a, *z, *m;
-       char *n;
-       size_t len;
 
        m = msg_id;
        while ((ch = *m) && (isspace(ch) || (ch == '<')))
@@ -458,11 +456,7 @@ static const char *clean_message_id(const char *msg_id)
                die("insane in-reply-to: %s", msg_id);
        if (++z == m)
                return a;
-       len = z - a;
-       n = xmalloc(len + 1);
-       memcpy(n, a, len);
-       n[len] = 0;
-       return n;
+       return xmemdupz(a, z - a);
 }
 
 int cmd_format_patch(int argc, const char **argv, const char *prefix)
@@ -541,9 +535,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                        endpos = strchr(committer, '>');
                        if (!endpos)
                                die("bogos committer info %s\n", committer);
-                       add_signoff = xmalloc(endpos - committer + 2);
-                       memcpy(add_signoff, committer, endpos - committer + 1);
-                       add_signoff[endpos - committer + 1] = 0;
+                       add_signoff = xmemdupz(committer, endpos - committer + 1);
                }
                else if (!strcmp(argv[i], "--attach")) {
                        rev.mime_boundary = git_version_string;
@@ -795,7 +787,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
                        struct strbuf buf;
                        strbuf_init(&buf, 0);
                        pretty_print_commit(CMIT_FMT_ONELINE, commit,
-                                           &buf, 0, NULL, NULL, 0);
+                                           &buf, 0, NULL, NULL, 0, 0);
                        printf("%c %s %s\n", sign,
                               sha1_to_hex(commit->object.sha1), buf.buf);
                        strbuf_release(&buf);