diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2013-05-01 16:12:46 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2013-05-01 16:12:46 +0100 |
commit | f645f8e503311d4130da9047ee9bc43aec5dc8c7 (patch) | |
tree | ec31323c0bfcce1fb3d5161851fe12bd9657f317 | |
parent | efc57ce772d4746cb42c57be84689c5b1a5f6120 (diff) | |
download | gitano-f645f8e503311d4130da9047ee9bc43aec5dc8c7.tar.gz |
REPOSITORY: Cope better with various cases of branch deletion
-rw-r--r-- | lib/gitano/repository.lua | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/gitano/repository.lua b/lib/gitano/repository.lua index 1634182..f512092 100644 --- a/lib/gitano/repository.lua +++ b/lib/gitano/repository.lua @@ -299,6 +299,9 @@ function repo_method:check_and_upgrade_hooks() end function repo_method:validate_admin_sha(sha) + if sha == string.rep("0", 40) then + return nil, "A deleted admin ref cannot be loaded" + end local commit = self.git:get(sha) local tree = gall.tree.flatten(commit.content.tree.content) @@ -534,14 +537,16 @@ function repo_method:update_modified_date(shas) f:close() end for _, sha in pairs(shas) do - local obj = self.git:get(sha) - if obj.type == "tag" then - local tagger = obj.content.tagger - update_based_on(tagger.unixtime, tagger.timezone) - elseif obj.type == "commit" then - local committer, author = obj.content.committer, obj.content.author - update_based_on(committer.unixtime, committer.timezone) - update_based_on(author.unixtime, author.timezone) + if sha ~= string.rep("0", 40) then + local obj = self.git:get(sha) + if obj.type == "tag" then + local tagger = obj.content.tagger + update_based_on(tagger.unixtime, tagger.timezone) + elseif obj.type == "commit" then + local committer, author = obj.content.committer, obj.content.author + update_based_on(committer.unixtime, committer.timezone) + update_based_on(author.unixtime, author.timezone) + end end end f = io.open(modfile, "w") |