X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/blobdiff_plain/1777d8cd458bddb1a5f638e8928726167469154c..edf4f599dcc78b741df36bf835cc14a1e0bafedb:/stgit/git.py diff --git a/stgit/git.py b/stgit/git.py index 40d54ef..8306c85 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -82,13 +82,21 @@ __commits = dict() # Functions # +# GIT_DIR value cached +__base_dir = None + def get_base_dir(): """Different start-up variables read from the environment """ - if 'GIT_DIR' in os.environ: - return os.environ['GIT_DIR'] - else: - return _output_one_line('git-rev-parse --git-dir') + global __base_dir + + if not __base_dir: + if 'GIT_DIR' in os.environ: + __base_dir = os.environ['GIT_DIR'] + else: + __base_dir = _output_one_line('git-rev-parse --git-dir') + + return __base_dir def get_commit(id_hash): """Commit objects factory. Save/look-up them in the __commits @@ -485,7 +493,7 @@ def merge(base, head1, head2): local tree """ refresh_index() - if __run('git-read-tree -u -m', [base, head1, head2]) != 0: + if __run('git-read-tree -u -m --aggressive', [base, head1, head2]) != 0: raise GitException, 'git-read-tree failed (local changes maybe?)' # this can fail if there are conflicts