l10n: Init Vietnamese translation

Signed-off-by: Trần Ngọc Quân <vnwildman@gmail.com>
gitk: Merge branch 'new' of https://github.com/vnwildman/gitk

to get Vietnamese translations for gitk.

Signed-off-by: Paul Mackerras <paulus@samba.org>
git-gui: show staged submodules regardless of ignore config

Currently setting submodule.<name>.ignore and/or diff.ignoreSubmodules to
"all" suppresses all output of submodule changes for git-gui. This is
really confusing, as even when the user chooses to record a new commit for
an ignored submodule by adding it manually this change won't show up under
"Staged Changes (Will Commit)".

Fix that by using the '--ignore-submodules=dirty' option for both callers
of "git diff-index --cached" when the underlying git version supports that
option.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
git-gui: tolerate major version changes when comparing the git version

Since git 2.0.0 starting git gui in a submodule using a gitfile fails with
the following error:

   No working directory ../../../<path>

   couldn't change working directory
   to "../../../<path>": no such file or
   directory

This is because "git rev-parse --show-toplevel" is only run when git gui
sees a git version of at least 1.7.0 (which is the version in which the
 --show-toplevel option was introduced). But "package vsatisfies" returns
false when the major version changes, which is not what we want here.

Fix that for both places where the git version is checked using vsatisfies
by appending a '-' to the version number. This tells vsatisfies that a
change of the major version is not considered to be a problem, as long as
the new major version is larger. This is done for both the place that
caused the reported bug and another spot where the git version is tested
for another feature.

Reported-by: Chris Packham <judge.packham@gmail.com>
Reported-by: Yann Dirson <ydirson@free.fr>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
gitk: Replace SHA1 entry field on keyboard paste

We already replace old SHA with the clipboard content for the mouse
paste event.  It seems reasonable to do the same when pasting from
keyboard.

Signed-off-by: Ilya Bobyr <ilya.bobyr@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk: Switch to patch mode when searching for line origin

If the "Show origin of this line" is started from tree mode,
it still shows the result in tree mode, which I suppose not
what user expects to see.

Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk: Allow displaying time zones from author and commit dates timestamps

Now gitk can be configured to display author and commit dates in their
original timezone, by putting %z into datetimeformat in ~/.gitk.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk: Honor TMPDIR when viewing external diffs

gitk fails to show diffs when browsing a read-only repository.
This is due to gitk's assumption that the current directory is always
writable.

Teach gitk to honor either the GITK_TMPDIR or TMPDIR environment
variables.  This allows users to override the default location
used when writing temporary files.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk: Show staged submodules regardless of ignore config

Currently setting submodule.<name>.ignore and/or diff.ignoreSubmodules to
"all" suppresses all output of submodule changes for gitk. This is really
confusing, as even when the user chooses to record a new commit for an
ignored submodule by adding it manually this change won't show up under
"Local changes checked in to index but not committed".

Fix that by using the '--ignore-submodules=dirty' option for both callers
of "git diff-index --cached" when the underlying git version supports that
option.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk: Use mktemp -d to avoid predictable temporary directories

gitk uses a predictable ".gitk-tmp.$PID" pattern when generating
a temporary directory.

Use "mktemp -d .gitk-tmp.XXXXXX" to harden gitk against someone
seeding /tmp with files matching the pid pattern.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
move "%G" format test from t7510 to t6006

The final test in t7510 checks that "--format" placeholders
that look similar to GPG placeholders (but that we don't
actually understand) are passed through. That test was
placed in t7510, since the other GPG placeholder tests are
there. However, it does not have a GPG prerequisite, because
it is not actually checking any signed commits.

This causes the test to erroneously fail when gpg is not
installed on a system, however. Not because we need signed
commits, but because we need _any_ commit to run "git log".
If we don't have gpg installed, t7510 doesn't create any
commits at all.

We can fix this by moving the test into t6006. This is
arguably a better place anyway, because it is where we test
most of the other placeholders (we do not test GPG
placeholders there because of the infrastructure needed to
make signed commits).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'jk/pretty-G-format-fixes' into next

* jk/pretty-G-format-fixes:
  move "%G" format test from t7510 to t6006
Merge git://repo.or.cz/git-gui

* git://repo.or.cz/git-gui:
  git-gui: tolerate major version changes when comparing the git version
  git-gui: show staged submodules regardless of ignore config
Merge early parts from git://ozlabs.org/~paulus/gitk.git

* master~2:
  gitk: Show staged submodules regardless of ignore config
  gitk: Allow displaying time zones from author and commit dates timestamps
  gitk: Switch to patch mode when searching for line origin
  gitk: Replace SHA1 entry field on keyboard paste
  l10n: Init Vietnamese translation
Sync with gitk/git-gui submodule fixes on master

* master:
  gitk: Show staged submodules regardless of ignore config
  gitk: Allow displaying time zones from author and commit dates timestamps
  gitk: Switch to patch mode when searching for line origin
  gitk: Replace SHA1 entry field on keyboard paste
  git-gui: tolerate major version changes when comparing the git version
  git-gui: show staged submodules regardless of ignore config
  l10n: Init Vietnamese translation
gitk: Catch mkdtemp errors

105b5d3f ("gitk: Use mktemp -d to avoid predictable temporary
directories") introduced a dependency on mkdtemp, which is not
available on Windows.

Use the original temporary directory behavior when mkdtemp fails.
This makes the code use mkdtemp when available and gracefully
fallback to the existing behavior when it is not available.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk: Add visiblerefs option, which lists always-shown branches

When many branches contain a commit, the branches used to be shown in
the form "A, B and many more", where A, B can be master of current
HEAD. But there are more which might be interesting to always know about.
For example, "origin/master".

The new option, visiblerefs, is stored in ~/.gitk. It contains a list
of references which are always shown before "and many more" if they
contain the commit. By default it is `{"master"}', which is compatible
with previous behavior.

Signed-off-by: Max Kirillov <max@max630.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Merge git://ozlabs.org/~paulus/gitk

* git://ozlabs.org/~paulus/gitk:
  gitk: Add visiblerefs option, which lists always-shown branches
  gitk: Catch mkdtemp errors
  gitk: Use mktemp -d to avoid predictable temporary directories
  gitk: Honor TMPDIR when viewing external diffs
Sync with master

* master:
  gitk: Add visiblerefs option, which lists always-shown branches
  gitk: Catch mkdtemp errors
  gitk: Use mktemp -d to avoid predictable temporary directories
  gitk: Honor TMPDIR when viewing external diffs
git-merge: Honor pre-merge hook

git-merge does not honor the pre-commit hook when doing automatic merge
commits, and for compatibility reasons this is going to stay.

Introduce a pre-merge hook which is called for an automatic merge commit
just like pre-commit is called for a non-automatic merge commit (or any
other commit).