# [Q] Tell Git to follow symlinks?

6 messages from 2008-02-24 to 2008-02-25. Participants: Alexander Gladysh, Remi Vanicat, David Tweed, Jakub Narebski, Matthieu Moy.
Thread: https://gitlist.dev/t/12290

## Alexander Gladysh, 2008-02-24 11:05

Subject: [Q] Tell Git to follow symlinks?
Message-ID: <c6c947f60802240305w40a7af96yc47f90e573384c04@mail.gmail.com>
URL: https://gitlist.dev/e/c6c947f60802240305w40a7af96yc47f90e573384c04%40mail.gmail.com

```
Hi, list!

Sorry for a rather dumb question.

I'm trying to build a rudimentary GIT-based backup system for my remote host.

I want to put all relevant data (which is scattered throught the
system) under single large Git backup-only (i.e. no development)
repository.

And then on the remote system set cron to do something like

    git add . && git commit -m "`date`" && git gc

And on local system set cron to do git pull.

I thought to construct my repo of the number of symlinks to other
places, but apparently Git does not follow any simlinks.

I have considered using zillion of git submodules, but looks like this
solution would demand more work than I'd like to put in there.

Please give me some directions on the building such dumb backup system I want :)

Thanks in advance,
Alexander.

```

## Remi Vanicat, 2008-02-24 15:08

Subject: Re: [Q] Tell Git to follow symlinks?
Message-ID: <87zltq2xzn.dlv@maison.homelinux.org>
URL: https://gitlist.dev/e/87zltq2xzn.dlv%40maison.homelinux.org
In-Reply-To: <c6c947f60802240305w40a7af96yc47f90e573384c04@mail.gmail.com>

```
"Alexander Gladysh" <agladysh@gmail.com> writes:

> I thought to construct my repo of the number of symlinks to other
> places, but apparently Git does not follow any simlinks.

Hope so, I use this feature, for example to manage my debian
alternatives. 

> Please give me some directions on the building such dumb backup
> system I want :)

I use "reverse" symlinks: the files i want to manage are replaced by
symlink to the file that is in then git repository:

my home contain:

.abbrev_defs -> .myconfig/abbrev_defs
.bash_logout -> .myconfig/bash_logout
.bash_profile -> .myconfig/bash_profile
.bashrc -> .myconfig/bashrc
.custom -> .myconfig/custom
.dircolors -> .myconfig/dircolors
.emacs -> .myconfig/emacs
.gnomerc -> .myconfig/gnomerc
.gnus -> .myconfig/gnus
.irssi -> .myconfig/irssi/
.profile -> .myconfig/profile
.ScrollZ -> .myconfig/ScrollZ/
.scrollzrc -> .myconfig/scrollzrc
.xchat2 -> .myconfig/xchat2/

and a .myconfig git repository that manage those file.

-- 
Rémi Vanicat

```

## Alexander Gladysh, 2008-02-24 18:22

Subject: Re: [Q] Tell Git to follow symlinks?
Message-ID: <c6c947f60802241022l53ef344es10e23e1cf9b7116a@mail.gmail.com>
URL: https://gitlist.dev/e/c6c947f60802241022l53ef344es10e23e1cf9b7116a%40mail.gmail.com
In-Reply-To: <87zltq2xzn.dlv@maison.homelinux.org>

```
On Sun, Feb 24, 2008 at 6:08 PM, Remi Vanicat <vanicat@debian.org> wrote:

>  > I thought to construct my repo of the number of symlinks to other
>  > places, but apparently Git does not follow any simlinks.
>
>  Hope so, I use this feature, for example to manage my debian
>  alternatives.

I do not advocate removal of this useful feature, but may be there are
some arcane switch or even a simple source hack that would help me in
my specific case, :)

>  > Please give me some directions on the building such dumb backup
>  > system I want :)
>
>  I use "reverse" symlinks: the files i want to manage are replaced by
>  symlink to the file that is in then git repository:
> <...>

Yes, this is an option, thank you. But it would involve altering
existing software configurations (like enabling FollowSymLinks in
Apache etc.) -- which I would like to avoid if possible.

Thank you,
Alexander.

```

