Fix display of all branches labels in repos with short branch names

In a fresh repository with only the master branch the "All branches"
label would be truncated to "All br".
Fix rendering glitch for branch names

Parts of the author name would randomly be shown after the branch's
commit title if the title was shorter than the author name.
Set the reference list ID during creation

Because the reference list could not be found again, this caused the
branches and tags in the list to disappear in the main view when the
references were reloaded, such as after an external command.

Fixes GH-148.
Improve invalidation during reload of references

Add valid field and only clear the reference ID after the reload so that
decoration of replaced commits will work correctly.
Create temporary file with name as suffix

This helps editors guess the filetype to properly set up their syntax
highlighting.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Use TMPDIR for temporary files

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>

Fall back to /tmp if copying fails for the environment variable.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Do not expand the graph for merges already aligned to the left

Fixes regression introduced in de7cb8abe84337fd5b628648dfda1b472e0a6c53
as part of GH-143.
Pass terminal dimensions to git by setting COLUMNS and LINES

This partially reverts "Show diff stats as wide as the terminal" (commit
a7eb3057ec70d4948ca5f2de98fcf29d844085b4) which passed the terminal
width to git-diff using `--stat=%(width)`. This feature was introduced
in Git version 1.7.10 released 2013-04-06 and causes problems for older
versions of Git.

It turns out that Git will automatically read $COLUMNS when showing diff
stats, so the same effect can be achieved by passing the terminal
dimensions using environment variables.

Fixes GH-151, "Broken commit rendering on Ubuntu 10.04" since
incompatibilitis with older versions of Git is no longer an issue.
Tested using `tig 1f384f3f5b9f0ea5a78504200eb577fcb8ba600a`.
Fix regexec() error checking in grep_text() and grep_refs()

regexec() returns 0 for success and the non-zero code REG_NOMATCH for
failure, so it should be '!result' instead of 'result != REG_NOMATCH'.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Do not apply diff styling to untracked files in the stage view

Fixes GH-153.
Reenable the log view from the command line

Like `git log`, `tig log` shows the log view by default.

Closes GH-146.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Fix blame and status to work from within directories starting with a dot

When running `tig blame ../io.h' or `tig status' inside the directory
`.dir', the command:

	git rev-parse --git-dir --is-inside-work-tree --show-cdup --show-prefix

will print:

	/tig/.git
	true
	../
	.dir/

This cause read_repo_info() to confuse the show-prefix option output was
the output of the show-cdup option.

Fixes #172 reported by Azat Khuzhin.
Enable tilde expansion in ~/.tigrc "source" commands

... as used in the examples of the 'SOURCE COMMAND' section of tigrc(5).
Thanks to Johann Visagie for reporting this and providing an initial
patch.

Fixes #168
Fix unicode_width for combining characters

Combining characters have an effective width of zero because they just
modify an adjacent character. The commit fixes tree indentation issues
when using those kinds of characters.

Fixes #170

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Fix regression when running tig with no arguments and custom encoding

Since c7d67ab running "tig" with no options has failed with the error
"tig: No revisions match the given arguments." This was due to a change
in how the arguments for the back-end git call was being constructed.
This change caused the blank field left in place of "%(encoding_arg)"
when it is empty to not overwrite "buf" which then caused the value in
"buf" to be copied into dst_argv twice. The resulting git command failed
if there was no available revision named "log" as shown in the trace.

From the TIG_TRACE log:
git log log --no-color --pretty=raw --parents --parents --
fatal: bad revision 'log'

This fix works by properly and fully initializing "buf" before each use.

Fixes #167

Signed-off-by: Drew Northup <n1xim.email@gmail.com>

Minor edits of commit message and change patch to use sizeof(buf).

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Open editor at selected line also for multi-file diffs in the stage view

Refactor out diff_common_edit(), which extracts the diffed file path and
line numbers so it can be used for the case in stage_request() where
there's not a single file.
Introduce the stash view

This patch adds a new "stash" view, bound to the 'y' key.
This view displays the list of stashes. Pressing Enter on one of them
displays the corresponding change in a split view.

Running 'tig stash' opens directly the stash view.

A new %(stash) variable is added for bindings and commands.

A built-in command to pop the current stash is bound to 'P' in this
view. Other bindings may be added in the ~/.tigrc file, for instance:

    bind stash D !?git stash drop %(stash)
    bind stash A !?git stash apply %(stash)
    bind status S !?git stash save --keep-index %(prompt)

Fixes #169
Closes #174

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Prepend the path to the repository root when editing a diff file

Fixes #165
Scroll diff with arrow keys in log view

This commit introduces the VIEW_NO_PARENT_NAV flag and adds it to the
log view. This allows the scrolling commands to fall through from the
pager to the diff when the diff is viewed in the log mode.

Signed-Off-By: Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Crop text when title-overflow is enabled

Limit the length of the title text if less columns are available when
drawing the title. This fixes a glitch introduced with the original
title-overflow patch, where the title text would wrap to the next line
when rendered.

Improve the rendering when only part of the "non-overflowing" title text
is displayed by showing the '~' character to indicate that the text was
cropped.

Fixes #166