{"thread":{"id":"40646","subject":"Filters and diff vs. status","startedAt":"2015-10-26T14:54:44Z","lastAt":"2015-10-26T14:54:44Z","messageCount":1,"participants":["Pietro Battiston"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"272242","messageId":"1445871284.2698.43.camel@pietrobattiston.it","threadId":"40646","inReplyTo":null,"subject":"Filters and diff vs. status","fromName":"Pietro Battiston","fromEmail":"me@pietrobattiston.it","sentAt":"2015-10-26T14:54:44Z","receivedAt":"2015-10-26T14:54:44Z","isPatch":false,"sender":{"key":"me@pietrobattiston.it","avatar":"https://gravatar.com/avatar/6de10c7b53eb76c5b2c03b58c9feee9291ce8e953ca759281075323ed022014e?d=mp&s=160"},"body":"Dear mailing list,\n\nI am using, on specific files, a filter which I created.¹ Often, files\nbeing tracked are modified in a way not meant to be reflected in the\ngit history to result in changes to be committed. And sometimes, the\nfollowing happens:\n\npietro@debiousci:~/path/to/repo$ git status a_file.ipynb\nOn branch master\nYour branch is up-to-date with 'origin/master'.\nChanges not staged for commit:\n  (use \"git add <file>...\" to update what will be committed)\n  (use \"git checkout -- <file>...\" to discard changes in working\ndirectory)\n\n\tmodified:   a_file.ipynb\n\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\npietro@debiousci:~/path/to/repo$ git diff a_file.ipynb\npietro@debiousci:~/path/to/repo$\n\n\n(notice that no diff shown). Then I wonder what is happening (checking\nout the file doesn't help, resetting --hard neither), and I try to\ncommit the (apparently unchanged) file . And I get the following:\n\n\npietro@debiousci:~/path_to_repo$ git commit a_file.ipynb -m '?!'\n[master\nc76125a] ?!\n 1 file changed, 1 insertion(+), 1 deletion(-)\npietro@debiousci:~/path/to/repo$ git show HEAD\ncommit c76125a537f88db4ff5d13c97b92e1f01c13bb47\nAuthor: Pietro Battiston <me@pietrobattiston.it>\nDate:   Mon Oct 26 13:37:24 2015 +0100\n\n    ?!\n\ndiff --git a/a_file.ipynb b/a_file.ipynb\nindex dfdbd79..61663fb 100644\n--- a/notebook/a_file.ipynb        \n+++ b/notebook/a_file.ipynb        \n@@ -349,4 +349,4 @@\n    \"metadata\": {}\n   }\n  ]\n-}\n\\ No newline at end of file\n+}\n\n\nNow, I don't particularly care about a newline being present or not at\nthe end of the file, but the fact that the working tree looks dirty\n(forbidding me from doing merges) - and that I don't understand why,\nand how to fix this without adding bogus commits, annoys me.\nI found an analogous behaviour reported some years ago,² and the\nconclusion was \"I think that there is a bug. I have observed this as\nwell with my own clean filter sometimes, but not always. I haven't\nfound a recipe that reliably exhibits the problem.\" Apart from that, I\nhave found no clue of why \"git diff\" and \"git status\" do not agree.\n\nDoes anybody have any pointer to solve this? I could try to play with\nmy filter imposing that it adds/doesn't add a newline at the end of its\noutput, but I am really missing the logic of what is going on on the\ngit side.\n\nThanks in advance,\n\nPietro\n\n\n\n¹ I don't want to waste anybody's time (I guess the answer to my\nproblem is pretty general), but for more details see\n https://github.com/toobaz/ipynb_output_filter , presenting both the\nscript and the configuration I use.\n\n² \nhttp://thread.gmane.org/gmane.comp.version-control.git/125378/focus=125\n684\n"}]}