Commit graph

24449 commits

Author SHA1 Message Date
Carlo Marcelo Arenas Belon 18e051a398 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>
2011-01-04 13:44:41 -08:00
Michael J Gruber 60d5985dab 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>
2011-01-04 13:31:03 -08:00
Junio C Hamano 83c90314aa unpack_trees(): skip trees that are the same in all input
unpack_trees() merges two trees (the current HEAD and the destination
commit) when switching to another branch, checking and updating the index
entry where the destination differs from the current HEAD.  It merges three
trees (the common ancestor, the current HEAD and the other commit) when
performing a three-way merge, checking and updating the index entry when
the merge result differs from the current HEAD.  It does so by walking the
input trees in parallel all the way down to the leaves.

One common special case is a directory is identical across the trees
involved in the merge.  In such a case, we do not have to descend into the
directory at all---we know that the end result is to keep the entries in
the current index.

This optimization cannot be applied in a few special cases in
unpack_trees(), though.  We need to descend into the directory and update
the index entries from the target tree in the following cases:

 - When resetting (e.g. "git reset --hard"); and

 - When checking out a tree for the first time into an empty working tree
   (e.g. "git read-tree -m -u HEAD HEAD" with missing .git/index).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-04 13:03:32 -08:00
Junio C Hamano f2665ec9fa Merge branch 'maint'
* maint:
  gitweb: skip logo in atom feed when there is none
  t9001: Fix test prerequisites
2011-01-04 11:23:45 -08:00
Jonathan Nieder 081f84ee9e 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>
2011-01-04 11:23:42 -08:00
Ralf Wildenhues 469bfc962d Fix typos in the documentation
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-04 11:23:42 -08:00
Jonathan Nieder 6822052427 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>
2011-01-04 10:49:32 -08:00
Jonathan Nieder 9d9f5e72dc 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>
2011-01-04 10:48:37 -08:00
Robin H. Johnson 57da204264 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>
2010-12-29 13:39:05 -08:00
Junio C Hamano 01b97a4cb6 Git 1.7.4-rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-28 13:53:24 -08:00
Junio C Hamano 2cd900fcf5 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
2010-12-28 13:50:11 -08:00
Junio C Hamano 17367939eb Prepare for 1.7.3.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-28 13:48:54 -08:00
Junio C Hamano a121d53fa6 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
2010-12-28 13:45:12 -08:00
Junio C Hamano 359f34f6cc 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
2010-12-28 13:44:58 -08:00
Junio C Hamano 58c58c8624 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
2010-12-28 13:43:10 -08:00
Junio C Hamano 2f73969570 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
2010-12-28 13:42:55 -08:00
Junio C Hamano 0ec9ee3bcf Merge branch 'kb/maint-status-cquote' into maint
* kb/maint-status-cquote:
  status: Quote paths with spaces in short format
2010-12-28 13:23:20 -08:00
Jonathan Nieder 67ac1e1d57 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>
2010-12-28 11:27:56 -08:00
Brandon Casey d2559f734b 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:

907a0b1e04
84eeb687de
3fee1fe871

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-28 11:27:12 -08:00
Junio C Hamano 5765870d53 Merge branch 'jc/maint-rebase-rewrite-last-skip'
* jc/maint-rebase-rewrite-last-skip:
  rebase --skip: correctly wrap-up when skipping the last patch
2010-12-28 11:26:59 -08:00
Junio C Hamano f3bb8b4b84 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
  ...
2010-12-28 11:26:55 -08:00
Robin H. Johnson 5cd3e10737 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>
2010-12-28 11:22:16 -08:00
Junio C Hamano a25e47377d userdiff/perl: catch BEGIN/END/... and POD as headers
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-27 09:19:38 -08:00
Jonathan Nieder 71a5d4bc0e 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>
2010-12-27 08:47:21 -08:00
Nguyễn Thái Ngọc Duy 0ed7481347 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>
2010-12-27 08:34:19 -08:00
Junio C Hamano 26517dea24 Merge branch 'rs/maint-diff-fd-leak' into maint
* rs/maint-diff-fd-leak:
  close file on error in read_mmfile()
2010-12-26 11:18:39 -08:00
René Scharfe 5fd898141c 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>
2010-12-26 11:17:18 -08:00
Junio C Hamano 73e7b2ef6c Merge branch 'rj/maint-difftool-cygwin-workaround'
* rj/maint-difftool-cygwin-workaround:
  difftool: Fix failure on Cygwin
2010-12-23 12:51:11 -08:00
Junio C Hamano 4e3a1b24ad Merge branch 'maint'
* maint:
  test-lib.sh/test_decode_color(): use octal not hex in awk script
2010-12-22 20:33:12 -08:00
Brandon Casey 19128d6cd8 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>
2010-12-22 19:56:02 -08:00
Brandon Casey c2ed29b49b 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>
2010-12-22 19:46:52 -08:00
Junio C Hamano ef88ad2387 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>
2010-12-22 16:50:28 -08:00
Junio C Hamano 4290f69067 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>
2010-12-22 15:18:47 -08:00
Junio C Hamano 48e0ad033f 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
2010-12-22 14:41:26 -08:00
Junio C Hamano cfa775c10e Merge branch 'jc/maint-am-abort-safely'
* jc/maint-am-abort-safely:
  am --abort: keep unrelated commits since the last failure and warn
2010-12-22 14:41:19 -08:00
Junio C Hamano 3ea3860758 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
2010-12-22 14:41:14 -08:00
Junio C Hamano 02fedc0f48 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
2010-12-22 14:40:55 -08:00
Junio C Hamano e39212ab08 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
2010-12-22 14:40:26 -08:00
Junio C Hamano 716958c9a2 Merge branch 'tf/commit-list-prefix'
* tf/commit-list-prefix:
  commit: Add commit_list prefix in two function names.

Conflicts:
	sha1_name.c
2010-12-22 14:40:17 -08:00
Nguyễn Thái Ngọc Duy e7d1efbe9d 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>
2010-12-22 14:34:25 -08:00
Nguyễn Thái Ngọc Duy 98acf75985 Revert "Documentation: always respect core.worktree if set"
This reverts commit f5e025a9d5.

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>
2010-12-22 14:34:25 -08:00
Jonathan Nieder 4ad8332ef7 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>
2010-12-22 14:34:24 -08:00
Nguyễn Thái Ngọc Duy 835183603b 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>
2010-12-22 14:34:24 -08:00
Nguyễn Thái Ngọc Duy b3f66fd3e3 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>
2010-12-22 14:34:24 -08:00
Nguyễn Thái Ngọc Duy 9951d3b37e 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>
2010-12-22 14:34:24 -08:00
Michael J Gruber 101662c225 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>
2010-12-22 14:34:24 -08:00
Nguyễn Thái Ngọc Duy 1cd8031b2d 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>
2010-12-22 14:34:24 -08:00
Nguyễn Thái Ngọc Duy e6aea2dba2 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>
2010-12-22 14:34:24 -08:00
Nguyễn Thái Ngọc Duy 337e51cedf 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>
2010-12-22 14:34:24 -08:00
Nguyễn Thái Ngọc Duy dbdf5854b2 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>
2010-12-22 14:34:24 -08:00