git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: read_branches_file ()

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 8, 2008, 16:22 UTC
Message-ID
<alpine.LSU.1.00.0802081618210.11591@racer.site>
In-Reply-To
<20080208170305.069d43d2@pc09.procura.nl>
Hi,
On Fri, 8 Feb 2008, H.Merijn Brand wrote:
Show 8 quoted lines
> --8<--- remote.c.diff
> --- remote.c.org        2008-01-27 09:04:18 +0100
> +++ remote.c    2008-02-08 17:01:09 +0100
> @@ -1,6 +1,7 @@
>  #include "cache.h"
>  #include "remote.h"
>  #include "refs.h"
> +#include <sys/stat.h>
This should not be necessary; we include all system headers in cache.h.
Show 6 quoted lines
> @@ -173,11 +174,15 @@ static void read_branches_file(struct re
>         char *frag;
>         char *branch;
>         int n = slash ? slash - remote->name : 1000;
> -       FILE *f = fopen(git_path("branches/%.*s", n, remote->name), "r");
> +       char *gp = git_path ("branches/%.*s", n, remote->name);

Please use a more descriptive variable name, such as "branches_file" or "branches_path".

Also, we only leave a space after operators like "for", "while", but not after function names.

> +       if (stat (gp, &st_buf) || S_ISDIR (st_buf.st_mode))
Again, please remove the spaces after "stat" and "S_ISDIR".

Other than that, the patch looks obviously correct: please resubmit with a nice commit message and a sign-off.

Thanks, Dscho

Previous: H.Merijn BrandNext: H.Merijn Brand
Message 3 of 7 in “read_branches_file ()”
  1. H.Merijn BrandFeb 8, 2008
  2. H.Merijn BrandFeb 8, 2008
  3. Johannes SchindelinFeb 8, 2008
  4. H.Merijn BrandFeb 8, 2008
  5. Andreas EricssonFeb 11, 2008
  6. H.Merijn BrandFeb 11, 2008
  7. Daniel BarkalowFeb 8, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.