threads / discuss / 21204

Git: "No you can't handle my root!" (?)

Subject: Git: "No you can't handle my root!" (?)

## tl;dr

18 messages between Oct 12, 2009 and Oct 15, 2009.

replies: 17people: 10as markdown or json

sylvain@demarque.qc.ca· Oct 12, 2009, 05:28 UTC · lore
Git is good, Git is great! All praise the Git! :-D
What do you people think about this strange phenomena?

localhost / # git --version git version 1.6.4.4

localhost / # git init Initialized empty Git repository in //.git/

localhost / # cd etc localhost etc # git add X11/xorg.conf fatal: pathspec 'etc/X11/xorg.conf' did not match any files

Aside from the obvious question of why would I want to Git the whole tree ("But all files deserve the Holy Presence of the Git!"), why does Git refuse the love offering from "/etc/X11/xorg.conf"? Is it because it contains font directory configurations?

Commit and [ENTER] to all,
S! :-)
sylvain@demarque.qc.ca· Oct 12, 2009, 17:59 UTC · re: sylvain@demarque.qc.ca · lore

Re: Git: "No you can't handle my root!" (?)

Hello there. I know I was being goofy, but here is the real down to earth question :

Is there a known bug/feature that prevents Git from being used at "/"? It seems that there is a problem either at "git init" or "git add" when the repository is located at "/.git". (Git 1.6.4.4, see example below)

Thank you!
Quoting sylvain@demarque.qc.ca:
Show 26 quoted lines
> Git is good, Git is great! All praise the Git! :-D
>
> What do you people think about this strange phenomena?
>
> localhost / # git --version
> git version 1.6.4.4
>
> localhost / # git init
> Initialized empty Git repository in //.git/
>
> localhost / # cd etc
> localhost etc # git add X11/xorg.conf
> fatal: pathspec 'etc/X11/xorg.conf' did not match any files
>
> Aside from the obvious question of why would I want to Git the whole
> tree ("But all files deserve the Holy Presence of the Git!"), why does
> Git refuse the love offering from "/etc/X11/xorg.conf"? Is it because
> it contains font directory configurations?
>
> Commit and [ENTER] to all,
>
> S! :-)
> --
> 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
Steven Noonan· Oct 12, 2009, 18:06 UTC · re: sylvain@demarque.qc.ca · lore

Re: Git: "No you can't handle my root!" (?)

I've had this problem too, but I eventually realized it was git's way of telling me I shouldn't do that. But even so, it'd be good if we _could_.

- Steven
On Mon, Oct 12, 2009 at 10:59 AM,  <sylvain@demarque.qc.ca> wrote:
Show 43 quoted lines
> Hello there. I know I was being goofy, but here is the real down to
> earth question :
>
> Is there a known bug/feature that prevents Git from being used at "/"?
> It seems that there is a problem either at "git init" or "git add"
> when the repository is located at "/.git". (Git 1.6.4.4, see example
> below)
>
> Thank you!
>
> Quoting sylvain@demarque.qc.ca:
>
>> Git is good, Git is great! All praise the Git! :-D
>>
>> What do you people think about this strange phenomena?
>>
>> localhost / # git --version
>> git version 1.6.4.4
>>
>> localhost / # git init
>> Initialized empty Git repository in //.git/
>>
>> localhost / # cd etc
>> localhost etc # git add X11/xorg.conf
>> fatal: pathspec 'etc/X11/xorg.conf' did not match any files
>>
>> Aside from the obvious question of why would I want to Git the whole
>> tree ("But all files deserve the Holy Presence of the Git!"), why does
>> Git refuse the love offering from "/etc/X11/xorg.conf"? Is it because
>> it contains font directory configurations?
>>
>> Commit and [ENTER] to all,
>>
>> S! :-)
>> --
>> 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
> --
> 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
>
Alex Riesen· Oct 12, 2009, 18:15 UTC · re: Steven Noonan · lore

Re: Git: "No you can't handle my root!" (?)

On Mon, Oct 12, 2009 at 20:06, Steven Noonan <steven@uplinklabs.net> wrote:
> I've had this problem too, but I eventually realized it was git's way
> of telling me I shouldn't do that. But even so, it'd be good if we
> _could_.

