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

Re: [PATCH v2] clone: error specifically with --local and symlinked objects

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 10, 2023, 22:27 UTC
Message-ID
<xmqqttxncr0k.fsf@gitster.g>
In-Reply-To
<pull.1488.v2.git.git.1681165130765.gitgitgadget@gmail.com>
"Glen Choo via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 9 quoted lines
>      ++		if (errno == ENOTDIR) {
>      ++			int saved_errno = errno;
>      ++			struct stat st;
>      ++			if (lstat(src->buf, &st) == 0 && S_ISLNK(st.st_mode))
>      ++				die(_("'%s' is a symlink, refusing to clone with --local"),
>      ++				    src->buf);
>      ++			errno = saved_errno;
>      ++		}
>        		die_errno(_("failed to start iterator over '%s'"), src->buf);

I doubt you need saved_errno in the code immediately after this patch gets applied, as what you are saving is guaranteed to be ENOTDIR so you can just restore it before you fall through out of the block.

It however would not hurt, though. Especially if the condition that guarding this block is likely to change in the future, we can view the apparent waste as paying insurance premium to protect from future breakages.

Will queue.  Thanks.
Previous: Glen Choo via GitGitGadgetNext: Taylor Blau
Message 9 of 14 in “clone: error specifically with --local and symlinked objects”
  1. clone: error specifically with --local and symlinked objectsGlen Choo via GitGitGadget, Apr 4, 2023
  2. Junio C HamanoApr 5, 2023
  3. Glen ChooApr 5, 2023
  4. Junio C HamanoApr 5, 2023
  5. Taylor BlauApr 6, 2023
  6. Glen ChooApr 6, 2023
  7. Taylor BlauApr 6, 2023
  8. clone: error specifically with --local and symlinked objectsGlen Choo via GitGitGadget, Apr 10, 2023
  9. Junio C HamanoApr 10, 2023
  10. Taylor BlauApr 10, 2023
  11. Taylor BlauApr 11, 2023
  12. clone: error specifically with --local and symlinked objectsGlen Choo via GitGitGadget, Apr 11, 2023
  13. Junio C HamanoApr 11, 2023
  14. Glen ChooApr 11, 2023

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.