git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: Johannes Schindelin via GitGitGadget
Message 14 of 14 in “scalar: accept -C and -c options before the subcommand”
  1. scalar: accept -C and -c options before the subcommandJohannes Schindelin via GitGitGadget, Jan 26, 2022
  2. Taylor BlauJan 26, 2022
  3. Johannes SchindelinJan 28, 2022
  4. Ævar Arnfjörð BjarmasonJan 27, 2022
  5. Derrick StoleeJan 27, 2022
  6. Johannes SchindelinJan 28, 2022
  7. Ævar Arnfjörð BjarmasonJan 28, 2022
  8. Derrick StoleeJan 28, 2022
  9. Ævar Arnfjörð BjarmasonJan 29, 2022
  10. Derrick StoleeJan 28, 2022
  11. Junio C HamanoJan 28, 2022
  12. Derrick StoleeJan 28, 2022
  13. scalar: accept -C and -c options before the subcommandJohannes Schindelin via GitGitGadget, Jan 28, 2022
  14. Derrick StoleeJan 28, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.