aboutsummaryrefslogtreecommitdiff
path: root/doc/bugs/proxy_--_git_commit__for_a_file_under_git__creates_.variant-local___40__original_file_is_even_get_removed__41__.mdwn
blob: d104dc91a24284ad057eda13dbb00dff192a58e3 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
### Please describe the problem.

For a file which I add directly under git (using  git -c annex.largefiles='exclude=analysis' annex add * ) upon proxied commit annex renames it with suffix .variant-local.

### What steps will reproduce the problem?

see transcript below

here you could find original demo script  http://www.onerussian.com/tmp/demo-script.sh  which was intended to do such commits in a loop but ended up growing a swarm of those *-local files.

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

debian sid 5.20150710-2

### Please provide any additional information below.

[[!format sh """
# If you can, paste a complete transcript of the problem occurring here.
# If the problem is with the git-annex assistant, paste in .git/annex/daemon.log
hopa:/tmp/demo1
$> git init; git annex init; git annex direct; git annex version
Initialized empty Git repository in /tmp/demo1/.git/
init  ok
(recording state in git...)
commit  
On branch master

Initial commit

nothing to commit
ok
direct  ok
git-annex version: 5.20150710-2
build flags: Assistant Webapp Webapp-secure Pairing Testsuite S3 WebDAV Inotify DBus DesktopNotify XMPP 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 webdav tahoe glacier ddar hook external
local repository version: 5
supported repository version: 5
upgrade supported from repository versions: 0 1 2 4
2 22762.....................................:Tue 28 Jul 2015 05:19:53 PM EDT:.
hopa:/tmp/demo1
$> echo 'echo 999' >> analysis                                  
zsh: no such file or directory: analysis
2 22763 ->1.....................................:Tue 28 Jul 2015 05:20:05 PM EDT:.
hopa:/tmp/demo1
$> echo 'echo 999' >| analysis 
2 22764.....................................:Tue 28 Jul 2015 05:20:11 PM EDT:.
hopa:/tmp/demo1
$> git -c annex.largefiles='exclude=analysis' annex add *       
add analysis (non-large file; adding content to git repository) ok
(recording state in git...)
2 22765.....................................:Tue 28 Jul 2015 05:20:18 PM EDT:.
hopa:/tmp/demo1
$> ls 
analysis
2 22766.....................................:Tue 28 Jul 2015 05:20:24 PM EDT:.
hopa:/tmp/demo1
$> git annex proxy -- git commit -m "analysis 1"         
ok                                             
[annex/direct/master (root-commit) 56e3ee4] analysis 1
 1 file changed, 1 insertion(+)
 create mode 100644 analysis
2 22767.....................................:Tue 28 Jul 2015 05:20:29 PM EDT:.
hopa:/tmp/demo1
$> echo 'echo 999' >> analysis                  
zsh: no such file or directory: analysis
2 22768 ->1.....................................:Tue 28 Jul 2015 05:20:35 PM EDT:.
hopa:/tmp/demo1
$> ls
analysis.variant-local
2 22769.....................................:Tue 28 Jul 2015 05:20:38 PM EDT:.
hopa:/tmp/demo1
$> git annex indirect
commit  (recording state in git...)

ok
[annex/direct/master 2c765d9] commit before switching to indirect mode
 1 file changed, 1 deletion(-)
 delete mode 100644 analysis
ok
indirect  ok
ok
2 22770.....................................:Tue 28 Jul 2015 05:21:56 PM EDT:.
hopa:/tmp/demo1
$> ls
analysis.variant-local
2 22771.....................................:Tue 28 Jul 2015 05:21:57 PM EDT:.
hopa:/tmp/demo1
$> git log --stat
commit 2c765d9dee7a53e6aaec1dd7efc0550353998a53
Author: Yaroslav Halchenko <debian@onerussian.com>
Date:   Tue Jul 28 17:21:56 2015 -0400

    commit before switching to indirect mode

 analysis | 1 -
 1 file changed, 1 deletion(-)

commit 56e3ee4b3b1ec6fdc1b9e058dcd6cae60bba73ac
Author: Yaroslav Halchenko <debian@onerussian.com>
Date:   Tue Jul 28 17:20:29 2015 -0400

    analysis 1

 analysis | 1 +
 1 file changed, 1 insertion(+)


# End of transcript or log.
"""]]

> Ok, this is [[fixed|done]].
> 
> What was going on is, proxy was reusing mergeDirectCleanup
> since it's in a similar situation to cleaning up after a direct mode
> merge. But, a direct mode merge can pull in changes to files that exist
> in the local work tree (and may or may not be in the index), but are
> not committed to git locally yet. So, it has to
> detect those and move them aside (to ".varient-local"). The code to do
> that is what was failing in this reuse of mergeDirectCleanup.
> 
> So, I made that code path not run when using proxy. And for commits,
> that's good enough. If there's a file in the work tree that's
> not added to git, then a proxied commit can't affect it, so that code
> path is not needed in this case.
> 
> Come to think, other proxied actions might affect such a file. For
> example a proxied revert could revert the deletion of a file with the
> same name, that's in the work tree. In this case, should the proxyed revert
> fail because there's a file in the work tree that will be overwritten by
> the revert? Would be good if it did, because git revert will normally fail
> in this situation.
> 
> The only way to make a proxied revert, etc exactly match a
> non-proxied revert is to arrange for all files that are in the work
> tree and not checked into git to be present in the temp work tree when
> the proxied command is run. Which I've now done. --[[Joey]]