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

error when no key precised #3

Closed
MainHanzo opened this issue Feb 4, 2020 · 2 comments
Closed

error when no key precised #3

MainHanzo opened this issue Feb 4, 2020 · 2 comments

Comments

@MainHanzo
Copy link
Contributor

MainHanzo commented Feb 4, 2020

the tool works well when we have a id precised by user as the key. However I think when the user doesn't use the '--key' option, it's not working as expected.

for example:
----1.csv----
"""id,name,age
1,Cleo,5
2,Pancakes,2"""

----2.csv----
"""id,name,age
1,Cleo,5
2,Pancakes,3"""

and we launch with no key option :
csv-diff 1.csv 2.csv
we will get:
"2 rows added, 2 rows removed

2 rows added

id: 1
name: Cleo
age: 5

id: 2
name: Pancakes
age: 2

2 rows removed

id: 1
name: Cleo
age: 5

id: 2
name: Pancakes
age: 4

"

while i expect this:
"
1 row added, 1 row removed
1 row added:
id:2
name: Pancakes
age: 2
1 row removed:
id: 2
name: Pancakes
age: 4

"

the problem is caused because that the hash of the line is stored as a hash object, and even two lines are the same content, the memo locations are different. So they are different objects.

I have corrected this feature, if you like, I can upload it through a pull request.

@simonw
Copy link
Owner

simonw commented Feb 29, 2020

Thanks - please do open a pull request for this!

@MainHanzo
Copy link
Contributor Author

Thanks - please do open a pull request for this!

PR Done! :)

@simonw simonw closed this as completed in 09409e3 Oct 16, 2020
simonw added a commit that referenced this issue Oct 16, 2020
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