summaryrefslogtreecommitdiff
path: root/lib/gitano/repocommand.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitano/repocommand.lua')
-rw-r--r--lib/gitano/repocommand.lua21
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)
end
+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)
+end
+
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))
end
return {