]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/git.py
git.py: generalize update_ref() to support tags in addition to heads
[bup.git] / lib / bup / git.py
index 4825a19820f813227304131ac79374d899000fb2..d09fc3f5b21f5276e99a730c210ef6e7c56c44c2 100644 (file)
@@ -872,10 +872,11 @@ def rev_parse(committish, repo_dir=None):
 
 
 def update_ref(refname, newval, oldval, repo_dir=None):
-    """Change the commit pointed to by a branch."""
+    """Update a repository reference."""
     if not oldval:
         oldval = ''
-    assert(refname.startswith('refs/heads/'))
+    assert(refname.startswith('refs/heads/') \
+           or refname.startswith('refs/tags/'))
     p = subprocess.Popen(['git', 'update-ref', refname,
                           newval.encode('hex'), oldval.encode('hex')],
                          preexec_fn = _gitenv(repo_dir))