Thread (5 messages) flat view 5 messages, 5 authors, 2016-06-15

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

From: pradeep singh rautela <hidden>
Date: 2016-06-15 22:44:09

Possibly related (same subject, not in this thread)

On 31/01/2008, Johannes Schindelin [off-list ref] wrote:
[snip]
quoted hunk ↗ jump to hunk
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 <redacted>

---

 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
+               return;
+       }
        x->base = base;
        x->baselen = baselen;
        x->flags = 0;

-- 
Pradeep Singh Rautela
http://eagain.wordpress.com
http://emptydomain.googlepages.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help