diff options
author | James Murty <james@murty.co> | 2014-05-23 16:20:30 +0100 |
---|---|---|
committer | James Murty <james@murty.co> | 2014-05-23 16:20:30 +0100 |
commit | 9f52324add1a4ededc8f47d11e90216f40cab497 (patch) | |
tree | 6732d80979632f40ba3f50a99134095736f6e701 /git-fat | |
parent | 456d22cb3c7ba60e15d5d0f7de771c2acf573481 (diff) | |
download | git-fat-9f52324add1a4ededc8f47d11e90216f40cab497.tar.gz |
Fail with a clear error if 'git fat pull' is run on uninitialised repo.
This fixes issue #25 in the original project.
Diffstat (limited to 'git-fat')
-rwxr-xr-x | git-fat | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -370,6 +370,7 @@ 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 @@ -414,9 +415,15 @@ class GitFat(object): fname = os.path.join(self.objdir, obj) print('%10d %s' % (os.stat(fname).st_size, obj)) os.remove(fname) + def is_init_done(self): + return gitconfig_get('filter.fat.clean') or gitconfig_get('filter.fat.smudge') + def assert_init_done(self): + if not self.is_init_done(): + print('Git fat is not yet configured in this repository, run "git fat init"') + sys.exit(1) def cmd_init(self): self.setup() - if gitconfig_get('filter.fat.clean') or gitconfig_get('filter.fat.smudge'): + if self.is_init_done(): print('Git fat already configured, check configuration in .git/config') else: gitconfig_set('filter.fat.clean', 'git-fat filter-clean') |