magit-compat.el: use `defvar-local' for declaring git compat vars

See commit a3128449.

Signed-off-by: Pieter Praet <pieter@praet.org>
`magit-rev-diff-count': check git-rev-list(1) "--count" support

Try using git-rev-list(1)'s "--count" option before falling back
to a less efficient algorithm.

Partially reverts commit 54156be7.

Signed-off-by: Pieter Praet <pieter@praet.org>
`magit-wazzup-toggle-ignore': optimize writing to wazzup ignore-file

- Replace `with-temp-buffer' + `write-file' with `with-temp-file':
  Much more efficient.  Just look at all the crap `write-file'
  wastes time on, while `write-region' (as used by `with-temp-file')
  is a C built-in.

- Replace `dolist' with `mapconcat':
  Once again, much more efficient.  Why use a CL macro when using
  a C built-in is just as concise and readable?

Signed-off-by: Pieter Praet <pieter@praet.org>
`magit-tests--modify-file': optimize writing to filename

See previous commit.

Signed-off-by: Pieter Praet <pieter@praet.org>
Merge branch 'praet/optimizations'