File: git_mv_before_commit_breaks_symlinks.mdwn

package info (click to toggle)
git-annex 5.20141125
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 37,828 kB
  • ctags: 583
  • sloc: haskell: 42,582; sh: 1,080; ansic: 498; makefile: 316; perl: 125
file content (28 lines) | stat: -rw-r--r-- 943 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
### Please describe the problem.

When I `git mv` a file that I just `git annex add`-ed without having `git commit`-ed it first, then the symlink will break.

### What steps will reproduce the problem?

    $ mkdir foo
    $ echo hello > foo/bar
    $ git annex add foo/bar
    $ git mv foo/bar .

### What version of git-annex are you using? On what operating system?

5.20140529 on Debian testing

> This is fundamentally something git-annex cannot deal with,
> because there is no way to hook into git to fix the symlink when
> `git mv` moves the file.
> 
> Instead, git-annex has several "good enough" fixes for the problem:
>
> * As soon as you `git commit`, the pre-commit hook will run `git annex
>   fix` and this will fix the symlink before it gets committed.
> * You can run `git annex fix` yourself after `git mv`.
> * Even `git annex add $file` will fix the symlink if the file is already
>   annexed.
> 
> So, [[done]] --[[Joey]]