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

Uncaught TypeError when opening the pane #4

Closed
sromocki opened this issue Apr 17, 2014 · 17 comments
Closed

Uncaught TypeError when opening the pane #4

sromocki opened this issue Apr 17, 2014 · 17 comments
Labels

Comments

@sromocki
Copy link

I get this error when I open this package in the editor.

/.atom/packages/atomatigit/node_modules/gift/lib/diff.js:77
Uncaught TypeError: Cannot read property '0' of null
module.exports.Diff.parse

This looks really cool, looking forward to using it.
Thanks,
Sean

@diiq
Copy link
Owner

diiq commented Apr 17, 2014

I'm sorry!

When you have this problem, does the package activate? Does the pane appear on the right? Does it populate with files? Or does it fail before anything happens at all?

@diiq diiq added the bug label Apr 17, 2014
@sromocki
Copy link
Author

I apologize for the lack of description.

So, it appears to only happen with certain projects. When I open the pane with cmd+alt+g, the pane pops open and I can see my branch with the associated file statuses, but the developer tools also opens up and I see the error. I'm still trying to see the difference between projects where I get the error vs when I don't.

@diiq
Copy link
Owner

diiq commented Apr 18, 2014

If you could post the stack trace (or a screenshot of it), that would help.

Atomatigit pre-loads the diffs for all tracked files and staged changes, but it doesn't have any special logic for moved or deleted files yet. Do those repos happen to have moved or removed files staged?

@sromocki
Copy link
Author

I do not have any moved or deleted files that are staged in the branch I'm working on. Only "untracked" and "unstaged", with the "unstaged" changes just being "modified" status.

screen shot 2014-04-21 at 8 57 45 am

screen shot 2014-04-21 at 12 54 06 pm

@diiq
Copy link
Owner

diiq commented Apr 22, 2014

Yup, ok.

Have you by any chance configured git to use a different diff tool? Gift (the node git library that's throwing the error) tries to parse the diff, but it expects git-difftool's default output.

Do you get one error for each untracked/unstaged file? It looks like 12 errors and ~12 files...

Any odd characters in the repo path?

@sromocki
Copy link
Author

I haven't set diff.tool or merge.tool in my git config. When I do a git difftool, it tries to use opendiff as the default. Also, no weird characters in my repo path.

It looks like I get 4 of the TypeErrors everytime I open and close the pane. So I think your right about the diff tool. It's probably getting that error when trying to run the diff on the 4 unstaged files. When I do a git diff, it gives me the diff output in the terminal, which leads me to believe I'm using the default.

I'm also seeing this error now, I had seen this before but had closed it. This reappeared once I restarted Atom:
screen shot 2014-04-22 at 3 35 58 pm

@diiq
Copy link
Owner

diiq commented Apr 22, 2014

OK, would you run through all the files in the list and hit tab for each of them? Is there anything special about which ones have diffs and which ones don't?

The other error -- no upstream configured -- is a known issue. As soon as you push, it will go away -- the branch header styles branches with unpushed commits differently than branches with up-to-date remotes, but it gets confused if there is no remote. Expect a patch to fix that this evening or tomorrow.

This diff problem, though -- I really have no idea. Thanks for being patient.

@sromocki
Copy link
Author

When I select one of the files and press tab I get a different error relating to the diff.

screen shot 2014-04-22 at 3 59 02 pm

@sromocki
Copy link
Author

I wonder if this is a problem with my git difftool defaulting to opendiff, is that the right default?

@diiq
Copy link
Owner

diiq commented Apr 22, 2014

Do you get that error for every file? I expected you to get it for some (4, hopefully)...

git difftool shouldn't cause us any problems; it's for graphical diff tools. Opendiff is what mine defaults to, too.

@sromocki
Copy link
Author

It gives me that error for every one of my unstaged files, 4 out of 4.

@diiq
Copy link
Owner

diiq commented Apr 22, 2014

Is it possible for you to run git diff on a [not-sensitive] file that fails to diff in atomatigit, and post the result?

I'm beginning to think this is not my fault, but a problem in Gift's diff parsing code. I'd like to raise the bug with the owners of the Gift library; but the text of the diff will be the relevant info, and I can't seem to replicate your problem on my end.

@sromocki
Copy link
Author

I have one project that works fine. I tested a few others and I think it may have to do with the project having submodules or not. I went into one of my projects and changed one file that was in a submodule of my project and then I get the error on the diff of the submodule pointer.

Here common is my submodule that i changed a file in. Since I'm not inside the submodule itself, the diff with only show the difference of commits. Pretty sure this has something to do with it, because it works fine for all projects that don't have git submodules.

screen shot 2014-04-22 at 4 55 22 pm

@diiq
Copy link
Owner

diiq commented Apr 22, 2014

OK. I'll see if the folks who work on Gift have any ideas.

@sromocki
Copy link
Author

@diiq Any word?

@diiq
Copy link
Owner

diiq commented Apr 30, 2014

Nope. They merged an (unrelated) pull request of mine, but didn't even comment on the issue :(

At least they did merge the PR, so I guess I'll take a look tonight and see if I can fix it myself.

Sorry about the wait! All my Atomatigit attention has been on the flow for committing (which still sucks).

@diiq
Copy link
Owner

diiq commented Apr 30, 2014

OK, so I didn't realize until I looked more closely at your diff that these were all files inside the submodules. It's somewhat unusual, I think, to do extensive editing of your submodules in-place, but I believe you're doing it for the best of reasons.

Unfortunately, I'm currently only using a single reference to the project repository; within that architecture, I can't get the diff of a file that's inside a subrepo :(

Maybe in the future I'll be able to accommodate editing submodules, but for right now, I don't think it's on the roadmap, because it would mean managing multiple repos simultaneously.

I will make some changes to prevent the error from appearing -- but you won't be able to see diffs or stage or commit files inside submodules.

What you can do is open the submodule in its own atom window -- because it really is a separate project -- then Atomatigit will react just the way it should, and let you commit files from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants