Code

git.git
13 years agoMerge branch 'master' into next
Junio C Hamano [Fri, 7 Jan 2011 00:40:09 +0000 (16:40 -0800)]
Merge branch 'master' into next

* master:
  t3032: limit sed branch labels to 8 characters
  t0001,t1510,t3301: use sane_unset which always returns with status 0
  trace.c: ensure NULL is not passed to printf

13 years agoMerge branch 'ef/alias-via-run-command' into next
Junio C Hamano [Fri, 7 Jan 2011 00:33:27 +0000 (16:33 -0800)]
Merge branch 'ef/alias-via-run-command' into next

* ef/alias-via-run-command:
  alias: use run_command api to execute aliases

13 years agoalias: use run_command api to execute aliases
Erik Faye-Lund [Thu, 6 Jan 2011 23:00:38 +0000 (00:00 +0100)]
alias: use run_command api to execute aliases

On Windows, system() executes with cmd.exe instead of /bin/sh. This
means that aliases currently has to be batch-scripts instead of
bourne-scripts. On top of that, cmd.exe does not handle single quotes,
which is what the code-path currently uses to handle arguments with
spaces.

To solve both problems in one go, use run_command_v_opt() to execute
the alias. It already does the right thing prepend "sh -c " to the
alias.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot3032: limit sed branch labels to 8 characters
Brandon Casey [Thu, 6 Jan 2011 00:30:03 +0000 (18:30 -0600)]
t3032: limit sed branch labels to 8 characters

POSIX leaves as unspecified the handling of labels greater than 8
characters.  Apparently, Sun decided to treat them as errors.  Make sed on
Solaris happy by trimming the length of labels to 8 characters.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot0001,t1510,t3301: use sane_unset which always returns with status 0
Brandon Casey [Thu, 6 Jan 2011 00:30:02 +0000 (18:30 -0600)]
t0001,t1510,t3301: use sane_unset which always returns with status 0

On some shells (like /usr/xpg4/bin/sh on Solaris), unset will exit
non-zero when passed the name of a variable that has not been set.  Use
sane_unset instead so that the return value of unset can be ignored while
the && linkage of the test script can be preserved.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotrace.c: ensure NULL is not passed to printf
Brandon Casey [Thu, 6 Jan 2011 00:30:01 +0000 (18:30 -0600)]
trace.c: ensure NULL is not passed to printf

GNU printf, and many others, will print the string "(null)" if a NULL
pointer is passed as the argument to a "%s" format specifier.  Some
implementations (like on Solaris) do not detect a NULL pointer and will
produce a segfault in this case.

So, fix this by ensuring that pointer variables do not contain the value
NULL.  Assign the string "(null)" to the variables are NULL.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'master' into next
Junio C Hamano [Wed, 5 Jan 2011 22:58:05 +0000 (14:58 -0800)]
Merge branch 'master' into next

* master:
  Git 1.7.4-rc1
  Git 1.7.3.5
  t/t9001-send-email.sh: fix '&&' chain in some tests

13 years agoGit 1.7.4-rc1 v1.7.4-rc1
Junio C Hamano [Wed, 5 Jan 2011 22:46:07 +0000 (14:46 -0800)]
Git 1.7.4-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint' to sync with 1.7.3.5
Junio C Hamano [Wed, 5 Jan 2011 22:50:33 +0000 (14:50 -0800)]
Merge branch 'maint' to sync with 1.7.3.5

13 years agoGit 1.7.3.5 v1.7.3.5
Junio C Hamano [Wed, 5 Jan 2011 22:49:19 +0000 (14:49 -0800)]
Git 1.7.3.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'sr/gitweb-hilite-more' into next
Junio C Hamano [Wed, 5 Jan 2011 22:25:07 +0000 (14:25 -0800)]
Merge branch 'sr/gitweb-hilite-more' into next

* sr/gitweb-hilite-more:
  gitweb: remove unnecessary test when closing file descriptor
  gitweb: add extensions to highlight feature map

13 years agoMerge branch 'rj/svn-test' into next
Junio C Hamano [Wed, 5 Jan 2011 22:25:06 +0000 (14:25 -0800)]
Merge branch 'rj/svn-test' into next

* rj/svn-test:
  lib-git-svn.sh: Move web-server handling code into separate function

13 years agoMerge branch 'cb/setup' into next
Junio C Hamano [Wed, 5 Jan 2011 22:25:06 +0000 (14:25 -0800)]
Merge branch 'cb/setup' into next

* cb/setup:
  setup: translate symlinks in filename when using absolute paths

13 years agoMerge branch 'ae/better-template-failure-report' into next
Junio C Hamano [Wed, 5 Jan 2011 22:25:05 +0000 (14:25 -0800)]
Merge branch 'ae/better-template-failure-report' into next

* ae/better-template-failure-report:
  Improve error messages when temporary file creation fails

13 years agoMerge branch 'jn/cherry-pick-strategy-option' into next
Junio C Hamano [Wed, 5 Jan 2011 22:25:05 +0000 (14:25 -0800)]
Merge branch 'jn/cherry-pick-strategy-option' into next

* jn/cherry-pick-strategy-option:
  cherry-pick/revert: add support for -X/--strategy-option

13 years agoMerge branch 'jn/perl-funcname' into next
Junio C Hamano [Wed, 5 Jan 2011 22:25:05 +0000 (14:25 -0800)]
Merge branch 'jn/perl-funcname' into next

