Fossil

Diff
Login

Differences From Artifact [607c7e8012]:

To Artifact [1cefe06ab1]:


247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
## Platform Quirks

Fossil glob patterns are based on the glob pattern feature of POSIX
shells. Fossil glob patterns also have a quoting mechanism, discussed
above. Because other parts of your operating system may interpret glob
patterns and quotes separately from Fossil, it is often difficult to
give glob patterns correctly to Fossil on the command line. Quotes and
special characters in glob patterns are likely to interpreted when given
as part of a `fossil` command, causing unexpected behavior.

These problems do not affect [versioned settings
files](/doc/trunk/www/settings.wiki) or Admin → Settings in Fossil
UI. Consequently, it is better to set long-term `*-glob` settings via
these methods than to use `fossil settings` commands.

That advice doesn't help you when you are giving one-off glob patterns







|
|







247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
## Platform Quirks

Fossil glob patterns are based on the glob pattern feature of POSIX
shells. Fossil glob patterns also have a quoting mechanism, discussed
above. Because other parts of your operating system may interpret glob
patterns and quotes separately from Fossil, it is often difficult to
give glob patterns correctly to Fossil on the command line. Quotes and
special characters in glob patterns are likely to be interpreted when
given as part of a `fossil` command, causing unexpected behavior.

These problems do not affect [versioned settings
files](/doc/trunk/www/settings.wiki) or Admin → Settings in Fossil
UI. Consequently, it is better to set long-term `*-glob` settings via
these methods than to use `fossil settings` commands.

That advice doesn't help you when you are giving one-off glob patterns
302
303
304
305
306
307
308
309
310
311
312
313
314
315

316

317
318
319
320
321
322
323
324
325
326
327
328
329
330
331

Beware that Fossil's `--ignore` option doesn't override explicit file
mentions:

    $ fossil add --ignore 'REALLY SECRET STUFF.txt' RE*

You might think that would add everything beginning with `RE` *except*
for `REALLY SECRET STUFF.txt`, but Fossil when a file is given
explicitly and found in the ignore list, Fossil asks what you want to do
with it in the default case, and doesn't even ask if gave `-f` or
`--force` along with `--ignore`.

The spaces in the ignored file name above bring us to another point:
file names must be quoted in Fossil glob patterns, but the shell

interprets quotation marks itself. There are a couple of ways to fix

both this and the previous problem:

    $ fossil add --ignore "'REALLY SECRET STUFF.txt'" READ*

The nested quotation marks cause the inner set to be passed through to
Fossil, and the more specific glob pattern expanded by the shell (that
is, `READ*` vs `RE*`) avoids a conflict between explicitly-listed files
and `--ignore` rules in the `fossil add` command.

Another solution would be to use shell escaping instead of nested
quoting:

    $ fossil add --ignore "\"REALLY SECRET STUFF.txt\"" READ*

It bears repeating that the two glob patterns here are not interpreted







|
|
|
|


|
>
|
>
|




|
|
|







302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333

Beware that Fossil's `--ignore` option doesn't override explicit file
mentions:

    $ fossil add --ignore 'REALLY SECRET STUFF.txt' RE*

You might think that would add everything beginning with `RE` *except*
for `REALLY SECRET STUFF.txt`, but when a file is both given explicitly
to Fossil and also matches an ignore rule, Fossil asks what you want to
do with it in the default case; it doesn't even ask if you gave the `-f`
or `--force` option along with `--ignore`.

The spaces in the ignored file name above bring us to another point:
such file names must be quoted in Fossil glob patterns, lest Fossil
interpret it as multiple glob patterns, but the shell interprets
quotation marks itself.

One way to fix both this and the previous problem is:

    $ fossil add --ignore "'REALLY SECRET STUFF.txt'" READ*

The nested quotation marks cause the inner set to be passed through to
Fossil, and the more specific glob pattern at the end — that is,
`READ*` vs `RE*` — avoids a conflict between explicitly-listed
files and `--ignore` rules in the `fossil add` command.

Another solution would be to use shell escaping instead of nested
quoting:

    $ fossil add --ignore "\"REALLY SECRET STUFF.txt\"" READ*

It bears repeating that the two glob patterns here are not interpreted
384
385
386
387
388
389
390
391

392
393
394
395
396
397
398
399
Windows' obsolete [Services for Unix
3.*x*](https://en.wikipedia.org/wiki/Windows_Services_for_UNIX) feature,
or the [Windows Subsystem for
Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux). (The
latter is sometimes incorrectly called "Bash on Windows" or "Ubuntu on
Windows.") See the POSIX Systems section above for those cases.)

For example, consider how you would set `crlf-glob` to `*`. The

naïve approach will not work:

    C:\...> fossil setting crlf-glob *

The C runtime library will expand that to the list of all files in the
current directory, which will probably cause a Fossil error because
Fossil expects either nothing or option flags after the setting's new
value.







|
>
|







386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
Windows' obsolete [Services for Unix
3.*x*](https://en.wikipedia.org/wiki/Windows_Services_for_UNIX) feature,
or the [Windows Subsystem for
Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux). (The
latter is sometimes incorrectly called "Bash on Windows" or "Ubuntu on
Windows.") See the POSIX Systems section above for those cases.)

For example, consider how you would set `crlf-glob` to `*` in order to
disable Fossil's "looks like a binary file" checks. The naïve
approach will not work:

    C:\...> fossil setting crlf-glob *

The C runtime library will expand that to the list of all files in the
current directory, which will probably cause a Fossil error because
Fossil expects either nothing or option flags after the setting's new
value.