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

Re: [PATCH] gitignore(5): Allow "foo/" in ignore list to match directory "foo"

From
PRpradeep singh rautela <rautelap@gmail.com>
Date
Jan 31, 2008, 11:56 UTC
Message-ID
<6bc632150801310356w1b2fa019n87d92986aed807c5@mail.gmail.com>
In-Reply-To
<alpine.LSU.1.00.0801311128190.23907@racer.site>

On 31/01/2008, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote: [snip]

Show 29 quoted lines
>
> Just to add my two eurocents: I think the patch is complicated enough that
> we could go the other way round: while parsing the ignore entries, we can
> plainly state that entries with a trailing slash are ignored:
>
> -- snipsnap --
> [PATCH] Warn if an ignore/exclude entry ends in a slash
>
> Git does not like ignore entries ending in a slash; they will be ignored.
> So just be honest and warn the user about it.
>
> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
>
> ---
>
>  dir.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/dir.c b/dir.c
> index 1b9cc7a..c3e9a0d 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -135,6 +135,11 @@ void add_exclude(const char *string, const char *base,
>         }
>         x->pattern = string;
>         x->patternlen = strlen(string);
> +       if (x->patternlen && x->pattern[x->patternlen - 1] == '/') {
> +               warning("Ignoring ignore entry because of trailing slash: %s",
> +                       string);
How about something like,
                  warning("Ignoring ignore entry because of trailing
slash: %s\n Remove the trailing slash from the directory name to
ignore it", string);

May be this will help absolute git newbies. Please ignore this if it sounds like a "too trivial, everyone should know this" case.

Thanks,
           --Pradeep
Show 6 quoted lines
> +               return;
> +       }
>         x->base = base;
>         x->baselen = baselen;
>         x->flags = 0;
>
-- 
Pradeep Singh Rautela
http://eagain.wordpress.com
http://emptydomain.googlepages.com
Previous: Johannes SchindelinNext: Junio C Hamano
Message 15 of 20 in “Why does git track directory listed in .gitignore/".git/info/exclude"?”
  1. pradeep singh rautelaJan 23, 2008
  2. pradeep singh rautelaJan 23, 2008
  3. Linus TorvaldsJan 23, 2008
  4. pradeep singh rautelaJan 24, 2008
  5. Adam PiatyszekJan 30, 2008
  6. Junio C HamanoJan 30, 2008
  7. Junio C HamanoJan 30, 2008
  8. Adam PiatyszekJan 31, 2008
  9. *Re: Why does git track directory listed in .gitignore/".git/info/exclude"?Junio C Hamano, Jan 31, 2008
  10. gitignore(5): Allow "foo/" in ignore list to match directory "foo"Junio C Hamano, Jan 31, 2008
  11. Jeff KingJan 31, 2008
  12. Junio C HamanoJan 31, 2008
  13. Jeff KingJan 31, 2008
  14. Johannes SchindelinJan 31, 2008
  15. pradeep singh rautelaJan 31, 2008
  16. Junio C HamanoJan 31, 2008
  17. Adam PiatyszekJan 31, 2008
  18. Andreas EricssonFeb 1, 2008
  19. Adam PiatyszekJan 31, 2008
  20. Wayne DavisonJan 23, 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.