* jn/perl-funcname:
  userdiff/perl: catch BEGIN/END/... and POD as headers
  diff: funcname and word patterns for perl

13 years agoMerge branch 'jn/svn-fe' (early part)
Junio C Hamano [Wed, 5 Jan 2011 21:34:43 +0000 (13:34 -0800)]
Merge branch 'jn/svn-fe' (early part)

* 'jn/svn-fe' (early part):
  vcs-svn: Error out for v3 dumps

Conflicts:
t/t9010-svn-fe.sh

13 years agoMerge branch 'ao/t9001-fix'
Junio C Hamano [Wed, 5 Jan 2011 21:31:25 +0000 (13:31 -0800)]
Merge branch 'ao/t9001-fix'

* ao/t9001-fix:
  t/t9001-send-email.sh: fix '&&' chain in some tests

13 years agoMerge branch 'pw/convert-pathname-substitution'
Junio C Hamano [Wed, 5 Jan 2011 21:31:01 +0000 (13:31 -0800)]
Merge branch 'pw/convert-pathname-substitution'

* pw/convert-pathname-substitution:
  t0021: avoid getting filter killed with SIGPIPE
  convert filter: supply path to external driver

13 years agoMerge branch 'mg/cvsimport'
Junio C Hamano [Wed, 5 Jan 2011 21:30:29 +0000 (13:30 -0800)]
Merge branch 'mg/cvsimport'

* mg/cvsimport:
  cvsimport: handle the parsing of uppercase config options
  cvsimport: partial whitespace cleanup

13 years agoMerge branch 'pw/convert-pathname-substitution' into next
Junio C Hamano [Wed, 5 Jan 2011 00:24:18 +0000 (16:24 -0800)]
Merge branch 'pw/convert-pathname-substitution' into next

* pw/convert-pathname-substitution:
  t0021: avoid getting filter killed with SIGPIPE
  convert filter: supply path to external driver

13 years agoMerge branch 'mg/cvsimport' into next
Junio C Hamano [Wed, 5 Jan 2011 00:24:17 +0000 (16:24 -0800)]
Merge branch 'mg/cvsimport' into next

* mg/cvsimport:
  cvsimport: handle the parsing of uppercase config options
  cvsimport: partial whitespace cleanup

13 years agoMerge branch 'jn/svn-fe' (early part) into next
Junio C Hamano [Wed, 5 Jan 2011 00:22:00 +0000 (16:22 -0800)]
Merge branch 'jn/svn-fe' (early part) into next

* 'jn/svn-fe' (early part):
  vcs-svn: Error out for v3 dumps

Conflicts:
t/t9010-svn-fe.sh

13 years agogitweb: remove unnecessary test when closing file descriptor
Sylvain Rabot [Thu, 30 Dec 2010 21:20:29 +0000 (22:20 +0100)]
gitweb: remove unnecessary test when closing file descriptor

It happens that closing file descriptor fails whereas the blob is
perfectly readable.  According to perlman the reasons could be:

   If the file handle came from a piped open, "close" will additionally
   return false if one of the other system calls involved fails, or if the
   program exits with non-zero status.  (If the only problem was that the
   program exited non-zero, $! will be set to 0.)  Closing a pipe also waits
   for the process executing on the pipe to complete, in case you want to
   look at the output of the pipe afterwards, and implicitly puts the exit
   status value of that command into $?.

   Prematurely closing the read end of a pipe (i.e. before the process writ-
   ing to it at the other end has closed it) will result in a SIGPIPE being
   delivered to the writer.  If the other end can't handle that, be sure to
   read all the data before closing the pipe.

In this case we don't mind that close fails.

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: add extensions to highlight feature map
Sylvain Rabot [Thu, 30 Dec 2010 21:20:28 +0000 (22:20 +0100)]
gitweb: add extensions to highlight feature map

added: sql, php5, phps, bash, zsh, ksh, mk, make

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/t9001-send-email.sh: fix '&&' chain in some tests
Antonio Ospite [Tue, 4 Jan 2011 20:56:58 +0000 (21:56 +0100)]
t/t9001-send-email.sh: fix '&&' chain in some tests

t/README recommends chaining test assertions.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agolib-git-svn.sh: Move web-server handling code into separate function
Ramsay Jones [Thu, 30 Dec 2010 19:44:48 +0000 (19:44 +0000)]
lib-git-svn.sh: Move web-server handling code into separate function

This library file is currently sourced by 57 test files, of which
only four may (optionally) start a web-server in order to access
the svn repo via an http url, rather than a file url.

In addition to isolating the current web-server handling code from
the majority of tests, in a new prepare_httpd function, we also
add some more error checking and reporting code to validate the
apache installation. Only those tests which attempt to start the
web-server, by calling start_httpd, will execute this code.

Note that it is important for start_httpd to return an error
indication, if prepare_httpd fails, so that the failure to use
the web-server, as requested by the user, should not go unnoticed.
(Unless the svnrepo variable is set to an http url at the end of
start_httpd, the remaining tests will use file urls, without
comment.)

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosetup: translate symlinks in filename when using absolute paths
Carlo Marcelo Arenas Belon [Mon, 27 Dec 2010 10:54:37 +0000 (02:54 -0800)]
setup: translate symlinks in filename when using absolute paths

