Git.php icon indicating copy to clipboard operation
Git.php copied to clipboard

Library doesn't work on FreeBSD

Open josh4trunks opened this issue 9 years ago • 10 comments

/usr/bin/git would not normally exist on FreeBSD as it install non-system applications to /usr/local/bin

I'm assuming there is a more portable way to find the git executable then hardcoding the location? I can try finding a solution to this at somepoint but don't have a ton of time to look into it at the moment.

Thanks

josh4trunks avatar May 07 '16 09:05 josh4trunks

@kbjr Could Git.php instead use protected static $bin = 'git';? This way systems with proper PATH set for PHP would find git even if it isn't the currently hardcoded /usr/bin/php.

We could then also remove the windows_mode() function since this would be the default. And by leaving the set_bin() function, programs who want to specify a git path that wouldn't normally be found by PHP could still do so.

If you agree with this proposal I can submit a Pull Request. What do you think?

josh4trunks avatar May 12 '16 06:05 josh4trunks

I haven't worked on this project for a long time, I don't remember most of the details. That said, I do remember that there was a reason why I hard coded that path, I ran into some issue trying to use just git.

kbjr avatar May 13 '16 00:05 kbjr

My five cents guys, how about a file_exists check to see where git is on a system based on the system type and one assumes the defaults. So an array of default paths for Linux , Windows, MacOS then a simple check to see whether any of those are there producing the path where the binary is found

On Fri, May 13, 2016 at 2:50 AM, James Brumond [email protected] wrote:

I haven't worked on this project for a long time, I don't remember most of the details. That said, I do remember that there was a reason why I hard coded that path, I ran into some issue trying to use just git.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/kbjr/Git.php/issues/47#issuecomment-218925579

[image: --]

Andre van Zuydam [image: https://]about.me/andrevanzuydam https://about.me/andrevanzuydam?promo=email_sig&utm_source=email_sig&utm_medium=email_sig&utm_campaign=external_links

[image: http://www.daniweb.com/profiles/1108517/Andre-van-Zuydam] http://www.daniweb.com/profiles/1108517/Andre-van-Zuydam

[image: https://www.openhub.net/accounts/75973?ref=Detailed] https://www.openhub.net/accounts/75973?ref=Detailed

andrevanzuydam avatar May 13 '16 05:05 andrevanzuydam

@kbjr thanks for the reply, that's what I figured based on the commit history.

It looks like the hardcoded /usr/bin/git path has been there since the beginning. https://github.com/kbjr/Git.php/blob/f7c5235fef70ac75576a93842beb1f2f3175f66d/Git.php#L73 Maybe it was because your PHP didn't have a proper environmental PATH set?

josh4trunks avatar May 13 '16 05:05 josh4trunks

@andrevanzuydam This would require Git.php have all the possible/common paths hardcoded. Or the program calling Git.php could have this logic instead.

I'd personally prefer just calling 'git' and relying on person deploying their app to have a proper PATH set. And an app could always call a different git path specifically with the set_bin() function.

josh4trunks avatar May 13 '16 05:05 josh4trunks

My proposal is here https://github.com/kbjr/Git.php/pull/48

josh4trunks avatar May 13 '16 06:05 josh4trunks

Can we please get this merged? It's been a long standing issue (there are closed issues about this going back to 2012).

Thanks.

kevinlekiller avatar Jun 19 '16 12:06 kevinlekiller

@kbjr if you'd rather not bother with fixes to this project, maybe there is a fork you could recommend?

thanks

josh4trunks avatar Jun 19 '16 15:06 josh4trunks

This fork seems the most active: https://github.com/coyl/git

kevinlekiller avatar Jun 19 '16 17:06 kevinlekiller

yeah, looks like alot of recent commits there. feel free to duplicate this PR over there, or when I get a chance I can do so

josh4trunks avatar Jun 19 '16 19:06 josh4trunks