Merge branch 'release-2.140.112'
[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 save_terminal_title
9
10 ##############
11
12 prune_dir="$1"
13 if [ -z "$prune_dir" ]; then
14   prune_dir="$(pwd)"
15 fi
16 pushd "$prune_dir" &>/dev/null
17 exit_on_error "changing to directory: $prune_dir"
18
19 echo "cleaning git repo in directory $(pwd)"
20
21 git fsck --full
22 exit_on_error "git fsck"
23
24 git gc --prune=today --aggressive
25 exit_on_error "git gc"
26
27 git repack
28 exit_on_error "git repack"
29
30 popd &>/dev/null
31
32 restore_terminal_title
33