otherwise, comparison to validate against work tree will fail when
the path includes a symlink and the name passed is not canonical.

Signed-off-by: Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocvsimport: handle the parsing of uppercase config options
Michael J Gruber [Wed, 29 Dec 2010 21:55:34 +0000 (22:55 +0100)]
cvsimport: handle the parsing of uppercase config options

The current code leads to

  fatal: bad config value for 'cvsimport.r' in .git/config

for a standard use case with cvsimport.r set.

cvsimport sets internal variables by checking the config for each
possible command line option. The problem is that config items are case
insensitive, so config.r and config.R are the same. The ugly error is
due to that fact that cvsimport expects a bool for -R (and thus
config.R) but a remote name for -r (and thus config.r).

Fix this by making cvsimport expect long names for uppercase options.

config options for cvsimport have been undocumented so far, though
present in the code and advertised in several tutorials. So one may read
"enhance" for "fix". Similarly, the names for the options are
"documented" in the code, waitiing for their lowercase equivalents to be
transformed into long config options, as well.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jn/gitweb-no-logo' into next
Junio C Hamano [Tue, 4 Jan 2011 19:24:14 +0000 (11:24 -0800)]
Merge branch 'jn/gitweb-no-logo' into next

* jn/gitweb-no-logo:
  gitweb: make logo optional

13 years agoMerge branch 'master' into next
Junio C Hamano [Tue, 4 Jan 2011 19:23:59 +0000 (11:23 -0800)]
Merge branch 'master' into next

* master:
  daemon: support <directory> arguments again
  Fix typos in the documentation
  gitweb: skip logo in atom feed when there is none
  t9001: Fix test prerequisites

13 years agoMerge branch 'maint'
Junio C Hamano [Tue, 4 Jan 2011 19:23:45 +0000 (11:23 -0800)]
Merge branch 'maint'

* maint:
  gitweb: skip logo in atom feed when there is none
  t9001: Fix test prerequisites

13 years agodaemon: support <directory> arguments again
Jonathan Nieder [Tue, 4 Jan 2011 04:04:46 +0000 (22:04 -0600)]
daemon: support <directory> arguments again

Ever since v1.7.4-rc0~125^2~8 (daemon: use run-command api for async
serving, 2010-11-04), git daemon spawns child processes instead of
forking to serve requests.  The child processes learn that they are
being run for this purpose from the presence of the --serve command
line flag.

When running with <ok_path> arguments, the --serve flag is treated
as one of the path arguments and the special child behavior does
not kick in.  So the child becomes an ordinary git daemon process,
notices that all the addresses it needs are in use, and exits with
the message "fatal: unable to allocate any listen sockets on port
9418".

Fix it by putting --serve at the beginning of the command line,
where the flag cannot be mistaken for a path argument.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix typos in the documentation
Ralf Wildenhues [Mon, 3 Jan 2011 19:03:34 +0000 (20:03 +0100)]
Fix typos in the documentation

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: make logo optional
Jonathan Nieder [Sat, 4 Sep 2010 00:45:09 +0000 (19:45 -0500)]
gitweb: make logo optional

Some sites may not want to have a logo at all.

While at it, use $cgi->img to simplify this code.  (CGI.pm learned
most HTML4 tags by version 2.79, so this should be portable to perl
5.8, though I haven't tested.)

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: skip logo in atom feed when there is none
Jonathan Nieder [Sat, 4 Sep 2010 00:44:39 +0000 (19:44 -0500)]
gitweb: skip logo in atom feed when there is none

With v1.5.0-rc0~169 (gitweb: Fix Atom feed <logo>: it is $logo,
not $logo_url, 2006-12-04), the logo URI to be written to Atom
feeds was corrected but the case of no logo forgotten.

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot9001: Fix test prerequisites
Robin H. Johnson [Wed, 29 Dec 2010 21:02:31 +0000 (21:02 +0000)]
t9001: Fix test prerequisites

Add in missing Perl prerequisites for new tests of send-email.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'master' into next
Junio C Hamano [Tue, 28 Dec 2010 21:53:51 +0000 (13:53 -0800)]
Merge branch 'master' into next

* master:
  Git 1.7.4-rc0
  Prepare for 1.7.3.5
  t9001: use older Getopt::Long boolean prefix '--no' rather than '--no-'
  Fix false positives in t3404 due to SHELL=/bin/false
  setup_work_tree: adjust relative $GIT_WORK_TREE after moving cwd
  close file on error in read_mmfile()

13 years agoGit 1.7.4-rc0 v1.7.4-rc0
Junio C Hamano [Tue, 28 Dec 2010 21:52:52 +0000 (13:52 -0800)]
Git 1.7.4-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Tue, 28 Dec 2010 21:50:11 +0000 (13:50 -0800)]
Merge branch 'maint'

* maint:
  Prepare for 1.7.3.5
  Fix false positives in t3404 due to SHELL=/bin/false
  close file on error in read_mmfile()

Conflicts:
RelNotes

13 years agoPrepare for 1.7.3.5
Junio C Hamano [Tue, 28 Dec 2010 21:48:54 +0000 (13:48 -0800)]
Prepare for 1.7.3.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jk/commit-die-on-bogus-ident' into maint
Junio C Hamano [Tue, 28 Dec 2010 21:45:12 +0000 (13:45 -0800)]
Merge branch 'jk/commit-die-on-bogus-ident' into maint

