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

Re: [PATCHv5 5/8] clone: factor out checking for an alternate path

From
Jacob Keller <jacob.keller@gmail.com>
Date
Aug 23, 2016, 22:29 UTC
Message-ID
<CA+P7+xrd4eagXSFQen+TZop7u+h2eyLgQ_0vjT03Bjov-KNL7w@mail.gmail.com>
In-Reply-To
<20160815215327.15682-6-sbeller@google.com>
On Mon, Aug 15, 2016 at 2:53 PM, Stefan Beller <sbeller@google.com> wrote:
Show 5 quoted lines
> +       if (!repo && is_directory(mkpath("%s/.git/objects", ref_git))) {
> +               char *ref_git_git = mkpathdup("%s/.git", ref_git);
> +               free(ref_git);
> +               ref_git = ref_git_git;
> +       } else if (!is_directory(mkpath("%s/objects", ref_git))) {

I realize this was directly copied but the use of !repo to determine what file path here was definitely not easy to process, because it made me think we were adding .git twice to the path. Not sure if there is an easier way to expand this and avoid that confusion?

Also, what happens if repo is false, so we run the first block above, but is_directory fails? We just continue along even though it appears like we should fail? I'm not 100% sure I follow the logic here. Regardless this appears to be a pretty direct copy of what was there before so I don't think it's worse.

Thanks, Jake

Previous: Stefan BellerNext: Stefan Beller
Message 9 of 24 in “[PATCHv5 0/8] git clone: Marry --recursive and --reference”
  1. Stefan BellerAug 15, 2016
  2. 1/8 t7408: modernize styleStefan Beller, Aug 15, 2016
  3. Jacob KellerAug 23, 2016
  4. 2/8 t7408: merge short tests, factor out testing methodStefan Beller, Aug 15, 2016
  5. Jacob KellerAug 23, 2016
  6. 4/8 submodule--helper update-clone: allow multiple referencesStefan Beller, Aug 15, 2016
  7. Jacob KellerAug 23, 2016
  8. 5/8 clone: factor out checking for an alternate pathStefan Beller, Aug 15, 2016
  9. Jacob KellerAug 23, 2016
  10. 6/8 clone: clarify option_reference as requiredStefan Beller, Aug 15, 2016
  11. Jacob KellerAug 23, 2016
  12. 3/8 submodule--helper module-clone: allow multiple referencesStefan Beller, Aug 15, 2016
  13. Jacob KellerAug 23, 2016
  14. 7/8 clone: implement optional referencesStefan Beller, Aug 15, 2016
  15. Jacob KellerAug 23, 2016
  16. 8/8 clone: recursive and reference option triggers submodule alternatesStefan Beller, Aug 15, 2016
  17. Jacob KellerAug 23, 2016
  18. Stefan BellerAug 23, 2016
  19. Jacob KellerAug 24, 2016
  20. Stefan BellerAug 24, 2016
  21. Jacob KellerAug 24, 2016
  22. Stefan BellerAug 31, 2016
  23. Jacob KellerAug 31, 2016
  24. Junio C HamanoAug 15, 2016

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.