Re: [PATCH 05/15] sequencer: lib'ify read_and_refresh_cache()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 23, 2016 at 12:07 PM, Johannes Schindelin
<johannes.schindelin@xxxxxx> wrote:
> To be truly useful, the sequencer should never die() but always return
> an error.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
> ---
> diff --git a/sequencer.c b/sequencer.c
> @@ -638,18 +638,21 @@ static int prepare_revs(struct replay_opts *opts)
> -static void read_and_refresh_cache(struct replay_opts *opts)
> +static int read_and_refresh_cache(struct replay_opts *opts)
>  {
>         static struct lock_file index_lock;
>         int index_fd = hold_locked_index(&index_lock, 0);
>         if (read_index_preload(&the_index, NULL) < 0)
> -               die(_("git %s: failed to read the index"), action_name(opts));
> +               return error(_("git %s: failed to read the index"),
> +                       action_name(opts));
>         refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
>         if (the_index.cache_changed && index_fd >= 0) {
>                 if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
> -                       die(_("git %s: failed to refresh the index"), action_name(opts));
> +                       return error(_("git %s: failed to refresh the index"),
> +                               action_name(opts));

Do these two error returns need to rollback the lockfile?

>         }
>         rollback_lock_file(&index_lock);
> +       return 0;
>  }
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]