Re: git-dir requires work-tree; documentation improvements for working directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yaroslav Nikitenko wrote:
> 2021-01-02 22:12 GMT+03:00, Felipe Contreras <felipe.contreras@xxxxxxxxx>:
> > Yaroslav Nikitenko wrote:
> >> I use git to manage my dotfiles with this command:
> >>
> >>     git --git-dir=/home/yaroslav/.cfg/ --work-tree=/home/yaroslav
> >
> > I do precisely the same thing.
> >
> >> When reading documentation, I noticed two issues.
> >>
> >> 1) The command doesn't work without --work-tree (even from the top
> >> level directory, which is my home directory).
> >>
> >>     [~]$ git --git-dir=/home/yaroslav/.cfg/ status
> >>     fatal: this operation must be run in a work tree
> >
> > That's weird. It works fine here (although I don't see why I would want
> > that).
> 
> BTW, how do you do that in your case?

I have an alias:

  alias config='git --git-dir=$HOME/.config/dotfiles/.git/ --work-tree=$HOME'

So, when I'm in my $HOME, I can do:

  config status

> > If you remove all your configuration does it still fail?
> 
> It starts to work when I remove my .cfg/config. I've no idea why it
> happens. Here is its contents:
> 
> $ more .cfg/config
> [core]
> 	repositoryformatversion = 0
> 	filemode = true
> 	bare = true

That's the difference: my core.bare is false.

I do have a checked out work-tree because that's the only way I could
get some commands to work, for example `git rebase`, even though I don't
use that work-tree.

I'm not sure if it makes sense to not assume '.' is the work-tree when
'core.bare=true', but I think it does make sense, so maybe just turn
that off.

Cheers.

-- 
Felipe Contreras



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux