summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Murty <james@murty.co>2014-05-24 14:21:34 +0100
committerJames Murty <james@murty.co>2014-05-24 14:22:47 +0100
commitf879d34548fe3181026d9e49bb24af1987db6892 (patch)
tree085c54da45fb996bc2a4d90f29edbf6f89e8b7d9
parent9f52324add1a4ededc8f47d11e90216f40cab497 (diff)
downloadgit-fat-f879d34548fe3181026d9e49bb24af1987db6892.tar.gz
Moved requirement for init to `checkout` operation.
Since `checkout` op is where the repo really needs to be init'ed for git-fat I moved the requirement to there. This way it is still triggered by a `pull` op, but only at the end after any files have been synced.
-rwxr-xr-xgit-fat2
-rwxr-xr-xtest.sh8
2 files changed, 8 insertions, 2 deletions
diff --git a/git-fat b/git-fat
index 7a9c00d..a2b4395 100755
--- a/git-fat
+++ b/git-fat
@@ -352,6 +352,7 @@ class GitFat(object):
sys.exit(p.returncode)
def checkout(self, show_orphans=False):
'Update any stale files in the present working tree'
+ self.assert_init_done()
for digest, fname in self.orphan_files():
objpath = os.path.join(self.objdir, digest)
if os.access(objpath, os.R_OK):
@@ -370,7 +371,6 @@ class GitFat(object):
def cmd_pull(self, args):
'Pull anything that I have referenced, but not stored'
self.setup()
- self.assert_init_done()
refargs = dict()
if '--all' in args:
refargs['all'] = True
diff --git a/test.sh b/test.sh
index a5ff2f6..33c6d66 100755
--- a/test.sh
+++ b/test.sh
@@ -32,7 +32,13 @@ git fat push
cd ..
git clone fat-test fat-test2
cd fat-test2
-# Pull should fail in repo not yet init'ed for git-fat
+# checkout and pull should fail in repo not yet init'ed for git-fat
+git fat checkout && true
+if [ $? -eq 0 ]
+then
+ echo 'ERROR: "git fat checkout" in uninitialised repo should fail'
+ exit 1
+fi
git fat pull -- 'a.fa*' && true
if [ $? -eq 0 ]
then