Skip to content

Commit

Permalink
fix handling of broken symlinks
Browse files Browse the repository at this point in the history
if a symlink has a length of self.magiclen git-fat would crash
because it could not read the file
  • Loading branch information
chhitz committed Aug 29, 2013
1 parent f0becae commit 776cc7c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion git-fat
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ class GitFat(object):
if stat.st_size != self.magiclen:
return False, None
# read file
digest, bytes = self.decode_stream(open(fname))
try:
digest, bytes = self.decode_stream(open(fname))
except IOError:
return False, None
if isinstance(digest, str):
return digest, bytes
else:
Expand Down
3 changes: 3 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ echo '*.fat filter=fat -crlf' > .gitattributes
git add .gitattributes .gitfat
git commit -m'Initial fat repository'

ln -s /oe/dss-oe/dss-add-ons-testing-build/deploy/licenses/common-licenses/GPL-3 c
git add c
git commit -m'add broken symlink'
echo 'fat content a' > a.fat
git add a.fat
git commit -m'add a.fat'
Expand Down

0 comments on commit 776cc7c

Please sign in to comment.