Re: [PATCH 07/10] worktree.c: add update_worktree_location()

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

 



On Sat, Jun 25, 2016 at 3:54 AM, Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
> diff --git a/worktree.c b/worktree.c
> +int update_worktree_location(struct worktree *wt, const char *path_)
> +{
> +       struct strbuf path = STRBUF_INIT;
> +       int ret = 0;
> +
> +       if (is_main_worktree(wt))
> +               return 0;
> +
> +       strbuf_add_absolute_path(&path, path_);
> +       if (fspathcmp(wt->path, path.buf)) {
> +               if (!write_file_gently(git_common_path("worktrees/%s/gitdir",
> +                                                      wt->id),
> +                                      "%s/.git", real_path(path.buf))) {
> +                       free(wt->path);
> +                       wt->path = strbuf_detach(&path, NULL);
> +                       ret = 0;

Useless assignment?

> +               } else
> +                       ret = error_errno(_("failed to update '%s'"),
> +                                         git_common_path("worktrees/%s/gitdir",
> +                                                         wt->id));
> +       }
> +       strbuf_release(&path);
> +       return ret;
> +}




[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]

  Powered by Linux