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

Re: [PATCH/GSoC/RFC] fetch: git fetch --deepen

From
Duy Nguyen <pclouds@gmail.com>
Date
Mar 14, 2015, 10:56 UTC
Message-ID
<CACsJy8AAsAO6gjWg0nsdiOXFEsZ4583pH9mkUx1Js3Yop5KHHQ@mail.gmail.com>
In-Reply-To
<1426251846-1604-1-git-send-email-dongcan.jiang@gmail.com>
On Fri, Mar 13, 2015 at 8:04 PM, Dongcan Jiang <dongcan.jiang@gmail.com> wrote:
Show 8 quoted lines
> @@ -317,7 +318,7 @@ static int find_common(struct fetch_pack_args *args,
>         if (is_repository_shallow())
>                 write_shallow_commits(&req_buf, 1, NULL);
>         if (args->depth > 0)
> -               packet_buf_write(&req_buf, "deepen %d", args->depth);
> +               packet_buf_write(&req_buf, "depth %d", args->depth);
>         packet_buf_flush(&req_buf);
>         state_len = req_buf.len;

Junio already questioned about your replacing starts_with("deepen "..) with starts_with("depth "..), this is part of that question. If you run "make test" you should find some breakages, or we need to improve our test suite.

I think you just need to keep the old "if (args->depth > 0) send "depth" unchanged and add two new statements that check args->depth_deepen and sends "depth ". BTW, I think "deepen-more" or "deepen-relative" would be better than "depth" (*), which is a noun. But that's a minor point at this stage.

And because --depth and --deepen are mutually exclusive, you need to make sure that the user must not specify that. The "user" includes the "client" from the server perspective, we need to make sure that upload-pack barf if some client sends both "deepen" and "depth".

(*) I was about to suggest you use "deepen" for both --depth and --deepen: --depth sends "deepen NUM" while --deepen sends "deepen +NUM". The protocol as described in pack-protocol.txt may allow this extension. Unfortunately the current implementation is too relaxed. We use strtol() to parse "NUM" and it would accept the leading "+" instead of barfing out. So old clients would mistakes --deepen as --depth, not good. And it even accepts base 8 and 16!! We should fix this.

-- 
Duy
Previous: Dongcan JiangNext: Dongcan Jiang
Message 8 of 14 in “fetch: git fetch --deepen”
  1. fetch: git fetch --deepenDongcan Jiang, Mar 13, 2015
  2. Eric SunshineMar 13, 2015
  3. Dongcan JiangMar 16, 2015
  4. Junio C HamanoMar 14, 2015
  5. Duy NguyenMar 14, 2015
  6. Junio C HamanoMar 14, 2015
  7. Dongcan JiangMar 16, 2015
  8. Duy NguyenMar 14, 2015
  9. Dongcan JiangMar 16, 2015
  10. Duy NguyenMar 17, 2015
  11. Dongcan JiangMar 17, 2015
  12. fetch: git fetch --deepenDongcan Jiang, Mar 22, 2015
  13. Eric SunshineMar 22, 2015
  14. Duy NguyenMar 22, 2015

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.