set $GIT_EDITOR from scratch, add client-less fallback

Add new variable `magit-emacsclient-executable'.  Its default value is
set by searching for an executable in the same directory the executable
of the running Emacs instance is located in or if it cannot be found
there anywhere on `exec-path'.  This should virtually always return
something usable.  If it doesn't then something is seriously wrong with
the Emacs installation.

We first limit the search to the directory containing the invoked Emacs
executable because multiple Emacs version might be installed and the
emacsclient earliest on the `exec-path' might not be compatible with
the running Emacs.

No longer base the $GIT_EDITOR that is eventually used by Magit when
calling git on $GIT_EDITOR or $EDITOR as set in the environment of the
running Emacs.  Instead of detecting and fixing bad values optained that
way always set $GIT_EDITOR from scratch.

Add alternative code paths to `magit-commit' and `magit-tag' that do not
require a working client/server interaction.  When using tramp and when
no window system is available also use these fallbacks.

This can still be improved a lot.  But at least we are no longer set on
a path that forces us add one kludge after another on top of the
existing kludges.

`magit-interactive-rebase' most likely cannot be implemented without the
use of emacsclient so that command now refuses to run if the client
cannot be used.

Remove `magit-git-editor' in favor of `magit-emacsclient-excecutable'.
Rename `magit-with-git-editor' to `magit-with-emacsclient'.
Add `magit-use-emacsclient-p' and `magit-assert-emacsclient'.
magit-commit-internal: use new git-commit-commit-hook
Merge branch 'sane-client'
fix previous commit
fix previous two commits
further improve magit-with-emacsclient
magit-commit-internal: when tagging use TAG_EDITMSG
Makefile: add 'authors' target

Commits a9ed908a/59fd7f6d removed the majority of our contributors'
copyright statements due to the maintenance overhead involved in
keeping it accurate and up to date.

However, besides being in violation of the GPL, this is rather
discourteous towards our contributors, considering all the time and
effort they've expended to improve Magit for the good of us all.

Also, if left in its current state, it's only a matter of time before
people start adding copyright lines again, and "who's maintainer" or
"who committed the most" are inherently transient metrics, so at some
point in the future, the list would need to be revised again, manually,
in every file, no matter what.

Fortunately, this can be easily solved by directly crediting only a
single entity and consolidating its constituents into an auto-generated
"AUTHORS.md" file that covers the entire project, allowing us to properly
credit our contributors as well as permanently retiring the Copyright
Cleaner hat.

- - -

I've globally replaced the copyright headers with a copyright statement
crediting "The Magit Project Developers" (do note that this is *not*
equivalent to "copyright assignment") with the correct copyright year(s),
a pointer to the "AUTHORS.md" file, and an "Author:" line, of which the
value was procured using:

  for i in *.el ; do
      printf "%s\n  %s\n\n" \
          "${i}" \
          "$(git log --pretty=format:'%h : [%ai] %aN <%aE>' -- "${i}" \
             | tail -n 1)" ;
  done

An exception was made for "magit-wip.el", which was introduced by
Ryan C. Thompson (commit b877584e) but Jonas Bernoulli coded pretty
much the whole thing (commit 5e2e992b and later).

Files containing code borrowed from other projects (specifically
"magit-blame.el" and "magit-compat.el") now state the relevant
projects' names, URLs and licenses, right below the "Author:" line.

The Makefile now contains targets which use git-log(1) to generate an
unabridged list of our contributors' names and email addresses, which
is combined with "AUTHORS.md.in" and written to "AUTHORS.md", which is
always included when rolling tarballs and installing.

To prevent incomplete/duplicate/outdated/erroneous authors' names and
email addresses, a ".mailmap" file was created, which is automatically
picked up by git-log(1) when using %aN/%aE instead of %an/%ae.

The only contributors for whom I couldn't find any conclusive info are:
- "aaa707 <aaa707b@gmail.com>"
- "acple <silentsphere110@gmail.com>"
- "rabio <rabiodev@o2.pl>"
...so these are included as-is.

And thus the only maintenance overhead left to keeping this list up to
date is running "make authors" and committing the updated "AUTHORS.md"
file, right before tagging a new release.

Signed-off-by: Pieter Praet <pieter@praet.org>
AUTHORS.md: auto-generated using 'make authors'

Signed-off-by: Pieter Praet <pieter@praet.org>
Specify the argument of verify-visited-file-modtime

On some Emacs version (24.3.1 in Debian) verify-visited-file-modtime
will fail when tramp is used, and the optional argument is omitted or
nil. fixes #808
magit.el: remove `git-commit-commit-function' declaration

Obsolete since magit/git-modes@e0763fdc.

Signed-off-by: Pieter Praet <pieter@praet.org>
`magit-assert-emacsclient': s/tramp-file-name-p/tramp-tramp-file-p/

Running `magit-interactive-rebase' in a repo over TRAMP resulted in:

  $ git --no-pager rebase -i foo^
  fatal: Terminal is dumb, but EDITOR unset
  Could not execute editor
  git exited abnormally with code 1.

Signed-off-by: Pieter Praet <pieter@praet.org>
`magit-interactive-rebase': pass more specific ACTION to `magit-assert-emacsclient'

We only need emacsclient(1) when rebasing *interactively*, so
don't needlessly discourage the user from using ordinary rebase.

Signed-off-by: Pieter Praet <pieter@praet.org>
Merge pull request #810 from praet/sane-client-fixes

sane-client fixes
Merge pull request #809 from praet/attribution-v4

Attribution v4
magit-save-some-buffers: add optional TOPDIR argument
magit-buffer-switch: add optional SWITCH-FUNCTION argument

This allows using this function in `magit-status' which until now
had to duplicate some of the functionality of this function.
magit-buffer-switch: detect magit buffers using derived-mode-p

Previously a regular expression ("magit") that matched to
much ("^\*magit" would have been more appropriate) was used to detect
such buffers based on their names.

This changes how the current buffer effects switching to a magit-mode
buffer:

- Buffers whose name begins with "*magit" but do not derive from
  `magit-mode' (e.g. "*magit-process*") are now treated as non-magit
  buffers.

- Buffers visiting magit libraries (e.g. "magit.el") are now treated
  as what they are "non-magit" buffers.
fix handling of magit-restore-window-configuration

When option `magit-restore-window-configuration' is non-nil
`magit-quit-window' restores the "previous window configuration" after
quitting the window and burying the buffer.  That configuration is
stored by `magit-buffer-switch'.

Until now the previous configuration was stored everytime
`magit-buffer-switch' was called, even if the buffer already existed
or even was already visible in the current frame.  This could lead to
`magit-quit-window' being unable to actually quit the window.

Now the previous configuration is only saved when it makes sense and
as an additional precaution `magit-quit-window' sets it to nil after
using it.
`magit-remove-conflicts': `delete-dups' from ALIST before populating hash table

When a member of `magit-repo-dirs' is a parent/child/duplicate of one of
the other members, ALIST will contain duplicate key-value mappings, and
because of the way `magit-remove-conflicts' tries to uniquify the keys,
it will keep recursing on those associations until their keys are the
canonical path to the repo, after which it blows up because it can no
longer extract a higher-level directory to prefix them with.

Fixes #811 and #311.

Signed-off-by: Pieter Praet <pieter@praet.org>