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

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

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Aug 1, 2017, 18:23 UTC
Message-ID
<CAPig+cRs0V8O7F1N9yQd6vC8nBabfiOEyOSoP61J5o+gB+KXig@mail.gmail.com>
In-Reply-To
<20160625075433.4608-8-pclouds@gmail.com>
On Sat, Jun 25, 2016 at 3:54 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 19 quoted lines
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> 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?
Show 8 quoted lines
> +               } else
> +                       ret = error_errno(_("failed to update '%s'"),
> +                                         git_common_path("worktrees/%s/gitdir",
> +                                                         wt->id));
> +       }
> +       strbuf_release(&path);
> +       return ret;
> +}
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 14 of 16 in “git worktree (re)move”
  1. 00/10 git worktree (re)moveNguyễn Thái Ngọc Duy, Jun 25, 2016
  2. 04/10 copy.c: style fixNguyễn Thái Ngọc Duy, Jun 25, 2016
  3. 02/10 copy.c: delete unused code in copy_file()Nguyễn Thái Ngọc Duy, Jun 25, 2016
  4. 09/10 worktree move: accept destination as directoryNguyễn Thái Ngọc Duy, Jun 25, 2016
  5. 05/10 copy.c: convert copy_file() to copy_dir_recursively()Nguyễn Thái Ngọc Duy, Jun 25, 2016
  6. Eric SunshineAug 1, 2017
  7. 01/10 copy.c: import copy_file() from busyboxNguyễn Thái Ngọc Duy, Jun 25, 2016
  8. 10/10 worktree: add "remove" commandNguyễn Thái Ngọc Duy, Jun 25, 2016
  9. Eric SunshineAug 1, 2017
  10. 06/10 worktree.c: add validate_worktree()Nguyễn Thái Ngọc Duy, Jun 25, 2016
  11. 08/10 worktree: add "move" commmandNguyễn Thái Ngọc Duy, Jun 25, 2016
  12. Eric SunshineAug 1, 2017
  13. 07/10 worktree.c: add update_worktree_location()Nguyễn Thái Ngọc Duy, Jun 25, 2016
  14. Eric SunshineAug 1, 2017
  15. 03/10 copy.c: convert bb_(p)error_msg to error(_errno)Nguyễn Thái Ngọc Duy, Jun 25, 2016
  16. Duy NguyenJul 23, 2016

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.