git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Glen Choo via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Taylor Blau <me@ttaylorr.com>,
	Glen Choo <chooglen@google.com>
Subject: Re: [PATCH v2] clone: error specifically with --local and symlinked objects
Date: Mon, 10 Apr 2023 15:27:07 -0700	[thread overview]
Message-ID: <xmqqttxncr0k.fsf@gitster.g> (raw)
In-Reply-To: <pull.1488.v2.git.git.1681165130765.gitgitgadget@gmail.com> (Glen Choo via GitGitGadget's message of "Mon, 10 Apr 2023 22:18:50 +0000")

"Glen Choo via GitGitGadget" <gitgitgadget@gmail.com> writes:

>      ++		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.


  reply	other threads:[~2023-04-10 22:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04 23:48 [PATCH] clone: error specifically with --local and symlinked objects Glen Choo via GitGitGadget
2023-04-05  0:13 ` Junio C Hamano
2023-04-05 16:48   ` Glen Choo
2023-04-05 19:20     ` Junio C Hamano
2023-04-06 21:35     ` Taylor Blau
2023-04-06 21:55       ` Glen Choo
2023-04-06 21:27   ` Taylor Blau
2023-04-10 22:18 ` [PATCH v2] " Glen Choo via GitGitGadget
2023-04-10 22:27   ` Junio C Hamano [this message]
2023-04-10 23:16   ` Taylor Blau
2023-04-11  1:58   ` Taylor Blau
2023-04-11 17:08   ` [PATCH v3] " Glen Choo via GitGitGadget
2023-04-11 17:13     ` Junio C Hamano
2023-04-11 18:38       ` Glen Choo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqttxncr0k.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=chooglen@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=me@ttaylorr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).