receive-pack: quarantine objects until pre-receive accepts
[gitweb.git] / commit.c
index 9d3d7119e065af27aac5516251d05018a8393f67..856fd4aeeff654c45ba0a6149f9db2c22806e0cb 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -1511,9 +1511,9 @@ static int verify_utf8(struct strbuf *buf)
 }
 
 static const char commit_utf8_warn[] =
-"Warning: commit message did not conform to UTF-8.\n"
-"You may want to amend it after fixing the message, or set the config\n"
-"variable i18n.commitencoding to the encoding your project uses.\n";
+N_("Warning: commit message did not conform to UTF-8.\n"
+   "You may want to amend it after fixing the message, or set the config\n"
+   "variable i18n.commitencoding to the encoding your project uses.\n");
 
 int commit_tree_extended(const char *msg, size_t msg_len,
                         const unsigned char *tree,
@@ -1566,7 +1566,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,
 
        /* And check the encoding */
        if (encoding_is_utf8 && !verify_utf8(&buffer))
-               fprintf(stderr, commit_utf8_warn);
+               fprintf(stderr, _(commit_utf8_warn));
 
        if (sign_commit && do_sign_commit(&buffer, sign_commit))
                return -1;
@@ -1576,6 +1576,15 @@ int commit_tree_extended(const char *msg, size_t msg_len,
        return result;
 }
 
+void set_merge_remote_desc(struct commit *commit,
+                          const char *name, struct object *obj)
+{
+       struct merge_remote_desc *desc;
+       FLEX_ALLOC_STR(desc, name, name);
+       desc->obj = obj;
+       commit->util = desc;
+}
+
 struct commit *get_merge_parent(const char *name)
 {
        struct object *obj;
@@ -1585,13 +1594,8 @@ struct commit *get_merge_parent(const char *name)
                return NULL;
        obj = parse_object(oid.hash);
        commit = (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);
-       if (commit && !commit->util) {
-               struct merge_remote_desc *desc;
-               desc = xmalloc(sizeof(*desc));
-               desc->obj = obj;
-               desc->name = strdup(name);
-               commit->util = desc;
-       }
+       if (commit && !commit->util)
+               set_merge_remote_desc(commit, name, obj);
        return commit;
 }
 
@@ -1622,16 +1626,6 @@ struct commit_list **commit_list_append(struct commit *commit,
        return &new->next;
 }
 
-void print_commit_list(struct commit_list *list,
-                      const char *format_cur,
-                      const char *format_last)
-{
-       for ( ; list; list = list->next) {
-               const char *format = list->next ? format_cur : format_last;
-               printf(format, oid_to_hex(&list->item->object.oid));
-       }
-}
-
 const char *find_commit_header(const char *msg, const char *key, size_t *out_len)
 {
        int key_len = strlen(key);