diff --git a/git-fat b/git-fat index 97315ea..50668f9 100755 --- a/git-fat +++ b/git-fat @@ -122,6 +122,10 @@ class GitFat(object): DecodeError = RuntimeError def __init__(self): self.verbose = verbose_stderr if os.environ.get('GIT_FAT_VERBOSE') else verbose_ignore + self.rsync_remote = os.environ.get('GIT_FAT_RSYNC_REMOTE') + self.rsync_ssh_port = os.environ.get('GIT_FAT_RSYNC_SSH_PORT') + self.rsync_ssh_user = os.environ.get('GIT_FAT_RSYNC_SSH_USER') + self.rsync_options = os.environ.get('GIT_FAT_RSYNC_OPTIONS') self.gitroot = subprocess.check_output('git rev-parse --show-toplevel'.split()).strip() self.gitdir = subprocess.check_output('git rev-parse --git-dir'.split()).strip() self.objdir = os.path.join(self.gitdir, 'fat', 'objects') @@ -137,10 +141,10 @@ class GitFat(object): mkdir_p(self.objdir) def get_rsync(self): cfgpath = os.path.join(self.gitroot,'.gitfat') - remote = gitconfig_get('rsync.remote', file=cfgpath) - ssh_port = gitconfig_get('rsync.sshport', file=cfgpath) - ssh_user = gitconfig_get('rsync.sshuser', file=cfgpath) - options = gitconfig_get('rsync.options', file=cfgpath) + remote = self.rsync_remote or gitconfig_get('rsync.remote', file=cfgpath) + ssh_port = self.rsync_ssh_port or gitconfig_get('rsync.sshport', file=cfgpath) + ssh_user = self.rsync_ssh_user or gitconfig_get('rsync.sshuser', file=cfgpath) + options = self.rsync_options or gitconfig_get('rsync.options', file=cfgpath) if remote is None: raise RuntimeError('No rsync.remote in %s' % cfgpath) return remote, ssh_port, ssh_user, options diff --git a/test.sh b/test.sh index e9c9163..44f6a44 100755 --- a/test.sh +++ b/test.sh @@ -38,3 +38,11 @@ git commit -m'add d with normal content' rm d git fat pull +# Test env var overrides rsync.remote from .gitfat file +mv .gitfat .gitfat.bak +cat - >> .gitfat <