From: Derrick Stolee Date: Fri, 28 Jan 2022 19:40:40 GMT Subject: Re: [PATCH v2] scalar: accept -C and -c options before the subcommand Message-ID: In-Reply-To: On 1/28/2022 9:31 AM, Johannes Schindelin via GitGitGadget wrote: > From: Johannes Schindelin > > The `git` executable has these two very useful options: > > -C : > switch to the specified directory before performing any actions > > -c =: > 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