]> arthur.barton.de Git - bup.git/commitdiff
git.py: generalize update_ref() to support tags in addition to heads
authorRob Browning <rlb@defaultvalue.org>
Sun, 23 Mar 2014 18:10:01 +0000 (13:10 -0500)
committerRob Browning <rlb@defaultvalue.org>
Fri, 17 Oct 2014 19:43:05 +0000 (14:43 -0500)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
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))