Closed tekurinui closed 10 years ago
Do you mean the terminal plugin from fluidbyte?
Could you run git status --branch --porcelain
in this terminal?
Yes I did mean the terminal plugin.
git status --branch --porcelain
error: unknown option `branch'
usage: git status [options] [--]
-v, --verbose be verbose
-s, --short show status concisely
--porcelain show porcelain output format
-z, --null terminate entries with NUL
-u, --untracked-files[=<mode>]
show untracked files, optional modes: all, normal, no. (Default: all)
git --version git version 1.7.1
Okay, I see the problem, I checked the reference and the option -b/--branch is only available since version 1.7.2. Are you able to update git?
I'll check with the host.
Ok, my host upgraded to 2.0.2 and now the plugin displays changes properly, thanks for that.
Next problem. If I try to commit, I get a "Failed Commit" error popup. Is there anyway to see what the error was? Any other ideas?
There is currently no way to see why a commit failed. I will think about a way to get this information.
Do you told git who you are? If not, use the settings of CodeGit to save these informations.
Whereabouts do I set this? The CodeGit settings prompt me for username and E-Mail.
Git requires an email address and an username to identify and mark your commits: Details: Git website. Even if they are fictitious.
There was already a username, I added an email and that seemed to help. I had some commits succeed. But most of them do still fail.
I'm doing some debugging and figured out that the problem is that a commit is getting called without an add first getting called.
Whereabouts does it call 'git add...' to stage the file prior to commit?
Ok I finally made it all go, had to make some code changes though.
1: In init.js:add the this variable is getting corrupted, so changed to use the _this you already had
2: the JSON.stringify in init.js:add is escaping quotes with a '\' character, which causes the json_decode in controller.php:add to fail, so strip them out prior
3: I also added an error condition to controller.php:add, as the fail was appearing as a success
Below is a diff:
diff /home/aohunga/tmp/Codiad-CodeGit-master/controller.php ./controller.php
68a69,70
> $filelist = $_POST['files'];
> $filelist = str_replace('\\', '', $filelist);
70c72
< $files = json_decode($_POST['files']);
---
> $files = json_decode($filelist);
72,76c74,82
< foreach($files as $file) {
< $result = !(!$result | !$git->add(getWorkspacePath($_GET['path']), $file));
< }
< if ($result) {
< echo '{"status":"success","message":"Files added"}';
---
> if ($files) {
> foreach($files as $file) {
> $result = !(!$result | !$git->add(getWorkspacePath($_GET['path']), $file));
> }
> if ($result) {
> echo '{"status":"success","message":"Files added"}';
> } else {
> echo '{"status":"error","message":"Failed add files!"}';
> }
78c84
< echo '{"status":"error","message":"Failed add files!"}';
---
> echo '{"status":"error","message":"Could not decode files to add \'' . $_POST['files'] . '\'!"}';
diff /home/aohunga/tmp/Codiad-CodeGit-master/init.js ./init.js
217c217
< $.post(this.path + 'controller.php?action=add&path=' + path, {files : JSON.stringify(this.files)}, function(result){
---
> $.post(this.path + 'controller.php?action=add&path=' + path, {files : JSON.stringify(_this.files)}, function(result){
Also multiple checkin wasn't working. To fix it changed class.git.php:add to
public function add($path, $file) {
if (!is_dir($path)) return false;
$cwd = getcwd();
chdir($path);
$result = $this->executeCommand("git add " . $file);
chdir($cwd);
if ($result === 0) {
return true;
} else {
return false;
}
}
Thanks for your bug hunting. I added your solution for the multiple checkin. But I can not reproduce your problems with JSON.stringify and this.files. Which browser do you use and on which files does this happen?
No problem :)
I'm on Chrome. I thought there must have been something environmental, otherwise it never would have worked, which clearly is not the case.
Changing this.files to _this.files makes sense even if it is only a problem in some environments right, because it will work in both cases?
I was checking in silverstripe template files. So they were pretty much html with some php in them with a file extension of .ss. Again replacing \" with " should work because it will replace the slash delimiter if it exists but leave it as is if it's not there.
Mauri Ora
Jeremy Banks
On 3 August 2014 03:00, Andr3as notifications@github.com wrote:
Thanks for your bug hunting. I added your solution for the multiple checkin. But I can not reproduce your problems with JSON.stringify and this.files. Which browser do you use and on which files does this happen?
— Reply to this email directly or view it on GitHub https://github.com/Andr3as/Codiad-CodeGit/issues/8#issuecomment-50964983 .
Hi I'm trying to get Codiad and CodeGit going for the first time. Git Init seems to work fine, but clicking on Open CodeGit returns "Failed to get status". I've installed Terminal and if I run git from there it seems to behave itself. Git version is 1.7.1. Thanks for your help.