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

Re: Moving .git around

From
Geoff Russell <geoffrey.russell@gmail.com>
Date
Jul 24, 2008, 02:36 UTC
Message-ID
<93c3eada0807231936ib103824u9204f1109119e1c2@mail.gmail.com>
In-Reply-To
<fcaeb9bf0807231912t6f20d508va1381f324a8981aa@mail.gmail.com>

On Thu, Jul 24, 2008 at 11:42 AM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:

Show 18 quoted lines
> On 7/24/08, Geoff Russell <geoffrey.russell@gmail.com> wrote:
>> For reasons which would take a while to explain, I'm building a repository
>>  in a directory  using "--git-dir=xxxx/.git --work-tree=." and
>>  then doing an "mv  xxxx/.git ./.git"  and then trying to work with
>>  that repository  --- but can't
>>
>>  Below is a sample script. The last line (git add) fails with
>>
>>  fatal: unable to create
>>  '/usr/local/AusTop/AuPrograms/AuServer/testgit/aaa/bbb/.git/index.lock':
>>  No such file or directory
>>
>>  git doesn't seem to realise that there is a .git back up the tree.
>
> It's because when you did git --work-tree=. init, worktree is stored
> in .git/config. The code that chdir() in setup_git_directory()
> probably forgot to chdir() back to toplevel worktree. Workaround could
> be just remove core.worktree in .git/config.

Many thanks, the work-around works. I'm not sure if this is a bug or a feature, but I'm happy either way.

Cheers, Geoff Russell

Show 33 quoted lines
>
>>  I'm using 1.5.5.1
>>
>>  Cheers,
>>  Geoff Russell
>>
>>  ------------------------ sample script
>>  #!/bin/sh
>>  if [ -d "testgit" ] ; then
>>     echo "remove testgit"
>>     /bin/rm -rf testgit
>>  fi
>>  mkdir testgit && echo yyyy >testgit/sample.sh && cd testgit
>>  mkdir aaa && mkdir aaa/bbb
>>  echo xxxx > aaa/bbb/sample2.sh
>>  mkdir xxx
>>  git --git-dir=xxx/.git --work-tree=. init
>>  git --git-dir=xxx/.git --work-tree=. add *.sh
>>  git --git-dir=xxx/.git --work-tree=. commit  -m demo
>>  mv xxx/.git .
>>  cd aaa/bbb
>>  git add sample2.sh
>>
>> --
>>  To unsubscribe from this list: send the line "unsubscribe git" in
>>  the body of a message to majordomo@vger.kernel.org
>>  More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
>
> --
> Duy
>
-- 
6 Fifth Ave,
St Morris, S.A. 5068
Australia
Ph: 041 8805 184 / 08 8332 5069
Previous: Nguyen Thai Ngoc DuyNext: Jan Hudec
Message 3 of 4 in “Moving .git around”
  1. Geoff RussellJul 24, 2008
  2. Nguyen Thai Ngoc DuyJul 24, 2008
  3. Geoff RussellJul 24, 2008
  4. Jan HudecAug 3, 2008

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.