Code

mktag: minimally update the description.
[git.git] / commit.c
index d01833d8137ece2f4a1d95d8b85d8ed54ecbd16b..4ca4d44ba0d648c6c102ac17160b69f6f0f02836 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -148,7 +148,7 @@ static int commit_graft_pos(const unsigned char *sha1)
 int register_commit_graft(struct commit_graft *graft, int ignore_dups)
 {
        int pos = commit_graft_pos(graft->sha1);
-       
+
        if (0 <= pos) {
                if (ignore_dups)
                        free(graft);
@@ -406,7 +406,7 @@ struct commit_list * insert_by_date(struct commit *item, struct commit_list **li
        return commit_list_insert(item, pp);
 }
 
-       
+
 void sort_by_date(struct commit_list **list)
 {
        struct commit_list *ret = NULL;
@@ -511,12 +511,16 @@ static int add_rfc2047(char *buf, const char *line, int len,
        bp += i;
        for (i = 0; i < len; i++) {
                unsigned ch = line[i] & 0xFF;
-               if (is_rfc2047_special(ch)) {
+               /*
+                * We encode ' ' using '=20' even though rfc2047
+                * allows using '_' for readability.  Unfortunately,
+                * many programs do not understand this and just
+                * leave the underscore in place.
+                */
+               if (is_rfc2047_special(ch) || ch == ' ') {
                        sprintf(bp, "=%02X", ch);
                        bp += 3;
                }
-               else if (ch == ' ')
-                       *bp++ = '_';
                else
                        *bp++ = ch;
        }
@@ -1063,6 +1067,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
                        int sz;
                        char header[512];
                        const char *header_fmt =
+                               "MIME-Version: 1.0\n"
                                "Content-Type: text/plain; charset=%s\n"
                                "Content-Transfer-Encoding: 8bit\n";
                        sz = snprintf(header, sizeof(header), header_fmt,
@@ -1111,15 +1116,6 @@ struct commit *pop_commit(struct commit_list **stack)
        return item;
 }
 
-int count_parents(struct commit * commit)
-{
-        int count;
-        struct commit_list * parents = commit->parents;
-        for (count = 0; parents; parents = parents->next,count++)
-               ;
-        return count;
-}
-
 void topo_sort_default_setter(struct commit *c, void *data)
 {
        c->util = data;
@@ -1155,7 +1151,7 @@ void sort_in_topological_order_fn(struct commit_list ** list, int lifo,
                next = next->next;
                count++;
        }
-       
+
        if (!count)
                return;
        /* allocate an array to help sort the list */
@@ -1183,11 +1179,11 @@ void sort_in_topological_order_fn(struct commit_list ** list, int lifo,
                }
                next=next->next;
        }
-       /* 
+       /*
          * find the tips
          *
-         * tips are nodes not reachable from any other node in the list 
-         * 
+         * tips are nodes not reachable from any other node in the list
+         *
          * the tips serve as a starting set for the work queue.
          */
        next=*list;
@@ -1215,7 +1211,7 @@ void sort_in_topological_order_fn(struct commit_list ** list, int lifo,
 
                        if (pn) {
                                /*
-                                * parents are only enqueued for emission 
+                                * parents are only enqueued for emission
                                  * when all their children have been emitted thereby
                                  * guaranteeing topological order.
                                  */