* Moving .git around
@ 2008-07-24 1:32 Geoff Russell
2008-07-24 2:12 ` Nguyen Thai Ngoc Duy
0 siblings, 1 reply; 4+ messages in thread
From: Geoff Russell @ 2008-07-24 1:32 UTC (permalink / raw)
To: git
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.
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
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Moving .git around 2008-07-24 1:32 Moving .git around Geoff Russell @ 2008-07-24 2:12 ` Nguyen Thai Ngoc Duy 2008-07-24 2:36 ` Geoff Russell 0 siblings, 1 reply; 4+ messages in thread From: Nguyen Thai Ngoc Duy @ 2008-07-24 2:12 UTC (permalink / raw) To: geoffrey.russell; +Cc: git 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. > 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Moving .git around 2008-07-24 2:12 ` Nguyen Thai Ngoc Duy @ 2008-07-24 2:36 ` Geoff Russell 2008-08-03 18:51 ` Jan Hudec 0 siblings, 1 reply; 4+ messages in thread From: Geoff Russell @ 2008-07-24 2:36 UTC (permalink / raw) To: Nguyen Thai Ngoc Duy; +Cc: git On Thu, Jul 24, 2008 at 11:42 AM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote: > 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 > >> 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Moving .git around 2008-07-24 2:36 ` Geoff Russell @ 2008-08-03 18:51 ` Jan Hudec 0 siblings, 0 replies; 4+ messages in thread From: Jan Hudec @ 2008-08-03 18:51 UTC (permalink / raw) To: Geoff Russell; +Cc: Nguyen Thai Ngoc Duy, git On Thu, Jul 24, 2008 at 12:06:28 +0930, Geoff Russell wrote: > On Thu, Jul 24, 2008 at 11:42 AM, Nguyen Thai Ngoc Duy > <pclouds@gmail.com> wrote: > > 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. That depends on what the value of core.worktree is: - If it is '.', than I think it should be considered a bug in git init, because that value is just plain nonsense. - If it is '..', than it's a user error and the right thing is to just remove it when you relocate the .git directory. - If it was '/usr/local/AusTop/AuPrograms/AuServer/testgit/' than it would have worked, so it's not that. Best regards, Jan -- Jan 'Bulb' Hudec <bulb@ucw.cz> ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-08-03 18:52 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-07-24 1:32 Moving .git around Geoff Russell 2008-07-24 2:12 ` Nguyen Thai Ngoc Duy 2008-07-24 2:36 ` Geoff Russell 2008-08-03 18:51 ` Jan Hudec
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.