It's more of "a note to the future generation of developers": "Hey guys, we didn't need that working, but if you have a night to spare could you please finish that?"

sylvain@demarque.qc.ca· Oct 12, 2009, 18:20 UTC · re: Alex Riesen · lore

Re: Git: "No you can't handle my root!" (?)

Quoting Alex Riesen <raa.lkml@gmail.com>:
Show 8 quoted lines
> On Mon, Oct 12, 2009 at 20:06, Steven Noonan <steven@uplinklabs.net> wrote:
>> I've had this problem too, but I eventually realized it was git's way
>> of telling me I shouldn't do that. But even so, it'd be good if we
>> _could_.
>
> It's more of "a note to the future generation of developers": "Hey guys,
> we didn't need that working, but if you have a night to spare could you
> please finish that?"

Ok, then I won't wait for it to work. I will dive in Git's code and play the "future generation of developers" part... some day. ;-)

Thank you! :-)
Alex Riesen· Oct 12, 2009, 18:30 UTC · re: sylvain@demarque.qc.ca · lore

Re: Git: "No you can't handle my root!" (?)

On Mon, Oct 12, 2009 at 20:20,  <sylvain@demarque.qc.ca> wrote:
Show 10 quoted lines
> Quoting Alex Riesen <raa.lkml@gmail.com>:
>> It's more of "a note to the future generation of developers": "Hey guys,
>> we didn't need that working, but if you have a night to spare could you
>> please finish that?"
>
> Ok, then I won't wait for it to work. I will dive in Git's code and play the
> "future generation of developers" part... some day. ;-)
>
> Thank you! :-)
>

Hmm... This strategy to encourage new contributors didn't quite worked out. Must try something else next time. Do you like sweets? Just asking...

Jeff King· Oct 12, 2009, 18:35 UTC · re: sylvain@demarque.qc.ca · lore

Re: Git: "No you can't handle my root!" (?)

On Mon, Oct 12, 2009 at 02:20:17PM -0400, sylvain@demarque.qc.ca wrote:
Show 8 quoted lines
> >It's more of "a note to the future generation of developers": "Hey guys,
> >we didn't need that working, but if you have a night to spare could you
> >please finish that?"
> 
> Ok, then I won't wait for it to work. I will dive in Git's code and
> play the "future generation of developers" part... some day. ;-)
> 
> Thank you! :-)

I think that it sort of works, actually. It seems to do OK if you do something like:

  $ GIT_DIR=/path/to/store/repo; export GIT_DIR
  $ GIT_WORK_TREE=/; export GIT_WORK_TREE
  $ git init
  $ cd /etc/whatever
  $ git add .
But it does not work if you try to make things work automatically:
  $ cd /
  $ git init
  $ cd /etc/whatever
  $ git add .

So probably the bug is in detecting the location of the work tree when it is not explicitly given. You can use the explicit style as a workaround for now.

-Peff
sylvain@demarque.qc.ca· Oct 12, 2009, 19:08 UTC · re: Jeff King · lore

Re: Git: "No you can't handle my root!" (?)

Quoting Jeff King <peff@peff.net>:
Show 16 quoted lines
> On Mon, Oct 12, 2009 at 02:20:17PM -0400, sylvain@demarque.qc.ca wrote:
>
> I think that it sort of works, actually. It seems to do OK if you do
> something like:
>
>   $ GIT_DIR=/path/to/store/repo; export GIT_DIR
>   $ GIT_WORK_TREE=/; export GIT_WORK_TREE
>   $ git init
>   $ cd /etc/whatever
>   $ git add .
>
> So probably the bug is in detecting the location of the work tree when
> it is not explicitly given. You can use the explicit style as a
> workaround for now.
>
> -Peff
Thank you! Great idea!

export GIT_DIR=/root/.git export GIT_WORK_TREE=/ echo "*" >> /root/.git/info/exclude

The Golden Solution of the Gods! :-D
Tony Finch· Oct 13, 2009, 17:46 UTC · re: Jeff King · lore

Re: Git: "No you can't handle my root!" (?)

On Mon, 12 Oct 2009, Jeff King wrote:
Show 5 quoted lines
>
>   $ cd /
>   $ git init
>   $ cd /etc/whatever
>   $ git add .

