Re: [PATCH v2] scalar: accept -C and -c options before the subcommand
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Jan 28, 2022, 19:40 UTC
- Message-ID
- <aad60461-be96-5122-ec50-abe0955e61d8@gmail.com>
- In-Reply-To
- <pull.1130.v2.git.1643380317358.gitgitgadget@gmail.com>
On 1/28/2022 9:31 AM, Johannes Schindelin via GitGitGadget wrote:
Show 20 quoted lines
> From: Johannes Schindelin <johannes.schindelin@gmx.de> > > The `git` executable has these two very useful options: > > -C <directory>: > switch to the specified directory before performing any actions > > -c <key>=<value>: > temporarily configure this setting for the duration of the > specified scalar subcommand > > With this commit, we teach the `scalar` executable the same trick. > > Note: It might look like a good idea to try to reuse the > `handle_options()` function in `git.c` instead of replicating only the > `-c`/`-C` part. However, that function is not only not in `libgit.a`, it > is also intricately entangled with the rest of the code in `git.c` that > is necessary e.g. to handle `--paginate`. Besides, no other option > handled by that `handle_options()` function is relevant to Scalar, > therefore the cost of refactoring vastly would outweigh the benefit.
Based on discussions elsewhere in this thread, I have changed my mind and agree that this approach is the best one to take at the moment.
With this additional context and the new tests, I think this patch is ready to go.
Thanks, -Stolee