Fossil SCM
Merged glob-docs branch down to trunk.
Commit
b45a985c864d06a3da00807b0609c21d695ebb8e36e1dd132a03828719d5df35
Parent
8466a1572259134…
1 file changed
+80
-32
+80
-32
| --- www/globs.md | ||
| +++ www/globs.md | ||
| @@ -188,10 +188,11 @@ | ||
| 188 | 188 | * [`commit`][] |
| 189 | 189 | * [`extras`][] |
| 190 | 190 | * [`merge`][] |
| 191 | 191 | * [`settings`][] |
| 192 | 192 | * [`status`][] |
| 193 | + * [`touch`][] | |
| 193 | 194 | * [`unset`][] |
| 194 | 195 | |
| 195 | 196 | The commands [`tarball`][] and [`zip`][] produce compressed archives of a |
| 196 | 197 | specific checkin. They may be further restricted by options that |
| 197 | 198 | specify glob patterns that name files to include or exclude rather |
| @@ -209,10 +210,11 @@ | ||
| 209 | 210 | [`commit`]: /help?cmd=commit |
| 210 | 211 | [`extras`]: /help?cmd=extras |
| 211 | 212 | [`merge`]: /help?cmd=merge |
| 212 | 213 | [`settings`]: /help?cmd=settings |
| 213 | 214 | [`status`]: /help?cmd=status |
| 215 | +[`touch`]: /help?cmd=touch | |
| 214 | 216 | [`unset`]: /help?cmd=unset |
| 215 | 217 | |
| 216 | 218 | [`tarball`]: /help?cmd=tarball |
| 217 | 219 | [`zip`]: /help?cmd=zip |
| 218 | 220 | |
| @@ -259,11 +261,11 @@ | ||
| 259 | 261 | That advice does not help you when you are giving one-off glob patterns |
| 260 | 262 | in `fossil` commands. The remainder of this section gives remedies and |
| 261 | 263 | workarounds for these problems. |
| 262 | 264 | |
| 263 | 265 | |
| 264 | -## POSIX Systems | |
| 266 | +### <a name="posix"></a>POSIX Systems | |
| 265 | 267 | |
| 266 | 268 | If you are using Fossil on a system with a POSIX-compatible shell |
| 267 | 269 | — Linux, macOS, the BSDs, Unix, Cygwin, WSL etc. — the shell |
| 268 | 270 | may expand the glob patterns before passing the result to the `fossil` |
| 269 | 271 | executable. |
| @@ -346,11 +348,28 @@ | ||
| 346 | 348 | accidentally check something like a password, an API key, or the |
| 347 | 349 | private half of a public cryptographic key into Fossil repository that |
| 348 | 350 | can be read by people who should not have such secrets. |
| 349 | 351 | |
| 350 | 352 | |
| 351 | -## Windows | |
| 353 | +### <a name="windows"></a>Windows | |
| 354 | + | |
| 355 | +Before we get into Windows-specific details here, beware that this | |
| 356 | +section does not apply to the several Microsoft Windows extensions that | |
| 357 | +provide POSIX semantics to Windows, for which you want to use the advice | |
| 358 | +in [the POSIX section above](#posix) instead: | |
| 359 | + | |
| 360 | + * the ancient and rarely-used [Microsoft POSIX subsystem][mps]; | |
| 361 | + * its now-discontinued replacement feature, [Services for Unix][sfu]; or | |
| 362 | + * their modern replacement, the [Windows Subsystem for Linux][wsl] | |
| 363 | + | |
| 364 | +[mps]: https://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem | |
| 365 | +[sfu]: https://en.wikipedia.org/wiki/Windows_Services_for_UNIX | |
| 366 | +[wsl]: https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux | |
| 367 | + | |
| 368 | +(The latter is sometimes incorrectly called "Bash on Windows" or "Ubuntu | |
| 369 | +on Windows," but the feature provides much more than just Bash or Ubuntu | |
| 370 | +for Windows.) | |
| 352 | 371 | |
| 353 | 372 | Neither standard Windows command shell — `cmd.exe` or PowerShell |
| 354 | 373 | — expands glob patterns the way POSIX shells do. Windows command |
| 355 | 374 | shells rely on the command itself to do the glob pattern expansion. The |
| 356 | 375 | way this works depends on several factors: |
| @@ -362,73 +381,102 @@ | ||
| 362 | 381 | * whether the command is built against a runtime system that does this |
| 363 | 382 | at all |
| 364 | 383 | * whether the Fossil command is being run from a file named `*.BAT` vs |
| 365 | 384 | being named `*.CMD` |
| 366 | 385 | |
| 367 | -These factors also affect how a program like `fossil.exe` interprets | |
| 368 | -quotation marks on its command line. | |
| 369 | - | |
| 370 | -The fifth item above does not apply to `fossil.exe` when built with | |
| 371 | -typical tool chains, but we will see an example below where the exception | |
| 372 | -applies in a way that affects how Fossil interprets the glob pattern. | |
| 386 | +Usually (but not always!) the C runtime library that your `fossil.exe` | |
| 387 | +executable is built against does this glob expansion on Windows so the | |
| 388 | +program proper does not have to. This may then interact with the way the | |
| 389 | +Windows command shell you’re using handles argument quoting. Because of | |
| 390 | +these differences, it is common to find perfectly valid Fossil command | |
| 391 | +examples that were written and tested on a POSIX system which then fail | |
| 392 | +when tried on Windows. | |
| 373 | 393 | |
| 374 | 394 | The most common problem is figuring out how to get a glob pattern passed |
| 375 | 395 | on the command line into `fossil.exe` without it being expanded by the C |
| 376 | 396 | runtime library that your particular Fossil executable is linked to, |
| 377 | -which tries to act like the POSIX systems described above. Windows is | |
| 397 | +which tries to act like [the POSIX systems described above](#posix). Windows is | |
| 378 | 398 | not strongly governed by POSIX, so it has not historically hewed closely |
| 379 | 399 | to its strictures. |
| 380 | 400 | |
| 381 | -(This section does not cover the [Microsoft POSIX | |
| 382 | -subsystem](https://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem), | |
| 383 | -Windows' obsolete [Services for Unix | |
| 384 | -3.*x*](https://en.wikipedia.org/wiki/Windows_Services_for_UNIX) feature, | |
| 385 | -or the [Windows Subsystem for | |
| 386 | -Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux). (The | |
| 387 | -latter is sometimes incorrectly called "Bash on Windows" or "Ubuntu on | |
| 388 | -Windows.") See the POSIX Systems section above for those cases.) | |
| 389 | - | |
| 390 | 401 | For example, consider how you would set `crlf-glob` to `*` in order to |
| 391 | -disable Fossil's "looks like a binary file" checks. The naïve | |
| 392 | -approach will not work: | |
| 402 | +get normal Windows text files with CR+LF line endings past Fossil's | |
| 403 | +"looks like a binary file" check. The naïve approach will not work: | |
| 393 | 404 | |
| 394 | 405 | C:\...> fossil setting crlf-glob * |
| 395 | 406 | |
| 396 | 407 | The C runtime library will expand that to the list of all files in the |
| 397 | 408 | current directory, which will probably cause a Fossil error because |
| 398 | 409 | Fossil expects either nothing or option flags after the setting's new |
| 399 | -value. | |
| 410 | +value, not a list of file names. (To be fair, the same thing will happen | |
| 411 | +on POSIX systems, only at the shell level, before `.../bin/fossil` even | |
| 412 | +gets run by the shell.) | |
| 400 | 413 | |
| 401 | 414 | Let's try again: |
| 402 | 415 | |
| 403 | 416 | C:\...> fossil setting crlf-glob '*' |
| 404 | 417 | |
| 405 | -That may or may not work. Either `'*'` or `*` needs to be passed through | |
| 406 | -to Fossil untouched for this to do what you expect, which may or may not | |
| 407 | -happen, depending on the factors listed above. | |
| 418 | +Quoting the argument like that will work reliably on POSIX, but it may | |
| 419 | +or may not work on Windows. If your Windows command shell interprets the | |
| 420 | +quotes, it means `fossil.exe` will see only the bare `*` so the C | |
| 421 | +runtime library it is linked to will likely expand the list of files in | |
| 422 | +the current directory before the `setting` command gets a chance to | |
| 423 | +parse the command line arguments, causing the same failure as above. | |
| 424 | +This alternative only works if you’re using a Windows command shell that | |
| 425 | +passes the quotes through to the executable *and* you have linked Fossil | |
| 426 | +to a C runtime library that interprets the quotes properly itself, | |
| 427 | +resulting in a bare `*` getting clear down to Fossil’s `setting` command | |
| 428 | +parser. | |
| 408 | 429 | |
| 409 | 430 | An approach that *will* work reliably is: |
| 410 | 431 | |
| 411 | 432 | C:\...> echo * | fossil setting crlf-glob --args - |
| 412 | 433 | |
| 413 | -This works because the built-in command `echo` does not expand its | |
| 414 | -arguments, and the `--args -` option makes it read further command | |
| 415 | -arguments from Fossil's standard input, which is connected to the output | |
| 434 | +This works because the built-in Windows command `echo` does not expand its | |
| 435 | +arguments, and the `--args -` option makes Fossil read further command | |
| 436 | +arguments from its standard input, which is connected to the output | |
| 416 | 437 | of `echo` by the pipe. (`-` is a common Unix convention meaning |
| 417 | -"standard input.") | |
| 438 | +"standard input," which Fossil obeys.) A [batch script][fng.cmd] to automate this trick was | |
| 439 | +posted on the now-inactive Fossil Mailing List. | |
| 440 | + | |
| 441 | +[fng.cmd]: https://www.mail-archive.com/[email protected]/msg25099.html | |
| 442 | + | |
| 443 | +(Ironically, this method will *not* work on POSIX systems because it is | |
| 444 | +not up to the command to expand globs. The shell will expand the `*` in | |
| 445 | +the `echo` command, so the list of file names will be passed to the | |
| 446 | +`fossil` standard input, just as with the first example above!) | |
| 418 | 447 | |
| 419 | -Another (usually) correct approach is: | |
| 448 | +Another (usually) correct approach which will work on both Windows and | |
| 449 | +POSIX systems: | |
| 420 | 450 | |
| 421 | 451 | C:\...> fossil setting crlf-glob *, |
| 422 | 452 | |
| 423 | -This works because the trailing comma prevents the command shell from | |
| 453 | +This works because the trailing comma prevents the glob pattern from | |
| 424 | 454 | matching any files, unless you happen to have files named with a |
| 425 | 455 | trailing comma in the current directory. If the pattern matches no |
| 426 | 456 | files, it is passed into Fossil's `main()` function as-is by the C |
| 427 | 457 | runtime system. Since Fossil uses commas to separate multiple glob |
| 428 | -patterns, this means "all files at the root of the Fossil checkout | |
| 429 | -directory and nothing else." | |
| 458 | +patterns, this means "all files from the root of the Fossil checkout | |
| 459 | +directory downward and nothing else," which is of course equivalent to | |
| 460 | +"all managed files in this repository," our original goal. | |
| 461 | + | |
| 462 | + | |
| 463 | +## Experimenting | |
| 464 | + | |
| 465 | +To preview the effects of command line glob pattern expansion for | |
| 466 | +various glob patterns (unquoted, quoted, comma-terminated), for any | |
| 467 | +combination of command shell, OS, C run time, and Fossil version, | |
| 468 | +preceed the command you want to test with [`test-echo`][] like so: | |
| 469 | + | |
| 470 | + $ fossil test-echo setting crlf-glob "*" | |
| 471 | + C:\> echo * | fossil test-echo setting crlf-glob --args - | |
| 472 | + | |
| 473 | +The [`test-glob`][] command is also handy to test if a string | |
| 474 | +matches a glob pattern. | |
| 475 | + | |
| 476 | +[`test-echo`]: /help?cmd=test-echo | |
| 477 | +[`test-glob`]: /help?cmd=test-glob | |
| 430 | 478 | |
| 431 | 479 | |
| 432 | 480 | ## Converting `.gitignore` to `ignore-glob` |
| 433 | 481 | |
| 434 | 482 | Many other version control systems handle the specific case of |
| 435 | 483 |
| --- www/globs.md | |
| +++ www/globs.md | |
| @@ -188,10 +188,11 @@ | |
| 188 | * [`commit`][] |
| 189 | * [`extras`][] |
| 190 | * [`merge`][] |
| 191 | * [`settings`][] |
| 192 | * [`status`][] |
| 193 | * [`unset`][] |
| 194 | |
| 195 | The commands [`tarball`][] and [`zip`][] produce compressed archives of a |
| 196 | specific checkin. They may be further restricted by options that |
| 197 | specify glob patterns that name files to include or exclude rather |
| @@ -209,10 +210,11 @@ | |
| 209 | [`commit`]: /help?cmd=commit |
| 210 | [`extras`]: /help?cmd=extras |
| 211 | [`merge`]: /help?cmd=merge |
| 212 | [`settings`]: /help?cmd=settings |
| 213 | [`status`]: /help?cmd=status |
| 214 | [`unset`]: /help?cmd=unset |
| 215 | |
| 216 | [`tarball`]: /help?cmd=tarball |
| 217 | [`zip`]: /help?cmd=zip |
| 218 | |
| @@ -259,11 +261,11 @@ | |
| 259 | That advice does not help you when you are giving one-off glob patterns |
| 260 | in `fossil` commands. The remainder of this section gives remedies and |
| 261 | workarounds for these problems. |
| 262 | |
| 263 | |
| 264 | ## POSIX Systems |
| 265 | |
| 266 | If you are using Fossil on a system with a POSIX-compatible shell |
| 267 | — Linux, macOS, the BSDs, Unix, Cygwin, WSL etc. — the shell |
| 268 | may expand the glob patterns before passing the result to the `fossil` |
| 269 | executable. |
| @@ -346,11 +348,28 @@ | |
| 346 | accidentally check something like a password, an API key, or the |
| 347 | private half of a public cryptographic key into Fossil repository that |
| 348 | can be read by people who should not have such secrets. |
| 349 | |
| 350 | |
| 351 | ## Windows |
| 352 | |
| 353 | Neither standard Windows command shell — `cmd.exe` or PowerShell |
| 354 | — expands glob patterns the way POSIX shells do. Windows command |
| 355 | shells rely on the command itself to do the glob pattern expansion. The |
| 356 | way this works depends on several factors: |
| @@ -362,73 +381,102 @@ | |
| 362 | * whether the command is built against a runtime system that does this |
| 363 | at all |
| 364 | * whether the Fossil command is being run from a file named `*.BAT` vs |
| 365 | being named `*.CMD` |
| 366 | |
| 367 | These factors also affect how a program like `fossil.exe` interprets |
| 368 | quotation marks on its command line. |
| 369 | |
| 370 | The fifth item above does not apply to `fossil.exe` when built with |
| 371 | typical tool chains, but we will see an example below where the exception |
| 372 | applies in a way that affects how Fossil interprets the glob pattern. |
| 373 | |
| 374 | The most common problem is figuring out how to get a glob pattern passed |
| 375 | on the command line into `fossil.exe` without it being expanded by the C |
| 376 | runtime library that your particular Fossil executable is linked to, |
| 377 | which tries to act like the POSIX systems described above. Windows is |
| 378 | not strongly governed by POSIX, so it has not historically hewed closely |
| 379 | to its strictures. |
| 380 | |
| 381 | (This section does not cover the [Microsoft POSIX |
| 382 | subsystem](https://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem), |
| 383 | Windows' obsolete [Services for Unix |
| 384 | 3.*x*](https://en.wikipedia.org/wiki/Windows_Services_for_UNIX) feature, |
| 385 | or the [Windows Subsystem for |
| 386 | Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux). (The |
| 387 | latter is sometimes incorrectly called "Bash on Windows" or "Ubuntu on |
| 388 | Windows.") See the POSIX Systems section above for those cases.) |
| 389 | |
| 390 | For example, consider how you would set `crlf-glob` to `*` in order to |
| 391 | disable Fossil's "looks like a binary file" checks. The naïve |
| 392 | approach will not work: |
| 393 | |
| 394 | C:\...> fossil setting crlf-glob * |
| 395 | |
| 396 | The C runtime library will expand that to the list of all files in the |
| 397 | current directory, which will probably cause a Fossil error because |
| 398 | Fossil expects either nothing or option flags after the setting's new |
| 399 | value. |
| 400 | |
| 401 | Let's try again: |
| 402 | |
| 403 | C:\...> fossil setting crlf-glob '*' |
| 404 | |
| 405 | That may or may not work. Either `'*'` or `*` needs to be passed through |
| 406 | to Fossil untouched for this to do what you expect, which may or may not |
| 407 | happen, depending on the factors listed above. |
| 408 | |
| 409 | An approach that *will* work reliably is: |
| 410 | |
| 411 | C:\...> echo * | fossil setting crlf-glob --args - |
| 412 | |
| 413 | This works because the built-in command `echo` does not expand its |
| 414 | arguments, and the `--args -` option makes it read further command |
| 415 | arguments from Fossil's standard input, which is connected to the output |
| 416 | of `echo` by the pipe. (`-` is a common Unix convention meaning |
| 417 | "standard input.") |
| 418 | |
| 419 | Another (usually) correct approach is: |
| 420 | |
| 421 | C:\...> fossil setting crlf-glob *, |
| 422 | |
| 423 | This works because the trailing comma prevents the command shell from |
| 424 | matching any files, unless you happen to have files named with a |
| 425 | trailing comma in the current directory. If the pattern matches no |
| 426 | files, it is passed into Fossil's `main()` function as-is by the C |
| 427 | runtime system. Since Fossil uses commas to separate multiple glob |
| 428 | patterns, this means "all files at the root of the Fossil checkout |
| 429 | directory and nothing else." |
| 430 | |
| 431 | |
| 432 | ## Converting `.gitignore` to `ignore-glob` |
| 433 | |
| 434 | Many other version control systems handle the specific case of |
| 435 |
| --- www/globs.md | |
| +++ www/globs.md | |
| @@ -188,10 +188,11 @@ | |
| 188 | * [`commit`][] |
| 189 | * [`extras`][] |
| 190 | * [`merge`][] |
| 191 | * [`settings`][] |
| 192 | * [`status`][] |
| 193 | * [`touch`][] |
| 194 | * [`unset`][] |
| 195 | |
| 196 | The commands [`tarball`][] and [`zip`][] produce compressed archives of a |
| 197 | specific checkin. They may be further restricted by options that |
| 198 | specify glob patterns that name files to include or exclude rather |
| @@ -209,10 +210,11 @@ | |
| 210 | [`commit`]: /help?cmd=commit |
| 211 | [`extras`]: /help?cmd=extras |
| 212 | [`merge`]: /help?cmd=merge |
| 213 | [`settings`]: /help?cmd=settings |
| 214 | [`status`]: /help?cmd=status |
| 215 | [`touch`]: /help?cmd=touch |
| 216 | [`unset`]: /help?cmd=unset |
| 217 | |
| 218 | [`tarball`]: /help?cmd=tarball |
| 219 | [`zip`]: /help?cmd=zip |
| 220 | |
| @@ -259,11 +261,11 @@ | |
| 261 | That advice does not help you when you are giving one-off glob patterns |
| 262 | in `fossil` commands. The remainder of this section gives remedies and |
| 263 | workarounds for these problems. |
| 264 | |
| 265 | |
| 266 | ### <a name="posix"></a>POSIX Systems |
| 267 | |
| 268 | If you are using Fossil on a system with a POSIX-compatible shell |
| 269 | — Linux, macOS, the BSDs, Unix, Cygwin, WSL etc. — the shell |
| 270 | may expand the glob patterns before passing the result to the `fossil` |
| 271 | executable. |
| @@ -346,11 +348,28 @@ | |
| 348 | accidentally check something like a password, an API key, or the |
| 349 | private half of a public cryptographic key into Fossil repository that |
| 350 | can be read by people who should not have such secrets. |
| 351 | |
| 352 | |
| 353 | ### <a name="windows"></a>Windows |
| 354 | |
| 355 | Before we get into Windows-specific details here, beware that this |
| 356 | section does not apply to the several Microsoft Windows extensions that |
| 357 | provide POSIX semantics to Windows, for which you want to use the advice |
| 358 | in [the POSIX section above](#posix) instead: |
| 359 | |
| 360 | * the ancient and rarely-used [Microsoft POSIX subsystem][mps]; |
| 361 | * its now-discontinued replacement feature, [Services for Unix][sfu]; or |
| 362 | * their modern replacement, the [Windows Subsystem for Linux][wsl] |
| 363 | |
| 364 | [mps]: https://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem |
| 365 | [sfu]: https://en.wikipedia.org/wiki/Windows_Services_for_UNIX |
| 366 | [wsl]: https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux |
| 367 | |
| 368 | (The latter is sometimes incorrectly called "Bash on Windows" or "Ubuntu |
| 369 | on Windows," but the feature provides much more than just Bash or Ubuntu |
| 370 | for Windows.) |
| 371 | |
| 372 | Neither standard Windows command shell — `cmd.exe` or PowerShell |
| 373 | — expands glob patterns the way POSIX shells do. Windows command |
| 374 | shells rely on the command itself to do the glob pattern expansion. The |
| 375 | way this works depends on several factors: |
| @@ -362,73 +381,102 @@ | |
| 381 | * whether the command is built against a runtime system that does this |
| 382 | at all |
| 383 | * whether the Fossil command is being run from a file named `*.BAT` vs |
| 384 | being named `*.CMD` |
| 385 | |
| 386 | Usually (but not always!) the C runtime library that your `fossil.exe` |
| 387 | executable is built against does this glob expansion on Windows so the |
| 388 | program proper does not have to. This may then interact with the way the |
| 389 | Windows command shell you’re using handles argument quoting. Because of |
| 390 | these differences, it is common to find perfectly valid Fossil command |
| 391 | examples that were written and tested on a POSIX system which then fail |
| 392 | when tried on Windows. |
| 393 | |
| 394 | The most common problem is figuring out how to get a glob pattern passed |
| 395 | on the command line into `fossil.exe` without it being expanded by the C |
| 396 | runtime library that your particular Fossil executable is linked to, |
| 397 | which tries to act like [the POSIX systems described above](#posix). Windows is |
| 398 | not strongly governed by POSIX, so it has not historically hewed closely |
| 399 | to its strictures. |
| 400 | |
| 401 | For example, consider how you would set `crlf-glob` to `*` in order to |
| 402 | get normal Windows text files with CR+LF line endings past Fossil's |
| 403 | "looks like a binary file" check. The naïve approach will not work: |
| 404 | |
| 405 | C:\...> fossil setting crlf-glob * |
| 406 | |
| 407 | The C runtime library will expand that to the list of all files in the |
| 408 | current directory, which will probably cause a Fossil error because |
| 409 | Fossil expects either nothing or option flags after the setting's new |
| 410 | value, not a list of file names. (To be fair, the same thing will happen |
| 411 | on POSIX systems, only at the shell level, before `.../bin/fossil` even |
| 412 | gets run by the shell.) |
| 413 | |
| 414 | Let's try again: |
| 415 | |
| 416 | C:\...> fossil setting crlf-glob '*' |
| 417 | |
| 418 | Quoting the argument like that will work reliably on POSIX, but it may |
| 419 | or may not work on Windows. If your Windows command shell interprets the |
| 420 | quotes, it means `fossil.exe` will see only the bare `*` so the C |
| 421 | runtime library it is linked to will likely expand the list of files in |
| 422 | the current directory before the `setting` command gets a chance to |
| 423 | parse the command line arguments, causing the same failure as above. |
| 424 | This alternative only works if you’re using a Windows command shell that |
| 425 | passes the quotes through to the executable *and* you have linked Fossil |
| 426 | to a C runtime library that interprets the quotes properly itself, |
| 427 | resulting in a bare `*` getting clear down to Fossil’s `setting` command |
| 428 | parser. |
| 429 | |
| 430 | An approach that *will* work reliably is: |
| 431 | |
| 432 | C:\...> echo * | fossil setting crlf-glob --args - |
| 433 | |
| 434 | This works because the built-in Windows command `echo` does not expand its |
| 435 | arguments, and the `--args -` option makes Fossil read further command |
| 436 | arguments from its standard input, which is connected to the output |
| 437 | of `echo` by the pipe. (`-` is a common Unix convention meaning |
| 438 | "standard input," which Fossil obeys.) A [batch script][fng.cmd] to automate this trick was |
| 439 | posted on the now-inactive Fossil Mailing List. |
| 440 | |
| 441 | [fng.cmd]: https://www.mail-archive.com/[email protected]/msg25099.html |
| 442 | |
| 443 | (Ironically, this method will *not* work on POSIX systems because it is |
| 444 | not up to the command to expand globs. The shell will expand the `*` in |
| 445 | the `echo` command, so the list of file names will be passed to the |
| 446 | `fossil` standard input, just as with the first example above!) |
| 447 | |
| 448 | Another (usually) correct approach which will work on both Windows and |
| 449 | POSIX systems: |
| 450 | |
| 451 | C:\...> fossil setting crlf-glob *, |
| 452 | |
| 453 | This works because the trailing comma prevents the glob pattern from |
| 454 | matching any files, unless you happen to have files named with a |
| 455 | trailing comma in the current directory. If the pattern matches no |
| 456 | files, it is passed into Fossil's `main()` function as-is by the C |
| 457 | runtime system. Since Fossil uses commas to separate multiple glob |
| 458 | patterns, this means "all files from the root of the Fossil checkout |
| 459 | directory downward and nothing else," which is of course equivalent to |
| 460 | "all managed files in this repository," our original goal. |
| 461 | |
| 462 | |
| 463 | ## Experimenting |
| 464 | |
| 465 | To preview the effects of command line glob pattern expansion for |
| 466 | various glob patterns (unquoted, quoted, comma-terminated), for any |
| 467 | combination of command shell, OS, C run time, and Fossil version, |
| 468 | preceed the command you want to test with [`test-echo`][] like so: |
| 469 | |
| 470 | $ fossil test-echo setting crlf-glob "*" |
| 471 | C:\> echo * | fossil test-echo setting crlf-glob --args - |
| 472 | |
| 473 | The [`test-glob`][] command is also handy to test if a string |
| 474 | matches a glob pattern. |
| 475 | |
| 476 | [`test-echo`]: /help?cmd=test-echo |
| 477 | [`test-glob`]: /help?cmd=test-glob |
| 478 | |
| 479 | |
| 480 | ## Converting `.gitignore` to `ignore-glob` |
| 481 | |
| 482 | Many other version control systems handle the specific case of |
| 483 |