Re: [PATCH 1/3] Move remote parsing into a library file out of builtin-push.
- From
Junio C Hamano <junkio@cox.net>
- Date
- May 12, 2007, 07:51 UTC
- Message-ID
- <7v3b225vkj.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <Pine.LNX.4.64.0705112238260.18541@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> writes:
> The new parser is different from the one in builtin-push in two ways: > the default is to use the current branch's remote, if there is one, > before "origin"; and config is used in preference to remotes.
Please chuck my comment about describing differences in the previous message---you did it already. Sorry.
Show 15 quoted lines
> diff --git a/remote.c b/remote.c > new file mode 100644 > index 0000000..1dd2e77 > --- /dev/null > +++ b/remote.c > @@ -0,0 +1,203 @@ > +#include "cache.h" > +#include "remote.h" > +#include "refs.h" > + > +static struct remote **remotes; > +static int allocated_remotes; > + > +#define BUF_SIZE (2084) > +static char buffer[BUF_SIZE];
Heh, inherited a funny constant from the original... I guess most likely he meant 2048 ;-).
Show 10 quoted lines
> +static void read_remotes_file(struct remote *remote)
> +{
> + FILE *f = fopen(git_path("remotes/%s", remote->name), "r");
> +
> + if (!f)
> + return;
> + while (fgets(buffer, BUF_SIZE, f)) {
> +...
> + }
> +}I sense a slight "FILE *" leak here...