summaryrefslogtreecommitdiff
path: root/doc/bugs/Data_loss_when_doing___96__git_annex_import_--force__96__.mdwn
blob: 60e04fc146eaf569b924b7c23220c16822df67d6 (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
### Please describe the problem.

Calling `git annex import --force file-in-working-copy` removes `file-in-working-copy` from disk.

My workflow is:

1) copy the CR2 files from a card to the desired directory structure using a tool of my choice,
2) import the created directory layout to git-annex

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

[[!format sh """
$ git-annex version
git-annex version: 5.20150327
build flags: Pairing Testsuite S3 DBus DNS Feeds Quvi TDFA
key/value backends: SHA256E SHA1E SHA512E SHA224E SHA384E SKEIN256E SKEIN512E MD5E SHA256 SHA1 SHA512 SHA224 SHA384 SKEIN256 SKEIN512 MD5 WORM URL
remote types: git gcrypt S3 bup directory rsync web bittorrent tahoe glacier ddar hook external
local repository version: 5
supported repository version: 5
upgrade supported from repository versions: 0 1 2 4
"""]]

### How to reproduce:

[[!format sh """
jkt@svist ~/temp $ mkdir annex-add-force-data-loss
jkt@svist ~/temp $ cd annex-add-force-data-loss/
jkt@svist ~/temp/annex-add-force-data-loss $ git init
Initialized empty Git repository in /home/jkt/temp/annex-add-force-data-loss/.git/
jkt@svist ~/temp/annex-add-force-data-loss $ echo 1234 > foo
jkt@svist ~/temp/annex-add-force-data-loss $ ls -al
total 16K
drwxr-xr-x  3 jkt jkt   27 May  8 13:54 .
drwx------ 55 jkt jkt 8.0K May  8 13:54 ..
drwxr-xr-x  6 jkt jkt   96 May  8 13:54 .git
-rw-r--r--  1 jkt jkt    5 May  8 13:54 foo
jkt@svist ~/temp/annex-add-force-data-loss $ git annex import --force foo
git-annex: First run: git-annex init
jkt@svist ~/temp/annex-add-force-data-loss $ git annex init
init  ok
(recording state in git...)
jkt@svist ~/temp/annex-add-force-data-loss $ ls -al
total 16K
drwxr-xr-x  3 jkt jkt   27 May  8 13:54 .
drwx------ 55 jkt jkt 8.0K May  8 13:54 ..
drwxr-xr-x  8 jkt jkt  119 May  8 13:54 .git
-rw-r--r--  1 jkt jkt    5 May  8 13:54 foo
jkt@svist ~/temp/annex-add-force-data-loss $ git annex import --force foo
import foo 
git-annex: foo: rename: does not exist (No such file or directory)
failed
git-annex: import: 1 failed
jkt@svist ~/temp/annex-add-force-data-loss $ ls -al
total 12K
drwxr-xr-x  3 jkt jkt   17 May  8 13:55 .
drwx------ 55 jkt jkt 8.0K May  8 13:54 ..
drwxr-xr-x  8 jkt jkt  119 May  8 13:55 .git
"""]]
...and the file is gone :(.

> You should use `git annex add` in this case, not import. 
> I've made import refuse to run in this case. [[done]] --[[Joey]]