| 2140 | } |
| 2141 | |
| 2142 | static struct command **queue_command(struct command **tail, |
| 2143 | const char *line, |
| 2144 | int linelen) |
| 2145 | { |
| 2146 | struct object_id old_oid, new_oid; |
| 2147 | struct command *cmd; |
| 2148 | const char *refname; |
| 2149 | int reflen; |
| 2150 | const char *p; |
| 2151 | |
| 2152 | if (parse_oid_hex(line, &old_oid, &p) || |
| 2153 | *p++ != ' ' || |
| 2154 | parse_oid_hex(p, &new_oid, &p) || |
| 2155 | *p++ != ' ') |
| 2156 | die("protocol error: expected old/new/ref, got '%s'", line); |
| 2157 | |
| 2158 | refname = p; |
| 2159 | reflen = linelen - (p - line); |
| 2160 | FLEX_ALLOC_MEM(cmd, ref_name, refname, reflen); |
| 2161 | oidcpy(&cmd->old_oid, &old_oid); |
| 2162 | oidcpy(&cmd->new_oid, &new_oid); |
| 2163 | *tail = cmd; |
| 2164 | return &cmd->next; |
| 2165 | } |
| 2166 | |
| 2167 | static void free_commands(struct command *commands) |
| 2168 | { |
no test coverage detected