Do not use symrefs for manually created Git refs

When creating the refs for the package base branch and the HEAD ref
workaround, directly use commit IDs instead of symrefs. It looks like
Git cannot pack symrefs, so this is expected to improve space
efficiency. Also, since the refs are now only created (or updated) when
new objects are actually received, this fixes a problem with dangling
refs that were created when a user initialized a repository but did not
push anything.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2015-06-11 13:58:43 +02:00
parent bd9af5f893
commit 2164750f1e
2 changed files with 10 additions and 17 deletions

View file

@ -285,3 +285,13 @@ for pkgname in srcinfo.GetPackageNames():
save_srcinfo(srcinfo, db, cur, user)
db.close()
# Create (or update) a branch with the name of the package base for better
# accessibility.
repo.create_reference('refs/heads/' + pkgbase, sha1_new, True)
# Work around a Git bug: The HEAD ref is not updated when using gitnamespaces.
# This can be removed once the bug fix is included in Git mainline. See
# http://git.661346.n2.nabble.com/PATCH-receive-pack-Create-a-HEAD-ref-for-ref-namespace-td7632149.html
# for details.
repo.create_reference('refs/namespaces/' + pkgbase + '/HEAD', sha1_new, True)