diff options
-rw-r--r-- | README.markdown | 3 | ||||
-rwxr-xr-x | bin/fgscr | 4 | ||||
-rwxr-xr-x | bin/gscr | 15 | ||||
-rw-r--r-- | man/man1/fgscr.1 | 16 | ||||
-rw-r--r-- | man/man1/gscr.1 | 19 |
5 files changed, 57 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown index 235d16f6..544f3763 100644 --- a/README.markdown +++ b/README.markdown @@ -299,9 +299,12 @@ Installed by the `install-bin` target: and have working secure versions; requires `curl(1)` * `edda(1)` provides a means to run `ed(1)` over a set of files preserving any options, mostly useful for scripts. +* `fgscr(1)` finds Git repositories in a directory root and scrubs them with + `gscr(1)`. * `gms(1)` runs a set of `getmailrc` files; does much the same thing as the script `getmails` in the `getmail` suite, but runs the requests in parallel and does up to three silent retries using `try(1)` +* `gscr(1)` scrubs Git repositories. * `han(1)` provides a `keywordprg` for Vim's Bash script filetype that will look for `help` topics. You could use it from the shell too. * `igex(1)` wraps around a command to allow you to ignore error conditions diff --git a/bin/fgscr b/bin/fgscr new file mode 100755 index 00000000..2a50cc20 --- /dev/null +++ b/bin/fgscr @@ -0,0 +1,4 @@ +#!/bin/sh +# Find all the Git repositories in a directory and scrub them all +hash gscr || exit +find "${@:-.}" -name '.git' -exec gscr {} + diff --git a/bin/gscr b/bin/gscr new file mode 100755 index 00000000..b96da8d7 --- /dev/null +++ b/bin/gscr @@ -0,0 +1,15 @@ +#!/bin/sh +# Scrub a Git repository +for arg in "${@:?}" ; do + case $arg in + *.git) + cd -- "$arg" || continue + ;; + *) + cd -- "$arg"/.git || continue + ;; + esac + git fsck || continue + git reflog expire --expire=now || continue + git gc --prune=now --aggressive || continue +done diff --git a/man/man1/fgscr.1 b/man/man1/fgscr.1 new file mode 100644 index 00000000..a3884e41 --- /dev/null +++ b/man/man1/fgscr.1 @@ -0,0 +1,16 @@ +.TH GSCR 1 "July 2016" "Manual page for fgscr" +.SH NAME +.B fgscr +\- find Git repositories and scrub them with gscr(1) +.SH SYNOPSIS +.B fgscr +.br +.B fgscr /path1 /path2 +.SH DESCRIPTION +.B fgscr +searches for Git repositories recursively with the given ancestor directory +(defaults to the current directory), and runs gscr(1) over them. +.SH SEE ALSO +git(1), gscr(1) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/gscr.1 b/man/man1/gscr.1 new file mode 100644 index 00000000..495b6a33 --- /dev/null +++ b/man/man1/gscr.1 @@ -0,0 +1,19 @@ +.TH GSCR 1 "July 2016" "Manual page for gscr" +.SH NAME +.B gscr +\- scrub a Git repository to pack it and reduce its size +.SH SYNOPSIS +.B gscr +/path/to/project/.git +.br +.B gscr +/path/to/project1 /path/to/project2 +.SH DESCRIPTION +.B gscr +runs the git fsck, reflog --expire, and gc commands to get rid of dangling +commit objects in a repository and pack the repository down as small as +possible. Each command will only run if the one before it exited non-zero. +.SH SEE ALSO +git(1), fgscr(1) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> |