Commit ee233f2
backfill: handle unexpected arguments
git backfill takes no non-option arguments. However, if extra
arguments are passed with git backfill, parse_options() leaves
them in argc and the command ignores them silently, giving the
user no indication that something is wrong.
Add a check after parse_options() to report an error if any unexpected
arguments remain. To ensure the user understands why the command
failed, print an error message specifying the unknown argument
followed by the short usage string. This matches the behavior of
other Git commands such as git bugreport.
Also, add a test in t5620 to ensure the unexpected arguments are
rejected with the correct error message and that the full option
descriptions are not printed.
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 6e8d538 commit ee233f2
2 files changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
139 | 144 | | |
140 | 145 | | |
141 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
179 | 185 | | |
180 | 186 | | |
181 | 187 | | |
| |||
0 commit comments