Ramkumar Ramachandra wrote:
> diff --git a/link.c b/link.c
> index bb20a51..349646d 100644
> --- a/link.c
> +++ b/link.c
> @@ -20,8 +20,30 @@ struct link *lookup_link(const unsigned char *sha1)
>
>  int parse_link_buffer(struct link *item, void *buffer, unsigned long size)
>  {
> +       char *bufptr = buffer;
> +       char *tail = buffer + size;
> +       char *eol;
> +
>         if (item->object.parsed)
>                 return 0;
>         item->object.parsed = 1;
> +       while (bufptr < tail) {
> +               eol = strchr(bufptr, '\n');
> +               *eol = '\0';
> +               if (!prefixcmp(bufptr, "upstream_url = "))
> +                       item->upstream_url = xstrdup(bufptr + 15);
> +               else if (!prefixcmp(bufptr, "checkout_rev = "))
> +                       item->checkout_rev = xstrdup(bufptr + 15);
> +               else if (!prefixcmp(bufptr, "ref_name = "))
> +                       item->ref_name = xstrdup(bufptr + 11);
> +               else if (!prefixcmp(bufptr, "floating = "))
> +                       item->floating = atoi(bufptr + 11);
> +               else if (!prefixcmp(bufptr, "statthrough = "))
> +                       item->statthrough = atoi(bufptr + 14);
> +               else
> +                       return error("Parse error in link buffer");
> +
> +               bufptr = eol + 1;
> +       }
>         return 0;
>  }

This needs to be replaced by a .git/config parser.  However, I can't
use the parser from config.c as-it-is, because it expects a section
like [core] to be present.  So, we have to refactor it to optionally
parse section-less configs.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to