view .shell.d/50.git_functions.sh @ 221:6aad20d9fcb0

emacs gui: move gui initialization code to a function Given the weirdness observed in gui init with daemon mode, this should make life with daemon mode easier.
author Augie Fackler <durin42@gmail.com>
date Tue, 07 Sep 2010 19:33:23 -0500
parents 0590f34b92a0
children 0cd241f35c40
line wrap: on
line source

# git utility functions

function git_next_unmerged_file() {
  git status | egrep '(unmerged|both modified)' | head -n 1 | sed 's/.*:   //'
}
alias git-next-unmerged-file=git_next_unmerged_file

function git_repack_all() {
  for repo in $(find . | \
      grep '/objects/pack/' | \
      sed -e 's%\.git/objects/pack/.*%%' | \
      sed -e 's%git/objects/pack/.*%git%' | sort | uniq) ; do
    pushd $repo
    git repack -ad --window 100
    git gc --prune="`date`"
    popd
  done
}

function git_fsck_all() {
  for repo in $(find . | \
      grep '/objects/pack/' | \
      sed -e 's%\.git/objects/pack/.*%%' | \
      sed -e 's%git/objects/pack/.*%git%' | sort | uniq) ; do
    pushd $repo
    git fsck
    popd
  done
}