rename section "Diffing" to "Ediff Support"

The code in this section has little to do with git-diff for which we
generally use the term "Diff".  That is only to get some information
which is then used to provide wrappers around ediff.
move misplace "Diff Mode" section heading

Function `magit-refresh-diff-buffer' belongs in this section.
add magit-buffer-file-name

This is an alternative to `buffer-file-name' which also works in buffers
that do not directly visit a file but still map to exactly one file.
More precisely this supports indirect buffer and buffers "visiting" a
file as it was in some revision.

Use it in `magit-read-file-from-rev'.
move definitions of magit-save-index and magit-show

These functions do not belong in the "Diffs and Hunks" section.

`magit-show' has absolutely nothing to do with that, unfortunately
there no place at all where it would naturally belong.  Add it to
the new "Miscellaneous Commands" section.

Move `magit-save-index' to section "Ediff Support" as it is only
used there.

Also move the definitions of the related variables so that their
definitions remain located before their first use.

Move `magit-show-current-version' to "Ediff Support".

Move `magit-file-name' to "String and File Utilities" as it is also
used by `magit-buffer-file-name' added in the previous commit.
move magit-insert-region right below its callers

This should make it easier to grasp their somewhat strange semantic.
merge magit-insert-current-line into its only caller

It was actually not abstract enough to be used in call cases where the
caller `magit-insert-hunk-item-region-patch' had to do "something like
it".  Merging reduces both line count and makes it easier to understand
what is going on.
move definition of magit-init

Move definition of `magit-init' below that of `magit-status'.
The fact that the former may be used by the latter is the only
justification for it to be defined somewhere in the "Status Mode"
section at all.

The old location was just silly.  It was defined below the refresh
function and above the mode definition; and nowhere near that of
`magit-status'.
add new subsections to "Status Mode" section

The "Status Mode" toplevel section contains various definitions that do
not strictly belong there.  Because there also are no other places that
would make complete sense and defining separate toplevel sections for
these definitions would also not be appropriate they are kept in the
current section.

The hope is that eventually a natural place for these definitions will
evolve.  Until then at least split the misplaced stuff into dedicated
subsections.  This can be done without moving any code around (except
for `magit-init' which was moved in the last commit).

Add a new subsection "Save File Buffers".  Because it right in the
middle of the existing "Status Refresh and Commands" subsection that is
renamed to "Status Refresh" and a new subsection "Status Commands" is
added.

Creating new toplevel sections would also be an option but that would
require that code be moved around (because "Status Commands" really does
belong in the "Status Mode" section).

In summary: "Save Buffers" and "Read Repository" should not really be
located below "Status Mode" but having them their is less bad than the
alternatives.
add magit-decode-git-path

... and use it to undo the following in some places.

(There might be some other places that could benefit from this.  Or
maybe there are event better places to do this instead, to avoid doing
it repeatedly.)

https://github.com/git/git/blob/master/quote.c

Quoting man:git-config "core.quotepath":

The commands that output paths (e.g.  ls-files, diff), when not given
the -z option, will quote "unusual" characters in the pathname by
enclosing the pathname in a double-quote pair and with backslashes the
same way strings in C source code are quoted. If this variable is set
to false, the bytes higher than 0x80 are not quoted but output as
verbatim. Note that double quote, backslash and control characters are
always quoted without -z regardless of the setting of this variable.

Thanks to Nicolas Richard for investigating this issue.  #581, #840.
magit-mode-setup: cosmetics
Merge branch 'cleanup'
Revert "merge magit-insert-current-line into its only caller"

This reverts commit 7439645923e2173b5019c13e7e947a656bd9c1ea.
move magit-insert-current-line right below its only caller
remove some makeup (fix: magit-mode-setup: cosmetics)
magit-git-dir: rename argument SUBDIR to PATH
magit-buffer-file-name: ensure returned value is full path

unless argument RELATIVE is non-nil, obviously.
magit-show: use full path for tempory  buffer-file-name value

`magit-show' temporarily binds `buffer-file-name' around the call to
`normal-mode' because that is needed to set directory local variables.

However it used the filename relative to the repository root.  Now that
is expanded to a full path before binding `buffer-file-name'.
magit-compat.el: note when support for tested features was added
Add debug statement to magit-section-action
Resurrect the staged version of a file

'k' on deleted file in the "Unstaged changes" section use to first reset
all change on the staged version and then checkout the file as in the
last commit. This can lead to data lost if one have already staged some
change, then deleted the file then try to resurrect the just deleted
file.

It less surprising if we resurrect the staged version of a file when it
is different from the committed version.