~ubuntu-branches/ubuntu/intrepid/git-core/intrepid-updates

« back to all changes in this revision

Viewing changes to commit.c

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape
  • Date: 2007-10-04 08:27:01 UTC
  • mfrom: (1.1.23)
  • Revision ID: package-import@ubuntu.com-20071004082701-rsd058ontoqz4i30
Tags: 1:1.5.3.4-1
new upstream point release (closes: #445188).

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
const char *commit_type = "commit";
29
29
 
30
 
struct cmt_fmt_map {
 
30
static struct cmt_fmt_map {
31
31
        const char *n;
32
32
        size_t cmp_len;
33
33
        enum cmit_fmt v;
148
148
int register_commit_graft(struct commit_graft *graft, int ignore_dups)
149
149
{
150
150
        int pos = commit_graft_pos(graft->sha1);
151
 
        
 
151
 
152
152
        if (0 <= pos) {
153
153
                if (ignore_dups)
154
154
                        free(graft);
406
406
        return commit_list_insert(item, pp);
407
407
}
408
408
 
409
 
        
 
409
 
410
410
void sort_by_date(struct commit_list **list)
411
411
{
412
412
        struct commit_list *ret = NULL;
529
529
        return bp - buf;
530
530
}
531
531
 
 
532
static unsigned long bound_rfc2047(unsigned long len, const char *encoding)
 
533
{
 
534
        /* upper bound of q encoded string of length 'len' */
 
535
        unsigned long elen = strlen(encoding);
 
536
 
 
537
        return len * 3 + elen + 100;
 
538
}
 
539
 
532
540
static int add_user_info(const char *what, enum cmit_fmt fmt, char *buf,
533
541
                         const char *line, enum date_mode dmode,
534
542
                         const char *encoding)
577
585
                break;
578
586
        case CMIT_FMT_EMAIL:
579
587
                ret += sprintf(buf + ret, "Date: %s\n",
580
 
                               show_rfc2822_date(time, tz));
 
588
                               show_date(time, tz, DATE_RFC2822));
581
589
                break;
582
590
        case CMIT_FMT_FULLER:
583
591
                ret += sprintf(buf + ret, "%sDate: %s\n", what,
713
721
        encoding = get_header(commit, "encoding");
714
722
        use_encoding = encoding ? encoding : utf8;
715
723
        if (!strcmp(use_encoding, output_encoding))
716
 
                out = xstrdup(commit->buffer);
 
724
                if (encoding) /* we'll strip encoding header later */
 
725
                        out = xstrdup(commit->buffer);
 
726
                else
 
727
                        return NULL; /* nothing to do */
717
728
        else
718
729
                out = reencode_string(commit->buffer,
719
730
                                      output_encoding, use_encoding);
770
781
                        tz = -tz;
771
782
        }
772
783
 
773
 
        interp_set_entry(table, 2, show_date(date, tz, 0));
774
 
        interp_set_entry(table, 3, show_rfc2822_date(date, tz));
775
 
        interp_set_entry(table, 4, show_date(date, tz, 1));
 
784
        interp_set_entry(table, 2, show_date(date, tz, DATE_NORMAL));
 
785
        interp_set_entry(table, 3, show_date(date, tz, DATE_RFC2822));
 
786
        interp_set_entry(table, 4, show_date(date, tz, DATE_RELATIVE));
 
787
        interp_set_entry(table, 6, show_date(date, tz, DATE_ISO8601));
776
788
}
777
789
 
778
790
static long format_commit_message(const struct commit *commit,
779
 
                const char *msg, char *buf, unsigned long space)
 
791
                const char *msg, char **buf_p, unsigned long *space_p)
780
792
{
781
793
        struct interp table[] = {
782
794
                { "%H" },       /* commit hash */
791
803
                { "%aD" },      /* author date, RFC2822 style */
792
804
                { "%ar" },      /* author date, relative */
793
805
                { "%at" },      /* author date, UNIX timestamp */
 
806
                { "%ai" },      /* author date, ISO 8601 */
794
807
                { "%cn" },      /* committer name */
795
808
                { "%ce" },      /* committer email */
796
809
                { "%cd" },      /* committer date */
797
810
                { "%cD" },      /* committer date, RFC2822 style */
798
811
                { "%cr" },      /* committer date, relative */
799
812
                { "%ct" },      /* committer date, UNIX timestamp */
 
813
                { "%ci" },      /* committer date, ISO 8601 */
800
814
                { "%e" },       /* encoding */
801
815
                { "%s" },       /* subject */
802
816
                { "%b" },       /* body */
813
827
                IPARENTS, IPARENTS_ABBREV,
814
828
                IAUTHOR_NAME, IAUTHOR_EMAIL,
815
829
                IAUTHOR_DATE, IAUTHOR_DATE_RFC2822, IAUTHOR_DATE_RELATIVE,
816
 
                IAUTHOR_TIMESTAMP,
 
830
                IAUTHOR_TIMESTAMP, IAUTHOR_ISO8601,
817
831
                ICOMMITTER_NAME, ICOMMITTER_EMAIL,
818
832
                ICOMMITTER_DATE, ICOMMITTER_DATE_RFC2822,
819
833
                ICOMMITTER_DATE_RELATIVE, ICOMMITTER_TIMESTAMP,
 
834
                ICOMMITTER_ISO8601,
820
835
                IENCODING,
821
836
                ISUBJECT,
822
837
                IBODY,
905
920
                if (!table[i].value)
906
921
                        interp_set_entry(table, i, "<unknown>");
907
922
 
908
 
        interpolate(buf, space, user_format, table, ARRAY_SIZE(table));
 
923
        do {
 
924
                char *buf = *buf_p;
 
925
                unsigned long space = *space_p;
 
926
 
 
927
                space = interpolate(buf, space, user_format,
 
928
                                    table, ARRAY_SIZE(table));
 
929
                if (!space)
 
930
                        break;
 
931
                buf = xrealloc(buf, space);
 
932
                *buf_p = buf;
 
933
                *space_p = space;
 
934
        } while (1);
909
935
        interp_clear_table(table, ARRAY_SIZE(table));
910
936
 
911
 
        return strlen(buf);
 
937
        return strlen(*buf_p);
 
938
}
 
939
 
 
940
static void pp_header(enum cmit_fmt fmt,
 
941
                      int abbrev,
 
942
                      enum date_mode dmode,
 
943
                      const char *encoding,
 
944
                      const struct commit *commit,
 
945
                      const char **msg_p,
 
946
                      unsigned long *len_p,
 
947
                      unsigned long *ofs_p,
 
948
                      char **buf_p,
 
949
                      unsigned long *space_p)
 
950
{
 
951
        int parents_shown = 0;
 
952
 
 
953
        for (;;) {
 
954
                const char *line = *msg_p;
 
955
                char *dst;
 
956
                int linelen = get_one_line(*msg_p, *len_p);
 
957
                unsigned long len;
 
958
 
 
959
                if (!linelen)
 
960
                        return;
 
961
                *msg_p += linelen;
 
962
                *len_p -= linelen;
 
963
 
 
964
                if (linelen == 1)
 
965
                        /* End of header */
 
966
                        return;
 
967
 
 
968
                ALLOC_GROW(*buf_p, linelen + *ofs_p + 20, *space_p);
 
969
                dst = *buf_p + *ofs_p;
 
970
 
 
971
                if (fmt == CMIT_FMT_RAW) {
 
972
                        memcpy(dst, line, linelen);
 
973
                        *ofs_p += linelen;
 
974
                        continue;
 
975
                }
 
976
 
 
977
                if (!memcmp(line, "parent ", 7)) {
 
978
                        if (linelen != 48)
 
979
                                die("bad parent line in commit");
 
980
                        continue;
 
981
                }
 
982
 
 
983
                if (!parents_shown) {
 
984
                        struct commit_list *parent;
 
985
                        int num;
 
986
                        for (parent = commit->parents, num = 0;
 
987
                             parent;
 
988
                             parent = parent->next, num++)
 
989
                                ;
 
990
                        /* with enough slop */
 
991
                        num = *ofs_p + num * 50 + 20;
 
992
                        ALLOC_GROW(*buf_p, num, *space_p);
 
993
                        dst = *buf_p + *ofs_p;
 
994
                        *ofs_p += add_merge_info(fmt, dst, commit, abbrev);
 
995
                        parents_shown = 1;
 
996
                }
 
997
 
 
998
                /*
 
999
                 * MEDIUM == DEFAULT shows only author with dates.
 
1000
                 * FULL shows both authors but not dates.
 
1001
                 * FULLER shows both authors and dates.
 
1002
                 */
 
1003
                if (!memcmp(line, "author ", 7)) {
 
1004
                        len = linelen;
 
1005
                        if (fmt == CMIT_FMT_EMAIL)
 
1006
                                len = bound_rfc2047(linelen, encoding);
 
1007
                        ALLOC_GROW(*buf_p, *ofs_p + len + 80, *space_p);
 
1008
                        dst = *buf_p + *ofs_p;
 
1009
                        *ofs_p += add_user_info("Author", fmt, dst,
 
1010
                                                line + 7, dmode, encoding);
 
1011
                }
 
1012
 
 
1013
                if (!memcmp(line, "committer ", 10) &&
 
1014
                    (fmt == CMIT_FMT_FULL || fmt == CMIT_FMT_FULLER)) {
 
1015
                        len = linelen;
 
1016
                        if (fmt == CMIT_FMT_EMAIL)
 
1017
                                len = bound_rfc2047(linelen, encoding);
 
1018
                        ALLOC_GROW(*buf_p, *ofs_p + len + 80, *space_p);
 
1019
                        dst = *buf_p + *ofs_p;
 
1020
                        *ofs_p += add_user_info("Commit", fmt, dst,
 
1021
                                                line + 10, dmode, encoding);
 
1022
                }
 
1023
        }
 
1024
}
 
1025
 
 
1026
static void pp_title_line(enum cmit_fmt fmt,
 
1027
                          const char **msg_p,
 
1028
                          unsigned long *len_p,
 
1029
                          unsigned long *ofs_p,
 
1030
                          char **buf_p,
 
1031
                          unsigned long *space_p,
 
1032
                          int indent,
 
1033
                          const char *subject,
 
1034
                          const char *after_subject,
 
1035
                          const char *encoding,
 
1036
                          int plain_non_ascii)
 
1037
{
 
1038
        char *title;
 
1039
        unsigned long title_alloc, title_len;
 
1040
        unsigned long len;
 
1041
 
 
1042
        title_len = 0;
 
1043
        title_alloc = 80;
 
1044
        title = xmalloc(title_alloc);
 
1045
        for (;;) {
 
1046
                const char *line = *msg_p;
 
1047
                int linelen = get_one_line(line, *len_p);
 
1048
                *msg_p += linelen;
 
1049
                *len_p -= linelen;
 
1050
 
 
1051
                if (!linelen || is_empty_line(line, &linelen))
 
1052
                        break;
 
1053
 
 
1054
                if (title_alloc <= title_len + linelen + 2) {
 
1055
                        title_alloc = title_len + linelen + 80;
 
1056
                        title = xrealloc(title, title_alloc);
 
1057
                }
 
1058
                len = 0;
 
1059
                if (title_len) {
 
1060
                        if (fmt == CMIT_FMT_EMAIL) {
 
1061
                                len++;
 
1062
                                title[title_len++] = '\n';
 
1063
                        }
 
1064
                        len++;
 
1065
                        title[title_len++] = ' ';
 
1066
                }
 
1067
                memcpy(title + title_len, line, linelen);
 
1068
                title_len += linelen;
 
1069
        }
 
1070
 
 
1071
        /* Enough slop for the MIME header and rfc2047 */
 
1072
        len = bound_rfc2047(title_len, encoding)+ 1000;
 
1073
        if (subject)
 
1074
                len += strlen(subject);
 
1075
        if (after_subject)
 
1076
                len += strlen(after_subject);
 
1077
        if (encoding)
 
1078
                len += strlen(encoding);
 
1079
        ALLOC_GROW(*buf_p, title_len + *ofs_p + len, *space_p);
 
1080
 
 
1081
        if (subject) {
 
1082
                len = strlen(subject);
 
1083
                memcpy(*buf_p + *ofs_p, subject, len);
 
1084
                *ofs_p += len;
 
1085
                *ofs_p += add_rfc2047(*buf_p + *ofs_p,
 
1086
                                      title, title_len, encoding);
 
1087
        } else {
 
1088
                memcpy(*buf_p + *ofs_p, title, title_len);
 
1089
                *ofs_p += title_len;
 
1090
        }
 
1091
        (*buf_p)[(*ofs_p)++] = '\n';
 
1092
        if (plain_non_ascii) {
 
1093
                const char *header_fmt =
 
1094
                        "MIME-Version: 1.0\n"
 
1095
                        "Content-Type: text/plain; charset=%s\n"
 
1096
                        "Content-Transfer-Encoding: 8bit\n";
 
1097
                *ofs_p += snprintf(*buf_p + *ofs_p,
 
1098
                                   *space_p - *ofs_p,
 
1099
                                   header_fmt, encoding);
 
1100
        }
 
1101
        if (after_subject) {
 
1102
                len = strlen(after_subject);
 
1103
                memcpy(*buf_p + *ofs_p, after_subject, len);
 
1104
                *ofs_p += len;
 
1105
        }
 
1106
        free(title);
 
1107
        if (fmt == CMIT_FMT_EMAIL) {
 
1108
                ALLOC_GROW(*buf_p, *ofs_p + 20, *space_p);
 
1109
                (*buf_p)[(*ofs_p)++] = '\n';
 
1110
        }
 
1111
}
 
1112
 
 
1113
static void pp_remainder(enum cmit_fmt fmt,
 
1114
                         const char **msg_p,
 
1115
                         unsigned long *len_p,
 
1116
                         unsigned long *ofs_p,
 
1117
                         char **buf_p,
 
1118
                         unsigned long *space_p,
 
1119
                         int indent)
 
1120
{
 
1121
        int first = 1;
 
1122
        for (;;) {
 
1123
                const char *line = *msg_p;
 
1124
                int linelen = get_one_line(line, *len_p);
 
1125
                *msg_p += linelen;
 
1126
                *len_p -= linelen;
 
1127
 
 
1128
                if (!linelen)
 
1129
                        break;
 
1130
 
 
1131
                if (is_empty_line(line, &linelen)) {
 
1132
                        if (first)
 
1133
                                continue;
 
1134
                        if (fmt == CMIT_FMT_SHORT)
 
1135
                                break;
 
1136
                }
 
1137
                first = 0;
 
1138
 
 
1139
                ALLOC_GROW(*buf_p, *ofs_p + linelen + indent + 20, *space_p);
 
1140
                if (indent) {
 
1141
                        memset(*buf_p + *ofs_p, ' ', indent);
 
1142
                        *ofs_p += indent;
 
1143
                }
 
1144
                memcpy(*buf_p + *ofs_p, line, linelen);
 
1145
                *ofs_p += linelen;
 
1146
                (*buf_p)[(*ofs_p)++] = '\n';
 
1147
        }
912
1148
}
913
1149
 
914
1150
unsigned long pretty_print_commit(enum cmit_fmt fmt,
915
1151
                                  const struct commit *commit,
916
1152
                                  unsigned long len,
917
 
                                  char *buf, unsigned long space,
 
1153
                                  char **buf_p, unsigned long *space_p,
918
1154
                                  int abbrev, const char *subject,
919
1155
                                  const char *after_subject,
920
1156
                                  enum date_mode dmode)
921
1157
{
922
 
        int hdr = 1, body = 0, seen_title = 0;
923
1158
        unsigned long offset = 0;
 
1159
        unsigned long beginning_of_body;
924
1160
        int indent = 4;
925
 
        int parents_shown = 0;
926
1161
        const char *msg = commit->buffer;
927
1162
        int plain_non_ascii = 0;
928
1163
        char *reencoded;
929
1164
        const char *encoding;
 
1165
        char *buf;
930
1166
 
931
1167
        if (fmt == CMIT_FMT_USERFORMAT)
932
 
                return format_commit_message(commit, msg, buf, space);
 
1168
                return format_commit_message(commit, msg, buf_p, space_p);
933
1169
 
934
1170
        encoding = (git_log_output_encoding
935
1171
                    ? git_log_output_encoding
937
1173
        if (!encoding)
938
1174
                encoding = "utf-8";
939
1175
        reencoded = logmsg_reencode(commit, encoding);
940
 
        if (reencoded)
 
1176
        if (reencoded) {
941
1177
                msg = reencoded;
 
1178
                len = strlen(reencoded);
 
1179
        }
942
1180
 
943
1181
        if (fmt == CMIT_FMT_ONELINE || fmt == CMIT_FMT_EMAIL)
944
1182
                indent = 0;
969
1207
                }
970
1208
        }
971
1209
 
 
1210
        pp_header(fmt, abbrev, dmode, encoding,
 
1211
                  commit, &msg, &len,
 
1212
                  &offset, buf_p, space_p);
 
1213
        if (fmt != CMIT_FMT_ONELINE && !subject) {
 
1214
                ALLOC_GROW(*buf_p, offset + 20, *space_p);
 
1215
                (*buf_p)[offset++] = '\n';
 
1216
        }
 
1217
 
 
1218
        /* Skip excess blank lines at the beginning of body, if any... */
972
1219
        for (;;) {
973
 
                const char *line = msg;
974
1220
                int linelen = get_one_line(msg, len);
975
 
 
 
1221
                int ll = linelen;
976
1222
                if (!linelen)
977
1223
                        break;
978
 
 
979
 
                /*
980
 
                 * We want some slop for indentation and a possible
981
 
                 * final "...". Thus the "+ 20".
982
 
                 */
983
 
                if (offset + linelen + 20 > space) {
984
 
                        memcpy(buf + offset, "    ...\n", 8);
985
 
                        offset += 8;
 
1224
                if (!is_empty_line(msg, &ll))
986
1225
                        break;
987
 
                }
988
 
 
989
1226
                msg += linelen;
990
1227
                len -= linelen;
991
 
                if (hdr) {
992
 
                        if (linelen == 1) {
993
 
                                hdr = 0;
994
 
                                if ((fmt != CMIT_FMT_ONELINE) && !subject)
995
 
                                        buf[offset++] = '\n';
996
 
                                continue;
997
 
                        }
998
 
                        if (fmt == CMIT_FMT_RAW) {
999
 
                                memcpy(buf + offset, line, linelen);
1000
 
                                offset += linelen;
1001
 
                                continue;
1002
 
                        }
1003
 
                        if (!memcmp(line, "parent ", 7)) {
1004
 
                                if (linelen != 48)
1005
 
                                        die("bad parent line in commit");
1006
 
                                continue;
1007
 
                        }
1008
 
 
1009
 
                        if (!parents_shown) {
1010
 
                                offset += add_merge_info(fmt, buf + offset,
1011
 
                                                         commit, abbrev);
1012
 
                                parents_shown = 1;
1013
 
                                continue;
1014
 
                        }
1015
 
                        /*
1016
 
                         * MEDIUM == DEFAULT shows only author with dates.
1017
 
                         * FULL shows both authors but not dates.
1018
 
                         * FULLER shows both authors and dates.
1019
 
                         */
1020
 
                        if (!memcmp(line, "author ", 7))
1021
 
                                offset += add_user_info("Author", fmt,
1022
 
                                                        buf + offset,
1023
 
                                                        line + 7,
1024
 
                                                        dmode,
1025
 
                                                        encoding);
1026
 
                        if (!memcmp(line, "committer ", 10) &&
1027
 
                            (fmt == CMIT_FMT_FULL || fmt == CMIT_FMT_FULLER))
1028
 
                                offset += add_user_info("Commit", fmt,
1029
 
                                                        buf + offset,
1030
 
                                                        line + 10,
1031
 
                                                        dmode,
1032
 
                                                        encoding);
1033
 
                        continue;
1034
 
                }
1035
 
 
1036
 
                if (!subject)
1037
 
                        body = 1;
1038
 
 
1039
 
                if (is_empty_line(line, &linelen)) {
1040
 
                        if (!seen_title)
1041
 
                                continue;
1042
 
                        if (!body)
1043
 
                                continue;
1044
 
                        if (subject)
1045
 
                                continue;
1046
 
                        if (fmt == CMIT_FMT_SHORT)
1047
 
                                break;
1048
 
                }
1049
 
 
1050
 
                seen_title = 1;
1051
 
                if (subject) {
1052
 
                        int slen = strlen(subject);
1053
 
                        memcpy(buf + offset, subject, slen);
1054
 
                        offset += slen;
1055
 
                        offset += add_rfc2047(buf + offset, line, linelen,
1056
 
                                              encoding);
1057
 
                }
1058
 
                else {
1059
 
                        memset(buf + offset, ' ', indent);
1060
 
                        memcpy(buf + offset + indent, line, linelen);
1061
 
                        offset += linelen + indent;
1062
 
                }
1063
 
                buf[offset++] = '\n';
1064
 
                if (fmt == CMIT_FMT_ONELINE)
1065
 
                        break;
1066
 
                if (subject && plain_non_ascii) {
1067
 
                        int sz;
1068
 
                        char header[512];
1069
 
                        const char *header_fmt =
1070
 
                                "MIME-Version: 1.0\n"
1071
 
                                "Content-Type: text/plain; charset=%s\n"
1072
 
                                "Content-Transfer-Encoding: 8bit\n";
1073
 
                        sz = snprintf(header, sizeof(header), header_fmt,
1074
 
                                      encoding);
1075
 
                        if (sizeof(header) < sz)
1076
 
                                die("Encoding name %s too long", encoding);
1077
 
                        memcpy(buf + offset, header, sz);
1078
 
                        offset += sz;
1079
 
                }
1080
 
                if (after_subject) {
1081
 
                        int slen = strlen(after_subject);
1082
 
                        if (slen > space - offset - 1)
1083
 
                                slen = space - offset - 1;
1084
 
                        memcpy(buf + offset, after_subject, slen);
1085
 
                        offset += slen;
1086
 
                        after_subject = NULL;
1087
 
                }
1088
 
                subject = NULL;
1089
1228
        }
1090
 
        while (offset && isspace(buf[offset-1]))
 
1229
 
 
1230
        /* These formats treat the title line specially. */
 
1231
        if (fmt == CMIT_FMT_ONELINE
 
1232
            || fmt == CMIT_FMT_EMAIL)
 
1233
                pp_title_line(fmt, &msg, &len, &offset,
 
1234
                              buf_p, space_p, indent,
 
1235
                              subject, after_subject, encoding,
 
1236
                              plain_non_ascii);
 
1237
 
 
1238
        beginning_of_body = offset;
 
1239
        if (fmt != CMIT_FMT_ONELINE)
 
1240
                pp_remainder(fmt, &msg, &len, &offset,
 
1241
                             buf_p, space_p, indent);
 
1242
 
 
1243
        while (offset && isspace((*buf_p)[offset-1]))
1091
1244
                offset--;
 
1245
 
 
1246
        ALLOC_GROW(*buf_p, offset + 20, *space_p);
 
1247
        buf = *buf_p;
 
1248
 
1092
1249
        /* Make sure there is an EOLN for the non-oneline case */
1093
1250
        if (fmt != CMIT_FMT_ONELINE)
1094
1251
                buf[offset++] = '\n';
 
1252
 
1095
1253
        /*
1096
 
         * make sure there is another EOLN to separate the headers from whatever
1097
 
         * body the caller appends if we haven't already written a body
 
1254
         * The caller may append additional body text in e-mail
 
1255
         * format.  Make sure we did not strip the blank line
 
1256
         * between the header and the body.
1098
1257
         */
1099
 
        if (fmt == CMIT_FMT_EMAIL && !body)
 
1258
        if (fmt == CMIT_FMT_EMAIL && offset <= beginning_of_body)
1100
1259
                buf[offset++] = '\n';
1101
1260
        buf[offset] = '\0';
1102
 
 
1103
1261
        free(reencoded);
1104
1262
        return offset;
1105
1263
}
1116
1274
        return item;
1117
1275
}
1118
1276
 
