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

Re: [PATCH v2] tag: support configuring --sort via .gitconfig

From
Jeff King <peff@peff.net>
Date
Jul 10, 2014, 04:00 UTC
Message-ID
<20140710040019.GC28401@sigill.intra.peff.net>
In-Reply-To
<1404945412-10197-1-git-send-email-jacob.e.keller@intel.com>
On Wed, Jul 09, 2014 at 03:36:51PM -0700, Jacob Keller wrote:
> Add support for configuring default sort ordering for git tags. Command
> line option will override this configured value, using the exact same
> syntax.
Thanks, this version looks pretty good to me. A few minor comments:
> +	if (!strcmp(var, "tag.sort")) {
> +		tag_sort = parse_sort_string(value);
> +	}

Our style is to usually avoid braces for a one-liner. However, I think would actually make sense to "return 0" from this conditional.

> +test_expect_success 'configured lexical sort' '
> +	git config tag.sort "v:refname" &&
> +	git tag -l "foo*" >actual &&
> [...]
Please use:
  test_config tag.sort "v:refname"

here, which will clean up the config value after the test ends (and thus not pollute any later tests).

Though you will need to add an extra "test_config" to the following test:

> +test_expect_success 'option override configured sort' '
> +	git tag -l --sort=-refname "foo*" >actual &&
> [...]

I think that's a good thing, though (it makes it more clear in the second test what is being tested, rather than relying on the state left by the previous test).

-Peff
Previous: Jacob KellerNext: Jeff King
Message 2 of 8 in “tag: support configuring --sort via .gitconfig”
  1. tag: support configuring --sort via .gitconfigJacob Keller, Jul 9, 2014
  2. Jeff KingJul 10, 2014
  3. Jeff KingJul 10, 2014
  4. Junio C HamanoJul 10, 2014
  5. Jeff KingJul 10, 2014
  6. Keller, Jacob EJul 10, 2014
  7. Junio C HamanoJul 10, 2014
  8. Keller, Jacob EJul 10, 2014

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.