## David Tweed, 2008-02-25 05:54

Subject: Re: [Q] Tell Git to follow symlinks?
Message-ID: <e1dab3980802242154h721bd8a5x60b7f73d9fc3a2ef@mail.gmail.com>
URL: https://gitlist.dev/e/e1dab3980802242154h721bd8a5x60b7f73d9fc3a2ef%40mail.gmail.com
In-Reply-To: <87zltq2xzn.dlv@maison.homelinux.org>

```
On Sun, Feb 24, 2008 at 3:08 PM, Remi Vanicat <vanicat@debian.org> wrote:
> "Alexander Gladysh" <agladysh@gmail.com> writes:
>
>  > I thought to construct my repo of the number of symlinks to other
>  > places, but apparently Git does not follow any simlinks.
>
>  I use "reverse" symlinks: the files i want to manage are replaced by
>  symlink to the file that is in then git repository:
>
>  my home contain:
>
>  .abbrev_defs -> .myconfig/abbrev_defs
>  .bash_logout -> .myconfig/bash_logout
[...]
>
>  and a .myconfig git repository that manage those file.

For configuration files I tend to actually physically copy them to a
directory under the tree that I'm archiving using git, just because it
feels slightly safer. If something git related goes wrong (probably
due to my input) it can't, eg, stick an old, corrupted version of, eg,
.bashrc in my home directory, which stops terminal login when I next
reboot. (I had something similar happen when I actually had the live
version of my archiving script being put into the archive. When I
checked out a previous tree to look at something, an old buggy
archiving script got checked out and created half a dozen corrupt
commits I had to reset away.) Of course, the odds of anything like
this happening in practice are quite small.

-- 
cheers, dave tweed__________________________
david.tweed@gmail.com
Rm 124, School of Systems Engineering, University of Reading.
"while having code so boring anyone can maintain it, use Python." --
attempted insult seen on slashdot

```

## Jakub Narebski, 2008-02-25 08:52

Subject: Re: [Q] Tell Git to follow symlinks?
Message-ID: <m3k5ktbep1.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3k5ktbep1.fsf%40localhost.localdomain
In-Reply-To: <c6c947f60802240305w40a7af96yc47f90e573384c04@mail.gmail.com>

```
"Alexander Gladysh" <agladysh@gmail.com> writes:

> I thought to construct my repo of the number of symlinks to other
> places, but apparently Git does not follow any symlinks.

Git stores symlinks as symlinks. Changing that (adding for example
core.followSymlinks) would require quite a bit of surgery.

You can alternatively try to work with GIT_DIR, or/and with
explicitely specifying worktree (and working from within repo), and/or
symlinking .git.
-- 
Jakub Narebski
Poland
ShadeHawk on #git

```

## Matthieu Moy, 2008-02-25 10:06

Subject: Re: [Q] Tell Git to follow symlinks?
Message-ID: <vpqtzjxbba3.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqtzjxbba3.fsf%40bauges.imag.fr
In-Reply-To: <m3k5ktbep1.fsf@localhost.localdomain>

```
Jakub Narebski <jnareb@gmail.com> writes:

> "Alexander Gladysh" <agladysh@gmail.com> writes:
>
>> I thought to construct my repo of the number of symlinks to other
>> places, but apparently Git does not follow any symlinks.
>
> Git stores symlinks as symlinks. Changing that (adding for example
> core.followSymlinks) would require quite a bit of surgery.

In particular, this would raise the question of what to do when
writting to a symlink. Following symlinks when doing a checkout or a
merge could mean to allow git to write outside its working tree, which
is problematic security-wise.

-- 
Matthieu

```
