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

Re: FIX/COMMENT: git remote manual page

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Dec 25, 2010, 13:00 UTC
Message-ID
<AANLkTik_x+FcdRs7ac1X45OE7_9E8W-y44HJU=XUuRog@mail.gmail.com>
In-Reply-To
<20101225124104.06a4f83c@eana.kheb.homelinux.org>
On Sat, Dec 25, 2010 at 6:41 PM, Michel Briand <michelbriand@free.fr> wrote:
Show 8 quoted lines
> Hi,
>
> I'm running Debian squeeze. Git is version 1.7.2.3.
>
> Here is the complete command sequence I used:
>
> ~/tmp/git $ mkdir toto toto_wk
> ~/tmp/git $ GIT_DIR=toto GIT_WORK_TREE=toto_wk git init

Note that this also sets core.worktree=`cwd`/toto_wk so you only need to set GIT_DIR in the following commands. But I wouldn't recommend it, just set GIT_WORK_TREE the way you are doing, until maybe 1.7.4. core.worktree is buggy.

> ~/tmp/git $ GIT_DIR=toto GIT_WORK_TREE=toto_wk git merge TOTO
> fatal: This operation must be run in a work tree
> fatal: read-tree failed

Thanks for the instructions. We've got a problem with $GIT_WORK_TREE vs cwd here. I'll send a patch later.

Show 9 quoted lines
> ~/tmp/git $ ls toto_wk/
> <NOTHING>
>
> I re-issue the latest command :
>
> ~/tmp/git $ GIT_DIR=toto GIT_WORK_TREE=toto_wk git merge TOTO
> Already up-to-date.
>
> Strange isn't it ?

Actually no. 'git-merge' is successful and its last step is to call 'git read-tree --reset -u SHA-1' to update worktree. Unfortunately, git's internal cwd has been moved to ~/tmp/git/toto_wk while $GIT_WORK_TREE is still "toto_wk". When git-read-tree is run, it tries to find a worktree at ~/tmp/git/toto_wk/toto_wk.

> But directory is still empty
> ~/tmp/git $ ls toto_wk/
> <NOTHING>
Because git-read-tree fails to run.
> Trying to recover :
>
> ~/tmp/git $ GIT_DIR=toto GIT_WORK_TREE=toto_wk git reset --hard
Or you can try this until new git release:
GIT_DIR=toto GIT_WORK_TREE=$HOME/tmp/toto_wk git merge TOTO
or
GIT_DIR=toto git merge TOTO

In other words, making worktree absolute should work (core.worktree is always set absolute by git-init).

-- 
Duy
Previous: Michel Briand
Message 4 of 4 in “FIX/COMMENT: git remote manual page”
  1. Michel BriandDec 22, 2010
  2. Nguyen Thai Ngoc DuyDec 25, 2010
  3. Michel BriandDec 25, 2010
  4. Nguyen Thai Ngoc DuyDec 25, 2010

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.