git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] gitignore: warn about pointless syntax
@ 2012-01-09 11:34 Jan Engelhardt
  2012-01-09 13:44 ` Thomas Rast
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Engelhardt @ 2012-01-09 11:34 UTC (permalink / raw)
  To: git

parent eac2d83247ea0a265d923518c26873bb12c33778 (v1.7.9-rc0)
commit b629bde461aeb178b257ab7e0f6c180f69f98cb0
Author: Jan Engelhardt <jengelh@medozas.de>
Date:   Mon Jan 9 12:30:07 2012 +0100

gitignore: warn about pointless syntax

Add a warning to the gitignore parser if it sees "**". Git, using
fnmatch, does not consider the double-asterisk anything special like
rsync/zsh. Remind users of that, since too many seem to be Doing It
Wrong™.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 dir.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dir.c b/dir.c
index 0a78d00..60f65cb 100644
--- a/dir.c
+++ b/dir.c
@@ -376,6 +376,15 @@ void free_excludes(struct exclude_list *el)
 	el->excludes = NULL;
 }
 
+static inline void check_bogus_wildcard(const char *file, const char *p)
+{
+	if (strstr(p, "**") == NULL)
+		return;
+	warning(_("Pattern \"%s\" from file \"%s\": Double asterisk does not "
+		"have a special meaning and is interpreted just like a single "
+		"asterisk.\n"), file, p);
+}
+
 int add_excludes_from_file_to_list(const char *fname,
 				   const char *base,
 				   int baselen,
@@ -427,6 +436,7 @@ int add_excludes_from_file_to_list(const char *fname,
 		if (buf[i] == '\n') {
 			if (entry != buf + i && entry[0] != '#') {
 				buf[i - (i && buf[i-1] == '\r')] = 0;
+				check_bogus_wildcard(fname, entry);
 				add_exclude(entry, base, baselen, which);
 			}
 			entry = buf + i + 1;
-- 
# Created with git-export-patch

^ permalink raw reply related	[flat|nested] 12+ messages in thread
* gitignore warn about ** submission
@ 2012-01-09 15:40 Jan Engelhardt
  2012-01-09 15:40 ` [PATCH] gitignore: warn about pointless syntax Jan Engelhardt
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Engelhardt @ 2012-01-09 15:40 UTC (permalink / raw)
  To: git; +Cc: trast


The following changes since commit eac2d83247ea0a265d923518c26873bb12c33778:

  Git 1.7.9-rc0 (2012-01-06 12:51:09 -0800)

are available in the git repository at:
  git://dev.medozas.de/git master

Jan Engelhardt (1):
      gitignore: warn about pointless syntax

 dir.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-01-10 18:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-09 11:34 [patch] gitignore: warn about pointless syntax Jan Engelhardt
2012-01-09 13:44 ` Thomas Rast
  -- strict thread matches above, loose matches on Subject: below --
2012-01-09 15:40 gitignore warn about ** submission Jan Engelhardt
2012-01-09 15:40 ` [PATCH] gitignore: warn about pointless syntax Jan Engelhardt
2012-01-09 16:28   ` Jeff King
2012-01-09 19:43     ` Junio C Hamano
2012-01-09 22:33       ` Jeff King
2012-01-10  5:42         ` Jan Engelhardt
2012-01-10  6:01           ` Junio C Hamano
2012-01-10  7:01             ` Jan Engelhardt
2012-01-10  7:02               ` Jan Engelhardt
2012-01-10  9:44           ` Thomas Rast
2012-01-10 18:51           ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).