Created
October 21, 2011 23:52
-
-
Save capttwinky/1305294 to your computer and use it in GitHub Desktop.
run git gc on all your dirs!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import os | |
| from subprocess import Popen, PIPE | |
| myWorkDir = '/home/jpmcgrady/workspace' | |
| def runGc(dirNameIn): | |
| os.chdir(dirNameIn) | |
| try: | |
| output = Popen(["git", "gc"], stdout=PIPE).communicate()[0] | |
| if output: print output | |
| return True | |
| except: | |
| return False | |
| if __name__ == '__main__': | |
| myDirs = ["%s/%s"%(myWorkDir,myDir) for myDir in os.listdir(myWorkDir) if os.path.isdir("%s/%s"%(myWorkDir,myDir))] | |
| print myDirs | |
| for thisDir in myDirs: | |
| print "%s->%s"%(thisDir, runGc(thisDir)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment