{"thread":{"id":"34143","subject":"Difficulty adding a symbolic link","startedAt":"2013-06-14T16:15:12Z","lastAt":"2013-06-14T16:15:12Z","messageCount":1,"participants":["Dale R. Worley"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"220888","messageId":"201306141615.r5EGFCH2015143@freeze.ariadne.com","threadId":"34143","inReplyTo":null,"subject":"Difficulty adding a symbolic link","fromName":"Dale R. Worley","fromEmail":"worley@alum.mit.edu","sentAt":"2013-06-14T16:15:12Z","receivedAt":"2013-06-14T16:15:12Z","isPatch":false,"sender":{"key":"worley@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/19911107?v=4"},"body":"I'm having a problem with \"git add\" in version 1.7.7.6.\n\nThe situation is that I have a repository that is contained in a\nsecond-level directory, a sub-sub-directory of \"/\".  The core.worktree\nof the repository is \"/\", so the working directory is the entire file\ntree.  I want this repository to track selected files, which I add\nwith \"git add\".\n\nThe difficulty is that \"git add\" seems to not add specific files,\ndepending on how they are specified as arguments to \"git add\".  In\nparticular, /dev/dvd (which is a symbolic link) can be added with \"git\nadd ../../dev/dvd\" but not with \"git add /dev/dvd\".  On the other\nhand, /etc/hosts (an ordinary file) can be added with either \"git add\n/etc/hosts\" or \"git add ../../etc/hosts\".\n\nTo demonstrate the problem, I've written a script.  A typical\nexecution of the script is as follows.  The lines at the left margin\nstart with \"$\", and are the lines of the script.  The lines indented 4\nspaces start with \"+\", and are the \"simple commands\" as they are\nexecuted by the shell, showing the values substituted for the shell\nvariables.  The lines indented 8 spaces are the output of the various\ncommands.\n\nSomeone suggested that the problem may be triggered by the fact that\n/dev is in a different filesystem than / and /etc.  I added a third\nsection to the script by creating a symbolic link from /etc/hosts.link\nto /etc/hosts, which is thus in the same filesystem as / and the\nrepository.  Git handles it as expected.\n\nAny help with this would be appreciated.\n\nDale\n\n$ set -x\n$ \n$ # Show git version.\n$ git version\n    + git version\n        git version 1.7.7.6\n$ \n$ # To be run in a directory that is contained in /.\n$ pwd\n    + pwd\n        /git-add-issue\n$ \n$ # Make a test directory.\n$ DIR=temp.$$\n    + DIR=temp.10714\n$ mkdir $DIR\n    + mkdir temp.10714\n$ cd $DIR\n    + cd temp.10714\n    ++ pwd\n$ DIR_ABSOLUTE=$( pwd )\n    + DIR_ABSOLUTE=/git-add-issue/temp.10714\n$ \n$ # Create a new repository.\n$ git init\n    + git init\n        Initialized empty Git repository in /git-add-issue/temp.10714/.git/\n$ # Set the worktree to be /\n$ git config core.worktree /\n    + git config core.worktree /\n$ # Create empty commit.\n$ git commit --allow-empty -m Empty.\n    + git commit --allow-empty -m Empty.\n        [master (root-commit) 62d86cb] Empty.\n$ \n$ # Show empty status\n$ git status -uno\n    + git status -uno\n        # On branch master\n        nothing to commit (use -u to show untracked files)\n$ \n$ # First test:  /dev/dvd, which is a symbolic link.\n$ \n$ # Try to add /dev/dvd\n$ ABSOLUTE_NAME=/dev/dvd\n    + ABSOLUTE_NAME=/dev/dvd\n$ ll $ABSOLUTE_NAME\n    + ls -al /dev/dvd\n        lrwxrwxrwx. 1 root root 9 Jun 12 22:23 /dev/dvd -> /dev/dvd1\n$ git add $ABSOLUTE_NAME\n    + git add /dev/dvd\n$ git status -uno\n    + git status -uno\n        # On branch master\n        nothing to commit (use -u to show untracked files)\n$ git reset\n    + git reset\n$ \n$ # Try with alternative name ../../dev/dvd\n$ RELATIVE_NAME=../../dev/dvd\n    + RELATIVE_NAME=../../dev/dvd\n$ ll $RELATIVE_NAME\n    + ls -al ../../dev/dvd\n        lrwxrwxrwx. 1 root root 9 Jun 12 22:23 ../../dev/dvd -> /dev/dvd1\n$ git add $RELATIVE_NAME\n    + git add ../../dev/dvd\n$ git status -uno\n    + git status -uno\n        # On branch master\n        # Changes to be committed:\n        #   (use \"git reset HEAD <file>...\" to unstage)\n        #\n        #\tnew file:   ../../dev/dvd\n        #\n        # Untracked files not listed (use -u option to show untracked files)\n$ git reset\n    + git reset\n$ \n$ # Second test:  /etc/hosts, which is an ordinary file.\n$ \n$ # Try to add /etc/hosts\n$ ABSOLUTE_NAME=/etc/hosts\n    + ABSOLUTE_NAME=/etc/hosts\n$ ll $ABSOLUTE_NAME\n    + ls -al /etc/hosts\n        -rw-r--r--. 1 root root 222 Nov  4  2012 /etc/hosts\n$ git add $ABSOLUTE_NAME\n    + git add /etc/hosts\n$ git status -uno\n    + git status -uno\n        # On branch master\n        # Changes to be committed:\n        #   (use \"git reset HEAD <file>...\" to unstage)\n        #\n        #\tnew file:   ../../etc/hosts\n        #\n        # Untracked files not listed (use -u option to show untracked files)\n$ git reset\n    + git reset\n$ \n$ # Try with alternative name ../../etc/hosts\n$ RELATIVE_NAME=../../etc/hosts\n    + RELATIVE_NAME=../../etc/hosts\n$ ll $RELATIVE_NAME\n    + ls -al ../../etc/hosts\n        -rw-r--r--. 1 root root 222 Nov  4  2012 ../../etc/hosts\n$ git add $RELATIVE_NAME\n    + git add ../../etc/hosts\n$ git status -uno\n    + git status -uno\n        # On branch master\n        # Changes to be committed:\n        #   (use \"git reset HEAD <file>...\" to unstage)\n        #\n        #\tnew file:   ../../etc/hosts\n        #\n        # Untracked files not listed (use -u option to show untracked files)\n$ git reset\n    + git reset\n$ \n$ # Third test:  /etc/hosts.link, which is a link to /etc/hosts\n$ \n$ # Try to add /etc/hosts.link\n$ ABSOLUTE_NAME=/etc/hosts.link\n    + ABSOLUTE_NAME=/etc/hosts.link\n$ ll $ABSOLUTE_NAME\n    + ls -al /etc/hosts.link\n\tlrwxrwxrwx. 1 root root 5 Jun 14 12:04 /etc/hosts.link -> hosts\n$ git add $ABSOLUTE_NAME\n    + git add /etc/hosts.link\n$ git status -uno\n    + git status -uno\n\t# On branch master\n\t# Changes to be committed:\n\t#   (use \"git reset HEAD <file>...\" to unstage)\n\t#\n\t#\tnew file:   ../../etc/hosts\n\t#\n\t# Untracked files not listed (use -u option to show untracked files)\n$ git reset\n    + git reset\n$ \n$ # Try with alternative name ../../etc/hosts.link\n$ RELATIVE_NAME=../../etc/hosts.link\n    + RELATIVE_NAME=../../etc/hosts.link\n$ ll $RELATIVE_NAME\n    + ls -al ../../etc/hosts.link\n\tlrwxrwxrwx. 1 root root 5 Jun 14 12:04 ../../etc/hosts.link -> hosts\n$ git add $RELATIVE_NAME\n    + git add ../../etc/hosts.link\n$ git status -uno\n    + git status -uno\n\t# On branch master\n\t# Changes to be committed:\n\t#   (use \"git reset HEAD <file>...\" to unstage)\n\t#\n\t#\tnew file:   ../../etc/hosts.link\n\t#\n\t# Untracked files not listed (use -u option to show untracked files)\n$ git reset\n    + git reset\n"}]}