Untracked files are not touched by git reset, so git-crypt init
is safe even with untracked files present.
This relies on the -u option to git-status, which was added in Git
1.6.0, which was released in 2008. Add Git 1.6.0 as a requirement in
the README.
* Correctly check for existence of HEAD (use 'git rev-parse' instead
of 'git show-ref'). Fixes bug where hard reset might be skipped
after running 'git init'.
* Don't require working directory to be clean if HEAD doesn't exist.
(If HEAD doesn't exist, we won't be hard resetting so the working
directory doesn't need to be clean.)
* Overwrite existing git config values (instead of --add'ing them) so
'git-crypt init' can be idempotent.
* In the error message for a disrty working directory, advise user to
commit changes or 'git stash' them.
Even though arpa/inet.h is "networky" and this isn't a network
application, arpa/inet.h is in POSIX whereas endian.h is non-standard.
This should let git-crypt build on Mac OS X.
Although glibc's implementation of mkstemp creates temporary files with
a safe (i.e. 0600) mode, POSIX does not mandate any particular mode. So
to ensure maximum cross-platform safety, we must set a umask of 0077
before calling mkstemp.