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

Re: [PATCHv4] transport: Catch non positive --depth option value

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Nov 26, 2013, 19:09 UTC
Message-ID
<20131126190902.GB4212@google.com>
In-Reply-To
<529488D5.80605@gmail.com>
Hi,

Thanks for tackling this. This review will be kind of nitpicky, as a way to save time when reviewing future patches.

Andrés G. Aragoneses wrote:
> From 4f3b24379090b7b69046903fba494f3191577b20 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Andr=C3=A9s=20G=2E=20Aragoneses?= <knocte@gmail.com>
> Date: Tue, 26 Nov 2013 12:38:19 +0100
> Subject: [PATCH] transport: Catch non positive --depth option value

These lines are redundant next to the mail header, so they can and should be omitted to avoid some noise.

> Instead of simply ignoring the value passed to --depth
> option when it is zero or negative, now it is caught
> and reported.
Nit: commit messages usually give a command to the codebase, like
this:
	When the value passed to --depth is zero or negative, instead of
	treating it as infinite depth, catch and report the mistake.
> This will let people know that they were using the
> option incorrectly (as depth<0 should be simply invalid,
> and under the hood depth==0 didn't have any effect).
Ok.  Do we know that no one was using --depth=0 this way deliberately?
> (The change in fetch.c is needed to avoid the tests
> failing because of this new restriction.)

Based on the surrounding thread I see that you're talking about the test script t5500 here. Which test failed? How does it use "git fetch"? Does the change just fix the test but keep in broken in production, or does it fix "git fetch" in production, too?

Show 6 quoted lines
> Signed-off-by: Andres G. Aragoneses <knocte@gmail.com>
> Reviewed-by: Duy Nguyen <pclouds@gmail.com>
> ---
>  builtin/fetch.c | 2 +-
>  transport.c     | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)

It would be nice to have a brief test to demonstrate the fix and make sure we don't break it in the future. "grep fetch.*--depth t/*.sh" tells me t5500 would be a good place to put it. For example, something like

	test_expect_success 'fetch catches invalid --depth values' '
		(
			cd shallow &&
			test_must_fail git fetch --depth=0 &&
			test_must_fail git fetch --depth=-2 &&
			test_must_fail git fetch --depth= &&
			test_must_fail git fetch --depth=nonsense
		)
	'

What do you think? Jonathan

Previous: Andrés G. AragonesesNext: Junio C Hamano
Message 15 of 16 in “transport: Catch non positive --depth option value”
  1. transport: Catch non positive --depth option valueAndrés G. Aragoneses, Nov 13, 2013
  2. Duy NguyenNov 16, 2013
  3. Junio C HamanoNov 18, 2013
  4. [PATCHv2] transport: Catch non positive --depth option valueAndrés G. Aragoneses, Nov 18, 2013
  5. Junio C HamanoNov 19, 2013
  6. [PATCHv3] transport: Catch non positive --depth option valueAndrés G. Aragoneses, Nov 21, 2013
  7. Junio C HamanoNov 21, 2013
  8. Junio C HamanoNov 21, 2013
  9. Duy NguyenNov 22, 2013
  10. Andrés G. AragonesesNov 25, 2013
  11. Duy NguyenNov 26, 2013
  12. Andrés G. AragonesesNov 26, 2013
  13. Duy NguyenNov 26, 2013
  14. [PATCHv4] transport: Catch non positive --depth option valueAndrés G. Aragoneses, Nov 26, 2013
  15. Jonathan NiederNov 26, 2013
  16. Junio C HamanoNov 26, 2013

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.