git-mv with absolute path derefereces symlinks
- From
Martin Erik Werner <martinerikwerner@gmail.com>
- Date
- Jan 15, 2014, 12:48 UTC
- Message-ID
- <20140115124859.GA4283@mule>
Hi,
If git-mv is provided absolute paths when moving symlinks, it tries to dereference them and (attempts to) move the symlink target rather than the symlink itself, this seems like a quite odd behaviour since it's inconsistent with how git-mv works with symlinks if given relative paths, and I'm thinking it might be a bug, since it not documented in the git-mv manpage.
### $ git init linktest Initialized empty Git repository in /home/arand/tmp/linktest/.git/ $ cd linktest/ $ touch target $ ln -s target link $ ln -s /tmp/target link2 $ git add . $ git commit -m1 [master (root-commit) 3cfea66] 1 3 files changed, 2 insertions(+) create mode 120000 link create mode 120000 link2 create mode 100644 target $ git mv "$(pwd)/link" "$(pwd)/moved" $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage)
renamed: target -> moved
$ git mv "$(pwd)/link2" "$(pwd)/moved2" fatal: /home/arand/tmp/linktest/link2: '/home/arand/tmp/linktest/link2' is outside repository ###
-- Martin Erik Werner <martinerikwerner@gmail.com>