Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
fc873d6
Cherry picks with modifications from Ozkan's jdsu-ger branch.
woytowgme2 Nov 24, 2014
94fbe41
Test for more fine grained @{upstream} being set instead of whether a…
woytowgme2 Nov 25, 2014
1d7911c
Ignore stderr when checking for upstream
gunterw Nov 27, 2014
8a4d4b7
Revert to make work with Python 2.7 which is what is on my system
gunterw Nov 27, 2014
80444c3
Add the filename to fat object names to allow easier assocation betwe…
woytowgme2 Nov 28, 2014
500adfd
Update previous commit so that is works with files in subdirectories
woytowgme2 Nov 28, 2014
f8cc1ca
Fixed some bugs with new full path scheme for fat objects
woytowgme2 Nov 29, 2014
2c8926c
Fix git fat verify so it works with full path objdir files.
woytowgme2 Nov 29, 2014
88bbfaa
Default git fat find arg to 0 if not present.
woytowgme2 Nov 29, 2014
3651da5
Cleanup help descriptions
woytowgme2 Nov 29, 2014
079ca7c
Fixed bug with file renames that have same blob but different tree ob…
gunterw Dec 1, 2014
52bf266
Add git2fat script which takes an existing git repo and converts it i…
gunterw Dec 1, 2014
fdd6f50
Remove debug prints accidentally checked in.
gunterw Dec 1, 2014
7a993cd
Added new git fat share command to easily change the share path value
woytowgme2 Dec 2, 2014
55e61e7
Update git2fat to use new default share configuration
gunterw Dec 2, 2014
55036d1
Update the hook scripts if anything is initialized.
gunterw Dec 4, 2014
1bee9a6
Alway call cmd_init, so git fat init is no longer needed (but still p…
gunterw Dec 5, 2014
da155dc
More updates for git share to allow easier recovery from share changing.
gunterw Dec 6, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Alway call cmd_init, so git fat init is no longer needed (but still p…
…resent for backward compat)
  • Loading branch information
gunterw committed Dec 5, 2014
commit 1bee9a65572609ebed67e51eab46b8c6c76abdc9
25 changes: 10 additions & 15 deletions git-fat
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ class GitFat(object):
return len(enc(hashlib.sha1('dummy').hexdigest(), 5))
self.magiclen = magiclen(self.encode) # Current version
self.magiclens = [magiclen(enc) for enc in [self.encode_v1, self.encode_v2]] # All prior versions
def setup(self):
mkdir_p(self.objdir)
def is_init_done(self):
return gitconfig_get('filter.fat.clean') or gitconfig_get('filter.fat.smudge')
def assert_init_done(self):
Expand Down Expand Up @@ -335,11 +333,11 @@ class GitFat(object):
The clean filter runs when a file is added to the index. It gets the "smudged" (tree)
version of the file on stdin and produces the "clean" (repository) version on stdout.
'''
self.setup()
self.cmd_init()
self.filter_clean(sys.stdin, sys.stdout, fname)

def cmd_filter_smudge(self, fname):
self.setup()
self.cmd_init()
result, bytes = self.decode_stream(sys.stdin)
if isinstance(result, str): # We got a digest
objfile = fname + '.' + result
Expand Down Expand Up @@ -456,7 +454,6 @@ class GitFat(object):
return fatfiles

def cmd_status(self, args):
self.setup()
catalog = self.catalog_objects()
refargs = dict()
if '--all' in args:
Expand Down Expand Up @@ -502,10 +499,10 @@ class GitFat(object):
sys.exit(p.returncode)
self.convert_objfile_to_symlink(self.catalog_objects(), share)
def cmd_pre_push(self, args):
self.cmd_init()
self.cmd_push("")
def cmd_push(self, args):
'Push all fat files that I have stored and referenced'
self.setup()
(remote, share) = self.get_fat_configs()
if remote is None:
return
Expand Down Expand Up @@ -548,12 +545,13 @@ class GitFat(object):
if p.returncode:
sys.exit(p.returncode)
def cmd_post_merge(self, args):
self.cmd_init()
self.cmd_pull("")
def cmd_pre_rebase(self, args):
self.cmd_init()
self.cmd_pull("")
def cmd_pull(self, args):
'Pull anything that I have referenced, but not stored'
self.setup()
(remote, share) = self.get_fat_configs()
if remote is None:
return
Expand Down Expand Up @@ -626,34 +624,30 @@ class GitFat(object):
ret = self.fat_init_one('filter.fat.smudge', 'git-fat filter-smudge %f') or ret
ret = self.fat_init_one('filter.fat.required', 'true') or ret
post_merge = os.path.join(self.gitdir, 'hooks', 'post-merge')
if ret or not os.path.isfile(post_merge):
if not os.path.isfile(post_merge):
with open(post_merge, "w") as f:
lines = ["#!/bin/sh\n", "git-fat post-merge \"$@\"\n"]
f.writelines(lines)
os.chmod(post_merge, 0755)
ret = True
pre_rebase = os.path.join(self.gitdir, 'hooks', 'pre-rebase')
if ret or not os.path.isfile(pre_rebase):
if not os.path.isfile(pre_rebase):
with open(pre_rebase, "w") as f:
lines = ["#!/bin/sh\n", "git-fat pre-rebase \"$@\"\n"]
f.writelines(lines)
os.chmod(pre_rebase, 0755)
ret = True
pre_push = os.path.join(self.gitdir, 'hooks', 'pre-push')
if ret or not os.path.isfile(pre_push):
if not os.path.isfile(pre_push):
with open(pre_push, "w") as f:
lines = ["#!/bin/sh\n", "git-fat pre-push \"$@\"\n"]
f.writelines(lines)
os.chmod(pre_push, 0755)
ret = True
pre_commit = os.path.join(self.gitdir, 'hooks', 'pre-commit')
if ret and os.path.isfile(pre_commit):
os.remove(pre_commit)
return ret
def cmd_init(self):
self.setup()
mkdir_p(self.objdir)
if self.fat_init_all() is True:
#self.cmd_post_merge("")
print('Initialized git fat')
def gen_large_blobs(self, revs, threshsize):
"""Build dict of all blobs"""
Expand Down Expand Up @@ -850,6 +844,7 @@ class GitFat(object):

if __name__ == '__main__':
fat = GitFat()
fat.cmd_init()
cmd = sys.argv[1] if len(sys.argv) > 1 else ''
if cmd == 'filter-clean':
fat.cmd_filter_clean(sys.argv[2])
Expand Down
13 changes: 0 additions & 13 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@ git fat push
cd ..
git clone fat-test fat-test2
cd fat-test2
# 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
echo 'ERROR: "git fat pull" in uninitialised repo should fail'
exit 1
fi
git fat init
git fat pull -- 'a.fa*'
cat a.fat
Expand Down