summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Spurk <christian.spurk@gmail.com>2014-05-09 11:05:50 +0200
committerChristian Spurk <christian.spurk@gmail.com>2014-05-09 11:05:50 +0200
commit3273f6b4c5390e2f3de56e9ec015184f32d10588 (patch)
treec3c66e9dd9b634aa5c87082176923664dc6b78b2
parent7cb170a7101c3b8599b6aa7765600108c83013dd (diff)
downloadgit-fat-3273f6b4c5390e2f3de56e9ec015184f32d10588.tar.gz
fix OSError on “git fat pull” with manually removed, tracked files in WC
If there is any manually removed, tracked file in the working copy, then running “git fat pull” fails with an OSError without this fix.
-rwxr-xr-xgit-fat5
-rwxr-xr-xtest.sh6
2 files changed, 10 insertions, 1 deletions
diff --git a/git-fat b/git-fat
index 9d4b1a1..f89cf59 100755
--- a/git-fat
+++ b/git-fat
@@ -195,7 +195,10 @@ class GitFat(object):
return itertools.chain([preamble], readblocks(stream)), None
def decode_file(self, fname):
# Fast check
- stat = os.lstat(fname)
+ try:
+ stat = os.lstat(fname)
+ except OSError:
+ return False, None
if stat.st_size != self.magiclen:
return False, None
# read file
diff --git a/test.sh b/test.sh
index e4ee3bb..e9c9163 100755
--- a/test.sh
+++ b/test.sh
@@ -32,3 +32,9 @@ cd fat-test2
git fat init
git fat pull -- 'a.fa*'
cat a.fat
+echo 'file which is committed and removed afterwards' > d
+git add d
+git commit -m'add d with normal content'
+rm d
+git fat pull
+