summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)