git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Thomas Adam <thomas@xteddy.org>
To: Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr>
Cc: git list <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Jorge Juan Garcia Garcia 
	<Jorge-Juan.Garcia-Garcia@ensimag.imag.fr>,
	Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Subject: Re: [PATCH] status: display the SHA1 of the commit being currently processed
Date: Mon, 17 Jun 2013 13:44:25 +0100	[thread overview]
Message-ID: <CA+39Oz7niTiaNfhaL3pi6=sDGpkpJ++1W6eKb1zdHxAm6r_hSw@mail.gmail.com> (raw)
In-Reply-To: <1371471004-9069-1-git-send-email-Mathieu.Lienard--Mayor@ensimag.imag.fr>

Hi,

[I rarely do reviews on this list, so feel free to ignore this.]

On 17 June 2013 13:10, Mathieu Lienard--Mayor
<Mathieu.Lienard--Mayor@ensimag.imag.fr> wrote:
> diff --git a/wt-status.c b/wt-status.c
> index bf84a86..5f5cddf 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -885,8 +885,19 @@ static void show_rebase_in_progress(struct wt_status *s,
>                                 struct wt_status_state *state,
>                                 const char *color)
>  {
> +       char *stopped_sha = read_line_from_git_path("rebase-merge/stopped-sha");
> +       int must_free_stopped_sha = 1;
>         struct stat st;
>
> +       /*
> +        * If the file stopped-sha does not exist
> +        * we go back to the old output saying "a commit"
> +        * instead of providing the commit's SHA1.
> +        */
> +       if (!stopped_sha) {
> +               stopped_sha = "a commit";
> +               must_free_stopped_sha = 0;
> +       }

Rather than having to assign a toggle of deciding when to free
stopped_sha, how much overhead would be introduced by just doing:

    if (!stopped_sha)
        stopped_sha = strdup("a commit");

And then at the end just do:

free (stopped_sha);

Just a thought.

-- Thomas Adam

  reply	other threads:[~2013-06-17 12:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-17 12:10 [PATCH] status: display the SHA1 of the commit being currently processed Mathieu Lienard--Mayor
2013-06-17 12:44 ` Thomas Adam [this message]
2013-06-17 13:10 ` Peter Krefting
2013-06-17 13:33   ` Mathieu Liénard--Mayor
2013-06-17 13:54     ` Peter Krefting
2013-06-17 13:57       ` Mathieu Liénard--Mayor
2013-06-17 15:10         ` Johannes Sixt
2013-06-17 16:33           ` Junio C Hamano
2013-06-20  7:56             ` Peter Krefting
2013-06-20  8:10               ` Johannes Sixt
2013-06-20 18:11                 ` Junio C Hamano
2013-06-21  5:34                   ` Johannes Sixt
2013-06-21 14:23                     ` Junio C Hamano
2013-06-17 18:37 ` Junio C Hamano
2013-06-18 10:12   ` Mathieu Liénard--Mayor
2013-06-18 16:32     ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CA+39Oz7niTiaNfhaL3pi6=sDGpkpJ++1W6eKb1zdHxAm6r_hSw@mail.gmail.com' \
    --to=thomas@xteddy.org \
    --cc=Jorge-Juan.Garcia-Garcia@ensimag.imag.fr \
    --cc=Mathieu.Lienard--Mayor@ensimag.imag.fr \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).