Advertisement
Guest User

Untitled

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