{"thread":{"id":"7512","subject":"git-gui blame dividing by zero","startedAt":"2007-04-04T15:21:49Z","lastAt":"2007-04-05T08:44:22Z","messageCount":5,"participants":["Andy Parkins","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"38624","messageId":"200704041621.51390.andyparkins@gmail.com","threadId":"7512","inReplyTo":null,"subject":"git-gui blame dividing by zero","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-04-04T15:21:49Z","receivedAt":"2007-04-04T15:21:49Z","isPatch":false,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"Hello,\n\nI've not used it before, but I thought I'd give it a go:\n\n $ git --version\n git version 1.5.1\n $ $ git-gui --version\n git-gui version 0.6.5\n $ git-gui blame HEAD somefile.cc\n\nI just get a window that contains:\n\ndivide by zero\ndivide by zero\n    while executing\n\"expr {100 * $blame_data($w,blame_lines)\n\t\t\t/ $blame_data($w,total_lines)}\"\n    (procedure \"blame_incremental_status\" line 4)\n    invoked from within\n\"blame_incremental_status $w\"\n    (procedure \"read_blame_catfile\" line 27)\n    invoked from within\n\"read_blame_catfile file6 {} HEAD \nsomefile.cc .cm.t .out.loaded_t .out.linenumber_t .out.file_t\"\n\nAm I doing something wrong?\n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"38625","messageId":"20070404152748.GE4628@spearce.org","threadId":"7512","inReplyTo":"200704041621.51390.andyparkins@gmail.com","subject":"Re: git-gui blame dividing by zero","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-04-04T15:27:48Z","receivedAt":"2007-04-04T15:27:48Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Andy Parkins <andyparkins@gmail.com> wrote:\n>  $ git-gui blame HEAD somefile.cc\n> \n> I just get a window that contains:\n> \n> divide by zero\n> divide by zero\n>     while executing\n> \"expr {100 * $blame_data($w,blame_lines)\n> \t\t\t/ $blame_data($w,total_lines)}\"\n>     (procedure \"blame_incremental_status\" line 4)\n>     invoked from within\n> \"blame_incremental_status $w\"\n>     (procedure \"read_blame_catfile\" line 27)\n>     invoked from within\n> \"read_blame_catfile file6 {} HEAD \n> somefile.cc .cm.t .out.loaded_t .out.linenumber_t .out.file_t\"\n\nHeh.  So we came up with no lines in the file.  Weird.  What does\ngit-blame produce on the same arguments?  What about with the\n--incremental flag?\n\nI'll dig into git-gui and see what I can do to more gracefully\nhandle this condition, but right now I'm thinking we didn't get\nany data from git...\n\n-- \nShawn.\n"},{"id":"38629","messageId":"20070404161101.GF4628@spearce.org","threadId":"7512","inReplyTo":"200704041621.51390.andyparkins@gmail.com","subject":"Re: git-gui blame dividing by zero","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-04-04T16:11:01Z","receivedAt":"2007-04-04T16:11:01Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Andy Parkins <andyparkins@gmail.com> wrote:\n>  $ git-gui blame HEAD somefile.cc\n> \n> I just get a window that contains:\n> \n> divide by zero\n> divide by zero\n\nOK, I'm a total noob sometimes.  That code was obviously getting\n0 into a variable, and then blindly dividing by the variable's value.\n\nI just pushed a new patch to my git-gui.git repository, its now in\nboth the maint and master branches.  Please give that a try.  ;-)\n\n-- \nShawn.\n"},{"id":"38686","messageId":"200704050933.14154.andyparkins@gmail.com","threadId":"7512","inReplyTo":"20070404161101.GF4628@spearce.org","subject":"Re: git-gui blame dividing by zero","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-04-05T08:33:11Z","receivedAt":"2007-04-05T08:33:11Z","isPatch":false,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Wednesday 2007 April 04 17:11, Shawn O. Pearce wrote:\n\n> I just pushed a new patch to my git-gui.git repository, its now in\n> both the maint and master branches.  Please give that a try.  ;-)\n\nOkay - it's an improvement - no more divide by zero error.  However, I don't \nget any output.  Just an empty window with HEAD:somefile.cc in it.\n\nThe following both give lots of output:\n\n $ git blame HEAD -- somefile.cc \n $ git blame --incremental HEAD -- somefile.cc\n\nSo; I think you've fixed a nasty bug, but that bug was only presenting because \nsomething else is messed up.  I'll poke around and see what I can discover \n(however, I don't understand tk so what I discover might be that I don't \nunderstand tk :-)).\n\n\n\nAndy\n\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"38687","messageId":"200704050944.23500.andyparkins@gmail.com","threadId":"7512","inReplyTo":"200704050933.14154.andyparkins@gmail.com","subject":"Re: git-gui blame dividing by zero","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-04-05T08:44:22Z","receivedAt":"2007-04-05T08:44:22Z","isPatch":false,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Thursday 2007 April 05 09:33, Andy Parkins wrote:\n\n> So; I think you've fixed a nasty bug, but that bug was only presenting\n> because something else is messed up.  I'll poke around and see what I can\n> discover (however, I don't understand tk so what I discover might be that I\n> don't understand tk :-)).\n\nOkay - got it.  Try this in the git repository:\n\n # this works\n $ git-gui blame HEAD templates/hooks--commit-msg\n $ cd templates\n # this doesn't work\n $ git-gui blame HEAD hooks--commit-msg\n # this works\n $ git-gui blame HEAD templates/hooks--commit-msg\n\nThe problem is that git-gui is calling git-cat-file to read the file, but \ngit-cat-file expects a path from the repository root.  The current directory \ndoesn't matter - you always have to type the path as if you're in the working \ndir root.\n\n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"}]}