Dear mailing list,

I am using, on specific files, a filter which I created.¹ Often, files
being tracked are modified in a way not meant to be reflected in the
git history to result in changes to be committed. And sometimes, the
following happens:

pietro@debiousci:~/path/to/repo$ git status a_file.ipynb
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working
directory)

        modified:   a_file.ipynb

no changes added to commit (use "git add" and/or "git commit -a")
pietro@debiousci:~/path/to/repo$ git diff a_file.ipynb
pietro@debiousci:~/path/to/repo$


(notice that no diff shown). Then I wonder what is happening (checking
out the file doesn't help, resetting --hard neither), and I try to
commit the (apparently unchanged) file . And I get the following:


pietro@debiousci:~/path_to_repo$ git commit a_file.ipynb -m '?!'
[master
c76125a] ?!
 1 file changed, 1 insertion(+), 1 deletion(-)
pietro@debiousci:~/path/to/repo$ git show HEAD
commit c76125a537f88db4ff5d13c97b92e1f01c13bb47
Author: Pietro Battiston <m...@pietrobattiston.it>
Date:   Mon Oct 26 13:37:24 2015 +0100

    ?!

diff --git a/a_file.ipynb b/a_file.ipynb
index dfdbd79..61663fb 100644
--- a/notebook/a_file.ipynb        
+++ b/notebook/a_file.ipynb        
@@ -349,4 +349,4 @@
    "metadata": {}
   }
  ]
-}
\ No newline at end of file
+}


Now, I don't particularly care about a newline being present or not at
the end of the file, but the fact that the working tree looks dirty
(forbidding me from doing merges) - and that I don't understand why,
and how to fix this without adding bogus commits, annoys me.
I found an analogous behaviour reported some years ago,² and the
conclusion was "I think that there is a bug. I have observed this as
well with my own clean filter sometimes, but not always. I haven't
found a recipe that reliably exhibits the problem." Apart from that, I
have found no clue of why "git diff" and "git status" do not agree.

Does anybody have any pointer to solve this? I could try to play with
my filter imposing that it adds/doesn't add a newline at the end of its
output, but I am really missing the logic of what is going on on the
git side.

Thanks in advance,

Pietro



¹ I don't want to waste anybody's time (I guess the answer to my
problem is pretty general), but for more details see
 https://github.com/toobaz/ipynb_output_filter , presenting both the
script and the configuration I use.

² 
http://thread.gmane.org/gmane.comp.version-control.git/125378/focus=125
684
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to