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

Re: [PATCH] [GSoC 2014]diff: Imported dir.h and renamed read_directory()

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 19, 2014, 01:19 UTC
Message-ID
<CAPig+cTkZPCMo6smKie4ZJP-Xu4rAFw6yPY-PYqs2Pniyww7MQ@mail.gmail.com>
In-Reply-To
<CAM+=D-Ac2yL02-6qGQFuV_qz4FKt_6EGwRHk4+MLDnSb5CgucQ@mail.gmail.com>

Thanks for the submission. Comments below to give you a taste of the Git review process...

On Tue, Mar 18, 2014 at 8:35 PM, Brian Bourn <ba.bourn@gmail.com> wrote:
> Subject: diff: Imported dir.h and renamed read_directory()
Use imperative voice: "import dir.h and rename read_directory()"
> this was done in order to implement the GSoC
> Micro project for diff-no-index.c

This commentary won't be relevant to anyone reading the commit message months or years from now. Place it below the "---" line following your sign-off.

Show 6 quoted lines
> this is the
> first patch importing dir.h, for the use of
> is_dot_or_dotdot(), and renaming
> read_directory() to read_directory_contents()
> in order to deal with the conflicting function
> in dir.h

Since this preparatory change and the one which will follow are so closely related, they should be submitted together as a two-patch series.

The commit message itself it somewhat rambling. It would be clearer if you could explain the problem precisely, then the solution. Perhaps something like this:

    It would be desirable to replace manual checking of "." or ".."
    in diff-no-index.c with is_dot_or_dotdot(), which is defined in
    dir.h, however, dir.h declares a read_directory() which conflicts
    with a (different) static read_directory() defined in
    diff-no-index.c. As a preparatory step, rename the local
    read_directory() to avoid the collision.
Show 18 quoted lines
> Signed-off-by: Brian Bourn <bab2177@columbia.edu>
> ---
>
> I plan on applying to GSoC 2014
>
>  diff-no-index.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/diff-no-index.c b/diff-no-index.c
> index 8e10bff..ba915af 100644
> --- a/diff-no-index.c
> +++ b/diff-no-index.c
> @@ -10,13 +10,14 @@
>  #include "blob.h"
>  #include "tag.h"
>  #include "diff.h"
> +#include "dir.h"
>  #include "diffcore.h"

dir.h is not needed for this patch, so including it here only confuses matters. Include it instead when it is actually required by the follow-up patch which uses is_dot_or_dotdot().

(Was it intentional to place the new #include between diff.h and diffcore.h? Just being curious; it's not particularly important.)

Other than this, the patch looks sane.
Show 24 quoted lines
>  #include "revision.h"
>  #include "log-tree.h"
>  #include "builtin.h"
>  #include "string-list.h"
>
> -static int read_directory(const char *path, struct string_list *list)
> +static int read_directory_contents(const char *path, struct string_list *list)
>  {
>   DIR *dir;
>   struct dirent *e;
> @@ -107,9 +108,9 @@ static int queue_diff(struct diff_options *o,
>   int i1, i2, ret = 0;
>   size_t len1 = 0, len2 = 0;
>
> - if (name1 && read_directory(name1, &p1))
> + if (name1 && read_directory_contents(name1, &p1))
>   return -1;
> - if (name2 && read_directory(name2, &p2)) {
> + if (name2 && read_directory_contents(name2, &p2)) {
>   string_list_clear(&p1, 0);
>   return -1;
>   }
> --
> 1.9.0
Previous: Brian BournNext: babourn
Message 2 of 5 in “[GSoC 2014]diff: Imported dir.h and renamed read_directory()”
  1. [GSoC 2014]diff: Imported dir.h and renamed read_directory()Brian Bourn, Mar 19, 2014
  2. Eric SunshineMar 19, 2014
  3. 2/2 [GSoC 2014] diff: used is_dot_or_dotdot() in codebabourn, Mar 19, 2014
  4. Eric SunshineMar 19, 2014
  5. Eric SunshineMar 19, 2014

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.