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

Re: [PATCH v3 1/2] refs: add a new function set_worktree_head_symref

From
David Turner <dturner@twopensource.com>
Date
Mar 29, 2016, 02:23 UTC
Message-ID
<1459218192.2976.4.camel@twopensource.com>
In-Reply-To
<xmqq4mbqze65.fsf@gitster.mtv.corp.google.com>
On Mon, 2016-03-28 at 10:48 -0700, Junio C Hamano wrote:
Show 24 quoted lines
> Kazuki Yamaguchi <k@rhe.jp> writes:
> 
> > Add a new function set_worktree_head_symref, to update HEAD symref
> > for
> > the specified worktree.
> > 
> > To update HEAD of a linked working tree,
> > create_symref("worktrees/$work_tree/HEAD", "refs/heads/$branch",
> > msg)
> > could be used. However when it comes to updating HEAD of the main
> > working tree, it is unusable because it uses $GIT_DIR for
> > worktree-specific symrefs (HEAD).
> > 
> > The new function takes git_dir (real directory) as an argument, and
> > updates HEAD of the working tree. This function will be used when
> > renaming a branch.
> > 
> > Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
> > ---
> 
> I suspect that this helper function should be in the common layer
> (refs.c) to be redirected to specific backend(s).
> 
> David & Michael, what do you think?

HEAD is a per-worktree ref, so it's always handled by the files backend. So this looks fine to me.

Show 6 quoted lines
> > +/*
> > + * Update HEAD of the specified gitdir.
> > + * Similar to create_symref("relative-git-dir/HEAD", target,
> > NULL), but this is
> > + * able to update the main working tree's HEAD wherever $GIT_DIR
> > points to.

nit: "able to update the main working tree's HEAD regardless of where GIT_DIR points to" would be clearer.

Previous: Junio C HamanoNext: Eric Sunshine
Message 4 of 8 in “update all per-worktree HEADs when renaming a branch”
  1. 0/2 update all per-worktree HEADs when renaming a branchKazuki Yamaguchi, Mar 27, 2016
  2. 1/2 refs: add a new function set_worktree_head_symrefKazuki Yamaguchi, Mar 27, 2016
  3. Junio C HamanoMar 28, 2016
  4. David TurnerMar 29, 2016
  5. Eric SunshineApr 7, 2016
  6. Kazuki YamaguchiApr 8, 2016
  7. Eric SunshineApr 8, 2016
  8. 2/2 branch -m: update all per-worktree HEADsKazuki Yamaguchi, Mar 27, 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.