[git-users] Re: Git Gui does not want to work on chunk level
Alexander Gladysh <[EMAIL PROTECTED]> wrote: > On Fri, Sep 5, 2008 at 8:53 AM, Shawn O. Pearce <[EMAIL PROTECTED]> wrote: > > > git-gui: Fix diff parsing for lines starting with "--" or "++" > > Somewhat related bug, but reproduceable event without "--". If I set > diff context to none in git gui (by repeatedly clicking "show less > context") I'm sometimes not able to stage hunk or line. git-apply refuses to apply a patch with 0 context lines. Latest git-gui in maint (and in Git 1.6.0.2?) won't let you reduce the number of context lines below 1, so you never can see this error. > Reduce context to none, then do stage hunk. It fails with message: > > error: patch failed: file.ext:3 > error: file.ext: patch does not apply > OK -- Shawn. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/git-users?hl=en -~--~~~~--~~--~--~---
[git-users] Re: Git Gui does not want to work on chunk level
Hi, list! On Fri, Sep 5, 2008 at 8:53 AM, Shawn O. Pearce <[EMAIL PROTECTED]> wrote: > git-gui: Fix diff parsing for lines starting with "--" or "++" Somewhat related bug, but reproduceable event without "--". If I set diff context to none in git gui (by repeatedly clicking "show less context") I'm sometimes not able to stage hunk or line. git version 1.6.0.GIT git-gui version 0.11.GITGUI Steps to reproduce: [EMAIL PROTECTED]:~$ mkdir test [EMAIL PROTECTED]:~$ cd test [EMAIL PROTECTED]:~/test$ git init Initialized empty Git repository in /home/agladysh/test/.git/ [EMAIL PROTECTED]:~/test$ cat >file.ext -- 1 -- 2 -- 3 -- 4 -- 5 [EMAIL PROTECTED]:~/test$ git add file.ext [EMAIL PROTECTED]:~/test$ git commit -m "one" Created initial commit aa4da16: one 1 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 file.ext [EMAIL PROTECTED]:~/test$ cat >file.ext -- 1 -- 2 -- 33 -- 4 -- 5 [EMAIL PROTECTED]:~/test$ git gui Reduce context to none, then do stage hunk. It fails with message: error: patch failed: file.ext:3 error: file.ext: patch does not apply OK Dump (by your debuging dumper patch from the same tread): diff --git a/file.ext b/file.ext --- a/file.ext +++ b/file.ext @@ -1,5 +1,5 @@ -- 1 -- 2 --- 3 +-- 33 -- 4 -- 5 Do stage line. It fails with message: fatal: corrupt patch at line 5 Dump: diff --git a/file.ext b/file.ext --- a/file.ext +++ b/file.ext @@ -3 +3 @@ --- 3 +-- 33 HTH, Alexander. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/git-users?hl=en -~--~~~~--~~--~--~---
[git-users] Re: Git Gui does not want to work on chunk level
> So that was an awesome reproduction case. I have committed the > following fix and will push it out in a few minutes: <...> Thank you! The fix helped indeed. I can commit on hunk level again! :-) Alexander. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/git-users?hl=en -~--~~~~--~~--~--~---
[git-users] Re: Git Gui does not want to work on chunk level
Junio C Hamano <[EMAIL PROTECTED]> wrote: > "Shawn O. Pearce" <[EMAIL PROTECTED]> writes: > > > git-gui was incorrectly parsing "--- foo" as the old file name > > in the file header, causing it to generate a bad patch file when > > the user tried to stage or unstage a hunk or the selected line. > > We need to keep track of where we are in the parsing so that we do > > not misread a deletion or addition record as part of the header. > > While keeping track of state is obviously a good change, it also might be > worth noticing "@@ -k,l +m,n @@" header and actively using the > information. Yea. But that was a lot more work. Noticing a hunk header, getting the line counts from it, then keeping a running counter to know how many lines before either EOF or the next header are all part of that hunk is just a lot of code I didn't feel like writing this evening. ;-) -- Shawn. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/git-users?hl=en -~--~~~~--~~--~--~---
[git-users] Re: Git Gui does not want to work on chunk level
(Shawn, apologies for double-posting.) > Actually the header you sent me privately wasn't well formed. > It looked something like this: > > diff --git a/path/file.ext b/path/file.ext > --- a/path/file.ext > +++ b/path/file.ext > --- assert(a != b) > --- assert(a != c) > @@ -10,1 +10,2 @@ > > It looks to me like some part of the context became part of the > diff header, with three "-" stuck in front of it. Which git-apply > then thinks is the pre-image path name. Aha! Thank you! That "--" is a comment in Lua (that is commented line that was removed in diff). First dash is from diff, next two came from file itself. Steps to reproduce the bug: $ mkdir test $ cd test $ git init Initialized empty Git repository in path/test/.git/ $ cat >file.ext -- 1 -- 2 -- 3 -- 4 -- 5 ^D $ git add file.ext $ git commit -m "one" Created initial commit 9226cdf: one 1 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 file.ext $ cat >file.ext -- 1 -- 2 -- 33 -- 4 -- 5 $ git gui And stage (sole) hunk. You see the error. > Can you put in some more puts in that same section of the code > so we can find out which of the puts has these extra asserts? > Is it the first one for $current_diff_header or is it the second > one that is supposed to be pulling in the patch hunk? Do you see > these extra asserts in the diff viewer like this before you try to > apply the patch? Hopefully the above steps would help to debug this bug directly. If you still need any more info from me, please say, I'll be glad to provide it. Thank you again! Alexander. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/git-users?hl=en -~--~~~~--~~--~--~---
[git-users] Re: Git Gui does not want to work on chunk level
On Thu, Sep 4, 2008 at 3:08 AM, Shawn O. Pearce <[EMAIL PROTECTED]> wrote: > Alexander Gladysh <[EMAIL PROTECTED]> wrote: >> On Wed, Aug 27, 2008 at 1:16 PM, Alexander Gladysh <[EMAIL PROTECTED]> wrote: >> > I like 'stage hunk for commit' feature in Git Gui, but often it gives >> > me an error message box: >> > >> > fatal: git-apply: bad git-diff - inconsistent old filename on line 4 > ... > I've never seen that before, but its clearly dumping a bad diff > into git-apply. > > Open up lib/diff.tcl and find "proc apply_hunk". Inside of the > catch maybe insert a puts to see the diff, e.g.: > <...> > Then if you can scrub the context and +/- lines for a bad diff and > send us at least the headers, or tell us how they are malformed, > it would help to debug it. Thank you! Header looks well-formed to me: diff --git a/path/file.ext b/path/file.ext --- a/path/file.ext +++ b/path/file.ext I have sent you full output privately. I do not see anything unusual in it... Anyplace where I may put more logging? Thanks again, Alexander. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/git-users?hl=en -~--~~~~--~~--~--~---
[git-users] Re: Git Gui does not want to work on chunk level
Hi, list! On Wed, Aug 27, 2008 at 1:16 PM, Alexander Gladysh <[EMAIL PROTECTED]> wrote: > $ git --version > git version 1.6.0.GIT > > $ git gui --version > git-gui version 0.11.GITGUI > > I like 'stage hunk for commit' feature in Git Gui, but often it gives > me an error message box: > > fatal: git-apply: bad git-diff - inconsistent old filename on line 4 Please advise how should I formulate this question to get an answer. I understand that it is hard to say something on the subject with that little info I provide, but anyway. I'm encountering this problem on roughly every fifth commit, and it is quite annoying, since I've got used to small feature-based per-chunk commits. Does anyone else encounter this kind of error? Any debugging advice? Perhaps I can instrument git gui with logging somewhere (dump diffs for example). (I have no experience with TCL though.) If error appears for single file diff, it would be reproduced each time I try to stage hunk from that diff. I have one such uncommitted diff now (can't send it, sorry), please advise what can I do to debug it. Alexander. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/git-users?hl=en -~--~~~~--~~--~--~---