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

Re: [PATCH v3] rev-parse --namespace

From
Jeff King <peff@peff.net>
Date
Jan 19, 2010, 06:56 UTC
Message-ID
<20100119065609.GB3946@coredump.intra.peff.net>
In-Reply-To
<1263808296-30756-1-git-send-email-ilari.liusvaara@elisanet.fi>
On Mon, Jan 18, 2010 at 11:51:36AM +0200, Ilari Liusvaara wrote:
> Add --namespace=<namespace> option to rev-parse and everything that
> accepts its options. This option matches all refs in some subnamespace
> of refs hierarchy.
Thanks, I think the code in this version looks good, but:
Show 9 quoted lines
> --- /dev/null
> +++ b/t/t6018-rev-list-namespace.sh
> [...]
> +compare () {
> +	# Split arguments on whitespace.
> +	git $1 $2 | sort >expected &&
> +	git $1 $3 | sort >actual &&
> +	cmp expected actual
> +}
Please use test_cmp instead of regular cmp.

Also, do you really need to sort? The internal ref code keeps the ref lists sorted by name, and we merge-sort the packed and loose lists in do_for_each_ref. So your --namespace should always operate on the refs in sorted order, producing predictable results.

Show 16 quoted lines
> +test_expect_success 'setup' '
> +
> +	commit master &&
> +	git checkout -b subspace/one master
> +	commit one &&
> +	git checkout -b subspace/two master
> +	commit two &&
> +	git checkout -b subspace-x master
> +	commit subspace-x &&
> +	git checkout -b other/three master
> +	commit three &&
> +	git checkout -b someref master
> +	commit some &&
> +	git checkout master &&
> +	commit master2
> +'
You are still missing some '&&' here to detect setup failures.
-Peff
Previous: Ilari LiusvaaraNext: Ilari Liusvaara
Message 4 of 14 in “rev-parse --namespace”
  1. rev-parse --namespaceIlari Liusvaara, Jan 18, 2010
  2. Junio C HamanoJan 18, 2010
  3. rev-parse --namespaceIlari Liusvaara, Jan 18, 2010
  4. Jeff KingJan 19, 2010
  5. Fix errors in t6018Ilari Liusvaara, Jan 19, 2010
  6. Junio C HamanoJan 19, 2010
  7. Thomas RastJan 19, 2010
  8. Ilari LiusvaaraJan 19, 2010
  9. Junio C HamanoJan 19, 2010
  10. Ilari LiusvaaraJan 19, 2010
  11. Thomas RastJan 19, 2010
  12. Ilari LiusvaaraJan 19, 2010
  13. Junio C HamanoJan 19, 2010
  14. Johannes SixtJan 20, 2010

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.