summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2012-05-29 22:22:54 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2012-05-29 22:22:54 +0100
commit4a80c08ad3ccd7e829027ccfd9128d3756d41ae3 (patch)
treefea6cb6568865c886d5b3aae3fff4a16a22bbd8a /bin
parent3bfd0792bf1011b76db07aeba5f5c6903ed9bd60 (diff)
downloadgitano-4a80c08ad3ccd7e829027ccfd9128d3756d41ae3.tar.gz
BIN: Support tags in gitano-update-hook
Diffstat (limited to 'bin')
-rw-r--r--bin/gitano-update-hook23
1 files changed, 21 insertions, 2 deletions
diff --git a/bin/gitano-update-hook b/bin/gitano-update-hook
index 3e10ddf..7a5a66f 100644
--- a/bin/gitano-update-hook
+++ b/bin/gitano-update-hook
@@ -107,12 +107,31 @@ local oldtree, newtree
if oldsha == nullsha then
oldtree = repo.git:get(gitano.git.tree.empty_sha).content
else
- oldtree = repo.git:get(oldsha).content.tree.content
+ local thing = repo.git:get(oldsha)
+ if thing.type == "tag" then
+ thing = thing.content.object
+ end
+ if thing.type == "commit" then
+ oldtree = thing.content.tree.content
+ else
+ oldtree = repo.git:get(gitano.git.tree.empty_sha).content
+ gitano.log.warn("Odd, old object", oldsha, "is not a commit or tag")
+ end
end
+
if newsha == nullsha then
newtree = repo.git:get(gitano.git.tree.empty_sha).content
else
- newtree = repo.git:get(newsha).content.tree.content
+ local thing = repo.git:get(newsha)
+ if thing.type == "tag" then
+ thing = thing.content.object
+ end
+ if thing.type == "commit" then
+ newtree = thing.content.tree.content
+ else
+ newtree = repo.git:get(gitano.git.tree.empty_sha).content
+ gitano.log.warn("Odd, new object", oldsha, "is not a commit or tag")
+ end
end
-- First, populate gitano/starttree and gitano/targettree