view .shell.d/50.git_functions.sh @ 372:ce87db9038f5

havepatch: new script to easily check if a mailed patch is applied Right now this only works on the hg repo, and it assumes the patch was applied as a descendant of 3.5 to keep the checks quick. In a perfect world I'd be able to do this all with obsolete marker checks, but that doesn't seem to be a good option yet.
author Augie Fackler <raf@durin42.com>
date Tue, 13 Oct 2015 11:04:51 -0400
parents 0cd241f35c40
children
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
}
alias git-repack-all=git_repack_all

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
}
alias git-fsck-all=git_fsck_all