|
16 | 16 | #define BATCH 1
|
17 | 17 | #define BATCH_CHECK 2
|
18 | 18 |
|
19 |
| -static void pprint_tag(const unsigned char *sha1, const char *buf, unsigned long size) |
20 |
| -{ |
21 |
| - /* the parser in tag.c is useless here. */ |
22 |
| - const char *endp = buf + size; |
23 |
| - const char *cp = buf; |
24 |
| - |
25 |
| - while (cp < endp) { |
26 |
| - char c = *cp++; |
27 |
| - if (c != '\n') |
28 |
| - continue; |
29 |
| - if (7 <= endp - cp && !memcmp("tagger ", cp, 7)) { |
30 |
| - const char *tagger = cp; |
31 |
| - |
32 |
| - /* Found the tagger line. Copy out the contents |
33 |
| - * of the buffer so far. |
34 |
| - */ |
35 |
| - write_or_die(1, buf, cp - buf); |
36 |
| - |
37 |
| - /* |
38 |
| - * Do something intelligent, like pretty-printing |
39 |
| - * the date. |
40 |
| - */ |
41 |
| - while (cp < endp) { |
42 |
| - if (*cp++ == '\n') { |
43 |
| - /* tagger to cp is a line |
44 |
| - * that has ident and time. |
45 |
| - */ |
46 |
| - const char *sp = tagger; |
47 |
| - char *ep; |
48 |
| - unsigned long date; |
49 |
| - long tz; |
50 |
| - while (sp < cp && *sp != '>') |
51 |
| - sp++; |
52 |
| - if (sp == cp) { |
53 |
| - /* give up */ |
54 |
| - write_or_die(1, tagger, |
55 |
| - cp - tagger); |
56 |
| - break; |
57 |
| - } |
58 |
| - while (sp < cp && |
59 |
| - !('0' <= *sp && *sp <= '9')) |
60 |
| - sp++; |
61 |
| - write_or_die(1, tagger, sp - tagger); |
62 |
| - date = strtoul(sp, &ep, 10); |
63 |
| - tz = strtol(ep, NULL, 10); |
64 |
| - sp = show_date(date, tz, 0); |
65 |
| - write_or_die(1, sp, strlen(sp)); |
66 |
| - xwrite(1, "\n", 1); |
67 |
| - break; |
68 |
| - } |
69 |
| - } |
70 |
| - break; |
71 |
| - } |
72 |
| - if (cp < endp && *cp == '\n') |
73 |
| - /* end of header */ |
74 |
| - break; |
75 |
| - } |
76 |
| - /* At this point, we have copied out the header up to the end of |
77 |
| - * the tagger line and cp points at one past \n. It could be the |
78 |
| - * next header line after the tagger line, or it could be another |
79 |
| - * \n that marks the end of the headers. We need to copy out the |
80 |
| - * remainder as is. |
81 |
| - */ |
82 |
| - if (cp < endp) |
83 |
| - write_or_die(1, cp, endp - cp); |
84 |
| -} |
85 |
| - |
86 | 19 | static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
|
87 | 20 | {
|
88 | 21 | unsigned char sha1[20];
|
@@ -133,10 +66,6 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
|
133 | 66 | buf = read_sha1_file(sha1, &type, &size);
|
134 | 67 | if (!buf)
|
135 | 68 | die("Cannot read object %s", obj_name);
|
136 |
| - if (type == OBJ_TAG) { |
137 |
| - pprint_tag(sha1, buf, size); |
138 |
| - return 0; |
139 |
| - } |
140 | 69 |
|
141 | 70 | /* otherwise just spit out the data */
|
142 | 71 | break;
|
|
0 commit comments