On Sat, Jun 25, 2016 at 3:54 AM, Nguyễn Thái Ngọc Duy <[email protected]> wrote:
> Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]>
> ---
> 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;
> +}