* jk/commit-die-on-bogus-ident:
  commit: die before asking to edit the log message
  ident: die on bogus date format

13 years agoMerge branch 'ks/blame-worktree-textconv-cached' into maint
Junio C Hamano [Tue, 28 Dec 2010 21:44:58 +0000 (13:44 -0800)]
Merge branch 'ks/blame-worktree-textconv-cached' into maint

* ks/blame-worktree-textconv-cached:
  fill_textconv(): Don't get/put cache if sha1 is not valid
  t/t8006: Demonstrate blame is broken when cachetextconv is on

13 years agoMerge branch 'jc/maint-rebase-rewrite-last-skip' into maint
Junio C Hamano [Tue, 28 Dec 2010 21:43:10 +0000 (13:43 -0800)]
Merge branch 'jc/maint-rebase-rewrite-last-skip' into maint

* jc/maint-rebase-rewrite-last-skip:
  rebase --skip: correctly wrap-up when skipping the last patch

13 years agoMerge branch 'jc/maint-am-abort-safely' into maint
Junio C Hamano [Tue, 28 Dec 2010 21:42:55 +0000 (13:42 -0800)]
Merge branch 'jc/maint-am-abort-safely' into maint

* jc/maint-am-abort-safely:
  am --abort: keep unrelated commits since the last failure and warn

13 years agoMerge branch 'kb/maint-status-cquote' into maint
Junio C Hamano [Tue, 28 Dec 2010 21:23:20 +0000 (13:23 -0800)]
Merge branch 'kb/maint-status-cquote' into maint

* kb/maint-status-cquote:
  status: Quote paths with spaces in short format

13 years agocherry-pick/revert: add support for -X/--strategy-option
Jonathan Nieder [Sat, 11 Dec 2010 00:51:44 +0000 (18:51 -0600)]
cherry-pick/revert: add support for -X/--strategy-option

For example, this would allow cherry-picking or reverting patches from
a piece of history with a different end-of-line style, like so:

$ git revert -Xrenormalize old-problematic-commit

Currently that is possible with manual use of merge-recursive but the
cherry-pick/revert porcelain does not expose the functionality.

While at it, document the existing support for --strategy.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot9001: use older Getopt::Long boolean prefix '--no' rather than '--no-'
Brandon Casey [Wed, 22 Dec 2010 23:58:53 +0000 (15:58 -0800)]
t9001: use older Getopt::Long boolean prefix '--no' rather than '--no-'

The '--no-chain-reply-to' option is a Getopt::Long boolean option. The
'--no-' prefix (as in --no-chain-reply-to) for boolean options is not
supported in Getopt::Long version 2.32 which was released with Perl 5.8.0.
This version only supports '--no' as in '--nochain-reply-to'.  More recent
versions of Getopt::Long, such as version 2.34, support either prefix. So
use the older form in the tests.

See also:

907a0b1e04ea31cb368e9422df93d8ebb0187914
84eeb687de7a6c7c42af3fb51b176e0f412a979e
3fee1fe87144360a1913eab86af9ad136c810076

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/maint-rebase-rewrite-last-skip'
Junio C Hamano [Tue, 28 Dec 2010 19:26:59 +0000 (11:26 -0800)]
Merge branch 'jc/maint-rebase-rewrite-last-skip'

* jc/maint-rebase-rewrite-last-skip:
  rebase --skip: correctly wrap-up when skipping the last patch

13 years agoMerge branch 'nd/setup'
Junio C Hamano [Tue, 28 Dec 2010 19:26:55 +0000 (11:26 -0800)]
Merge branch 'nd/setup'

* nd/setup: (47 commits)
  setup_work_tree: adjust relative $GIT_WORK_TREE after moving cwd
  git.txt: correct where --work-tree path is relative to
  Revert "Documentation: always respect core.worktree if set"
  t0001: test git init when run via an alias
  Remove all logic from get_git_work_tree()
  setup: rework setup_explicit_git_dir()
  setup: clean up setup_discovered_git_dir()
  t1020-subdirectory: test alias expansion in a subdirectory
  setup: clean up setup_bare_git_dir()
  setup: limit get_git_work_tree()'s to explicit setup case only
  Use git_config_early() instead of git_config() during repo setup
  Add git_config_early()
  git-rev-parse.txt: clarify --git-dir
  t1510: setup case #31
  t1510: setup case #30
  t1510: setup case #29
  t1510: setup case #28
  t1510: setup case #27
  t1510: setup case #26
  t1510: setup case #25
  ...

13 years agoFix false positives in t3404 due to SHELL=/bin/false
Robin H. Johnson [Mon, 27 Dec 2010 08:03:43 +0000 (08:03 +0000)]
Fix false positives in t3404 due to SHELL=/bin/false

If the user's shell in NSS passwd is /bin/false (eg as found during Gentoo's
package building), the git-rebase exec tests will fail, because they call
$SHELL around the command, and in the existing testcase, $SHELL was not being
cleared sufficently.

This lead to false positive failures of t3404 on systems where the package
build user was locked down as noted above.

