git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] status: display the SHA1 of the commit being currently processed

From
Thomas Adam <thomas@xteddy.org>
Date
Jun 17, 2013, 12:44 UTC
Message-ID
<CA+39Oz7niTiaNfhaL3pi6=sDGpkpJ++1W6eKb1zdHxAm6r_hSw@mail.gmail.com>
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:

Show 21 quoted lines
> 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
Previous: Mathieu Lienard--MayorNext: Peter Krefting
Message 2 of 16 in “status: display the SHA1 of the commit being currently processed”
  1. status: display the SHA1 of the commit being currently processedMathieu Lienard--Mayor, Jun 17, 2013
  2. Thomas AdamJun 17, 2013
  3. Peter KreftingJun 17, 2013
  4. Mathieu Liénard--MayorJun 17, 2013
  5. Peter KreftingJun 17, 2013
  6. Mathieu Liénard--MayorJun 17, 2013
  7. Johannes SixtJun 17, 2013
  8. Junio C HamanoJun 17, 2013
  9. Peter KreftingJun 20, 2013
  10. Johannes SixtJun 20, 2013
  11. Junio C HamanoJun 20, 2013
  12. Johannes SixtJun 21, 2013
  13. Junio C HamanoJun 21, 2013
  14. Junio C HamanoJun 17, 2013
  15. Mathieu Liénard--MayorJun 18, 2013
  16. Junio C HamanoJun 18, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.