From c3ac18a45c976824abffd13fca8320757bb84b8a Mon Sep 17 00:00:00 2001 From: Christopher James Hayward Date: Wed, 30 Jun 2021 08:47:26 -0400 Subject: [PATCH] Add git-fix shim to fix local repo corruptions --- README.org | 15 ++++++++++++++- modules/git.nix | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/README.org b/README.org index 8bcbaa5..b896653 100644 --- a/README.org +++ b/README.org @@ -1291,7 +1291,20 @@ Git[fn:37] is a free and open source distributed version control system designed # <> { pkgs, ... }: -{ +let + # Fix any corruptions in the local copy. + myGitFix = pkgs.writeShellScriptBin "git-fix" '' + if [ -d .git/objects/ ]; then + find ./git/objects/ -type f -empty | xargs rm -f + git fetch -p + git fsck --full + fi + exit 1 + ''; + +in { + home.packages = [ myGitFix ]; + programs.git = { enable = true; userName = "Christopher James Hayward"; diff --git a/modules/git.nix b/modules/git.nix index fbfa79b..49d140a 100644 --- a/modules/git.nix +++ b/modules/git.nix @@ -1,7 +1,20 @@ # This file is controlled by /etc/dotfiles/README.org { pkgs, ... }: -{ +let + # Fix any corruptions in the local copy. + myGitFix = pkgs.writeShellScriptBin "git-fix" '' + if [ -d .git/objects/ ]; then + find ./git/objects/ -type f -empty | xargs rm -f + git fetch -p + git fsck --full + fi + exit 1 + ''; + +in { + home.packages = [ myGitFix ]; + programs.git = { enable = true; userName = "Christopher James Hayward";