Signed-off-by: "Robin H. Johnson" <robbat2@gentoo.org>
X-Gentoo-Bug: 349083
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=349083
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agouserdiff/perl: catch BEGIN/END/... and POD as headers
Junio C Hamano [Mon, 27 Dec 2010 17:19:38 +0000 (09:19 -0800)]
userdiff/perl: catch BEGIN/END/... and POD as headers

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff: funcname and word patterns for perl
Jonathan Nieder [Sun, 26 Dec 2010 09:07:31 +0000 (03:07 -0600)]
diff: funcname and word patterns for perl

The default function name discovery already works quite well for Perl
code... with the exception of here-documents (or rather their ending).

 sub foo {
print <<END
 here-document
 END
return 1;
 }

The default funcname pattern treats the unindented END line as a
function declaration and puts it in the @@ line of diff and "grep
--show-function" output.

With a little knowledge of perl syntax, we can do better.  You can
try it out by adding "*.perl diff=perl" to the gitattributes file.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosetup_work_tree: adjust relative $GIT_WORK_TREE after moving cwd
Nguyễn Thái Ngọc Duy [Mon, 27 Dec 2010 01:26:04 +0000 (08:26 +0700)]
setup_work_tree: adjust relative $GIT_WORK_TREE after moving cwd

When setup_work_tree() is called, it moves cwd to $GIT_WORK_TREE and
makes internal copy of $GIT_WORK_TREE absolute. The environt variable,
if set by user, remains unchanged. If the variable is relative, it is
no longer correct because its base dir has changed.

Instead of making $GIT_WORK_TREE absolute too, we just say "." and let
subsequent git processes handle it.

Reported-by: Michel Briand <michelbriand@free.fr>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'rs/maint-diff-fd-leak' into maint
Junio C Hamano [Sun, 26 Dec 2010 19:18:39 +0000 (11:18 -0800)]
Merge branch 'rs/maint-diff-fd-leak' into maint

* rs/maint-diff-fd-leak:
  close file on error in read_mmfile()

13 years agoclose file on error in read_mmfile()
René Scharfe [Sat, 25 Dec 2010 12:38:46 +0000 (13:38 +0100)]
close file on error in read_mmfile()

Reported in http://qa.debian.org/daca/cppcheck/sid/git_1.7.2.3-2.2.html
and in http://thread.gmane.org/gmane.comp.version-control.git/123042.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'nd/setup' into next
Junio C Hamano [Thu, 23 Dec 2010 23:46:52 +0000 (15:46 -0800)]
Merge branch 'nd/setup' into next

* nd/setup: (46 commits)
  git.txt: correct where --work-tree path is relative to
  Revert "Documentation: always respect core.worktree if set"
  t0001: test git init when run via an alias
  Remove all logic from get_git_work_tree()
  setup: rework setup_explicit_git_dir()
  setup: clean up setup_discovered_git_dir()
  t1020-subdirectory: test alias expansion in a subdirectory
  setup: clean up setup_bare_git_dir()
  setup: limit get_git_work_tree()'s to explicit setup case only
  Use git_config_early() instead of git_config() during repo setup
  Add git_config_early()
  git-rev-parse.txt: clarify --git-dir
  t1510: setup case #31
  t1510: setup case #30
  t1510: setup case #29
  t1510: setup case #28
  t1510: setup case #27
  t1510: setup case #26
  t1510: setup case #25
  t1510: setup case #24
  ...

13 years agoMerge branch 'jc/maint-rebase-rewrite-last-skip' into next
Junio C Hamano [Thu, 23 Dec 2010 23:46:52 +0000 (15:46 -0800)]
Merge branch 'jc/maint-rebase-rewrite-last-skip' into next

* jc/maint-rebase-rewrite-last-skip:
  rebase --skip: correctly wrap-up when skipping the last patch

13 years agoMerge branch 'master' into next
Junio C Hamano [Thu, 23 Dec 2010 20:51:22 +0000 (12:51 -0800)]
Merge branch 'master' into next

* master:
  Makefile: add NO_FNMATCH_CASEFOLD to IRIX sections
  test-lib.sh/test_decode_color(): use octal not hex in awk script

13 years agoMerge branch 'rj/maint-difftool-cygwin-workaround'
Junio C Hamano [Thu, 23 Dec 2010 20:51:11 +0000 (12:51 -0800)]
Merge branch 'rj/maint-difftool-cygwin-workaround'

* rj/maint-difftool-cygwin-workaround:
  difftool: Fix failure on Cygwin

13 years agoMerge branch 'maint'
Junio C Hamano [Thu, 23 Dec 2010 04:33:12 +0000 (20:33 -0800)]
Merge branch 'maint'

* maint:
  test-lib.sh/test_decode_color(): use octal not hex in awk script

13 years agoMakefile: add NO_FNMATCH_CASEFOLD to IRIX sections
Brandon Casey [Wed, 22 Dec 2010 23:58:51 +0000 (15:58 -0800)]
Makefile: add NO_FNMATCH_CASEFOLD to IRIX sections

IRIX's fnmatch() does not support the GNU FNM_CASEFOLD extension, so set
NO_FNMATCH_CASEFOLD so that the internal fnmatch implementation will be
used.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotest-lib.sh/test_decode_color(): use octal not hex in awk script
Brandon Casey [Wed, 22 Dec 2010 23:58:52 +0000 (15:58 -0800)]
test-lib.sh/test_decode_color(): use octal not hex in awk script

POSIX awk seems to explicitly not support hexadecimal escape sequences.