One reason that you don't want to do this (even if it does work) is that careless use of git (e.g. by a user who is not the sysadmin playing with git in their home directory) is going to find the root repository when you expect it not to find any repository.

Also, I suggest this little wrapper script: http://dotat.at/cgi/git?p=git-deploy.git;a=blob;f=git-root.sh

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
GERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS.
MODERATE OR GOOD.
Markus Heidelberg· Oct 12, 2009, 18:30 UTC · re: sylvain@demarque.qc.ca · lore

Re: Git: "No you can't handle my root!" (?)

sylvain@demarque.qc.ca, 12.10.2009:
Show 13 quoted lines
> Git is good, Git is great! All praise the Git! :-D
> 
> What do you people think about this strange phenomena?
> 
> localhost / # git --version
> git version 1.6.4.4
> 
> localhost / # git init
> Initialized empty Git repository in //.git/
> 
> localhost / # cd etc
> localhost etc # git add X11/xorg.conf
> fatal: pathspec 'etc/X11/xorg.conf' did not match any files
"git add etc/X11/xorg.conf" works, seems to be a bug.
Markus
Matthieu Moy· Oct 12, 2009, 19:02 UTC · re: sylvain@demarque.qc.ca · lore

Re: Git: "No you can't handle my root!" (?)

sylvain@demarque.qc.ca writes:
> localhost / # cd etc
> localhost etc # git add X11/xorg.conf
> fatal: pathspec 'etc/X11/xorg.conf' did not match any files

cd .. git add etc/X11/xorg.conf

works. I don't know why the other doesn't (just tested adding from an untracked directory in another project, it does work).

If you want to version a large directory like /, I'd advise putting "*" in /.gitignore to make sure Git never tries to traverse the whole filesystem.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Daniele Segato· Oct 12, 2009, 21:37 UTC · re: sylvain@demarque.qc.ca · lore

Re: Git: "No you can't handle my root!" (?)

Il giorno lun, 12/10/2009 alle 01.28 -0400, sylvain@demarque.qc.ca ha scritto:

> localhost / # git init
I don't see the point of using git on the root directory :)

but that made me think that it could actually be a good idea for /etc/ :) I happen to modify some configuration and then I forgot which one... and sometimes updates broke something

And that make me think of another question...

is there a way to have a git repo for a subset of directory that match a pattern?

for instance...

can I have a git report of $HOME/.* (without . and ..)? (all user setting)

Or better: provide a list of directory under $HOME I want to track 

Instead of providing the list of directory I want to ignore i would like to provide the list of the directory and files I want to track :)

I probably am going out of topic here but I hope you forgive me :)
Avery Pennarun· Oct 12, 2009, 21:57 UTC · re: Daniele Segato · lore

Re: Git: "No you can't handle my root!" (?)

On Mon, Oct 12, 2009 at 5:37 PM, Daniele Segato <daniele.bilug@gmail.com> wrote:
Show 7 quoted lines
> can I have a git report of $HOME/.* (without . and ..)? (all user
> setting)
>
> Or better: provide a list of directory under $HOME I want to track
>
> Instead of providing the list of directory I want to ignore i would like
> to provide the list of the directory and files I want to track :)

You can probably do pretty much anything you want by twiddling with options in .gitignore. You should be able to add "don't ignore" names by starting them with !, iirc.

Avery
sylvain@demarque.qc.ca· Oct 12, 2009, 22:04 UTC · re: Daniele Segato · lore

Re: Git: "No you can't handle my root!" (?)

Quoting Daniele Segato <daniele.bilug@gmail.com>:
Show 28 quoted lines
> Il giorno lun, 12/10/2009 alle 01.28 -0400, sylvain@demarque.qc.ca ha
> scritto:
>> localhost / # git init
>
> I don't see the point of using git on the root directory :)
>
> but that made me think that it could actually be a good idea
> for /etc/ :)
> I happen to modify some configuration and then I forgot which one... and
> sometimes updates broke something
>
>
> And that make me think of another question...
>
> is there a way to have a git repo for a subset of directory that match a
> pattern?
>
> for instance...
>
> can I have a git report of $HOME/.* (without . and ..)? (all user
> setting)
>
> Or better: provide a list of directory under $HOME I want to track
>
> Instead of providing the list of directory I want to ignore i would like
> to provide the list of the directory and files I want to track :)
>
> I probably am going out of topic here but I hope you forgive me :)

