argv: ensure closing parenthesis in variables

While format_expand_arg() can assume a variable is well formed,
format_append_arg() should not.

A command using '%(prompt' without closing parenthesis causes Tig to
segfault. This is due to format_append_arg() which assumes the presence
of a ')' char, resulting in the 'next' variable being 0x1 (NULL + 1).

This patch checks for this case and return FALSE in consequence.

In the meantime, constify variables in these two functions.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Merge pull request #291 from vivien/argv/closing-parenthesis

argv: ensure closing parenthesis in variables
Move enum input_status to prompt header
Add :save-display command

This allows to dump the current ncurses screen data to a file. The main
use is for testing. The command optionally takes a file name.
Add support for running scripts using :script <file>
Add TIG_SCRIPT and TIG_NO_DISPLAY environment variables

The former allows to execute prompt scripts automatically on startup and
the latter forces Tig to not render anything to the terminal.
Add test framework

This adds a small test framework and updates all existing tests to use
it. Tests are now implemented using shell scripts and integration with
the build output is much improved.
Add test for tigrc compat errors
Add test for tigrc parsing errors
Add test for the main view
Fix the VERSION variable in Makefile

This also fixes the release script to correctly update the release
title.
Fix documentation for toggle command examples
Add test to check tigrc(5) examples for errors

This also fixes the errors identified by the test.
Ensure that tests reads tigrc from the default location
Extend tigrc parse test to check parsed bindings via the help view
Add test for TIGRC_USER and TIGRC_SYSTEM env variables

This also fixes a segfault when TERM=dumb due to built-in line rules not
being properly initialized.
Document the test framework and improve the test output

This adds the possibility to configure tests via TEST_OPTS env variable
which is used to control the indentation depending on whether showing
verbose output or not.
blame: treat HEAD as the parent of not-committed-yet

When blaming a file with uncommitted changes, it is annoying that it is
not possible to jump to the HEAD version from an uncommitted line.  It
turns out that the commit already has HEAD as its parent, so we simply
need to relax the check in check_blame_commit() to allow the parent
request to make it to blame_go_forward().

Signed-off-by: John Keeping <john@keeping.me.uk>
Merge pull request #295 from johnkeeping/blame-head-parent-of-not-committed

blame: treat HEAD as the parent of not-committed-yet
Use string_ncopy when copying ref names

Change code that updates the internal env/state variables to use
string_ncopy instead of string_copy_rev, since the latter copies atmost
40 characters. Test that both branches and tags with long names can be
succesfully checked out.

Fixes #290