Commit 95919e8
committed
fast-import: use parse_options() for command line options
Previous commits have started to use the parse-options API to display
output from `git fast-import -h` and `git fast-import --help-all` and
to prepare for parsing the command line options using this API.
Let's now actually use the API to parse command line options.
This brings a number of changes that are mostly beneficial:
- The `--alias`, `--get-mark`, `--cat-blob`, `--ls` and `--notes`
options are no longer accepted on the command line. They were
previously accepted as no-ops because parse_argv() fell through to
parse_one_feature(). They are not documented in the OPTIONS section
and are only meaningful as in-stream feature assertions, so
accepting them on the command line was an accident of code sharing
dating back to 9c8398f (fast-import: add option command,
2009-12-04).
- Abbreviated options like `--dep=5` now work since parse_options()
allows unambiguous prefixes.
- As `--cat-blob` is an abbreviation of `--cat-blob-fd`, using the
former on the command line will fail with "option `cat-blob-fd'
requires a value" unlike the other four options that are not
accepted anymore on the command line (see above).
- Value-taking options now also accept the space-separated
`--opt value` form, like `--depth 5`, in addition to the
`--opt=value` form.
- A bare or trailing `--` is now accepted and the stream is read
normally, while it used to be a usage error.
- The error messages for some options might differ a bit.
- The code is shorter and more standard.
Note that parse_one_feature() is now always called with its
`from_stream` argument set to 1, but the code simplifications that
can be made are left for a following clean-up commit.
Signed-off-by: Christian Couder <christian.couder@gmail.com>1 parent d109b8c commit 95919e8
3 files changed
Lines changed: 28 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3975 | 3975 | | |
3976 | 3976 | | |
3977 | 3977 | | |
3978 | | - | |
3979 | | - | |
3980 | | - | |
3981 | | - | |
3982 | | - | |
3983 | | - | |
3984 | | - | |
3985 | | - | |
3986 | | - | |
3987 | | - | |
3988 | | - | |
3989 | | - | |
3990 | | - | |
3991 | | - | |
3992 | | - | |
3993 | | - | |
3994 | | - | |
3995 | | - | |
3996 | | - | |
3997 | | - | |
3998 | | - | |
| 3978 | + | |
| 3979 | + | |
| 3980 | + | |
3999 | 3981 | | |
4000 | | - | |
4001 | | - | |
4002 | | - | |
| 3982 | + | |
4003 | 3983 | | |
4004 | 3984 | | |
4005 | 3985 | | |
| |||
4135 | 4115 | | |
4136 | 4116 | | |
4137 | 4117 | | |
4138 | | - | |
4139 | | - | |
4140 | | - | |
4141 | | - | |
4142 | | - | |
4143 | 4118 | | |
4144 | 4119 | | |
4145 | 4120 | | |
| |||
4230 | 4205 | | |
4231 | 4206 | | |
4232 | 4207 | | |
| 4208 | + | |
| 4209 | + | |
| 4210 | + | |
| 4211 | + | |
| 4212 | + | |
| 4213 | + | |
| 4214 | + | |
| 4215 | + | |
| 4216 | + | |
| 4217 | + | |
4233 | 4218 | | |
4234 | 4219 | | |
4235 | 4220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2827 | 2827 | | |
2828 | 2828 | | |
2829 | 2829 | | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
2830 | 2837 | | |
2831 | 2838 | | |
2832 | 2839 | | |
| |||
0 commit comments