Advertisement
Guest User

Untitled

a guest
Aug 19th, 2014
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. diff --git a/morphlib/gitdir.py b/morphlib/gitdir.py
  2. index fea26c2..6b04b77 100644
  3. --- a/morphlib/gitdir.py
  4. +++ b/morphlib/gitdir.py
  5. @@ -355,6 +355,7 @@ class GitDirectory(object):
  6. # so we just use the provided dirname
  7. if not self.dirname:
  8. self.dirname = dirname
  9. + self._config = {}
  10.  
  11. def _runcmd(self, argv, **kwargs):
  12. '''Run a command at the root of the git directory.
  13. @@ -447,12 +448,15 @@ class GitDirectory(object):
  14. '''
  15.  
  16. self._runcmd(['git', 'config', key, value])
  17. + self._config[key] = value
  18.  
  19. def get_config(self, key):
  20. '''Return value for a git repository configuration variable.'''
  21.  
  22. - value = self._runcmd(['git', 'config', '-z', key])
  23. - return value.rstrip('\0')
  24. + if key not in self._config:
  25. + value = self._runcmd(['git', 'config', '-z', key])
  26. + self._config[key] = value.rstrip('\0')
  27. + return self._config[key]
  28.  
  29. def get_remote(self, *args, **kwargs):
  30. '''Get a remote for this Repository.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement