Revert "magic pathspec: add ":(icase)path" to match case insensitively"
This reverts commit d0546e2d488b1ba185c430b638619ab1d91af509, which was only meant to be a Proof-of-concept used during the discussion. The real implementation of the feature needs to wait until we migrate all the code to use "struct pathspec", not "char **", to represent richer semantics given to pathspec.
Junio C Hamano committed
May 10, 2011 at 10:23 UTC
6d9429271013898df103f7e77ed0736cdfab01b8
2 files changed
+6
-32
Documentation/glossary-content.txt
+2
-5
@@ -319,13 +319,10 @@ top `/`;;
319
The magic word `top` (mnemonic: `/`) makes the pattern match
320
from the root of the working tree, even when you are running
321
the command from inside a subdirectory.
322
-icase;;
323
- The magic word `icase` (there is no mnemonic for it) makes the
324
- pattern match case insensitively. E.g. `:(icase)makefile` matches
325
- both `Makefile` and `makefile`.
322
--
323
+
328
-It is envisioned that we will support more types of magic in later
324
+Currently only the slash `/` is recognized as the "magic signature",
325
+but it is envisioned that we will support more types of magic in later
326
versions of git.
327
328
[[def_parent]]parent::
setup.c
+4
-27
@@ -136,12 +136,12 @@ void verify_non_filename(const char *prefix, const char *arg)
136
* Possible future magic semantics include stuff like:
137
*
138
* { PATHSPEC_NOGLOB, '!', "noglob" },
139
+ * { PATHSPEC_ICASE, '\0', "icase" },
140
* { PATHSPEC_RECURSIVE, '*', "recursive" },
141
* { PATHSPEC_REGEXP, '\0', "regexp" },
142
*
143
*/
144
#define PATHSPEC_FROMTOP (1<<0)
144
-#define PATHSPEC_ICASE (1<<1)
145
146
struct pathspec_magic {
147
unsigned bit;
@@ -149,7 +149,6 @@ struct pathspec_magic {
149
const char *name;
150
} pathspec_magic[] = {
151
{ PATHSPEC_FROMTOP, '/', "top" },
152
- { PATHSPEC_ICASE, '\0', "icase" },
152
};
153
154
/*
@@ -169,8 +168,7 @@ const char *prefix_pathspec(const char *prefix, int prefixlen, const char *elt)
168
{
169
unsigned magic = 0;
170
const char *copyfrom = elt;
172
- const char *retval;
173
- int i, free_source = 0;
171
+ int i;
172
173
if (elt[0] != ':') {
174
; /* nothing to do */
@@ -224,31 +222,10 @@ const char *prefix_pathspec(const char *prefix, int prefixlen, const char *elt)
222
copyfrom++;
223
}
224
227
- if (magic & PATHSPEC_ICASE) {
228
- struct strbuf sb = STRBUF_INIT;
229
- for (i = 0; copyfrom[i]; i++) {
230
- int ch = copyfrom[i];
231
- if (('a' <= ch && ch <= 'z') ||
232
- ('A' <= ch && ch <= 'Z')) {
233
- strbuf_addf(&sb, "[%c%c]",
234
- tolower(ch), toupper(ch));
235
- } else {
236
- strbuf_addch(&sb, ch);
237
- }
238
- }
239
- if (sb.len) {
240
- free_source = 1;
241
- copyfrom = strbuf_detach(&sb, NULL);
242
- }
243
- }
244
-
225
if (magic & PATHSPEC_FROMTOP)
246
- retval = xstrdup(copyfrom);
226
+ return xstrdup(copyfrom);
227
else
248
- retval = prefix_path(prefix, prefixlen, copyfrom);
249
- if (free_source)
250
- free((char *)copyfrom);
251
- return retval;
228
+ return prefix_path(prefix, prefixlen, copyfrom);
229
}
230
231
const char **get_pathspec(const char *prefix, const char **pathspec)