lighttiger2505 / lab

lab is a cli client of gitlab like hub
MIT License
91 stars 9 forks source link

"Failed collect git remove infos. exit status 128." #64

Open PhilipRoman opened 6 years ago

PhilipRoman commented 6 years ago

I installed the binary but any sub-command (other than simply typing "lab") will show this error message: Failed collect git remove infos. exit status 128. . Git is installed and works correctly. I am using Windows Subsystem for Linux.

lighttiger2505 commented 6 years ago

Thank you for contributing !!!

Failed collect git remove infos. exit status 128.

This error is caused by do git remote failing. Please move to the error repository on your console and confirm that you can do git remote.

Unfortunately I do not have Windows so I can not reproduce your error. I need your cooperation to resolve this error.

Of course you are also welcome to pull request.

lighttiger2505 commented 6 years ago

I added code for error tracking of Git command with this commit. If you install and run this release binary you can see more detailed error.

Reinstallation can be done by executing the command below.

curl -s https://raw.githubusercontent.com/lighttiger2505/lab/master/install.sh | bash
PhilipRoman commented 6 years ago

Okay, I think I have this figured out.

My Windows file system is mounted on /mnt/c A long time ago I noticed that git from linux has trouble with files within /mnt/c but git.exe from windows could not access files unless they were in /mnt/c. I solved this by aliasing git to `if inwindows; then echo git.exe; else echo git; fi` - choosing between git and git.exe depending on current directory.

Now, lab obviously calls git without doing any shell expansions and thus it fails when inside /mnt/c. For the record, here is the error: fatal: Could not chdir to 'C:/Users/usr/xxx: No such file or directory.

Solution

There should be some way of configuring the git command that is called, maybe an env variable or command line option (something like alias lab='lab --git-cmd=...')?

Unfortunately I'm not too familiar with Go so I can't PR.

Also, thank you for the commit - I never would've figured it out without it!

lighttiger2505 commented 6 years ago

Please let me check.

  1. Running the lab on a windows file system(/mnt/c) results in an error. Because git is executed instead of git.exe which should be aliased.
  2. Running the lab on a linux file system(Other mnt/c) results in an success.

OK ?

lighttiger2505 commented 6 years ago

There should be some way of configuring the git command that is called, maybe an env variable or command line option (something like alias lab='lab --git-cmd=...')?

I appreciate your suggestion.

But I think your case is special. I think that it is better to use the git command in an appropriate place rather than using it differently depending on the location.

If possible we want you to use lab on the linux file system.

PhilipRoman commented 6 years ago

Yeah, lab works good outside of /mnt/c. Unfortunately I can't move the repo to the linux file system. Even if this is an edge case, I don't think that option to choose custom git command would be difficult to implement or maintain. If not, I can always fork this, implement the patch and use my own forked version. Thank you for helping me resolve this!

lighttiger2505 commented 6 years ago

Hmmm...

I was thinking about adding --git-cmd option, but I thought it would be bad to add specific environment dependent options. Because the git command does not need to switch at all in a general unix/linux environment.

I may not start with this issue at once, but I would like to think about other methods.

PhilipRoman commented 6 years ago

Actually I guess I should just rename git to git-real and create my own script called git. This should be a fairly robust solution.