From http://pubs.opengroup.org/onlinepubs/009695399/:

   Regular expressions in awk have been extended somewhat...
   One sequence that is not supported is hexadecimal value escapes
   beginning with '\x'.

This affects the awk on IRIX 6.5, and causes t4015.56 to fail.
Use octal instead.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorebase --skip: correctly wrap-up when skipping the last patch
Junio C Hamano [Thu, 23 Dec 2010 00:50:28 +0000 (16:50 -0800)]
rebase --skip: correctly wrap-up when skipping the last patch

When "rebase --skip" is used to skip the last patch in the series, the
code to wrap up the rewrite by copying the notes from old to new commits
and also by running the post-rewrite hook was bypassed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot0021: avoid getting filter killed with SIGPIPE
Junio C Hamano [Wed, 22 Dec 2010 23:18:47 +0000 (15:18 -0800)]
t0021: avoid getting filter killed with SIGPIPE

The fake filter did not read from the standard input at all,
which caused the calling side to die with SIGPIPE, depending
on the timing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'master' into next
Junio C Hamano [Wed, 22 Dec 2010 22:41:43 +0000 (14:41 -0800)]
Merge branch 'master' into next

* master:

13 years agoMerge branch 'rj/maint-test-fixes'
Junio C Hamano [Wed, 22 Dec 2010 22:41:26 +0000 (14:41 -0800)]
Merge branch 'rj/maint-test-fixes'

* rj/maint-test-fixes:
  t9501-*.sh: Fix a test failure on Cygwin
  lib-git-svn.sh: Add check for mis-configured web server variables
  lib-git-svn.sh: Avoid setting web server variables unnecessarily
  t9142: Move call to start_httpd into the setup test
  t3600-rm.sh: Don't pass a non-existent prereq to test #15

13 years agoMerge branch 'jc/maint-am-abort-safely'
Junio C Hamano [Wed, 22 Dec 2010 22:41:19 +0000 (14:41 -0800)]
Merge branch 'jc/maint-am-abort-safely'

* jc/maint-am-abort-safely:
  am --abort: keep unrelated commits since the last failure and warn

13 years agoMerge branch 'jk/commit-die-on-bogus-ident'
Junio C Hamano [Wed, 22 Dec 2010 22:41:14 +0000 (14:41 -0800)]
Merge branch 'jk/commit-die-on-bogus-ident'

* jk/commit-die-on-bogus-ident:
  commit: die before asking to edit the log message
  ident: die on bogus date format

Conflicts:
builtin/commit.c

13 years agoMerge branch 'pd/bash-4-completion'
Junio C Hamano [Wed, 22 Dec 2010 22:40:55 +0000 (14:40 -0800)]
Merge branch 'pd/bash-4-completion'

* pd/bash-4-completion:
  bash: simple reimplementation of _get_comp_words_by_ref
  bash: get --pretty=m<tab> completion to work with bash v4

Conflicts:
contrib/completion/git-completion.bash

13 years agoMerge branch 'nd/maint-fix-add-typo-detection'
Junio C Hamano [Wed, 22 Dec 2010 22:40:26 +0000 (14:40 -0800)]
Merge branch 'nd/maint-fix-add-typo-detection'

* nd/maint-fix-add-typo-detection:
  Revert "excluded_1(): support exclude files in index"
  unpack-trees: fix sparse checkout's "unable to match directories"
  unpack-trees: move all skip-worktree checks back to unpack_trees()
  dir.c: add free_excludes()
  cache.h: realign and use (1 << x) form for CE_* constants

13 years agoMerge branch 'tf/commit-list-prefix'
Junio C Hamano [Wed, 22 Dec 2010 22:40:17 +0000 (14:40 -0800)]
Merge branch 'tf/commit-list-prefix'

* tf/commit-list-prefix:
  commit: Add commit_list prefix in two function names.

Conflicts:
sha1_name.c

13 years agogit.txt: correct where --work-tree path is relative to
Nguyễn Thái Ngọc Duy [Fri, 26 Nov 2010 15:32:43 +0000 (22:32 +0700)]
git.txt: correct where --work-tree path is relative to

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRevert "Documentation: always respect core.worktree if set"
Nguyễn Thái Ngọc Duy [Fri, 26 Nov 2010 15:32:42 +0000 (22:32 +0700)]
Revert "Documentation: always respect core.worktree if set"

This reverts commit f5e025a9d5b35e24768475f6890b836ce0d5ed15.

The commit reflected what the code did. But the code did that because
it had bugs.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot0001: test git init when run via an alias
Jonathan Nieder [Fri, 26 Nov 2010 15:32:41 +0000 (22:32 +0700)]
t0001: test git init when run via an alias

Add some tests to document the correct behavior of (possibly aliased)
init when run within and outside a git directory.

If I set up a simple git alias “quietinit = init --quiet”, usually it
will work just like ‘git init --quiet’.

There are some differences, unfortunately, since in the process of
checking for aliases, git has to look for a .git/config file.  If ‘git
quietinit’ is run from a subdirectory of an existing git repository,
that repository’s configuration will affect the configuration of the
new repository.  In particular, the new repository can inherit
bogus values for core.bare and core.worktree.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRemove all logic from get_git_work_tree()
Nguyễn Thái Ngọc Duy [Fri, 26 Nov 2010 15:32:40 +0000 (22:32 +0700)]
Remove all logic from get_git_work_tree()

