xmkstemp(): avoid showing truncated template more carefully

Some implementations of xmkstemp() leaves the given in/out buffer
truncated when they return with failure.

6cf6bb3 (Improve error messages when temporary file creation fails,
2010-12-18) attempted to show the real filename we tried to create
(but failed), and if that is not available due to such truncation,
to show the original template that was given by the caller.

But it failed to take into account that the given template could
have "directory/" in front, in which case the truncation point may
not be template[0] but somewhere else.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: detect when PYTHON_PATH changes

When make is run, the python scripts are created from *.py files that
are changed to use the python given by PYTHON_PATH. And PYTHON_PATH
is set by default to /usr/bin/python on Linux.

This is nice except when you run make another time setting a
different PYTHON_PATH, because, as the python scripts have already
been created, make finds nothing to do.

The goal of this patch is to detect when the PYTHON_PATH changes and
to create the python scripts again when this happens. To do that we
use the same trick that is done to track other variables like prefix,
flags, tcl/tk path and shell path. We update a GIT-PYTHON-VARS file
with the PYTHON_PATH and check if it changed.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: replace "echo 1>..." with "echo >..."

This is clearer to many people this way.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t3600: Avoid "cp -a" which is a GNUism

With d4a7ffa (tests: "cp -a" is a GNUism, 2012-10-08), we got rid of
most of them, but a topic that was still in flight was missed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
t4014: fix arguments to grep

These "expect-failure" tests were not looking for the right string
in the patch file.  For example:

	grep "^ *"S. E. Cipient" <scipient@example.com>\$" patch5

was looking for "^ *S." in three files:

    "E."
    "Cipient <scipient@example.com>$"
    patch5

With some implementations of grep, the lack of file "E." was
reported as an error, leading to the expected failure of the test.
With other implementations of grep, the pattern "^ *S." matched what
was in patch5, without missing files diagnosed as an error, which
lead to these tests to unexpectedly pass.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
t9020: use configured Python to run test helper

The test helper svnrdump_sim.py is used as "svnrdump" during the
execution of this test, but the arrangement had a few undesirable
things:

 - it relied on symbolic links;
 - unportable "export VAR=VAL" was used;
 - GIT_BUILD_DIR variable was not quoted correctly;
 - it assumed that the Python interpreter is in /usr/bin/ and
   called "python" (i.e. not "python2.7" etc.)

Rework this by writing a small shell script that spawns the right
Python interpreter, using the right quoting.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
t9502: do not assume GNU tar

The check_snapshot function inspects and makes sure that not cruft
outside the repository hierarchy is added to the tar archive, by
insisting that the output from "tar tf" on the resulting archive
does not contain anything that does not begin with "$prefix/".
There are two issues with this implementation:

 - Traditional tar implemenations that do not understand
   pax_global_header will write it out as if it is a plain file at
   the top-level;

 - Some implementations of tar does not add trailing slash when
   showing a directory entry (i.e. the output line for the entire
   archive will show "$prefix", not "$prefix/").

Fix them so that what we want to validate can be tested with
traditional tar implementations.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
tests: optionally fail passed todo immediately

Add "--fail-passed-todo" option to stop the test immediately when a
test that is expected to fail succeeds.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'ap/log-mailmap' into jch

Clean up various codepaths around mailmap and teach the "log"
machinery to use it.

Will merge to 'next' after reading it over once again.

* ap/log-mailmap:
  test: Add test for --use-mailmap option
  log: Add --use-mailmap option
  pretty: Use mailmap to display username and email
  mailmap: Add mailmap structure to rev_info and pp
  mailmap: Simplify map_user() interface
  mailmap: Remove buffer length limit in map_user
  Use split_ident_line to parse author and committer

Conflicts:
	commit.h
	log-tree.c
Merge branch 'cc/no-gitk-build-dependency' into jch

Remove leftover bits from an earlier change to move gitk in its own
subdirectory.  Reimplementing the dependency tracking rules needs
to be done in gitk history separately.

* cc/no-gitk-build-dependency:
  Makefile: replace "echo 1>..." with "echo >..."
  Makefile: detect when PYTHON_PATH changes
  Makefile: remove tracking of TCLTK_PATH
Merge branch 'ss/svn-prompt' into jch

Waiting for an Ack from the area export.

* ss/svn-prompt:
  git-svn, perl/Git.pm: extend and use Git->prompt method for querying users
  perl/Git.pm: Honor SSH_ASKPASS as fallback if GIT_ASKPASS is not set
  git-svn, perl/Git.pm: add central method for prompting passwords
