On Sat, 16 Aug 2014 21:43:32 -0500
"'Terry Brown' via leo-editor" <[email protected]> wrote:

> On Sat, 16 Aug 2014 17:59:51 -0500
> "Edward K. Ream" <[email protected]> wrote:
> 
> > On Sat, Aug 16, 2014 at 5:38 PM, Edward K. Ream
> > <[email protected]> wrote:
> > 
> > > Interestingly, the Git error message actually gives the name of
> > > the temporary file that we want to get.  Something like::
> > >
> > >     C:\Users\edreamleo\AppData\Local\Temp\e2d01fyz.nak
> > >
> > > So the question is, how to pass this file to commit-msg.py.
> > 
> > Success!
> > 
> > I googled "git hooks on windows" and got:
> > http://stackoverflow.com/questions/18277429/executing-git-hooks-on-windows
> > 
> > QQQ
> > By default, Git for Windows executes hook scripts using its own
> > Windows port of the bash shell.
> > [snip]
> > #!/bin/sh
> > c:/Programs/PHP/php.exe c:/Data/Scripts/git-pre-push.phpcli "$@"
> > QQQ
> > 
> > So, I just added "$@" to get the arguments.  That is, commit-msg is
> > now::
> > 
> > #!/bin/sh
> > c:/Python27/python.exe
> > C:/leo.repo/leo-editor/.git/hooks/commit-msg.py "$@"
> 
> Ok, but we need a bash script that works in windows and unix (probably
> not hard) *and* can find D:/Python34/python.exe etc. as needed, seeing
> python's obviously not on the path when the hooks execute.

maybe

start "" ".git\\hooks\\commit-msg.py" "$@"

but I'm not sure - start works in batch files but presumably will only
work in bash if `start` is an executable and not internal to the batch
environment.

If `start` only works in a batch file, which I suspect is the case,
perhaps commit-msg the bash script can use cmd to invoke commit-msg.bat
the batch file which invokes commit-msg.py the python file.

As long as the return codes propagate ok :-/

Cheers -Terry

> Hmm, there's a thing you can do in a Windows batch file to open a
> target as if you've done it from the desktop, I can't remember what it
> is right now, but that might work *if* it's via a windows executable
> command you can invoke from bash, even if it's some weird invocation
> of cmd itself.  That might avoid the "find the path to python in
> Windows" issue.  I bet that's out there already somewhere, we can not
> be the first to tackle this.
> 
> > Now the commit "takes" and commit_timestamp.json is::
> > 
> > {
> >     "asctime": "Sat Aug 16 17:47:46 2014",
> >     "parent": "6d9af6f59679757d6d4fd34b9f3b66dc1d64be46",
> >     "timestamp": "20140816174746"
> > }
> > 
> > If I reload Leo, I get this in the log::
> > 
> > Leo 4.11 final, build 20140816174746, Sat Aug 16 17:47:46 2014
> > Git repo info: branch = master, commit = 50363ba888b4
> > 
> > This commit is correct,  I have no idea whether the parent in the
> > json is used.
> 
> No, I just threw that in - probably not useful.  We could log the
> committer's ID too, that seemed intrusive though, even though git kind
> of does that anyway.
> 
> Cheers -Terry
> 
> > Hmmm.  Maybe I had better update pre-commit too.  Hehe.
> > 
> > Edward
> > ------------------------------------------------------------------------------------------
> > Edward K. Ream: [email protected] Leo: http://leoeditor.com/
> > Speak the truth, but not to punish--Thich Nhat Hanh
> > ------------------------------------------------------------------------------------------
> > 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to