This logic is now only used by cmd_init_db(). setup_* functions do not
rely on it any more. Move all the logic to cmd_init_db() and turn
get_git_work_tree() into a simple function.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosetup: rework setup_explicit_git_dir()
Nguyễn Thái Ngọc Duy [Fri, 26 Nov 2010 15:32:39 +0000 (22:32 +0700)]
setup: rework setup_explicit_git_dir()

This function is the most complex one among the three setup_*
functions because all GIT_DIR, GIT_WORK_TREE, core.worktree and
core.bare are involved.

Because core.worktree is only effective inside
setup_explicit_git_dir() and the extra code in setup_git_directory()
is to handle that. The extra code can now be retired.

Also note that setup_explicit assignment is removed, worktree setting
is no longer decided by get_git_work_tree(). get_git_work_tree() will
be simplified in the next commit.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosetup: clean up setup_discovered_git_dir()
Nguyễn Thái Ngọc Duy [Fri, 26 Nov 2010 15:32:38 +0000 (22:32 +0700)]
setup: clean up setup_discovered_git_dir()

If core.bare is true, discard the discovered worktree, move back to
original cwd.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot1020-subdirectory: test alias expansion in a subdirectory
Michael J Gruber [Fri, 26 Nov 2010 15:32:37 +0000 (22:32 +0700)]
t1020-subdirectory: test alias expansion in a subdirectory

Add a test for alias expansion in a subdirectory of the worktree.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosetup: clean up setup_bare_git_dir()
Nguyễn Thái Ngọc Duy [Fri, 26 Nov 2010 15:32:36 +0000 (22:32 +0700)]
setup: clean up setup_bare_git_dir()

work_tree_env argument is removed because this function does not need
it. GIT_WORK_TREE is only effective inside setup_explicit_git_dir.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosetup: limit get_git_work_tree()'s to explicit setup case only
Nguyễn Thái Ngọc Duy [Fri, 26 Nov 2010 15:32:35 +0000 (22:32 +0700)]
setup: limit get_git_work_tree()'s to explicit setup case only

get_git_work_tree() takes input as core.worktree, core.bare,
GIT_WORK_TREE and decides correct worktree setting.

Unfortunately it does not do its job well. core.worktree and
GIT_WORK_TREE should only be taken into account, if GIT_DIR is set
(which is handled by setup_explicit_git_dir). For other setup cases,
only core.bare matters.

Add a temporary variable setup_explicit to adjust get_git_work_tree()
behavior as such. This variable will be gone once setup_* rework is
done.

Also remove is_bare_repository_cfg check in set_git_work_tree() to
ease the rework. We are going to check for core.bare and core.worktree
early before setting worktree. For example, if core.bare is true, no
need to set worktree.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUse git_config_early() instead of git_config() during repo setup
Nguyễn Thái Ngọc Duy [Fri, 26 Nov 2010 15:32:34 +0000 (22:32 +0700)]
Use git_config_early() instead of git_config() during repo setup

When git_config() is called, either git_dir has already been set (by
$GIT_DIR env or set_git_dir()), or it will default git_dir to ".git".

git_config_early() gives setup functions more freedom because it does
not require git_dir. Give it a config path, it will happily examine
it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoAdd git_config_early()
Nguyễn Thái Ngọc Duy [Fri, 26 Nov 2010 15:32:33 +0000 (22:32 +0700)]
Add git_config_early()

This version of git_config() will be used during repository setup.
As a repository is being set up, $GIT_DIR is not nailed down yet,
git_pathdup() should not be used to get $GIT_DIR/config.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoconvert filter: supply path to external driver
Pete Wyckoff [Wed, 22 Dec 2010 14:40:13 +0000 (06:40 -0800)]
convert filter: supply path to external driver

Filtering to support keyword expansion may need the name of
the file being filtered.  In particular, to support p4 keywords
like

    $File: //depot/product/dir/script.sh $

the smudge filter needs to know the name of the file it is
smudging.

Allow "%f" in the custom filter command line specified in the
configuration.  This will be substituted by the filename
inside a single-quote pair to be passed to the shell.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoImprove error messages when temporary file creation fails
Arnout Engelen [Sat, 18 Dec 2010 21:28:00 +0000 (22:28 +0100)]
Improve error messages when temporary file creation fails

Before, when creating a temporary file failed, a generic 'Unable to create
temporary file' message was printed. In some cases this could lead to
confusion as to which directory should be checked for correct permissions etc.

This patch adds the template for the temporary filename to the error message,
converting it to an absolute path if needed. A test verifies that the template
is indeed printed when pointing to a nonexistent or unwritable directory.

A copy of the original template is made in case mkstemp clears the template.

Signed-off-by: Arnout Engelen <arnouten@bzzt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'rj/maint-test-fixes' into next
Junio C Hamano [Wed, 22 Dec 2010 00:46:53 +0000 (16:46 -0800)]
Merge branch 'rj/maint-test-fixes' into next

* rj/maint-test-fixes:
  t9501-*.sh: Fix a test failure on Cygwin
  lib-git-svn.sh: Add check for mis-configured web server variables
  lib-git-svn.sh: Avoid setting web server variables unnecessarily
  t9142: Move call to start_httpd into the setup test
  t3600-rm.sh: Don't pass a non-existent prereq to test #15

