summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2014-08-25 12:11:23 -0700
committerDaniel Silverstone <dsilvers@digital-scurf.org>2014-08-25 12:11:23 -0700
commit0bd0c31a0184d30042c6942bbae0e772e6695141 (patch)
treecbe5834de85d264cdcc6b8271b2ef2738a69f341 /bin
parent13accf4d0633b33c5cfe340253dce6956191e789 (diff)
downloadgitano-0bd0c31a0184d30042c6942bbae0e772e6695141.tar.gz
Support indicating the object type (and tagged object and type) on update
Diffstat (limited to 'bin')
-rw-r--r--bin/gitano-update-hook.in27
1 files changed, 26 insertions, 1 deletions
diff --git a/bin/gitano-update-hook.in b/bin/gitano-update-hook.in
index 15da2a9..ca579ca 100644
--- a/bin/gitano-update-hook.in
+++ b/bin/gitano-update-hook.in
@@ -246,7 +246,32 @@ defer_generation "treediff/modified"
defer_generation "treediff/renamed"
defer_generation "treediff/renamedto"
--- Run the ruleset given the contextet
+-- Fill out source and target object types
+local function populate(sha, pfx)
+ if sha == ("0"):rep(40) then
+ context[pfx.."type"] = "empty"
+ else
+ local obj = repo.git:get(sha)
+ if not obj then
+ context[pfx.."type"] = "unknown"
+ else
+ context[pfx.."type"] = obj.type
+ if obj.type == 'tag' then
+ obj = obj.content.object
+ if not obj then
+ context[pfx.."taggedtype"] = "unknown"
+ else
+ context[pfx.."taggedtype"] = obj.type
+ context[pfx.."taggedsha"] = obj.sha
+ end
+ end
+ end
+ end
+end
+populate(context.oldsha, "old")
+populate(context.newsha, "new")
+
+-- Run the ruleset given the context
local action, reason = repo:run_lace(context)