{"thread":{"id":"8665","subject":"Strange diff behavior?","startedAt":"2007-06-21T01:02:13Z","lastAt":"2007-06-21T16:46:02Z","messageCount":7,"participants":["Jason Sewall","Johannes Schindelin","Raimund Bauer","Matthias Lederhofer"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"45450","messageId":"31e9dd080706201802h9dcbffawd82575d09e082155@mail.gmail.com","threadId":"8665","inReplyTo":null,"subject":"Strange diff behavior?","fromName":"Jason Sewall","fromEmail":"jasonsewall@gmail.com","sentAt":"2007-06-21T01:02:13Z","receivedAt":"2007-06-21T01:02:13Z","isPatch":false,"sender":{"key":"jasonsewall@gmail.com","avatar":null},"body":"I'm pretty new to git, but I've been using it a lot recently and I'm\nreally liking it.\n\nI do have a question that I'm 99% sure is a stupid one but I'd like an\nanswer anyway.\n\nI recently make a few simple changes to a working directory, and\ndecided to do a diff before I committed it.\n\nThe results were something like the diff at the end of this email.\n\nIt seems like every change listed after the first one is meaningless.\nI really think I just don't understand something about the diff\nalgorithm. Can someone tell my why those empty lines are recorded as\nchanges?\n\nJason\n\nP.S. git diff --check is empty; there's no whitespace on those lines\n\nP.P.S. The diff:\n\ndiff --git a/mac.cpp b/mac.cpp\nindex 02aab7b..34c510b 100644\n--- a/mac.cpp\n+++ b/mac.cpp\n@@ -80,10 +80,10 @@ float grid::bilerp(const uVec & lower, const Vec &\ninpos) const\n     idx[0] += 1;\n     vals[3] = (*this)(idx); // 1, 1\n\n-    float low_val = lerp(pos[0], vals[0], vals[1]);\n-    float high_val = lerp(pos[0], vals[2], vals[3]);\n+    float low_val = cog::lerp(pos[0], vals[0], vals[1]);\n+    float high_val = cog::lerp(pos[0], vals[2], vals[3]);\n\n-    return lerp(pos[1], low_val, high_val);\n+    return cog::lerp(pos[1], low_val, high_val);\n }\n\n float grid::max() const\n@@ -194,7 +194,7 @@ mac_grid::mac_grid(const Vec & low, const Vec &\nhigh, unsigned int dim) : low_bo\n\n         for(idx[0] = (dim_-1)/4+1; idx[0] < 3*(dim_-1)/4; idx[0]++)\n             cell_type(idx) = SOLID;\n-\n+\n         for(idx[0] = 3*(dim_-1)/4+1; idx[0] < (dim_-1); idx[0]++)\n             cell_type(idx) = SOLID;\n     }\n@@ -636,7 +636,7 @@ void mac_grid::printA(std::ostream & out)\n     out << \"sparse(\";\n\n     iVec idx;\n-\n+\n     out << \"[\";\n     for(idx[1] = 0; idx[1] < static_cast<int>(dim_); idx[1]++)\n         for(idx[0] = 0; idx[0] < static_cast<int>(dim_); idx[0]++)\n@@ -645,7 +645,7 @@ void mac_grid::printA(std::ostream & out)\n             iVec e(idx + iVec(1, 0));\n             iVec s(idx - iVec(0, 1));\n             iVec n(idx + iVec(0, 1));\n-\n+\n             if(w[0] > 0)\n                 out << row_major_idx(idx, Adiag_.dim_)+1 <<\",\";\n             if(s[1] > 0)\n@@ -654,7 +654,7 @@ void mac_grid::printA(std::ostream & out)\n                 out << row_major_idx(idx, Adiag_.dim_)+1 <<\",\";\n             if(n[1] < static_cast<int>(dim_))\n                 out << row_major_idx(idx, Adiag_.dim_)+1 <<\",\";\n-\n+\n             out << row_major_idx(idx, Adiag_.dim_)+1 <<\",\";\n         }\n\n@@ -742,7 +742,7 @@ float mac_grid::dot(const grid & l, const grid & r) const\n         for(idx[0] = 1; idx[0] < dim_-1; idx[0]++)\n             if(cell_type(idx) == FLUID)\n                 res += l(idx)*r(idx);\n-\n+\n     return res;\n }\n\n@@ -903,7 +903,7 @@ void mac_grid::construct_pc()\n                 {\n                     float sfact = Aplusj_(s)*pc_(s);\n                     ichol += sfact*sfact;\n-\n+\n                     float wfact = Aplusi_(w)*pc_(w);\n                     ichol += wfact*wfact;\n                 }\n@@ -940,7 +940,7 @@ void mac_grid::apply_pc(const grid & rhs, grid & res)\n         {\n             uVec s(idx-uVec(0, 1));\n             uVec w(idx-uVec(1, 0));\n-\n+\n             float t = rhs(idx);\n             if(cell_type(s) == FLUID)\n                 t -= Aplusj_(s)*pc_(s)*q_(s);\n"},{"id":"45451","messageId":"Pine.LNX.4.64.0706210212060.4059@racer.site","threadId":"8665","inReplyTo":"31e9dd080706201802h9dcbffawd82575d09e082155@mail.gmail.com","subject":"Re: Strange diff behavior?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-21T01:13:11Z","receivedAt":"2007-06-21T01:13:11Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 20 Jun 2007, Jason Sewall wrote:\n\n> It seems like every change listed after the first one is meaningless.\n\nJust a guess: core.autocrlf=true?\n\nCiao,\nDscho\n"},{"id":"45472","messageId":"1182408458.6159.0.camel@localhost","threadId":"8665","inReplyTo":"Pine.LNX.4.64.0706210212060.4059@racer.site","subject":"Re: Strange diff behavior?","fromName":"Raimund Bauer","fromEmail":"ray007@gmx.net","sentAt":"2007-06-21T06:47:38Z","receivedAt":"2007-06-21T06:47:38Z","isPatch":false,"sender":{"key":"ray007@gmx.net","avatar":null},"body":"On Thu, 2007-06-21 at 02:13 +0100, Johannes Schindelin wrote:\n> Hi,\n> \n> On Wed, 20 Jun 2007, Jason Sewall wrote:\n> \n> > It seems like every change listed after the first one is meaningless.\n> \n> Just a guess: core.autocrlf=true?\n\nMy guess: apply.whitespace=strip\n\n> Ciao,\n> Dscho\n\n-- \nbest regards\n\n  Ray\n"},{"id":"45473","messageId":"20070621065043.GA30521@moooo.ath.cx","threadId":"8665","inReplyTo":"31e9dd080706201802h9dcbffawd82575d09e082155@mail.gmail.com","subject":"Re: Strange diff behavior?","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2007-06-21T06:50:44Z","receivedAt":"2007-06-21T06:50:44Z","isPatch":false,"sender":{"key":"matled@gmx.net","avatar":null},"body":"Jason Sewall <jasonsewall@gmail.com> wrote:\n> It seems like every change listed after the first one is meaningless.\n> I really think I just don't understand something about the diff\n> algorithm. Can someone tell my why those empty lines are recorded as\n> changes?\n\nThis are whitespace changes.\n\n    $ git diff --color\n\nmarks whitespaces at the end of the line with a red background color\nso you can see what changed.  I also use vim with :set list to see\nwhitespace changes, e.g.\n\n    $ git diff | vim -c 'set list' -\n\nIf you like to have colors (not just in diff) permnanently you can add\nthis to your .git/config or ~/.gitconfig:\n\n    [color]\n        branch = auto\n        diff = auto\n        status = auto\n        pager = true\n\nSee also git-config(1) for more information on these and other\nconfiguration options.\n"},{"id":"45475","messageId":"31e9dd080706210002q4703f464xafa07359f98878cf@mail.gmail.com","threadId":"8665","inReplyTo":"20070621065043.GA30521@moooo.ath.cx","subject":"Re: Strange diff behavior?","fromName":"Jason Sewall","fromEmail":"jasonsewall@gmail.com","sentAt":"2007-06-21T07:02:20Z","receivedAt":"2007-06-21T07:02:20Z","isPatch":false,"sender":{"key":"jasonsewall@gmail.com","avatar":null},"body":"As I mentioned in the ps, I git-diff --check shows nothing. As a\nmatter of fact, I do have color turned on and the pluses are green and\nminuses red, but there are none of the characteristic red blocks that\ntrailing whitespace makes.\n\nOn 6/20/07, Matthias Lederhofer <matled@gmx.net> wrote:\n> Jason Sewall <jasonsewall@gmail.com> wrote:\n> > It seems like every change listed after the first one is meaningless.\n> > I really think I just don't understand something about the diff\n> > algorithm. Can someone tell my why those empty lines are recorded as\n> > changes?\n>\n> This are whitespace changes.\n>\n>     $ git diff --color\n>\n> marks whitespaces at the end of the line with a red background color\n> so you can see what changed.  I also use vim with :set list to see\n> whitespace changes, e.g.\n>\n>     $ git diff | vim -c 'set list' -\n>\n> If you like to have colors (not just in diff) permnanently you can add\n> this to your .git/config or ~/.gitconfig:\n>\n>     [color]\n>         branch = auto\n>         diff = auto\n>         status = auto\n>         pager = true\n>\n> See also git-config(1) for more information on these and other\n> configuration options.\n>\n"},{"id":"45484","messageId":"Pine.LNX.4.64.0706211131160.4059@racer.site","threadId":"8665","inReplyTo":"1182408458.6159.0.camel@localhost","subject":"Re: Strange diff behavior?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-21T10:31:38Z","receivedAt":"2007-06-21T10:31:38Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 21 Jun 2007, Raimund Bauer wrote:\n\n> On Thu, 2007-06-21 at 02:13 +0100, Johannes Schindelin wrote:\n> \n> > Just a guess: core.autocrlf=true?\n> \n> My guess: apply.whitespace=strip\n\nMuch better guess, I guess. Jason?\n\nCiao,\nDscho\n"},{"id":"45514","messageId":"31e9dd080706210946i4821f300o55e89b67b3be562@mail.gmail.com","threadId":"8665","inReplyTo":"Pine.LNX.4.64.0706211131160.4059@racer.site","subject":"Re: Strange diff behavior?","fromName":"Jason Sewall","fromEmail":"jasonsewall@gmail.com","sentAt":"2007-06-21T16:46:02Z","receivedAt":"2007-06-21T16:46:02Z","isPatch":false,"sender":{"key":"jasonsewall@gmail.com","avatar":null},"body":"Ok, it was my bad. There *were* whitespaces on those lines, but in\nHEAD^, not head. Git only cares when they are introduced, not when\nthey are removed. So git diff HEAD^..HEAD showed that strange line\nremoval/add but git diff HEAD..HEAD^ shows me the whitespace.\n\nI recently set up emacs to strip whitespace whenever I save a file to\nprevent git from complaining (and it's good practice anyway), so that\nexplains why I didn't expect the change\n\nSorry about the mixup, and thanks for your help.\n\nOn 6/21/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> Hi,\n>\n> On Thu, 21 Jun 2007, Raimund Bauer wrote:\n>\n> > On Thu, 2007-06-21 at 02:13 +0100, Johannes Schindelin wrote:\n> >\n> > > Just a guess: core.autocrlf=true?\n> >\n> > My guess: apply.whitespace=strip\n>\n> Much better guess, I guess. Jason?\n>\n> Ciao,\n> Dscho\n>\n"}]}