threads / discuss / 11396

[msysgit] how to detect git.exe directory?

Subject: [msysgit] how to detect git.exe directory?

## tl;dr

6 messages between Dec 23, 2007 and Dec 23, 2007.

replies: 5people: 5as markdown or json

Marco Costalba· Dec 23, 2007, 16:25 UTC · lore
Hi all,
   I'm progressing on qgit installer for windows, I have switched to
MSVC for compiling Qt4 and qgit sources and I have to say that first
results are very good, qgit.exe now seems to work without problems or
artifacts and the speed is much more similar to what we achieve under
the Linux platform (read much higher).
So it seems Qt+mingw is not the _best_ possible solution.

Anyhow, under Vista you cannot simply copy qgit.exe in the git directory (OS barfs regarding some administrative rights, note that *I am* the administartor!), so to make qgit.exe work git.exe file must be in PATH.

To easy the user and allowing to call qgit.exe double clicking on a nice desktop icon I need a way to know where git.exe is installed *at runtime*.

So my question is: "What is the preferred way to detect git directory at runtime for msysgit files?"

- environment variable ??
- windows registry ??
- others ?

I don't plan to use the cygwin version of git but going directly to the "long term" solution that is msysgit.

Thanks for your help Marco

Abdelrazak Younes· Dec 23, 2007, 19:45 UTC · re: Marco Costalba · lore

Re: [msysgit] how to detect git.exe directory?

Marco Costalba wrote:
Show 7 quoted lines
> Hi all,
> 
>    I'm progressing on qgit installer for windows, I have switched to
> MSVC for compiling Qt4 and qgit sources and I have to say that first
> results are very good, qgit.exe now seems to work without problems or
> artifacts and the speed is much more similar to what we achieve under
> the Linux platform (read much higher).

Glad you manage to do it by yourself. Sorry for not going further with compilation as I promised but the git repository had only a MSVC2008 solution file and I have only MSVC2005 here. I tried to adapt our CMake files to qgit but failed...

> 
> So it seems Qt+mingw is not the _best_ possible solution.
I told you that ;-)
Show 12 quoted lines
> 
> Anyhow, under Vista you cannot simply copy qgit.exe in the git
> directory (OS barfs regarding some administrative rights, note that *I
> am* the administartor!), so to make qgit.exe work git.exe file must be
> in PATH.
> 
> To easy the user and allowing to call qgit.exe double clicking on a
> nice desktop icon I need a way to know where git.exe is installed *at
> runtime*.
> 
> So my question is: "What is the preferred way to detect git directory
> at runtime for msysgit files?"

If you use QProcess to launch git, maybe you could just use QProcess::workingDirectory()?

Abdel.
Marco Costalba· Dec 23, 2007, 20:04 UTC · re: Abdelrazak Younes · lore

Re: [msysgit] how to detect git.exe directory?

On Dec 23, 2007 8:45 PM, Abdelrazak Younes <younes.a@free.fr> wrote:
Show 8 quoted lines
> Marco Costalba wrote:
> > Hi all,
> >
> Glad you manage to do it by yourself. Sorry for not going further with
> compilation as I promised but the git repository had only a MSVC2008
> solution file and I have only MSVC2005 here. I tried to adapt our CMake
> files to qgit but failed...
>

Don't worry, I have installed MSVC2008, compiled Qt4 (and everithing went smooth) and bruefly tested qgit: it really seems to work, now following steps are:

- Detect git.exe directory at runtime also when is not in PATH (see below)
- Manage to package qgit and others needed files in a windows
installer (I know very little about this)
Show 7 quoted lines
>
> > So my question is: "What is the preferred way to detect git directory
> > at runtime for msysgit files?"
>
> If you use QProcess to launch git, maybe you could just use
> QProcess::workingDirectory()?
>

It's not the repository that I don't find, but the git binary directory. I explain better. If I open a console under windows with cmd.exe and type "git" when I hit enter button I have an error message that says that "command git is not known"

This is because git.exe directory is _not_ (normally) in PATH environment variable.

So, or msysgit installation *modifies* the user PATH adding the bin directory, or I have to found git bin directory myself and manage to add to the PATH of qgit process environment.

The question is: "How I find git.exe??"
Marco
Johannes Sixt· Dec 23, 2007, 16:35 UTC · lore

Re: how to detect git.exe directory?

On Sunday 23 December 2007 17:25, Marco Costalba wrote:
Show 12 quoted lines
> To easy the user and allowing to call qgit.exe double clicking on a
> nice desktop icon I need a way to know where git.exe is installed *at
> runtime*.
>
> So my question is: "What is the preferred way to detect git directory
> at runtime for msysgit files?"
>
> - environment variable ??
>
> - windows registry ??
>
> - others ?
Running
	git --exec-path
should get you close to it. But I have to question why you need that path.
-- Hannes
Marco Costalba· Dec 23, 2007, 16:53 UTC · lore

Re: how to detect git.exe directory?

On Dec 23, 2007 5:35 PM, Johannes Sixt <johannes.sixt-dl2ejS2iUSazZXS1Dc/lvw@public.gmane.org> wrote:
Show 20 quoted lines
> On Sunday 23 December 2007 17:25, Marco Costalba wrote:
> > To easy the user and allowing to call qgit.exe double clicking on a
> > nice desktop icon I need a way to know where git.exe is installed *at
> > runtime*.
> >
> > So my question is: "What is the preferred way to detect git directory
> > at runtime for msysgit files?"
> >
> > - environment variable ??
> >
> > - windows registry ??
> >
> > - others ?
>
> Running
>
>         git --exec-path
>
> should get you close to it. But I have to question why you need that path.
>

What I'm looking for is git.exe itself. If I run "git --exec-path" I get something along the lines "git executable not found..."

I don't use dashed command inside qgit, so I run "git log ..." not "git-log ...", but the git.exe should be known to qgit or in path.

Hope it's clear.

Thanks Marco

Abdelrazak Younes· Dec 23, 2007, 19:51 UTC · lore

Re: how to detect git.exe directory?

Marco Costalba wrote:
Show 6 quoted lines
> 
> What I'm looking for is git.exe itself. If I run "git --exec-path" I
> get something along the lines "git executable not found..."
> 
> I don't use dashed command inside qgit, so I run "git log ..." not
> "git-log ...", but the git.exe should be known to qgit or in path.

If you're planning to create an installer for qgit, a good solution would be to ask the user to manually point to the msysgit installation directory if not found in the path. Then the installer could just save the directory to an ini file along 'qgit.exe'.

Abdel.

← back to recent threads