Re: [RFC] introduce GIT_WORK_DIR environment variable
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Mar 11, 2007, 14:18 UTC
- Message-ID
- <fcaeb9bf0703110718i70742b8frca4d0df78bff214d@mail.gmail.com>
- In-Reply-To
- <20070311140553.GA18947@moooo.ath.cx>
On 3/11/07, Matthias Lederhofer <matled@gmx.net> wrote:
Show 10 quoted lines
> Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote: > > Yes I expected it to move the specified working directory as described > > in the previous mail (copied/pasted below). However the patch requires > > me to be in workdir somewhere already (which is fine if that is your > > expectation). If that's the case, maybe you should tell users > > something about GIT_WORK_DIR not applicable. > > Let's say we have GIT_DIR=/tmp/git GIT_WORK_DIR=/tmp/foo and are in > /tmp. You want `git add bar` to chdir to /tmp/foo and add the file > bar from /tmp/foo?
Yes. I wanted it for easy scripting but it's not very intuitive from command line. I'd take it back.
Show 16 quoted lines
>
> > >Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
> > >> By the way, is it plausible to add --git-workdir option to specify
> > >> working directory? With that option, I won't need to _chdir_ to the
> > >> working directory, run git commands and _chdir back_.
> I thought you meant the chdir to the toplevel directory when you're in
> a subdirectory. For this case I'd rather suggest
> mygit() {
> old=$(pwd)
> cd "$MYTOPDIR"
> git "$@"
> ret=$?
> cd "$old"
> return $ret
> }
>Thanks, will try
-- Duy