1119
 
int count_parents(struct commit * commit)
1120
 
{
1121
 
        int count;
1122
 
        struct commit_list * parents = commit->parents;
1123
 
        for (count = 0; parents; parents = parents->next,count++)
1124
 
                ;
1125
 
        return count;
1126
 
}
1127
 
 
1128
1277
void topo_sort_default_setter(struct commit *c, void *data)
1129
1278
{
1130
1279
        c->util = data;
1160
1309
                next = next->next;
1161
1310
                count++;
1162
1311
        }
1163
 
        
 
1312
 
1164
1313
        if (!count)
1165
1314
                return;
1166
1315
        /* allocate an array to help sort the list */
1188
1337
                }
1189
1338
                next=next->next;
1190
1339
        }
1191
 
        /* 
 
1340
        /*
1192
1341
         * find the tips
1193
1342
         *
1194
 
         * tips are nodes not reachable from any other node in the list 
1195
 
         * 
 
1343
         * tips are nodes not reachable from any other node in the list
 
1344
         *
1196
1345
         * the tips serve as a starting set for the work queue.
1197
1346
         */
1198
1347
        next=*list;
1220
1369
 
1221
1370
                        if (pn) {
1222
1371
                                /*
1223
 
                                 * parents are only enqueued for emission 
 
1372
                                 * parents are only enqueued for emission
1224
1373
                                 * when all their children have been emitted thereby
1225
1374
                                 * guaranteeing topological order.
1226
1375
                                 */