Re: [PATCH 0/8] Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-30 Thread Jeff King
On Thu, Mar 29, 2018 at 04:57:26PM +0200, Duy Nguyen wrote: > On Wed, Mar 28, 2018 at 02:19:32PM -0400, Jeff King wrote: > > > > > I will probably rework on top of your chdir-notify instead (and let > > > yours to be merged earlier) > > > > Thanks. I like some of the related changes you made,

Re: [PATCH 0/8] Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-29 Thread Duy Nguyen
On Wed, Mar 28, 2018 at 02:19:32PM -0400, Jeff King wrote: > > > I will probably rework on top of your chdir-notify instead (and let > > yours to be merged earlier) > > Thanks. I like some of the related changes you made, like including this > in the tracing output. That should be easy to do on

Re: [PATCH 0/8] Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-28 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > This is what I got, which is slightly different from your series > because I want to call set_git_dir() just one time (by > setup_git_directory) and never again. I think the API looks close > enough. > > I will probably rework on top of your

Re: [PATCH 0/8] Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-28 Thread Jeff King
On Wed, Mar 28, 2018 at 07:55:29PM +0200, Nguyễn Thái Ngọc Duy wrote: > >> The problem is switching relative paths relies on the old $CWD if I'm > >> not mistaken and we need  getcwd() for this. I'd love to have one > >> callback that says "$CWD has been switched from this path to that > >> path,

[PATCH 0/8] Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-28 Thread Nguyễn Thái Ngọc Duy
On Wed, Mar 28, 2018 at 7:36 PM, Jeff King wrote: > On Wed, Mar 28, 2018 at 12:10:21PM +0200, Duy Nguyen wrote: > >> > I think it might be clearer if a single call is given both the old and >> > new paths. That requires the caller of chdir() storing getcwd() before >> > it moves,

Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-28 Thread Jeff King
On Wed, Mar 28, 2018 at 12:10:21PM +0200, Duy Nguyen wrote: > > I think it might be clearer if a single call is given both the old and > > new paths. That requires the caller of chdir() storing getcwd() before > > it moves, but I don't think that should be a big deal. > > The problem is

Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-28 Thread Duy Nguyen
On Wed, Mar 28, 2018 at 11:52 AM, Jeff King wrote: > On Tue, Mar 27, 2018 at 07:30:24PM +0200, Duy Nguyen wrote: > >> On Tue, Mar 27, 2018 at 07:09:36PM +0200, Duy Nguyen wrote: >> > I would rather have something like ref_store_reinit() in the same >> > spirit as the second call of

Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-28 Thread Jeff King
On Tue, Mar 27, 2018 at 07:30:24PM +0200, Duy Nguyen wrote: > On Tue, Mar 27, 2018 at 07:09:36PM +0200, Duy Nguyen wrote: > > I would rather have something like ref_store_reinit() in the same > > spirit as the second call of set_git_dir() in setup_work_tree. It is > > hacky, but it works and

Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-28 Thread Jeff King
On Tue, Mar 27, 2018 at 07:09:36PM +0200, Duy Nguyen wrote: > > I don't quite get why f57f37e2 doesn't want to call git_path(). Is it to > > avoid the way the path is munged? Or is it to avoid some lazy-setup that > > is triggered by calling get_git_dir() at all (which doesn't make much > > sense

Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-27 Thread Duy Nguyen
On Tue, Mar 27, 2018 at 07:09:36PM +0200, Duy Nguyen wrote: > I would rather have something like ref_store_reinit() in the same > spirit as the second call of set_git_dir() in setup_work_tree. It is > hacky, but it works and keeps changes to minimal (so that it could be > easily replaced later).

Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-27 Thread Duy Nguyen
On Tue, Mar 27, 2018 at 6:47 PM, Jeff King wrote: >> So I would not mind papering over it right now (with an understanding >> that absolute path pays some more overhead in path walking, which was >> th reason we tried to avoid it in setup code). A slightly better patch >> is

Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-27 Thread Jeff King
On Tue, Mar 27, 2018 at 04:56:00PM +0200, Duy Nguyen wrote: > The way setup_work_tree() does it is just bad to me. When it calls > set_git_dir() again, the assumption is the new path is exactly the > same as the old one. The only difference is relative vs absolute. But > this is super hard to see

Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-27 Thread Duy Nguyen
On Tue, Mar 27, 2018 at 8:31 AM, Jeff King wrote: >... > > But that really feels like we're papering over the problem. It is papering over the problem in my opinion. setup_work_tree() is involved here and when it moves cwd around, it re-init git-dir (and all other paths). Before

Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-27 Thread Jeff King
On Mon, Mar 26, 2018 at 10:27:09PM +0100, Rafael Ascensao wrote: > One of the tools that manages PKGBUILDS for Arch Linux stores PKGBUILD > git repos inside a cache directory for reuse. > > One of the repos is triggering some unexpected behaviour that can be > reproduced in the CLI with: > >

Re: git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-26 Thread Ævar Arnfjörð Bjarmason
On Mon, Mar 26 2018, Rafael Ascensao wrote: > One of the tools that manages PKGBUILDS for Arch Linux stores PKGBUILD > git repos inside a cache directory for reuse. > > One of the repos is triggering some unexpected behaviour that can be > reproduced in the CLI with: > > $ GIT_DIR=spotify/.git

git complains packed-refs is not a directory when used with GIT_DIR and GIT_WORK_TREE envvars.

2018-03-26 Thread Rafael Ascensao
One of the tools that manages PKGBUILDS for Arch Linux stores PKGBUILD git repos inside a cache directory for reuse. One of the repos is triggering some unexpected behaviour that can be reproduced in the CLI with: $ GIT_DIR=spotify/.git GIT_WORK_TREE=spotify git reset HEAD fatal: couldn't