Package: git
Version: 1:2.11.0-2
Severity: minor

Changes .git/info/attributes can mean that previously checkout out
versions of files are no longer accurate, because they have had the
wrong filters or whatever applied.

git does not always get this right.  For example, changing the
attributes configuration and then running `git reset --hard' usually
updates the working tree with the new view of the tree objects, but
sometimes doesn't.

To reproduce:

   mkdir -p bug/scripts
   cd bug/scripts
   # put `many' and `try' from this email in bug/scripts/{many,try}
   # chmod +x many try
   ./many

Expected results: `many' runs to completion.

Actual results: a lot of output ending with something like this:

   On branch master
   nothing to commit, working tree clean
   + echo '* -filter'
   + git reset --hard
   HEAD is now at 6ce0887 file
   + cat file
   a
   b
   + diff file ../blob
   1,2c1,2
   < a
   < b
   ---
   > n
   > o

On my modern and rather fast laptop the number of trials before
failure varies from 2 or so to well over 100.  The distributions of
results suggests that the trials are not independent, somehow.

Thanks,
Ian.

#!/bin/bash
set -e
set -x

rm -rf ../expt
mkdir ../expt
cd ../expt
git init

mkdir -p .git/info

git config filter.crazy.smudge '/usr/games/rot13 2'
git config filter.crazy.clean  '/usr/games/rot13 24'
git config filter.crazy.required true

echo >.gitattributes 'file filter=crazy'
git add .gitattributes
git commit -m attrs .gitattributes

(echo a; echo b) >file
git add file
git commit -m file

cat file
git cat-file blob master:file
git cat-file blob master:file >../blob

cat file
git status

echo >.git/info/attributes '* -filter'
git reset --hard

cat file
diff file ../blob
#!/bin/bash
set -e
for s in {0..1000}; do echo ========== $s ==========; ./try; done

-- 
Ian Jackson <ijack...@chiark.greenend.org.uk>   These opinions are my own.

If I emailed you from an address @fyvzl.net or @evade.org.uk, that is
a private address which bypasses my fierce spamfilter.

Reply via email to