From 2a7484bdc69b27e5aa3af6090141e1b3b9b81a61 Mon Sep 17 00:00:00 2001 From: yarikoptic Date: Wed, 8 Aug 2018 20:07:27 +0000 Subject: [PATCH] initial report about failure to commit --- ...ile_status_to_be_committed_to_git_now.mdwn | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 doc/bugs/cannot_commit___34__annex_add__34__ed_modified_file_which_switched_its_largefile_status_to_be_committed_to_git_now.mdwn diff --git a/doc/bugs/cannot_commit___34__annex_add__34__ed_modified_file_which_switched_its_largefile_status_to_be_committed_to_git_now.mdwn b/doc/bugs/cannot_commit___34__annex_add__34__ed_modified_file_which_switched_its_largefile_status_to_be_committed_to_git_now.mdwn new file mode 100644 index 0000000000..9fdfa20124 --- /dev/null +++ b/doc/bugs/cannot_commit___34__annex_add__34__ed_modified_file_which_switched_its_largefile_status_to_be_committed_to_git_now.mdwn @@ -0,0 +1,70 @@ +### 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: +[[!format sh """ +#!/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 +[[!format sh """ +... ++ 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) + +[[!meta author=yoh]]