'git pull' also updates the HEAD but StGIT did not flush the cached value
causing problems with pulling.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
- __head = val
- if __run('git-update-ref HEAD', [val]) != 0:
- raise GitException, 'Could not update HEAD to "%s".' % val
+ if not __head or __head != val:
+ if __run('git-update-ref HEAD', [val]) != 0:
+ raise GitException, 'Could not update HEAD to "%s".' % val
+ __head = val
+
+def __clear_head_cache():
+ """Sets the __head to None so that a re-read is forced
+ """
+ global __head
+
+ __head = None
def rev_parse(git_id):
"""Parse the string and return a verified SHA1 id
def rev_parse(git_id):
"""Parse the string and return a verified SHA1 id
"""Pull changes from the remote repository. At the moment, just
use the 'git pull' command
"""
"""Pull changes from the remote repository. At the moment, just
use the 'git pull' command
"""
+ # 'git pull' updates the HEAD
+ __clear_head_cache()
+
args = [repository]
if refspec:
args.append(refspec)
args = [repository]
if refspec:
args.append(refspec)