In case you are using #Emacs on the master branch, you may have troubles staging only chunks in #Magit when working on a repository opened through #TRAMP (yeah, very specific stuff, but really annoying when it happens).
This is a known bug, currently tracked both on Magit’s repository and on Emacs’ bug tracker.
https://github.com/magit/magit/issues/4720
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62093
A way to avoid this #Magit issue is to freeze your #Emacs version at commit 0214e90 (https://github.com/emacs-mirror/emacs/commit/0214e9021b4dbbda1b6040e3b692f29d77a3b8cc). It’s the next commit, 8c6a463, that introduces the bug.
Or you could apply a patch before building that reverses 8c6a463 if you want to stay on the edge.