Thread (49 messages) 49 messages, 6 authors, 2018-03-30
STALE3021d

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

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2018-03-28 17:56:29

On Wed, Mar 28, 2018 at 7:36 PM, Jeff King [off-list ref] wrote:
On Wed, Mar 28, 2018 at 12:10:21PM +0200, Duy Nguyen wrote:
quoted
quoted
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 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, do whatever you need to" that can be called any time, before or
after chdir(). I'll look more into it.
I think it should be OK to save getcwd() and just construct the original
path after the fact. Here's some patches which do that in a nice way.
Heh.. I should have checked mails more often while coding ;-)

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 chdir-notify instead (and let
yours to be merged earlier)

Note, this one is built on a strange base, which is a merge of 'next'
and 'sb/object-store' (I needed 'next' and Junio would have another
evil merge if 'sb/object-store' was not in the base).

Nguyễn Thái Ngọc Duy (8):
  strbuf.c: add strbuf_ensure_trailing_dr_sep()
  strbuf.c: reintroduce get_pwd_cwd() (with strbuf_ prefix)
  trace.c: export trace_setup_key
  setup.c: introduce setup_adjust_path()
  setup.c: allow other code to be notified when $CWD moves
  environment.c: adjust env containing relpath when $CWD is moved
  repository: adjust repo paths when $CWD moves
  refs: adjust main repo paths when $CWD moves

 abspath.c             |  4 +--
 builtin/difftool.c    |  6 ++---
 cache.h               |  8 ++++++
 dir-iterator.c        |  3 +--
 environment.c         | 46 +++++++++++++++++++++++++++++++++
 object-store.h        |  3 +++
 object.c              | 15 +++++++++++
 path.c                |  9 +++----
 refs.c                | 10 ++++++++
 refs/files-backend.c  | 15 +++++++++++
 refs/packed-backend.c | 12 +++++++++
 refs/refs-internal.h  |  4 +++
 repository.c          | 28 ++++++++++++++++++++
 setup.c               | 59 ++++++++++++++++++++++++++++++++++---------
 strbuf.c              | 43 ++++++++++++++++++++-----------
 strbuf.h              |  8 ++++++
 trace.c               | 14 +++++-----
 trace.h               |  1 +
 18 files changed, 239 insertions(+), 49 deletions(-)

-- 
2.17.0.rc1.439.gca064e2955
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help