]> dgit.raspbian.org Git - git-annex.git/blob
b01c70774bd8ba2898a37b9c353e500cd5e93a8a
[git-annex.git] /
1 ### Please describe the problem.
2
3 Leads to a failure of 'git commit' upon attempt to commit a file which went from "largefile" to small, according to .gitattributes settings, if we `git annex add file` before committing the change.
4
5 ### What version of git-annex are you using? On what operating system?
6
7 6.20180720+gitg03978571f-1~ndall+1
8
9 ### Please provide any additional information below.
10
11 Here is a full script to reproduce it:
12 [[!format sh """
13 #!/bin/bash
14
15 set -ex
16
17 builtin cd /tmp; 
18
19 if [ -e /tmp/repo ]; then
20     chmod -R +w /tmp/repo; 
21     rm -rf /tmp/repo; 
22 fi
23 mkdir /tmp/repo; 
24 cd /tmp/repo; 
25 git init; 
26 git annex init; 
27 echo '* annex.largefiles=(largerthan=5b)' >.gitattributes; 
28 git add .gitattributes; 
29 git commit -m 'added .gitattri'; 
30 echo 123456 > file; 
31 git annex add file; 
32 git commit -m add1; 
33 ls -l; 
34
35 git annex unlock file; 
36 echo 123 >| file
37 git annex add file
38
39 # this would work but commit to git-annex, not git despite .gitattributes settings
40 # git commit -m edit -a 
41 # This one would fail to commit at all, complaining about "partial commit"
42 git commit -m edit file
43 ls -l file; 
44
45 git status
46
47
48 """]]
49
50 which leads to 
51 [[!format sh """
52 ...
53 + git annex add file
54 add file (non-large file; adding content to git repository) ok
55 add file (non-large file; adding content to git repository) ok
56 (recording state in git...)
57 + git commit -m edit file
58 git-annex: Cannot make a partial commit with unlocked annexed files. You should `git annex add` the files you want to commit, and then run git commit.
59 """]]
60
61 additional observations:
62
63 - works fine if remains large file (e.g. we just append to it)
64 - does not fail if we do `git commit -a` not `git commit file`, but it commits it to annex not to git, despite previous `git annex add` message rightfully says that "non-large file; adding content to git repository" 
65
66 Expected behavior:
67 - have consistent behavior between `commit -a` and `commit file`
68 - commit without a failure, committing to git (since .gitattributes instructs so and even `git annex add` reports that)
69
70 [[!meta author=yoh]]
71 [[!tag projects/datalad]]
72
73 > [[fixed|done]] --[[Joey]]