path: root/lib/gitano/repocommand.lua
diff options
authorDaniel Silverstone <>2013-05-27 10:17:31 +0100
committerDaniel Silverstone <>2013-05-27 10:17:31 +0100
commit4193ec5ef29d6375191df5683d6eb2b18f18e720 (patch)
tree99c97f3e4012b57ac7d1ba299d881c362ef8a928 /lib/gitano/repocommand.lua
parentefc8035be1ba941b95f194bfa66642839baf3a53 (diff)
REPOCOMMAND: Add fsck command
This adds an fsck command to the repocommand module. This allows git-fsck to be invoked on repositories in a Gitano instance.
Diffstat (limited to 'lib/gitano/repocommand.lua')
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/gitano/repocommand.lua b/lib/gitano/repocommand.lua
index 6cdcf0a..4d70a8b 100644
--- a/lib/gitano/repocommand.lua
+++ b/lib/gitano/repocommand.lua
@@ -38,6 +38,21 @@ local function builtin_count_objects_prep(config, repo, cmdline, context)
return repo:run_lace(context)
+local builtin_fsck_short = "Perform a fsck operation on a repository"
+local builtin_fsck_helptext = [[
+usage: fsck repo [options]
+Runs the git fsck process in your repository.
+You must have write access to the repository in order
+to run fsck.
+local function builtin_fsck_prep(config, repo, cmdline, context)
+ context.operation = "write"
+ return repo:run_lace(context)
local function builtin_simple_validate(config, repo, cmdline)
if not repo or repo.is_nascent then
log.error("Unable to proceed, repository does not exist")
@@ -58,11 +73,15 @@ local function register_repocommand(register_cmd)
assert(register_cmd("gc", builtin_gc_short, builtin_gc_helptext,
builtin_simple_validate, builtin_gc_prep,
builtin_simple_run, true, false))
assert(register_cmd("count-objects", builtin_count_objects_short,
builtin_count_objects_helptext, builtin_simple_validate,
builtin_count_objects_prep, builtin_simple_run,
true, false))
+ assert(register_cmd("fsck", builtin_fsck_short, builtin_fsck_helptext,
+ builtin_simple_validate, builtin_fsck_prep,
+ builtin_simple_run, true, false))
return {