13 years agoMerge branch 'rj/maint-difftool-cygwin-workaround' into next
Junio C Hamano [Wed, 22 Dec 2010 00:46:53 +0000 (16:46 -0800)]
Merge branch 'rj/maint-difftool-cygwin-workaround' into next

* rj/maint-difftool-cygwin-workaround:
  difftool: Fix failure on Cygwin

13 years agoMerge branch 'jc/maint-am-abort-safely' into next
Junio C Hamano [Wed, 22 Dec 2010 00:46:53 +0000 (16:46 -0800)]
Merge branch 'jc/maint-am-abort-safely' into next

* jc/maint-am-abort-safely:
  am --abort: keep unrelated commits since the last failure and warn

13 years agoMerge branch 'jk/commit-die-on-bogus-ident' into next
Junio C Hamano [Wed, 22 Dec 2010 00:46:53 +0000 (16:46 -0800)]
Merge branch 'jk/commit-die-on-bogus-ident' into next

* jk/commit-die-on-bogus-ident:
  commit: die before asking to edit the log message
  ident: die on bogus date format

Conflicts:
builtin/commit.c

13 years agoMerge branch 'pd/bash-4-completion' into next
Junio C Hamano [Wed, 22 Dec 2010 00:46:52 +0000 (16:46 -0800)]
Merge branch 'pd/bash-4-completion' into next

* pd/bash-4-completion:
  bash: simple reimplementation of _get_comp_words_by_ref
  bash: get --pretty=m<tab> completion to work with bash v4

Conflicts:
contrib/completion/git-completion.bash

13 years agoMerge branch 'tf/commit-list-prefix' into next
Junio C Hamano [Wed, 22 Dec 2010 00:46:52 +0000 (16:46 -0800)]
Merge branch 'tf/commit-list-prefix' into next

* tf/commit-list-prefix:
  commit: Add commit_list prefix in two function names.

Conflicts:
sha1_name.c

13 years agoMerge branch 'nd/maint-fix-add-typo-detection' into next
Junio C Hamano [Wed, 22 Dec 2010 00:46:52 +0000 (16:46 -0800)]
Merge branch 'nd/maint-fix-add-typo-detection' into next

* nd/maint-fix-add-typo-detection:
  Revert "excluded_1(): support exclude files in index"
  unpack-trees: fix sparse checkout's "unable to match directories"
  unpack-trees: move all skip-worktree checks back to unpack_trees()
  dir.c: add free_excludes()
  cache.h: realign and use (1 << x) form for CE_* constants

13 years agoMerge branch 'master' into next
Junio C Hamano [Tue, 21 Dec 2010 22:45:35 +0000 (14:45 -0800)]
Merge branch 'master' into next

* master:
  t0050: fix printf format strings for portability
  t3419-*.sh: Fix arithmetic expansion syntax error
  set_try_to_free_routine(NULL) means "do nothing special"

13 years agoMerge branch 'maint'
Junio C Hamano [Tue, 21 Dec 2010 22:45:28 +0000 (14:45 -0800)]
Merge branch 'maint'

* maint:
  t0050: fix printf format strings for portability
  t3419-*.sh: Fix arithmetic expansion syntax error

13 years agoMerge branch 'ks/blame-worktree-textconv-cached'
Junio C Hamano [Tue, 21 Dec 2010 22:30:52 +0000 (14:30 -0800)]
Merge branch 'ks/blame-worktree-textconv-cached'

* ks/blame-worktree-textconv-cached:
  fill_textconv(): Don't get/put cache if sha1 is not valid
  t/t8006: Demonstrate blame is broken when cachetextconv is on

13 years agoMerge branch 'jk/t2107-now-passes'
Junio C Hamano [Tue, 21 Dec 2010 22:30:47 +0000 (14:30 -0800)]
Merge branch 'jk/t2107-now-passes'

* jk/t2107-now-passes:
  t2107: mark passing test as success

13 years agoMerge branch 'jk/maint-decorate-01-bool'
Junio C Hamano [Tue, 21 Dec 2010 22:30:43 +0000 (14:30 -0800)]
Merge branch 'jk/maint-decorate-01-bool'

* jk/maint-decorate-01-bool:
  handle arbitrary ints in git_config_maybe_bool

13 years agoMerge branch 'tc/completion-reflog'
Junio C Hamano [Tue, 21 Dec 2010 22:30:23 +0000 (14:30 -0800)]
Merge branch 'tc/completion-reflog'

* tc/completion-reflog:
  bash completion: add basic support for git-reflog

13 years agoMerge branch 'nd/oneline-sha1-name-from-specific-ref'
Junio C Hamano [Tue, 21 Dec 2010 22:30:19 +0000 (14:30 -0800)]
Merge branch 'nd/oneline-sha1-name-from-specific-ref'

* nd/oneline-sha1-name-from-specific-ref:
  get_sha1: handle special case $commit^{/}
  get_sha1: support $commit^{/regex} syntax
  get_sha1_oneline: make callers prepare the commit list to traverse
  get_sha1_oneline: fix lifespan rule of temp_commit_buffer variable

13 years agoMerge branch 'jn/maint-gitweb-pathinfo-fix'
Junio C Hamano [Tue, 21 Dec 2010 22:30:09 +0000 (14:30 -0800)]
Merge branch 'jn/maint-gitweb-pathinfo-fix'

* jn/maint-gitweb-pathinfo-fix:
  gitweb: Fix handling of whitespace in generated links