Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ignore all lines of subsequent hunks until last one is found #602

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

Merged
Byron merged 3 commits into gitpython-developers:master from gitprime:master
Mar 7, 2017

Conversation

Copy link
Contributor

@ghickman ghickman commented Mar 6, 2017

Git version 2.11.1+ introduced extra lines into the subsequent hunk
sections for incremental blame output. The documentation notes that
parsers of this output should ignore all lines between the start and end
for robust parsing.

Git version 2.11.1+ introduced extra lines into the subsequent hunk
sections for incremental blame output. The documentation notes that
parsers of this output should ignore all lines between the start and end
for robust parsing.
Copy link

codecov-io commented Mar 6, 2017
edited
Loading

Codecov Report

Merging #602 into master will increase coverage by 0.02%.
The diff coverage is 100%.

@@ Coverage Diff @@
## master #602 +/- ##
=========================================
+ Coverage 94.48% 94.5% +0.02% 
=========================================
 Files 63 63 
 Lines 9958 9961 +3 
=========================================
+ Hits 9409 9414 +5 
+ Misses 549 547 -2
Impacted Files Coverage Δ
git/repo/base.py 95.76% <100%> (+0.02%)
git/test/test_repo.py 97.47% <100%> (+0.34%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 830070d...73a5926. Read the comment docs.

orig_filename = value
# Discard all lines until we find "filename" which is
# guaranteed to be the last line
while True:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this loops break-condition is not clearly defined just now.
Do you think 'end-of-stream' could be another one?

What do you think of something like this:

for line in stream:
	tag, value = line.split(b' ', 1)
	if tag == b'filename':
		orig_filename = value
		break
		
# Finally handle the case of the stream being exhausted too early

Copy link
Contributor Author

@ghickman ghickman Mar 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a comment in 77b20be to be more explicit about an unexpected EOF condition. With a for loop we'd need to raise that exception ourselves in an else block so I think the while loop works better here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see now! I didn't know that next throws - iterators do that, right. Have been doing Rust for too long ;).

Copy link
Member

Byron commented Mar 7, 2017

Thanks a lot! In addition to the comment, how feasible/easy is it for you to add a test based on the kind of input you are handling? I believe there are fixtures for this already, maybe it's possible to adjust one too.

Copy link
Contributor Author

ghickman commented Mar 7, 2017

@Byron – yep I think that sort of test should be easy to add with an extra fixture that has the new style git output. I'll add that as soon as I get the time :)

Copy link
Member

Byron commented Mar 7, 2017

@ghickman Great, I will be waiting for that one then - by now github sends emails on new commits, so I should see it and merge shortly thereafter.

@@ -0,0 +1,33 @@
82b8902e033430000481eb355733cd7065342037 2 2 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! I am ready to merge!
One last question though: should there or should there not be empty lines in the fixture?

Copy link
Contributor Author

@ghickman ghickman Mar 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there should be empty lines in the fixture.

If it helps I generated the fixture with git blame --incremental -p 82b8902e033430000481eb355733cd7065342037 -- AUTHORS > git/test/fixtures/blame_incremental_2.11.1_plus (which I believe matches how blame_incremental was generated).

@Byron Byron merged commit 6c6ae79 into gitpython-developers:master Mar 7, 2017
@Byron Byron added this to the v2.1.2 - Bugfixes milestone Mar 7, 2017
Copy link
Member

Byron commented Mar 7, 2017

Awesome! Thanks a lot for this one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@Byron Byron Byron left review comments

Assignees
No one assigned
Labels
None yet
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /