`magit-guess-branch': use new func `magit-get-previous-branch'

Instead of depending on git-log(1)'s "--grep-reflog" flag (which
was only added in Git v1.8.0 [1]) and potentially doing a whole
bunch of string matching, use git-rev-parse(1) with the @{-N}
construct, which is supported since Git v1.6.2 [2].

As an added benefit, we now return nil instead of an invalid
refname when the previously checked out branch no longer exists.

[1] git/git@72fd13f7
[2] git/git@d18ba221

Signed-off-by: Pieter Praet <pieter@praet.org>
Merge pull request #793 from praet/get-prev-branch

`magit-guess-branch': use new func `magit-get-previous-branch'
Some better use of with-current buffer

  (save-current-buffer
    (set-buffer (process-buffer proc))
    ...)

is the same than with-current-buffer,
and when using with-current-buffer, one do not need to set the buffer a
second time.
Merge pull request #796 from vanicat/t/some-cleanup

Some better use of with-current buffer
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