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

From: Chris Packham <[email-masked]>
Date: Wed, 06 Oct 2010 08:47:45 -0700

On 06/10/10 06:59, Nguyễn Thái Ngọc Duy wrote:
> 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 <[email-masked]>
> ---
>  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.