Skip to content

Instantly share code, notes, and snippets.

@dcolish
Created January 6, 2011 00:05
Show Gist options
  • Save dcolish/767271 to your computer and use it in GitHub Desktop.
Save dcolish/767271 to your computer and use it in GitHub Desktop.
If you use HG or GIT, now you dont need to remember type of repo you're in
function selectvcs() {
case `stat -qn -f "%N" $1/.{git,hg}` in
*.git) echo "git" ;;
*.hg) echo "hg" ;;
//./) exit -1 ;;
*) $(selectvcs "`dirname ${1}`") ;;
esac
}
$(selectvcs $PWD) $@
@dcolish
Copy link
Author

dcolish commented Jan 6, 2011

I like stat!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment