src/fnmatch.c


Log

Author Commit Date CI Message
Patrick Steinhardt 0c7f49dd 2017-06-30T13:39:01 Make sure to always include "common.h" first Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
Carlos Martín Nieto d45928cc 2016-04-18T16:05:12 ignore: move star-star matching closer to it use Instead of threading the state down to the larger loop, let's have the loop where we detect the double star so each of them are easier to read.
Carlos Martín Nieto 1c3018eb 2016-04-18T13:34:18 ignore: fix directory limits when searching for star-star In order to match the star-star, we disable the flag that's looking for a single path element, but that leads to searching for the pattern in the middle of elements in the input string. Mark when we're handing a star-star so we jump over the elements in our attempt to match the part of the pattern that comes after the star-star. While here, tighten up the check so we don't allow invalid rules through.
Edward Thomson 75a4636f 2015-05-29T16:56:38 git__tolower: a tolower() that isn't dumb Some brain damaged tolower() implementations appear to want to take the locale into account, and this may require taking some insanely aggressive lock on the locale and slowing down what should be the most trivial of trivial calls for people who just want to downcase ASCII.
Martin Woodward 213a269a 2014-05-19T14:39:45 Restore attributions for fnmatch
Russell Belfer d19b2f9f 2014-05-01T12:46:46 Make ** pattern eat trailing slash This allows "foo/**/*.html" to match "foo/file.html"
Russell Belfer c7d96060 2014-04-06T11:20:22 Fix fnmatch comment to be clearer
Russell Belfer 2b6b85f1 2014-04-04T17:02:12 Add support for ** matches in ignores This is an experimental addition to add ** support to fnmatch pattern matching in libgit2. It needs more testing.
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
Russell Belfer d5a51910 2012-10-11T13:39:53 Import DOS fix for fnmatch Because fnmatch uses recursion, there were some input sequences that cause seriously degenerate behavior. This imports a fix that imposes a max recursion limiter to avoid the worst of it.
Russell Belfer 824d5e4d 2012-10-11T11:58:00 Always use internal fnmatch, not system
Vicent Marti e9c6571d 2011-07-06T01:04:04 fnmatch: Use native on Unix, emulate on Win32
Carlos Martín Nieto 63f91e1c 2011-06-22T16:52:30 Add git.git's fnmatch, which is really GNU's and the git__fnmatch wrapper If the strings match, git__fnmatch returns GIT_SUCCESS and GIT_ENOMATCH on failure to match. MSVC fixes: Added a test for _MSC_VER and (in that case) defined HAVE_STRING_H to 1 so it doesn't try to include <strings.h> which doesn't exist in the MSVC world. Moved the function declarations to use the modern inline ones so MSVC doesn't have a fit. Added casts everywhere so MSVC doesn't crap its pants. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>