summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-18 13:24:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-18 13:24:55 -0400
commit0f99873417030ee9f5375fca12022879d8e5727f (patch)
tree9288f95245410818a2a7af28d7bdc6b7f9099383
parente82e13dea5c3daf1053d4322b5579d01074712c1 (diff)
moving git-repair to its own package
-rw-r--r--.gitignore2
-rw-r--r--Git/Repair.hs6
-rw-r--r--Makefile6
-rw-r--r--doc/git-recover-repository.mdwn40
-rw-r--r--git-recover-repository.hs42
5 files changed, 4 insertions, 92 deletions
diff --git a/.gitignore b/.gitignore
index 221087847..532f1e3ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,8 +15,6 @@ git-annex.1
git-annex-shell.1
git-union-merge
git-union-merge.1
-git-recover-repository
-git-recover-repository.1
doc/.ikiwiki
html
*.tix
diff --git a/Git/Repair.hs b/Git/Repair.hs
index 4265f8796..270b04182 100644
--- a/Git/Repair.hs
+++ b/Git/Repair.hs
@@ -525,10 +525,10 @@ runRepairOf fsckresult forced referencerepo g = do
unsuccessfulfinish stillmissing = do
if repoIsLocalBare g
then do
- putStrLn "If you have a clone of this bare repository, you should add it as a remote of this repository, and re-run git-recover-repository."
- putStrLn "If there are no clones of this repository, you can instead run git-recover-repository with the --force parameter to force recovery to a possibly usable state."
+ putStrLn "If you have a clone of this bare repository, you should add it as a remote of this repository, and retry."
+ putStrLn "If there are no clones of this repository, you can instead retry with the --force parameter to force recovery to a possibly usable state."
return (False, stillmissing, [])
else needforce stillmissing
needforce stillmissing = do
- putStrLn "To force a recovery to a usable state, run this command again with the --force parameter."
+ putStrLn "To force a recovery to a usable state, retry with the --force parameter."
return (False, stillmissing, [])
diff --git a/Makefile b/Makefile
index 7baa18b3f..541efaecd 100644
--- a/Makefile
+++ b/Makefile
@@ -30,12 +30,8 @@ git-annex-shell.1: doc/git-annex-shell.mdwn
# These are not built normally.
git-union-merge.1: doc/git-union-merge.mdwn
./Build/mdwn2man git-union-merge 1 doc/git-union-merge.mdwn > git-union-merge.1
-git-recover-repository.1: doc/git-recover-repository.mdwn
- ./Build/mdwn2man git-recover-repository 1 doc/git-recover-repository.mdwn > git-recover-repository.1
git-union-merge:
$(GHC) --make -threaded $@
-git-recover-repository:
- $(GHC) --make -threaded $@
install-mans: $(mans)
install -d $(DESTDIR)$(PREFIX)/share/man/man1
@@ -82,7 +78,7 @@ clean:
doc/.ikiwiki html dist tags Build/SysConfig.hs build-stamp \
Setup Build/InstallDesktopFile Build/EvilSplicer \
Build/Standalone Build/OSXMkLibs \
- git-union-merge git-recover-repository
+ git-union-merge
find . -name \*.o -exec rm {} \;
find . -name \*.hi -exec rm {} \;
diff --git a/doc/git-recover-repository.mdwn b/doc/git-recover-repository.mdwn
deleted file mode 100644
index dac4a310b..000000000
--- a/doc/git-recover-repository.mdwn
+++ /dev/null
@@ -1,40 +0,0 @@
-# NAME
-
-git-recover-repository - Fix a broken git repository
-
-# SYNOPSIS
-
-git-recover-repository [--force]
-
-# DESCRIPTION
-
-This can fix a corrupt or broken git repository, which git fsck would
-only complain has problems.
-
-It does by deleting all corrupt objects, and retreiving all missing
-objects that it can from the remotes of the repository.
-
-If that is not sufficient to fully recover the repository, it can also
-reset branches back to commits before the corruption happened, delete
-branches that are no longer available due to the lost data, and remove any
-missing files from the index. It will only do this if run with the
-`--force` option, since that rewrites history and throws out missing data.
-Note that the `--force` option never touches tags, even if they are no
-longer usable due to missing data.
-
-After running this command, you will probably want to run `git fsck` to
-verify it fixed the repository. Note that fsck may still complain about
-objects referenced by the reflog, or the stash, if they were unable to be
-recovered. This command does not try to clean up either the reflog or the
-stash.
-
-Since this command unpacks all packs in the repository, you may want to
-run `git gc` afterwards.
-
-# AUTHOR
-
-Joey Hess <joey@kitenet.net>
-
-<http://git-annex.branchable.com/>
-
-Warning: Automatically converted into a man page by mdwn2man. Edit with care
diff --git a/git-recover-repository.hs b/git-recover-repository.hs
deleted file mode 100644
index 3e348f5bb..000000000
--- a/git-recover-repository.hs
+++ /dev/null
@@ -1,42 +0,0 @@
-{- git-recover-repository program
- -
- - Copyright 2013 Joey Hess <joey@kitenet.net>
- -
- - Licensed under the GNU GPL version 3 or higher.
- -}
-
-import System.Environment
-import qualified Data.Set as S
-import Data.Tuple.Utils
-
-import Common
-import qualified Git
-import qualified Git.CurrentRepo
-import qualified Git.Fsck
-import qualified Git.Repair
-import qualified Git.Config
-import qualified Git.Branch
-
-header :: String
-header = "Usage: git-recover-repository"
-
-usage :: a
-usage = error $ "bad parameters\n\n" ++ header
-
-parseArgs :: IO Bool
-parseArgs = do
- args <- getArgs
- return $ or $ map parse args
- where
- parse "--force" = True
- parse _ = usage
-
-main :: IO ()
-main = do
- forced <- parseArgs
-
- g <- Git.Config.read =<< Git.CurrentRepo.get
- ifM (fst3 <$> Git.Repair.runRepair forced g)
- ( exitSuccess
- , exitFailure
- )