From d396dd9d332ec0fe88c930b7f8a5e2754c602fc4 Mon Sep 17 00:00:00 2001 From: Martin Kemp Date: Thu, 12 Dec 2013 12:24:08 +0000 Subject: [PATCH] Initial commit of gitcleanup.py Initial commit of gitcleanup.py --- gitcleanup.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 gitcleanup.py diff --git a/gitcleanup.py b/gitcleanup.py new file mode 100644 index 0000000..57213bd --- /dev/null +++ b/gitcleanup.py @@ -0,0 +1,24 @@ +import os + +def main(): + cwd = os.getcwd() + os.chdir(cwd + '\\vendor\\msysgit\\libexec\\git-core\\') + for file_ in os.listdir(cwd + '\\vendor\\msysgit\\libexec\\git-core\\'): + if file_ == 'git.exe' or file_ == 'mergetools' or file_.endswith('.bat'): + continue # Ignore main git exe, mergetools folder and already created batch files. + if file_.endswith('.exe'): + with open(os.path.splitext(file_)[0] + '.bat', 'w') as out: + out.write('@ECHO OFF\n' + os.path.splitext(file_)[0].replace('-',' ') + ' $*') + os.remove(file_) + # print 'Cleaned out ' + file_ + continue + else: + with open(file_ + '.bat', 'w') as out: + out.write('@ECHO OFF\n' + file_.replace('-', ' ') + ' $*') + os.remove(file_) + # print 'Cleaned out ' + file_ + continue + pass + +if __name__ == '__main__': + main()