git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tobias Klauser <tklauser@distanz.ch>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] pretend_sha1_file(): Change return type from int to void
Date: Wed, 7 Oct 2015 10:13:48 +0200	[thread overview]
Message-ID: <20151007081344.GC11304@distanz.ch> (raw)
In-Reply-To: <ef5b20ed42ea20b2891fc3998a81f339@dscho.org>

Hi Johannes

On 2015-10-06 at 16:30:36 +0200, Johannes Schindelin <johannes.schindelin@gmx.de> wrote:
> On 2015-10-06 15:51, Tobias Klauser wrote:
> 
> > On 2015-10-06 at 15:16:12 +0200, Johannes Schindelin
> > <johannes.schindelin@gmx.de> wrote:
> >>
> >> On 2015-10-06 14:15, Tobias Klauser wrote:
> >> > prented_sha1_file() always returns 0 and its only callsite in
> >> > builtin/blame.c doesn't use the return value, so change the return type
> >> > to void.
> >>
> >> While this commit message is technically correct, it would appear that there are some things left unsaid.
> >>
> >> Is there a problem with the current code that is solved by not returning 0? If so, could you add it to the commit message? And in particular, change the oneline appropriately?
> > 
> > There's no problem with the current code other than that the return
> > value is unused and thus unnecessary for correct funcionality. So it's
> > certainly not a functional problem but rather a cosmetic change.
> 
> Okay.
> 
> > Does such a change even make sense (it's one of my first patch to git,
> > so I'm not really sure what your criteria in this respect are)?
> 
> Welcome!
> 
> As to the patch, I cannot speak for Junio, of course, but my preference would be to keep the return type. Traditionally, functions that can fail either die() or return an int; non-zero indicates an error. In this case, it seems that we do not have any condition (yet...) under which an error could occur. It does not seem very unlikely that we may eventually have such conditions, though, hence my preference.

Ok, I see. Thank you for your explanation. I'll wait for Junio's decision
then :)

Cheers
Tobias

  reply	other threads:[~2015-10-07  8:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06 12:15 [PATCH] pretend_sha1_file(): Change return type from int to void Tobias Klauser
2015-10-06 13:16 ` Johannes Schindelin
2015-10-06 13:51   ` Tobias Klauser
2015-10-06 14:30     ` Johannes Schindelin
2015-10-07  8:13       ` Tobias Klauser [this message]
2015-10-07 17:36       ` Junio C Hamano
2015-10-07 20:42         ` Stefan Beller
2015-10-07 21:14           ` Junio C Hamano
2015-10-07 21:24             ` Stefan Beller
2015-10-07 21:29               ` Junio C Hamano
2015-10-07 21:22       ` Junio C Hamano
2015-10-08  7:45         ` Tobias Klauser

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=20151007081344.GC11304@distanz.ch \
    --to=tklauser@distanz.ch \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /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).