modified error handling methods
[feisty_meow.git] / scripts / rev_control / compact_git.sh
1 #!/bin/bash
2
3 # compresses the git archive in the folder specified.
4
5 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
6 source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh"
7
8 ##############
9
10 prune_dir="$1"
11 if [ -z "$prune_dir" ]; then
12   prune_dir="$(pwd)"
13 fi
14 pushd "$prune_dir" &>/dev/null
15 exit_on_error "changing to directory: $prune_dir"
16
17 echo "cleaning git repo in directory $(pwd)"
18
19 git fsck --full
20 exit_on_error "git fsck"
21
22 git gc --prune=today --aggressive
23 exit_on_error "git gc"
24
25 git repack
26 exit_on_error "git repack"
27
28 popd &>/dev/null
29