Web lists-archives.com

Re: [PATCH] status: show progress bar if refreshing the index takes too long




On Fri, Sep 7, 2018 at 11:51 AM Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> Refreshing the index is usually very fast, but it can still take a
> long time sometimes. Cold cache is one, or something else silly (*).
> In this case, it's good to show something to let the user know "git
> status" is not hanging, it's just busy doing something.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
> diff --git a/read-cache.c b/read-cache.c
> @@ -1516,6 +1522,8 @@ int refresh_index(struct index_state *istate, unsigned int flags,
> +               if (progress)
> +                       display_progress(progress, i);
> @@ -1547,6 +1555,8 @@ int refresh_index(struct index_state *istate, unsigned int flags,
> +       if (progress)
> +               stop_progress(&progress);

Nit: Both display_progress() and stop_progress() behave sanely when
'progress' is NULL, so no need for the conditional.