Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the git command to obtain the dirty state of the repository #971

Closed
wants to merge 1 commit into from
Closed

Fix the git command to obtain the dirty state of the repository #971

wants to merge 1 commit into from

Conversation

sveggiani
Copy link

Fixes #928

@luisrudge
Copy link

I can confirm this is now working:
image

@Stanzilla
Copy link
Member

Stanzilla commented May 31, 2016

We had a few problems with os.execute which is why we switched away from it #749 #692

Does this help you maybe? #809 (comment) Maybe removing 2>nulis already good enough?

@sveggiani
Copy link
Author

@Stanzilla nope, it doesn't work. I'll try to come up with another solution.

@vBm
Copy link

vBm commented Jun 1, 2016

@Stanzilla I've also tried what's suggested in 809 but doesn't help either.
However, this patch makes it work again.

@Stanzilla
Copy link
Member

567889e found it, paging @JanSchulz

@jankatins
Copy link
Contributor

Unfortunately, I only send the patch, not found the cause: @vvartivarian-nbcu suggested the particular fix: #749 (comment)

@jankatins
Copy link
Contributor

But reading this: http://www.lua.org/manual/5.1/manual.html#pdf-io.popen it looks like the solution could never work: t returns a handle and not the exit code:

io.popen (prog [, mode])
Starts program prog in a separated process and returns a file handle that you can use to read data from this program (if mode is "r", the default) or to write data to this program (if mode is "w").
This function is system dependent and is not available on all platforms.

@jankatins
Copy link
Contributor

See also http://stackoverflow.com/questions/7607384/getting-return-status-and-program-output

this works:

---
 -- Get the status of working dir
 -- @return {bool}
---
function get_git_status()
    local file = io.popen("git diff --quiet --ignore-submodules HEAD 2>nul")
    -- This will get a table with some return stuff
    -- rc[3] will be the signal, 0 or 1
    local rc = {file:close()}
    return rc[3] == 0 
end

-> Will send a PR

@jankatins
Copy link
Contributor

See #974 for the PR, please test... :-)

@sveggiani
Copy link
Author

Closing this in favor of the more appropiate fix in #974

@sveggiani sveggiani closed this Jun 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants