373051 (3) [Avatar] Offline
#1
@Help Desk ... Page 88 >>>"To save the lines that are specified in Fig 7.15...." Results in error "Fatal:corrupt patch at line 5" ... Did not find an answer when searching web....
rickumali (130) [Avatar] Offline
#2
Hello!

Thanks for posting your question here. Page 88 utilizes git gui to stage individual lines. By any chance does your file in git gui look like figure 7.16? If so, then there may be an end of line issue.

Either way, can you upload a screenshot of your file inside of git gui?

Thanks for this help.
373051 (3) [Avatar] Offline
#3
Rick Here is the screenshot. Thx much for your help. (I am a little late responding back as I have been running behind this week- Busy with HTML5 Brunch Season 5 -Not too late to join). http://www.meetup.com/bostonphp/events/221356927/

Update-I reworked Ch 7 from the start- Receiving same error. I moved onto Chp 8.
Thx, David
rickumali (130) [Avatar] Offline
#4
Thanks for posting your screen.

I was able to reproduce your error, even getting the exact message as you did.

There are two issues here, from what I can see.

1) You're running into an old git gui bug. See:

http://stackoverflow.com/questions/12147930/fatal-corrupt-patch-at-line-xx-when-staging-single-line

The main issue from the above post is that your file must contain a newline at the end of the file before you can stage a single line. (Note that this is what we're doing on page 88 through 89. We're staging one line at a time.)

The comments suggest an even further nuance: you must git add and git commit this newer file before attempting to stage a single line. I didn't try this workaround, as it goes against what we're doing: we're staging one line at a time, but the workaround wants you to stage all the changes at once (via git add).

In the end, to short-circuit the error, select "Stage Hunk for Commit". This is the equivalent of staging all the lines at once (git add), but it will get you past the error.

2) The second issue is more subtle: the lines in your file don't look exactly like figure 7.19. Figure 7.19 is what your file should look like within git gui. From the screenshot, it seems as if you had added all the lines at once. I think making the lines look exactly like figure 7.19 will help you avoid the error. When I make my file match 7.19 (following the editing/commit session from section 6.2.4, and figure 7.12), I do not get the error.

How do you edit the file?

The goal of this section is to test out line-by-line staging via git gui, so if need be, try it out on a smaller file, so you can prove to yourself that this technique works properly.

I apologize that this is long and windy, but I hope it helps in some way!
373051 (3) [Avatar] Offline
#5
Rick
I had to re-install Git on my computer-new computer. I went back to my issue in chp 7. It seems to be working great now. No Fatal errors. I guess I had installed Git incorrectly. Thank you.