diff options
Diffstat (limited to 'lib/git/repo.py')
-rw-r--r-- | lib/git/repo.py | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/lib/git/repo.py b/lib/git/repo.py index 37847c98..b6624d8b 100644 --- a/lib/git/repo.py +++ b/lib/git/repo.py @@ -19,7 +19,7 @@ from config import GitConfigParser from remote import Remote def touch(filename): - fp = open(filename, "w") + fp = open(filename, "a") fp.close() def is_git_dir(d): @@ -432,11 +432,13 @@ class Repo(object): # start from the one which is fastest to evaluate default_args = ('--abbrev=40', '--full-index', '--raw') if index: + # diff index against HEAD if len(self.git.diff('HEAD', '--cached', *default_args)): return True # END index handling if working_tree: - if len(self.git.diff('HEAD', *default_args)): + # diff index against working tree + if len(self.git.diff(*default_args)): return True # END working tree handling if untracked_files: @@ -639,32 +641,23 @@ class Repo(object): Examples:: - >>> repo.archive(open("archive" + >>> repo.archive(open("archive")) <String containing tar.gz archive> - >>> repo.archive_tar_gz('a87ff14') - <String containing tar.gz archive for commit a87ff14> - - >>> repo.archive_tar_gz('master', 'myproject/') - <String containing tar.gz archive and prefixed with 'myproject/'> - Raise GitCommandError in case something went wrong + Returns + self """ if treeish is None: treeish = self.active_branch if prefix and 'prefix' not in kwargs: kwargs['prefix'] = prefix - kwargs['as_process'] = True kwargs['output_stream'] = ostream - proc = self.git.archive(treeish, **kwargs) - status = proc.wait() - if status != 0: - raise GitCommandError( "git-archive", status, proc.stderr.read() ) - - + self.git.archive(treeish, **kwargs) + return self def __repr__(self): return '<git.Repo "%s">' % self.path |