I am still a Git newbee, but I am using GNU/Linux for a long time now. I have just reformatted my disk and installed Gentoo and I have to setup all these little things all over again. Since I clean install only every couple of years, I often forget some details, etc.

So I am trying something new. I have my "home Git" at "~/.git" and the "root Git" at "/root/.git" with the GIT_WORK_TREE at "/". Both have "*" in "info/exclude", so I do provide my list of directories and files I want to track explicitly by adding them one by one.

My home Git takes care of .bash* .vim* .emacs*, firefox passwords and bookmarks, etc. My root git takes care of some "/etc", "/var" configs, etc. (That is the reason why I wanted it on "/", because some configuration tweaks are done outside of "/etc". Oh, I forgot to mention "/usr/src/linux/.config")

My hope is that next time I'll clean install my system, I won't have to backup my whole disk and then mount it again to recover configs pieces by pieces. I'll just copy my two Git repositories and I'll should be OK.

All praise the Git. :-)
Jeff King· Oct 13, 2009, 01:43 UTC · re: Daniele Segato · lore

Re: Git: "No you can't handle my root!" (?)

On Mon, Oct 12, 2009 at 11:37:39PM +0200, Daniele Segato wrote:
Show 6 quoted lines
> I don't see the point of using git on the root directory :)
> 
> but that made me think that it could actually be a good idea
> for /etc/ :)
> I happen to modify some configuration and then I forgot which one... and
> sometimes updates broke something
Take a look at:
  http://joey.kitenet.net/code/etckeeper/
> can I have a git report of $HOME/.* (without . and ..)? (all user
> setting)
This seems to work:
  $ cd ~
  $ git init
  $ echo '*' >.gitignore
  $ echo '!.*' >.gitignore
> Or better: provide a list of directory under $HOME I want to track 
Same thing, but make your ! pattern more specific.
-Peff
Daniele Segato· Oct 13, 2009, 04:17 UTC · re: Jeff King · lore

Re: Git: "No you can't handle my root!" (?)

Il giorno lun, 12/10/2009 alle 21.43 -0400, Jeff King ha scritto:
> Take a look at:
> 
>   http://joey.kitenet.net/code/etckeeper/
thanks really interesting
Show 13 quoted lines
> > can I have a git report of $HOME/.* (without . and ..)? (all user
> > setting)
> 
> This seems to work:
> 
>   $ cd ~
>   $ git init
>   $ echo '*' >.gitignore
>   $ echo '!.*' >.gitignore
> 
> > Or better: provide a list of directory under $HOME I want to track 
> 
> Same thing, but make your ! pattern more specific.
thanks again!

regards, Daniele

Jeff King· Oct 13, 2009, 05:01 UTC · re: Daniele Segato · lore

Re: Git: "No you can't handle my root!" (?)

On Tue, Oct 13, 2009 at 06:17:13AM +0200, Daniele Segato wrote:
Show 12 quoted lines
> > This seems to work:
> > 
> >   $ cd ~
> >   $ git init
> >   $ echo '*' >.gitignore
> >   $ echo '!.*' >.gitignore
> > 
> > > Or better: provide a list of directory under $HOME I want to track 
> > 
> > Same thing, but make your ! pattern more specific.
> 
> thanks again!

You're welcome, though while reading the quoted text I noticed a typo in my instructions. The second echo should obviously be _appending_ to .gitignore:

  $ echo '!.*' >>.gitignore

Hopefully that was obvious, but I thought I would point it out for the record.

-Peff
Wesley J. Landaker· Oct 15, 2009, 03:02 UTC · re: Daniele Segato · lore

Re: Git: "No you can't handle my root!" (?)

On Monday 12 October 2009 15:37:39 Daniele Segato wrote:
Show 6 quoted lines
> Il giorno lun, 12/10/2009 alle 01.28 -0400, sylvain@demarque.qc.ca ha
>
> scritto:
> > localhost / # git init
>
> I don't see the point of using git on the root directory :)
Just a comment: this might be of serious use in e.g. a chroot.

← back to recent threads