Please describe the problem.

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.

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

6.20180720+gitg03978571f-1~ndall+1

Please provide any additional information below.

Here is a full script to reproduce it:

#!/bin/bash

set -ex

builtin cd /tmp; 

if [ -e /tmp/repo ]; then
    chmod -R +w /tmp/repo; 
    rm -rf /tmp/repo; 
fi
mkdir /tmp/repo; 
cd /tmp/repo; 
git init; 
git annex init; 
echo '* annex.largefiles=(largerthan=5b)' >.gitattributes; 
git add .gitattributes; 
git commit -m 'added .gitattri'; 
echo 123456 > file; 
git annex add file; 
git commit -m add1; 
ls -l; 

git annex unlock file; 
echo 123 >| file
git annex add file

# this would work but commit to git-annex, not git despite .gitattributes settings
# git commit -m edit -a 
# This one would fail to commit at all, complaining about "partial commit"
git commit -m edit file
ls -l file; 

git status

which leads to

...
+ git annex add file
add file (non-large file; adding content to git repository) ok
add file (non-large file; adding content to git repository) ok
(recording state in git...)
+ git commit -m edit file
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.

additional observations:

  • works fine if remains large file (e.g. we just append to it)
  • 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"

Expected behavior: - have consistent behavior between commit -a and commit file - commit without a failure, committing to git (since .gitattributes instructs so and even git annex add reports that)