This commit is contained in:
Joey Hess 2011-01-26 13:34:39 -04:00
parent 06ca13b103
commit 758019cc18

View file

@ -21,11 +21,19 @@ On the smudge side, I have not heard of a way to have the smudge filter
point to an existing file, it probably still needs to cat it out. Luckily point to an existing file, it probably still needs to cat it out. Luckily
that is only done at checkout anyway. that is only done at checkout anyway.
---- ### dealing with partial content availability
The smudge filter cannot be allowed to fail, that leaves the tree and
index in a weird state. So if a file's content is requested by calling
the smudge filter, the trick is to instead provide dummy content,
indicating it is not available (and perhaps saying to run "git-annex get").
Then, in the clean filter, it has to detect that it's cleaning a file
with that dummy content, and make sure to provide the same identifier as
it would if the file content was there.
I've a demo implementation of this technique in the scripts below.
The other trick may be doing it with partial content availability.
When a smudge filter fails, git leaves the tree and index in a very weird
state. More investigation needed.
### test files ### test files
@ -35,7 +43,11 @@ huge-smudge:
#!/bin/sh #!/bin/sh
read sha1 read sha1
echo "smudging $sha1" >&2 echo "smudging $sha1" >&2
cat ~/$sha1 if [ -e ~/$sha1 ]; then
cat ~/$sha1
else
echo "$sha1 not available"
fi
</pre> </pre>
huge-clean: huge-clean:
@ -43,6 +55,11 @@ huge-clean:
<pre> <pre>
#!/bin/sh #!/bin/sh
cat >temp cat >temp
if grep -q 'not available' temp; then
awk '{print $1}' temp # provide what we would if the content were avail!
rm temp
exit 0
fi
sha1=`sha1sum temp | cut -d' ' -f1` sha1=`sha1sum temp | cut -d' ' -f1`
echo "cleaning $sha1" >&2 echo "cleaning $sha1" >&2
ls -l temp >&2 ls -l temp >&2