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

Tab characters cause grit import to panic #1

Closed
hannah-scott opened this issue Apr 2, 2021 · 5 comments
Closed

Tab characters cause grit import to panic #1

hannah-scott opened this issue Apr 2, 2021 · 5 comments
Assignees

Comments

@hannah-scott
Copy link

grit import panics if the imported file has tab delimiters. It works if tabs are converted to spaces.

I've attached the error that got thrown, as well as the two files that I used to test it.

import-with-spaces.txt (this works)
import-with-tabs.txt (this errors)
import-with-tabs.log

The files were made in nano with tabwidth of 4.

@hannah-scott
Copy link
Author

Think I've found a fix to this.

In multitree/node.go, line 313:

if origin.ID == 0 || dest.ID == 0 {
    panic("link endpoints must have IDs")
}

Changing 0 to -1 fixes the problem and multitree_test.go still passes. Initialising NewNode with an ID with 1 on line 24 seems to fix things too.

Not sure if this will cause problems elsewhere?

@climech
Copy link
Owner

climech commented Apr 4, 2021

You're on the right track, but I suspect there's a lot more wrong going on there -- the truth is I forgot about the command, during the switch from DAGs to multitrees, if I'm not mistaken. The import code doesn't have any tests either!

I'll fix it for the next release and add the tests, probably tomorrow -- I had it working before so it shouldn't take long.

BTW, it doesn't work for spaces either, it's just including them in task names 😄. I will definitely have to add support for spaces too.

@climech climech self-assigned this Apr 4, 2021
@hannah-scott
Copy link
Author

hannah-scott commented Apr 4, 2021

Yeah I realised the spaces thing when I was looking at it today, I just managed to confuse myself!

I have imports working, I think as intended minus the spaces thing. I can submit a pull request if you want, although I haven't written tests.

climech added a commit that referenced this issue Apr 5, 2021
@climech
Copy link
Owner

climech commented Apr 5, 2021

4f226b0 probably would cause other problems, and in 3c266a8 the function shouldn't accept zero, since it's used for user-provided selectors elsewhere -- I shouldn't have used the function there to begin with, and it's fixed now. 6e518bd was spot on, thanks for pointing that out!

I ended up reworking the whole thing, it was too confusing. The were also some other issues, like not updating ancestors after insertion.

Props for trying to make sense of that mess! 😄

@hannah-scott
Copy link
Author

Yeah I kind of expected those would break something else, glad to help though.

Really cool project btw 😄

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

No branches or pull requests

2 participants