The Lone C++ Coder's Blog

The Lone C++ Coder's Blog

The continued diary of an experienced C++ programmer. Thoughts on C++ and other languages I play with, Emacs, functional, non functional and sometimes non-functioning programming.

Timo Geusch

2-Minute Read

The default installation of msysgit (aka the official git client for Windows) is unfortunately built without python support. There are understandable reasons as to why this is, starting with “where the heck do I find the various python versions on Windows”. For me the problem was that I needed git-p4 to extract some code history out of a Perforce repository and guess what, git-p4 is written in Python. Only solution for me was that I had to find a way to make this work short of throwing Linux in a VM just to get a git import going.

It actually turned out to be fairly simple. The git-p4 that comes with the msysgit installation is a very basic placeholder that the main git executable runs via its shell. Getting the git-p4 plugin to work was a simple case of dropping the “real” git-p4.py from the Linux distribution into an appropriate location and then modifying git-p4 to run my local python with the appropriate command line. Just keep in mind that the shell used by msysgit is a unix shell so you need to make sure that the paths and parameters are in /bin/sh syntax and not in DOS batch syntax. Here’s my current hacked version of git-p4 that seems to do the job:

<br /> #!/bin/sh

c:/python27/python “c:/program files (x86)/Git/libexec/git-core/git-p4.py” $1 $2 $3 $4 $5 $6 $7 $8 $9

Recent Posts

Categories

About

A developer's journey. Still trying to figure out this software thing after several decades.