From: Jeff King <peff@peff.net>
To: Daniel Barkalow <barkalow@iabervon.org>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Alex Riesen <raa.lkml@gmail.com>,
Pierre Habouzit <madcoder@debian.org>
Subject: Re: [PATCH 1/3] send-pack: track errors for each ref
Date: Sat, 17 Nov 2007 19:13:14 -0500 [thread overview]
Message-ID: <20071118001312.GB4000@sigill.intra.peff.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0711171217200.12193@iabervon.org>
On Sat, Nov 17, 2007 at 01:05:35PM -0500, Daniel Barkalow wrote:
> > +static void print_ref_status(char flag, const char *summary, struct ref *to, struct ref *from, const char *msg)
>
> Isn't "from" always "to->peer_ref"? It'd be nice to make this function
> unable to print something different from what we actually did. (Actually
> it might be "to->deletion ? NULL : to->peer_ref", but that would also be
> better to have as an explicit feature of how you display "to", rather than
> implicit in the set of callers.
Yes, I also considered changing "from" to "show peer" which might have
been nicer. I am not opposed to such a cleanup, but again, not sure if
it worth it now that we are merged.
> > +static const char *status_abbrev(unsigned char sha1[20])
> > +{
> > + const char *abbrev;
> > + abbrev = find_unique_abbrev(sha1, DEFAULT_ABBREV);
> > + return abbrev ? abbrev : sha1_to_hex(sha1);
> > +}
>
> Maybe we should have a find_unique_abbrev()-like function that doesn't
> mind if the requested object doesn't exist?
I agree, though I don't feel qualified to comment on what other places
that should be used (I was a bit surprised to find out that
find_unique_abbrev ever returned NULL, but changing the semantics at
this point is probably going to cause some subtle bug).
> > + char quickref[83];
> Shouldn't this be 40 + 3 + 40 + 1?
Oops, yes. I think it should be hard to trigger (both commits would have
to either not be in your db, or not be unique to 40 digits). But clearly
it should be fixed, and it looks like Junio did.
It was a stupid cut-and-paste from Nicolas' fetch code, but it looks
like he correctly allocates 84 bytes for the "..." case.
> > + char type;
> > + const char *msg;
> > +
> > + strcpy(quickref, status_abbrev(ref->old_sha1));
> > + if (ref->nonfastforward) {
> > + strcat(quickref, "...");
> > + type = '+';
> > + msg = " (forced update)";
> > + }
> > + else {
>
> Coding style, IIRC.
Sorry, I don't see the style nit you're mentioning here.
-Peff
next prev parent reply other threads:[~2007-11-18 0:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-17 12:53 [PATCH v3 0/3] tracking per-ref errors on push Jeff King
2007-11-17 12:54 ` [PATCH 1/3] send-pack: track errors for each ref Jeff King
2007-11-17 13:34 ` Alex Riesen
2007-11-17 18:05 ` Daniel Barkalow
2007-11-18 0:13 ` Jeff King [this message]
2007-11-18 1:21 ` Junio C Hamano
2007-11-18 3:12 ` Jeff King
2007-11-17 20:53 ` Junio C Hamano
2007-11-18 0:15 ` Jeff King
2007-11-17 12:55 ` [PATCH 2/3] send-pack: check ref->status before updating tracking refs Jeff King
2007-11-17 13:45 ` Alex Riesen
2007-11-17 13:53 ` Jeff King
2007-11-17 18:05 ` Daniel Barkalow
2007-11-17 12:56 ` [PATCH 3/3] send-pack: assign remote errors to each ref Jeff King
2007-11-17 18:05 ` Daniel Barkalow
2007-11-18 0:03 ` Jeff King
2007-11-18 1:03 ` Junio C Hamano
2007-11-18 2:39 ` Jeff King
2007-11-18 4:47 ` Junio C Hamano
2007-11-18 5:00 ` Jeff King
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=20071118001312.GB4000@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=madcoder@debian.org \
--cc=raa.lkml@gmail.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).