lucasmotta / dploy

⛔️ currently unmaintained ⛔️
http://lucasmotta.github.io/dploy/
MIT License
990 stars 90 forks source link

"git diff" in checkDiff() fails on Windows running msysgit #13

Closed joncys closed 10 years ago

joncys commented 10 years ago

Deploy.prototype.checkDiff always exits with an error and halts the entire process on Windows, running msysgit:

Connecting to dev..
Checking revisions.
Checking diffs...
This is not a valid .git repository. Error: Command failed: fatal: ambiguous arg
ument ''601b92f84948d5ed085237964f69304dc02431eb'': unknown revision or path not
in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

It seems that for some reason git diff does not accept commit hashes that are "stringified" by wrapping them in single quotes. I've removed the single quotes via simple String.replace and everything seems to work fine from there on. Don't know if this is platform (Windows) or implementation (msysgit) specific.

I'm not sure how will this affect *nix users, but maybe ditch the single quotes altogether?

lucasmotta commented 10 years ago

Ouch, my bad for not testing on Windows. I will run a few tests to see if the single quotes are the only problem on windows and I will get back to you here.

lucasmotta commented 10 years ago

Fixed with the commit b058ebc6863c9ae70d07796ae35532c034c118ad. The problem was slightly different and it was happening on the checkDiff method. Basically the data from the .rev buffer was wrapped on a single quotes, causing problems later when checking the diff:

git diff '12345678910' abcdefghjkl

So to prevent that, I'm running a regex to strip all special characters from the result. Try updating dploy to 1.0.1 and let me know :)