Merge branch 'jc/doc-diff-blobs' into jch

"git diff <blob> <blob>" was not documented and was only hinted as
an extension to "git diff <commit> <commit> -- <pathspec>", but
comparison between two blobs are more special than that.  It does
not take any pathspec to begin with.

* jc/doc-diff-blobs:
  Documentation: Describe "git diff <blob> <blob>" separately
Merge branch 'mk/maint-graph-infinity-loop' into jch

The --graph code fell into infinite loop when asked to do what the
code did not expect ;-)

Anybody who worked on "--graph" wants to comment?
Stalled mostly due to lack of responses.

* mk/maint-graph-infinity-loop:
  graph.c: infinite loop in git whatchanged --graph -m
Merge branch 'jc/test-portability' into pu

* jc/test-portability:
  tests: optionally fail passed todo immediately
  t9502: do not assume GNU tar
  t9020: use configured Python to run test helper
  t4014: fix arguments to grep
  t3600: Avoid "cp -a" which is a GNUism
Merge branch 'jc/mkstemp-more-careful-error-reporting' into pu

* jc/mkstemp-more-careful-error-reporting:
  xmkstemp(): avoid showing truncated template more carefully
Merge branch 'bc/append-signed-off-by' into pu

Expecting a re-roll after a review.

* bc/append-signed-off-by:
  Unify appending signoff in format-patch, commit and sequencer
  format-patch: update append_signoff prototype
  format-patch: stricter S-o-b detection
  t4014: more tests about appending s-o-b lines
  sequencer.c: teach append_signoff to avoid adding a duplicate newline
  sequencer.c: teach append_signoff how to detect duplicate s-o-b
  sequencer.c: always separate "(cherry picked from" from commit body
  sequencer.c: recognize "(cherry picked from ..." as part of s-o-b footer
  t/t3511: add some tests of 'cherry-pick -s' functionality
  t/test-lib-functions.sh: allow to specify the tag name to test_commit
  sequencer.c: remove broken support for rfc2822 continuation in footer
Merge branch 'wk/submodule-update-remote' into pu

Expecting a re-roll.

* wk/submodule-update-remote:
  submodule add: If --branch is given, record it in .gitmodules
  submodule update: add --remote for submodule's upstream changes
  submodule: add get_submodule_config helper funtion

Conflicts:
	Documentation/git-submodule.txt
	git-submodule.sh
Merge branch 'jc/add-delete-default' into pu

"git add dir/" updated modified files and added new files, but does
not notice removed files, which may be "Huh?" to some users.  They
can of course use "git add -A dir/", but why should they?

Resurrected from graveyard, as I thought it was a worthwhile thing
to do in the longer term.

Waiting for comments.

* jc/add-delete-default:
  git add: notice removal of tracked paths by default
Merge branch 'jc/maint-name-rev' into pu

"git name-rev" names the given revision based on a ref that can be
reached in the smallest number of steps from the rev, but that is
not useful when the caller wants to know which tag is the oldest one
that contains the rev.  This teaches a new mode to the command that
uses the oldest ref among those which contain the rev.

I am not sure if this is worth it; for one thing, even with the help
from notes-cache, it seems to make the "describe --contains" even
slower. Also the command will be unusably slow for a user who does
not have a write access (hence unable to create or update the
notes-cache).

Stalled mostly due to lack of responses.

* jc/maint-name-rev:
  describe --contains: use "name-rev --algorithm=weight"
  name-rev --algorithm=weight: tests and documentation
  name-rev --algorithm=weight: cache the computed weight in notes
  name-rev --algorithm=weight: trivial optimization
  name-rev: --algorithm option
  name_rev: clarify the logic to assign a new tip-name to a commit
  name-rev: lose unnecessary typedef

Conflicts:
	builtin/name-rev.c
Merge branch 'fc/remote-bzr' into pu

New remote helper for bzr (v3).  With minor fixes, this may be ready
for 'next'.

* fc/remote-bzr:
  (fixup) test-bzr.sh: fix multi-line string assignment
  remote-bzr: detect local repositories
  remote-bzr: add support for older versions of bzr
  remote-bzr: add support to push special modes
  remote-bzr: add support for fecthing special modes
  remote-bzr: add simple tests
  remote-bzr: update working tree upon pushing
  remote-bzr: add support for remote repositories
  remote-bzr: add support for pushing
  Add new remote-bzr transport helper