Use non-predictable filename for downloaded patch file

Since the /tmp directory is readable by everybody on Unix, and since
the patch name could be public or easy to guess, a attacker could create a symlink
to a file writable by the user running hub, which would be replaced by the patch.

This has been assigned CVE-2014-0177
Add test support for matching command outcome via regex
Improve temporary patch file usage and tests
Merge branch 'tmp-random'
Fix API 422 error: `Duplicate value for "description"`

When looking up an existing hub token among user's authorizations, be
sure to fetch all results by following pagination links. Previously we
just stopped at the 1st page, and if the token for hub didn't appear
there we would try to create it, which would result in a 422 validation
error if it already existed.

References 1e4477b566c01aadfd807fc77ab4596ec164aed2

Fixes #531, fixes #558, fixes #563
Merge branch 'auth-pagination'
Fix "invalid byte sequence" errors in `pull-request`

If the user's `LANG` environment variable doesn't include "UTF-8", the
default external encoding in Ruby will be US-ASCII and as such, string
operations will fail dealing with pull request message or changelog that
contains non-ASCII characters.

This explicitly configures external encoding in hub to default to "UTF-8".
This applies to data over ARGV, `$stdin.read`, and reading files.

Fixes #566
Fix generating standalone script in bundle context

`bundle exec rake standalone` in development mode would try to shell out
to `ruby --disable-gems` to detect 1.9 support, but that would fail
because Bundler tries to propagate itself through RUBYOPT and
`--disable-gems` obviously doesn't play along with it.
Merge branch 'encoding-fix'
Respect git "core.commentchar" setting

The comment char is read from git config if it exists, but defaults to
"#" as before.

Fixes #530
Revert "Allow help pager to clear screen on exit"

This reverts commit 5a94221027e8c83a08ee15ff03f21ab74e288f1d.

Removing "X" from `less` configuration did help to clear the screen on
exit, but also led to paginated output being swallowed up when the
output was less than one page (i.e. one line). I have no idea what
actually happens, but it's important to bring back full output.

I couldn't find a way to have paginated output cleared on exit at the
same time as having single-page output normally.

Fixes #520, reopens #368
Don't re-wrap default pull request message taken from commit

Re-wrapping to 78 chars was dangerous since it could lead to moving
a #-reference to the beginning of a line which would then get
interpreted as a comment.

Wrapping pull request message is not useful anyway since it's Markdown.
For best results when rendered, users should unwrap their text.

Fixes #548, closes #570
Merge branch 'commentchar'
Fix shebang on Ubuntu

Ubuntu is a kind of system where everything after the first space in a
shebang is provided as the first argument. Therefore, we can't allow
generating a script that has more than one argument to Ruby interpreter
in the shebang.

http://stackoverflow.com/a/4304187/11687

References ea0103fbc5ea61fc02577cf3ff3bdadda871dc20

Fixes #569
hub 1.12.1
Merge remote-tracking branch 'origin/master' into merge_master

Conflicts:
	features/pull_request.feature
Explicitly paginate just help text instead of all output

Before we tried to automatically paginate all `puts` output depending on
whether it fits on one page using LESS options. This didn't work as
intended, so now explicitly opt in for pagination for `hub help -p` and
`hub help hub` output.

Doing so enables us to clear the screen reliably upon exiting the pager
without risking single-page output being swallowed.

This reverts commit 45003e19524dafa7dbfe23685eb0e7010b223957.

Fixes #368
Don't allow man page width to exceed 120 characters

Text wider that that is hard to read. Also, on terminals narrower than
120 chars, provide a 1-character right margin to improve readability in
case of vertical splits.
Show `hub <command> -h` short usage help on stdout

Instead of stderr, show this help on stdout because we suppose that the
user intended to retrieve help intentionally.
Merge branch 'terminal-tweaks'