| 1078 | } |
| 1079 | |
| 1080 | static int count_ident(const char *cp, unsigned long size) |
| 1081 | { |
| 1082 | /* |
| 1083 | * "$Id: 0000000000000000000000000000000000000000 $" <=> "$Id$" |
| 1084 | */ |
| 1085 | int cnt = 0; |
| 1086 | char ch; |
| 1087 | |
| 1088 | while (size) { |
| 1089 | ch = *cp++; |
| 1090 | size--; |
| 1091 | if (ch != '$') |
| 1092 | continue; |
| 1093 | if (size < 3) |
| 1094 | break; |
| 1095 | if (memcmp("Id", cp, 2)) |
| 1096 | continue; |
| 1097 | ch = cp[2]; |
| 1098 | cp += 3; |
| 1099 | size -= 3; |
| 1100 | if (ch == '$') |
| 1101 | cnt++; /* $Id$ */ |
| 1102 | if (ch != ':') |
| 1103 | continue; |
| 1104 | |
| 1105 | /* |
| 1106 | * "$Id: ... "; scan up to the closing dollar sign and discard. |
| 1107 | */ |
| 1108 | while (size) { |
| 1109 | ch = *cp++; |
| 1110 | size--; |
| 1111 | if (ch == '$') { |
| 1112 | cnt++; |
| 1113 | break; |
| 1114 | } |
| 1115 | if (ch == '\n') |
| 1116 | break; |
| 1117 | } |
| 1118 | } |
| 1119 | return cnt; |
| 1120 | } |
| 1121 | |
| 1122 | static int ident_to_git(const char *src, size_t len, |
| 1123 | struct strbuf *buf, int ident) |
no outgoing calls
no test coverage detected