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

Re: [PATCH] worktree: provide better prefix to go back to original cwd

From
Chris Packham <judge.packham@gmail.com>
Date
Oct 6, 2010, 15:47 UTC
Message-ID
<4CAC9A21.7030401@gmail.com>
In-Reply-To
<1286373578-2484-1-git-send-email-pclouds@gmail.com>
On 06/10/10 06:59, Nguyễn Thái Ngọc Duy wrote:
Show 18 quoted lines
> When both GIT_DIR and GIT_WORK_TREE are set, if cwd is outside worktree,
> prefix (the one passed to every builtin commands) will be set to NULL,
> which means "user stays at worktree topdir".
> 
> As a consequence, command line arguments are supposed to be relative
> to worktree topdir, not current working directory. Not very intuitive.
> Moreover, output from such situation is (again) relative to worktree
> topdir. Users are expected to understand that.
> 
> This patch allows builtin commands access to original cwd even if it's
> outside worktree, via cwd_to_worktree and worktree_to_cwd fields. As
> the name implies, if you stay at original cwd, "cd $(cwd_to_worktree)"
> would take you to worktree topdir and vice versa.
> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  startup_info->cwd_to_worktree would be as same as opt.submodule_prefix
>  in your 2/3 patch.

Thanks. I must admit I was struggling a little with implementing this part. I'll be sending out a re-roll of my series shortly and I'll include your patch if Junio doesn't pick it up on its own. I was also planning on re-basing my patches on top of next or pu so more people can actually compile it.

Previous: Nguyễn Thái Ngọc DuyNext: Jonathan Nieder
Message 2 of 6 in “worktree: provide better prefix to go back to original cwd”
  1. worktree: provide better prefix to go back to original cwdNguyễn Thái Ngọc Duy, Oct 6, 2010
  2. Chris PackhamOct 6, 2010
  3. Jonathan NiederOct 6, 2010
  4. Junio C HamanoOct 6, 2010
  5. Nguyen Thai Ngoc DuyOct 7, 2010
  6. Nguyen Thai Ngoc DuyOct 7, 2010

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.