{"thread":{"id":"29319","subject":"[patch] gitignore: warn about pointless syntax","startedAt":"2012-01-09T11:34:12Z","lastAt":"2012-01-09T13:44:45Z","messageCount":2,"participants":["Jan Engelhardt","Thomas Rast"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"182158","messageId":"alpine.LNX.2.01.1201091233050.28805@frira.zrqbmnf.qr","threadId":"29319","inReplyTo":null,"subject":"[patch] gitignore: warn about pointless syntax","fromName":"Jan Engelhardt","fromEmail":"jengelh@medozas.de","sentAt":"2012-01-09T11:34:12Z","receivedAt":"2012-01-09T11:34:12Z","isPatch":true,"sender":{"key":"jengelh@medozas.de","avatar":null},"body":"parent eac2d83247ea0a265d923518c26873bb12c33778 (v1.7.9-rc0)\ncommit b629bde461aeb178b257ab7e0f6c180f69f98cb0\nAuthor: Jan Engelhardt <jengelh@medozas.de>\nDate:   Mon Jan 9 12:30:07 2012 +0100\n\ngitignore: warn about pointless syntax\n\nAdd a warning to the gitignore parser if it sees \"**\". Git, using\nfnmatch, does not consider the double-asterisk anything special like\nrsync/zsh. Remind users of that, since too many seem to be Doing It\nWrong™.\n\nSigned-off-by: Jan Engelhardt <jengelh@medozas.de>\n---\n dir.c |   10 ++++++++++\n 1 files changed, 10 insertions(+), 0 deletions(-)\n\ndiff --git a/dir.c b/dir.c\nindex 0a78d00..60f65cb 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -376,6 +376,15 @@ void free_excludes(struct exclude_list *el)\n \tel->excludes = NULL;\n }\n \n+static inline void check_bogus_wildcard(const char *file, const char *p)\n+{\n+\tif (strstr(p, \"**\") == NULL)\n+\t\treturn;\n+\twarning(_(\"Pattern \\\"%s\\\" from file \\\"%s\\\": Double asterisk does not \"\n+\t\t\"have a special meaning and is interpreted just like a single \"\n+\t\t\"asterisk.\\n\"), file, p);\n+}\n+\n int add_excludes_from_file_to_list(const char *fname,\n \t\t\t\t   const char *base,\n \t\t\t\t   int baselen,\n@@ -427,6 +436,7 @@ int add_excludes_from_file_to_list(const char *fname,\n \t\tif (buf[i] == '\\n') {\n \t\t\tif (entry != buf + i && entry[0] != '#') {\n \t\t\t\tbuf[i - (i && buf[i-1] == '\\r')] = 0;\n+\t\t\t\tcheck_bogus_wildcard(fname, entry);\n \t\t\t\tadd_exclude(entry, base, baselen, which);\n \t\t\t}\n \t\t\tentry = buf + i + 1;\n-- \n# Created with git-export-patch\n"},{"id":"182163","messageId":"87vcolrnw2.fsf@thomas.inf.ethz.ch","threadId":"29319","inReplyTo":"alpine.LNX.2.01.1201091233050.28805@frira.zrqbmnf.qr","subject":"Re: [patch] gitignore: warn about pointless syntax","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2012-01-09T13:44:45Z","receivedAt":"2012-01-09T13:44:45Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Jan Engelhardt <jengelh@medozas.de> writes:\n\n> parent eac2d83247ea0a265d923518c26873bb12c33778 (v1.7.9-rc0)\n> commit b629bde461aeb178b257ab7e0f6c180f69f98cb0\n> Author: Jan Engelhardt <jengelh@medozas.de>\n> Date:   Mon Jan 9 12:30:07 2012 +0100\n>\n> gitignore: warn about pointless syntax\n[...]\n> -- \n> # Created with git-export-patch\n\nAre you the author of this tool?  The format is bogus in so far as it\ncauses git-am to insert the above lines into the git commit message, as\nin:\n\n    $ git am -3 < gitignore-patch.mbox\n    Applying: gitignore: warn about pointless syntax\n    $ git show\n    commit 59bea4d9a1de3b3b9c0139de4298ffd9d9431457\n    Author: Jan Engelhardt <jengelh@medozas.de>\n    Date:   Mon Jan 9 12:34:12 2012 +0100\n\n        gitignore: warn about pointless syntax\n        \n        parent eac2d83247ea0a265d923518c26873bb12c33778 (v1.7.9-rc0)\n        commit b629bde461aeb178b257ab7e0f6c180f69f98cb0\n        Author: Jan Engelhardt <jengelh@medozas.de>\n        Date:   Mon Jan 9 12:30:07 2012 +0100\n        \n        gitignore: warn about pointless syntax\n    [...]\n\nSo using this tool over format-patch is just a pointless cause of manual\nfixup work.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"}]}