From: "Shawn O. Pearce" <spearce@spearce.org>
To: Alex Riesen <raa.lkml@gmail.com>
Cc: "Jeff King" <peff@peff.net>, "Väinö Järvelä" <v@pp.inet.fi>,
git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH] Fixed crash in fetching remote tags when there is not tags.
Date: Fri, 12 Oct 2007 00:07:45 -0400 [thread overview]
Message-ID: <20071012040745.GC27899@spearce.org> (raw)
In-Reply-To: <20071010212735.GB16635@steel.home>
Alex Riesen <raa.lkml@gmail.com> wrote:
> Still, I'd suggest move the test into the caller, firstly because it
> is the only place that special. Also, I can't think of a proper reason
> to add a NULL ref to a reflist, and so the crashing tail_link_ref will
> help us find the callers which use tail_link_ref incorrectly
> (illogically too).
>
> As the result of patter expansion can be NULL (empty pattern, as it
> seems), lets just check for it. I parked the patch below locally.
>
> diff --git a/remote.c b/remote.c
> index 5e92378..58d63ed 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -884,7 +884,8 @@ int get_fetch_map(struct ref *remote_refs,
> rm->peer_ref->name);
> }
>
> - tail_link_ref(ref_map, tail);
> + if (ref_map)
> + tail_link_ref(ref_map, tail);
>
> return 0;
> }
I disagree with Alex's argument above, because the result of the
pattern expansion can be NULL due to a pattern that matched nothing
from the remote. This can easily happen if the user originally
configured "remote.$name.fetch = +refs/heads/subdir/*:..." and
then the remote deletes all branches from refs/heads/subdir at some
point in the future.
I think the above patch is the only thing to do here. Perhaps Alex
can write up a formal patch and send it to back to the list and CC
Lars Hjemli <hjemli@gmail.com> so he can put it into the patch queue.
--
Shawn.
next prev parent reply other threads:[~2007-10-12 4:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-09 8:51 [PATCH] Added a test for fetching remote tags when there is not tags Väinö Järvelä
2007-10-09 8:51 ` [PATCH] Fixed crash in " Väinö Järvelä
2007-10-09 10:52 ` Väinö Järvelä
2007-10-09 18:20 ` Alex Riesen
2007-10-10 5:10 ` Jeff King
2007-10-10 21:27 ` Alex Riesen
2007-10-10 21:33 ` Jeff King
2007-10-12 4:07 ` Shawn O. Pearce [this message]
2007-10-12 20:40 ` [PATCH] Fix a crash in ls-remote when refspec expands into nothing Alex Riesen
2007-10-14 21:26 ` Lars Hjemli
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=20071012040745.GC27899@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=raa.lkml@gmail.com \
--cc=v@pp.inet.fi \
/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).