- if (!prefixcmp(refspec->src, fetch->src)) {
- refspec->dst =
- xmalloc(strlen(fetch->dst) +
- strlen(refspec->src) -
- strlen(fetch->src) + 1);
- strcpy(refspec->dst, fetch->dst);
- strcpy(refspec->dst + strlen(fetch->dst),
- refspec->src + strlen(fetch->src));
- refspec->force = fetch->force;
- return 0;
- }
- } else {
- if (!strcmp(refspec->src, fetch->src)) {
- refspec->dst = xstrdup(fetch->dst);
+ if (!prefixcmp(needle, key)) {
+ *result = xmalloc(strlen(value) +
+ strlen(needle) -
+ strlen(key) + 1);
+ strcpy(*result, value);
+ strcpy(*result + strlen(value),
+ needle + strlen(key));