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

Re: [PATCH 3/3] t5403: do not use access repos with GIT_DIR when worktree is involved

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 13, 2011, 04:27 UTC
Message-ID
<7vwrc95xe5.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1318412105-13595-3-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 8 quoted lines
> Setting GIT_DIR alone means worktree is current directory for legacy
> reasons. Avoid using that, instead go to the worktree and execute
> commands there.
>
> The troublesome command is "GIT_DIR=clone2/.git git add clone2/b". The
> real worktree is clone2, but that command tells git worktree is $(pwd).
> What does user expect to add then? Should the new entry in index be "b"
> or "clone2/b"?

There is no troublesomeness here, as the semantics has been clearly defined and (hopefully) stayed constant before the days when GIT_WORK_TREE was invented.

Assuming that there is no core.worktree in clone2/.git/config and there is no GIT_WORK_TREE environment variable, "GIT_DIR=$anything git add clone2/b" should add a path "clone2/b" to the index controlled by that $GIT_DIR no matter where $anything is.

I would like to find out the motivation behind this patch. Even though I find the ancient style stale and unsightly, we would want to keep the (GIT_DIR is set, GIT_WORK_TREE is not set anywhere) combination working for people who have work habits (read: old scripts) that rely on it. So we would discourage new tests from using ancient style, but at the same time, we would not want to remove _all_ existing ones.

Unless we are trying to break them without knowing, and declare that we deprecated it after the fact, which is not exactly the way we want to remove existing (mis)feature.

Same comment applies to the other patch that removes the test that uses update-index && update-ref combination to a lessor degree.

The [PATCH 2/3] is a genuine improvement, though.
Thanks.
Previous: Nguyễn Thái Ngọc DuyNext: Nguyen Thai Ngoc Duy
Message 4 of 7 in “t5403.1: simplify commit creation”
  1. 1/3 t5403.1: simplify commit creationNguyễn Thái Ngọc Duy, Oct 12, 2011
  2. 2/3 t5403: convert leading spaces to tabsNguyễn Thái Ngọc Duy, Oct 12, 2011
  3. 3/3 t5403: do not use access repos with GIT_DIR when worktree is involvedNguyễn Thái Ngọc Duy, Oct 12, 2011
  4. Junio C HamanoOct 13, 2011
  5. Nguyen Thai Ngoc DuyOct 13, 2011
  6. Johannes SixtOct 12, 2011
  7. Nguyen Thai Ngoc DuyOct 13, 2011

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.