Commit graph

2961 commits

Author SHA1 Message Date
Allan Caffee 7b1d6269ee t4202-log: extend test coverage of graphing
Extend this test to cover the rendering of graphs with octopus merges
and pre_commit lines.

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-22 17:48:22 -07:00
Michael J Gruber 3a0483281a test-lib.sh: Help test_create_repo() find the templates dir
Currently, test_create_repo() expects that templates can be found below
`pwd`/.. This assumption fails when tests are run against a git
installed somewhere else or test_create_repo() is called from
subdirectiories (several tests do this).
Therefore, use $TEST_DIRECTORY as introduced in 2d84e9fb and expect
templates to be present in $TEST_DIRECTORY/.. which should be the root
dir of the git checkout.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-21 09:49:04 -07:00
Junio C Hamano 0be9bc0f0a Merge branch 'mk/maint-apply-swap'
* mk/maint-apply-swap:
  tests: make test-apply-criss-cross-rename more robust
  builtin-apply: keep information about files to be deleted
  tests: test applying criss-cross rename patch

Conflicts:
	t/t4130-apply-criss-cross-rename.sh
2009-04-21 00:16:09 -07:00
Matthieu Moy a162e78df0 clone: add test for push on an empty clone.
Commit 55f0566 (get_local_heads(): do not return random pointer if
there is no head, 2009-04-17) fixed a segfault for git push, this
patch adds a test-case to avoid future regressions.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-20 13:53:03 -07:00
Michał Kiedrowicz f0583867e7 tests: make test-apply-criss-cross-rename more robust
I realized that this test does check if git-apply succeeds, but doesn't
tell if it applies patches correctly. So I added test_cmp to check it.

I also added a test which checks swapping three files.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-20 13:47:02 -07:00
Michał Kiedrowicz e8141fcf54 builtin-apply: keep information about files to be deleted
Example correct diff generated by `diff -M -B' might look like this:

	diff --git a/file1 b/file2
	similarity index 100%
	rename from file1
	rename to file2
	diff --git a/file2 b/file1
	similarity index 100%
	rename from file2
	rename to file1

Information about removing `file2' comes after information about creation
of new `file2' (renamed from `file1'). Existing implementation isn't able to
apply such patch, because it has to know in advance which files will be
removed.

This patch populates fn_table with information about removal of files
before calling check_patch() for each patch to be applied.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-20 13:46:58 -07:00
Michał Kiedrowicz 1d49f0d1a1 tests: test applying criss-cross rename patch
Originally reported by Linus in $gmane/116198

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-20 13:46:55 -07:00
Junio C Hamano 4f26c39806 Merge branch 'ef/maint-fast-export' into maint
* ef/maint-fast-export:
  builtin-fast-export.c: handle nested tags
  builtin-fast-export.c: fix crash on tagged trees
  builtin-fast-export.c: turn error into warning
  test-suite: adding a test for fast-export with tag variants
2009-04-19 12:40:17 -07:00
Junio C Hamano 5027acc4db Merge branch 'jc/maint-shared-literally' into maint
* jc/maint-shared-literally:
  Update docs on behaviour of 'core.sharedRepository' and 'git init --shared'
  t1301-shared-repo: fix forced modes test
2009-04-19 12:40:05 -07:00
Erik Faye-Lund aadd44404b builtin-fast-export.c: handle nested tags
When tags that points to tags are passed to fast-export, an error is given,
saying "Tag [TAGNAME] points nowhere?". This fix calls parse_object() on the
object before referencing it's tag, to ensure the tag-info is fully initialized.
In addition, it inserts a comment to point out where nested tags are handled.
This is consistent with the comment for signed tags.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-19 12:29:26 -07:00
Erik Faye-Lund 426193c025 builtin-fast-export.c: fix crash on tagged trees
If a tag object points to a tree (or another unhandled type), the commit-
pointer is left uninitialized and later dereferenced. This patch adds a
default case to the switch that issues a warning and skips the object.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-19 12:29:26 -07:00
Erik Faye-Lund 1092f6b3f8 test-suite: adding a test for fast-export with tag variants
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-19 12:29:25 -07:00
Ben Jackson ea10b60c91 Work around ash "alternate value" expansion bug
Ash (used as /bin/sh on many distros) has a shell expansion bug
for the form ${var:+word word}.  The result is a single argument
"word word".  Work around by using ${var:+word} ${var:+word} or
equivalent.

Signed-off-by: Ben Jackson <ben@ben.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-18 21:37:46 -07:00
Junio C Hamano 5758b25da4 Merge branch 'nd/archive-attribute'
* nd/archive-attribute:
  archive test: attributes
  archive: do not read .gitattributes in working directory
  unpack-trees: do not muck with attributes when we are not checking out
  attr: add GIT_ATTR_INDEX "direction"
  archive tests: do not use .gitattributes in working directory
2009-04-18 14:46:08 -07:00
Junio C Hamano cef5775b9f Merge branch 'maint'
* maint:
  Describe fixes since 1.6.2.3
  doc/git-daemon: add missing arguments to max-connections option
  doc/git-daemon: add missing arguments to options
  init: Do not segfault on big GIT_TEMPLATE_DIR environment variable
  imap-send: use correct configuration variable in documentation
2009-04-18 14:45:59 -07:00
Junio C Hamano a4d1797332 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  doc/git-daemon: add missing arguments to options
  init: Do not segfault on big GIT_TEMPLATE_DIR environment variable
2009-04-18 14:43:24 -07:00
Junio C Hamano 08e7239c36 Merge branch 'bs/maint-1.6.0-tree-walk-prefix' into maint
* bs/maint-1.6.0-tree-walk-prefix:
  match_tree_entry(): a pathspec only matches at directory boundaries
  tree_entry_interesting: a pathspec only matches at directory boundary
2009-04-18 14:18:32 -07:00
Junio C Hamano f392485813 Merge branch 'js/maint-submodule-checkout' into maint
* js/maint-submodule-checkout:
  Fix 'git checkout <submodule>' to update the index
2009-04-18 14:18:29 -07:00
Junio C Hamano eb8a1c4aed Merge branch 'cb/maint-merge-recursive-submodule-fix' into maint
* cb/maint-merge-recursive-submodule-fix:
  simplify output of conflicting merge
  update cache for conflicting submodule entries
  add tests for merging with submodules
2009-04-18 14:18:25 -07:00
Junio C Hamano d890d3f996 Merge branch 'maint-1.6.0' into maint
* maint-1.6.0:
  doc/git-daemon: add missing arguments to options
  init: Do not segfault on big GIT_TEMPLATE_DIR environment variable
2009-04-18 13:39:52 -07:00
Frank Lichtenheld 32d1776b13 init: Do not segfault on big GIT_TEMPLATE_DIR environment variable
Signed-off-by: Frank Lichtenheld <flichtenheld@astaro.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-18 13:06:40 -07:00
Junio C Hamano fc917ad6b2 Merge branch 'mk/apply-swap'
* mk/apply-swap:
  builtin-apply: keep information about files to be deleted
  tests: test applying criss-cross rename patch
2009-04-17 21:42:13 -07:00
Junio C Hamano 1dd9b638c1 Merge branch 'jc/shared-literally'
* jc/shared-literally:
  t1301-shared-repo: fix forced modes test
2009-04-17 21:42:12 -07:00
Junio C Hamano 1ee28e58d5 Merge branch 'ns/am-to-empty'
* ns/am-to-empty:
  git-am: teach git-am to apply a patch to an unborn branch
2009-04-17 21:42:12 -07:00
Junio C Hamano a9b772a011 Merge branch 'bw/short-ref-strict'
* bw/short-ref-strict:
  remote.c: use shorten_unambiguous_ref
  rev-parse: --abbrev-ref option to shorten ref name
  for-each-ref: utilize core.warnAmbiguousRefs for :short-format
  shorten_unambiguous_ref(): add strict mode
2009-04-17 21:42:12 -07:00
Junio C Hamano bd15ef078a Merge branch 'da/difftool'
* da/difftool:
  mergetool--lib: simplify API usage by removing more global variables
  Fix misspelled mergetool.keepBackup
  difftool/mergetool: refactor commands to use git-mergetool--lib
  mergetool: use $( ... ) instead of `backticks`
  bash completion: add git-difftool
  difftool: add support for a difftool.prompt config variable
  difftool: add various git-difftool tests
  difftool: move 'git-difftool' out of contrib
  difftool/mergetool: add diffuse as merge and diff tool
  difftool: add a -y shortcut for --no-prompt
  difftool: use perl built-ins when testing for msys
  difftool: remove the backup file feature
  difftool: remove merge options for opendiff, tkdiff, kdiff3 and xxdiff
  git-mergetool: add new merge tool TortoiseMerge
  git-mergetool/difftool: make (g)vimdiff workable under Windows
  doc/merge-config: list ecmerge as a built-in merge tool
2009-04-17 21:42:12 -07:00
Junio C Hamano 2d430c7133 Merge branch 'maint'
* maint:
  doc/gitattributes: clarify location of config text
  Fix buffer overflow in config parser
  git-apply: fix option description
2009-04-17 21:29:15 -07:00
Junio C Hamano f7446fc6bb Merge branch 'maint-1.6.1' into maint
* maint-1.6.1:
  Fix buffer overflow in config parser
2009-04-17 21:20:58 -07:00
Junio C Hamano 0fa0514b91 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  Fix buffer overflow in config parser
2009-04-17 21:06:11 -07:00
René Scharfe 8aece7ff06 archive test: attributes
Add a test script for all archive attributes and their handling in
normal and bare repositories.  export-ignore and export-subst are
tested, as well as the effect of the option --worktree-attributes.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-17 21:05:49 -07:00
René Scharfe ad94657fdb archive tests: do not use .gitattributes in working directory
We are interested in using archive mostly from a bare repository, so it
should not add .gitattributes to the work tree.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-17 21:05:49 -07:00
Thomas Jarosch e0b3cc0dff Fix buffer overflow in config parser
When interpreting a config value, the config parser reads in 1+ space
character(s) and puts -one- space character in the buffer as soon as
the first non-space character is encountered (if not inside quotes).

Unfortunately the buffer size check lacks the extra space character
which gets inserted at the next non-space character, resulting in
a crash with a specially crafted config entry.

The unit test now uses Java to compile a platform independent
.NET framework to output the test string in C# :o)

    Read: Thanks to Johannes Sixt for the correct printf call
    which replaces the perl invocation.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-17 20:59:01 -07:00
Michał Kiedrowicz 7fac0eef91 builtin-apply: keep information about files to be deleted
Example correct diff generated by `diff -M -B' might look like this:

	diff --git a/file1 b/file2
	similarity index 100%
	rename from file1
	rename to file2
	diff --git a/file2 b/file1
	similarity index 100%
	rename from file2
	rename to file1

Information about removing `file2' comes after information about creation
of new `file2' (renamed from `file1'). Existing implementation isn't able to
apply such patch, because it has to know in advance which files will be
removed.

This patch populates fn_table with information about removal of files
before calling check_patch() for each patch to be applied.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-15 17:47:55 -07:00
Michał Kiedrowicz d8c81dfcaf tests: test applying criss-cross rename patch
Originally reported by Linus in $gmane/116198

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-13 09:48:49 -07:00
Bert Wesarg 2bb98169be for-each-ref: utilize core.warnAmbiguousRefs for :short-format
core.warnAmbiguousRefs is used to select strict mode for the
abbreviation for the ":short" format specifier of "refname" and "upstream".

In strict mode, the abbreviated ref will never trigger the
'warn_ambiguous_refs' warning. I.e. for these refs:

  refs/heads/xyzzy
  refs/tags/xyzzy

the abbreviated forms are:

  heads/xyzzy
  tags/xyzzy

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-13 09:36:52 -07:00
Nanako Shiraishi f79d4c8a0f git-am: teach git-am to apply a patch to an unborn branch
People sometimes wonder why they cannot apply a patch that only
creates new files to an unborn branch.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-12 18:42:15 -07:00
Junio C Hamano 7d5a1806e8 Mark t1301 permission test to depend on POSIXPERM
This prepares the topic for inclusion to master.
2009-04-12 17:56:25 -07:00
Junio C Hamano 6f523f6d38 Merge branch 'jk/no-perl'
* jk/no-perl:
  tests: skip perl tests if NO_PERL is defined
  Makefile: allow building without perl
2009-04-12 16:46:42 -07:00
Junio C Hamano 3e52effcf6 Merge branch 'jk/show-upstream'
* jk/show-upstream:
  branch: show upstream branch when double verbose
  make get_short_ref a public function
  for-each-ref: add "upstream" format field
  for-each-ref: refactor refname handling
  for-each-ref: refactor get_short_ref function
2009-04-12 16:46:42 -07:00
Junio C Hamano c276857ee2 Merge branch 'fg/remote-prune'
* fg/remote-prune:
  add tests for remote groups
  git remote update: Fallback to remote if group does not exist
  remote: New function remote_is_configured()
  git remote update: Report error for non-existing groups
  git remote update: New option --prune
  builtin-remote.c: Split out prune_remote as a separate function.
2009-04-12 16:46:41 -07:00
Junio C Hamano 6e353a5e5d Merge branch 'cc/bisect-filter'
* cc/bisect-filter: (21 commits)
  rev-list: add "int bisect_show_flags" in "struct rev_list_info"
  rev-list: remove last static vars used in "show_commit"
  list-objects: add "void *data" parameter to show functions
  bisect--helper: string output variables together with "&&"
  rev-list: pass "int flags" as last argument of "show_bisect_vars"
  t6030: test bisecting with paths
  bisect: use "bisect--helper" and remove "filter_skipped" function
  bisect: implement "read_bisect_paths" to read paths in "$GIT_DIR/BISECT_NAMES"
  bisect--helper: implement "git bisect--helper"
  bisect: use the new generic "sha1_pos" function to lookup sha1
  rev-list: call new "filter_skip" function
  patch-ids: use the new generic "sha1_pos" function to lookup sha1
  sha1-lookup: add new "sha1_pos" function to efficiently lookup sha1
  rev-list: pass "revs" to "show_bisect_vars"
  rev-list: make "show_bisect_vars" non static
  rev-list: move code to show bisect vars into its own function
  rev-list: move bisect related code into its own file
  rev-list: make "bisect_list" variable local to "cmd_rev_list"
  refs: add "for_each_ref_in" function to refactor "for_each_*_ref" functions
  quote: add "sq_dequote_to_argv" to put unwrapped args in an argv array
  ...
2009-04-12 16:46:40 -07:00
Johannes Sixt 078688213f t1301-shared-repo: fix forced modes test
This test was added recently (5a688fe, "core.sharedrepository = 0mode"
should set, not loosen; 2009-03-28). It checked the result of a sed
invocation for emptyness, but in some cases it forgot to print anything
at all, so that those checks would never be false.

Due to this mistake, it went unnoticed that the files in objects/info are
not necessarily 0440, but can also be 0660.  Because the 0mode setting
tries to guarantee that the files are accessible only to the people they
are meant to be used by, we should only make sure that they are readable
by the user and the group when the configuration is set to 0660.  It is a
separate matter from the core.shredrepository settings that w-bit from
immutable object files under objects/[0-9a-f][0-9a-f] directories should
be dropped.

COMMIT_EDITMSG is still world-readable, but it (and any transient files
that are meant for repositories with a work tree) does not matter.  If you
are working on a shared machine and on a sekrit stuff, the root of the
work tree would be with mode 0700 (or 0750 to allow peeking by other
people in the group), and that would mean that .git/COMMIT_EDITMSG in such
a repository would not be readable by the strangers anyway.

Also, in the real-world use case, .git/COMMIT_EDITMSG will be given to an
arbitrary editor the user happens to use, and we have no guarantee what it
does (e.g. it may create a new file with umask and replace, it may rewrite
in place, it may leave an editor backup file but use umask to create it,
etc.), and the protection of the file lies majorly on the protection of
the root of the work tree.

This test cannot be run on Windows; it requires POSIXPERM when merged to
'master'.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-12 13:34:06 -07:00
Johannes Schindelin c59cb03a8b git-add: introduce --edit (to edit the diff vs. the index)
With "git add -e [<files>]", Git will fire up an editor with the current
diff relative to the index (i.e. what you would get with "git diff
[<files>]").

Now you can edit the patch as much as you like, including adding/removing
lines, editing the text, whatever.  Make sure, though, that the first
character of the hunk lines is still a space, a plus or a minus.

After you closed the editor, Git will adjust the line counts of the hunks
if necessary, thanks to the --recount option of apply, and commit the
patch.  Except if you deleted everything, in which case nothing happens
(for obvious reasons).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-12 11:56:17 -07:00
Ben Jackson 88ec205477 git-svn: Save init/clone --ignore-paths in config
The --ignored-paths argument is now stored as
"svn-remote.$REMOTE_NAME.ignore-paths" in the config file.

[ew: edited subject and message]
Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-04-11 17:55:37 -07:00
Ben Jackson 0d8bee71af git-svn: Add per-svn-remote ignore-paths config
The --ignore-paths option to fetch is very useful for working on a subset
of a SVN repository.  For proper operation, every command that causes a
fetch (explicit or implied) must include a matching --ignore-paths option.

This patch adds a persistent svn-remote.$repo_id.ignore-paths config by
promoting Fetcher::is_path_ignored to a member function and initializing
$self->{ignore_regex} in Fetcher::new.  Command line --ignore-paths is
still recognized and acts in addition to the config value.

Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-04-11 17:55:37 -07:00
Jeff King 27845e9548 add tests for remote groups
This tries to systematically cover existing behavior, and
also mark some expect_failure cases for desired behavior.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-09 01:30:06 -07:00
Junio C Hamano bff82d0cda Merge branch 'jc/shared-literally' into maint
* jc/shared-literally:
  t1301: loosen test for forced modes
  set_shared_perm(): sometimes we know what the final mode bits should look like
  move_temp_to_file(): do not forget to chmod() in "Coda hack" codepath
  Move chmod(foo, 0444) into move_temp_to_file()
  "core.sharedrepository = 0mode" should set, not loosen
2009-04-08 23:23:41 -07:00
Junio C Hamano 197cf8d59c Merge branch 'jc/maint-1.6.0-diff-borrow-carefully' into maint
* jc/maint-1.6.0-diff-borrow-carefully:
  diff --cached: do not borrow from a work tree when a path is marked as assume-unchanged
2009-04-08 23:23:17 -07:00
Junio C Hamano c3067cbfb3 Merge branch 'jc/maint-1.6.0-keep-pack' into maint
* jc/maint-1.6.0-keep-pack:
  pack-objects: don't loosen objects available in alternate or kept packs
  t7700: demonstrate repack flaw which may loosen objects unnecessarily
  Remove --kept-pack-only option and associated infrastructure
  pack-objects: only repack or loosen objects residing in "local" packs
  git-repack.sh: don't use --kept-pack-only option to pack-objects
  t7700-repack: add two new tests demonstrating repacking flaws
  is_kept_pack(): final clean-up
  Simplify is_kept_pack()
  Consolidate ignore_packed logic more
  has_sha1_kept_pack(): take "struct rev_info"
  has_sha1_pack(): refactor "pretend these packs do not exist" interface
  git-repack: resist stray environment variable

Conflicts:
	t/t7700-repack.sh
2009-04-08 23:21:10 -07:00
Junio C Hamano 1c9f54417e Merge branch 'bc/maint-1.6.1-branch-deleted-was' into maint-1.6.1
* bc/maint-1.6.1-branch-deleted-was:
  git-branch: display "was sha1" on branch deletion rather than just "sha1"
2009-04-08 23:01:15 -07:00
Jeff King 1b19ccd236 tests: skip perl tests if NO_PERL is defined
These scripts all test git programs that are written in
perl, and thus obviously won't work if NO_PERL is defined.
We pass NO_PERL to the scripts from the building Makefile
via the GIT-BUILD-OPTIONS file.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-08 22:42:16 -07:00
Jeff King 8cae19d987 for-each-ref: add "upstream" format field
The logic for determining the upstream ref of a branch is
somewhat complex to perform in a shell script. This patch
provides a plumbing mechanism for scripts to access the C
logic used internally by git-status, git-branch, etc.

For example:

  $ git for-each-ref \
       --format='%(refname:short) %(upstream:short)' \
       refs/heads/
  master origin/master

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-07 23:22:15 -07:00
Junio C Hamano 6da14ee14f Merge branch 'maint'
* maint:
  Change double quotes to single quotes in message
  Documentation: clarify .gitattributes search
  git-checkout.txt: clarify that <branch> applies when no path is given.
  git-checkout.txt: fix incorrect statement about HEAD and index

Conflicts:
	Documentation/git-checkout.txt
2009-04-07 23:05:43 -07:00
Jari Aalto 714fddf2fc Change double quotes to single quotes in message
Most of the time when we give branch name in the message, we quote it
inside a pair of single-quotes.  git-checkout uses double-quotes; this
patch corrects the inconsistency.

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-07 23:04:45 -07:00
Junio C Hamano 00f39fc995 Merge branch 'bs/maint-1.6.0-tree-walk-prefix'
* bs/maint-1.6.0-tree-walk-prefix:
  match_tree_entry(): a pathspec only matches at directory boundaries
  tree_entry_interesting: a pathspec only matches at directory boundary
2009-04-07 22:33:10 -07:00
Junio C Hamano a9906723b2 Merge branch 'js/maint-submodule-checkout'
* js/maint-submodule-checkout:
  Fix 'git checkout <submodule>' to update the index
2009-04-07 22:33:02 -07:00
Junio C Hamano 2149e0f6a6 Merge branch 'cb/maint-merge-recursive-submodule-fix'
* cb/maint-merge-recursive-submodule-fix:
  simplify output of conflicting merge
  update cache for conflicting submodule entries
  add tests for merging with submodules
2009-04-07 22:32:56 -07:00
David Aguilar a904392eae difftool: add support for a difftool.prompt config variable
difftool now supports difftool.prompt so that users do not have to
pass --no-prompt or hit enter each time a diff tool is launched.
The --prompt flag overrides the configuration variable.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-07 22:19:56 -07:00
David Aguilar f92f2038a5 difftool: add various git-difftool tests
t7800-difftool.sh tests the various command-line flags,
git-config variables, and environment settings supported by
git-difftool.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-07 22:19:56 -07:00
Junio C Hamano 03a39a9184 Merge branch 'jc/shared-literally'
* jc/shared-literally:
  t1301: loosen test for forced modes
  set_shared_perm(): sometimes we know what the final mode bits should look like
  move_temp_to_file(): do not forget to chmod() in "Coda hack" codepath
  Move chmod(foo, 0444) into move_temp_to_file()
  "core.sharedrepository = 0mode" should set, not loosen
2009-04-06 00:42:52 -07:00
Junio C Hamano ccc852c377 Merge branch 'mg/tracked-local-branches'
* mg/tracked-local-branches:
  Make local branches behave like remote branches when --tracked
  Test for local branches being followed with --track
2009-04-06 00:42:31 -07:00
Junio C Hamano 87d2062b39 Merge branch 'sb/format-patch-patchname'
* sb/format-patch-patchname:
  format_sanitized_subject: Don't trim past initial length of strbuf
  log-tree: fix patch filename computation in "git format-patch"
  format-patch: --numbered-files and --stdout aren't mutually exclusive
  format-patch: --attach/inline uses filename instead of SHA1
  format-patch: move get_patch_filename() into log-tree
  format-patch: pass a commit to reopen_stdout()
  format-patch: construct patch filename in one function
  pretty.c: add %f format specifier to format_commit_message()
2009-04-06 00:42:23 -07:00
Christian Couder b74d7efb10 t6030: test bisecting with paths
This patch adds some tests to check that "git bisect" works fine when
passing paths to "git bisect start" to reduce the number of
bisection steps.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05 01:29:45 -07:00
Jeff King 5dba359124 tests: remove exit after test_done call
test_done always exits, so this line is never executed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05 00:38:26 -07:00
Clemens Buchacher 0eb6574c24 update cache for conflicting submodule entries
When merging merge bases during a recursive merge we do not want to
leave any unmerged entries. Otherwise we cannot create a temporary
tree for the recursive merge to work with.

We failed to do so in case of a submodule conflict between merge
bases, causing a NULL pointer dereference in the next step of the
recursive merge.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05 00:26:32 -07:00
Clemens Buchacher f37ae35e73 add tests for merging with submodules
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05 00:26:30 -07:00
Jay Soffian 0da43a685a send-email: fix nasty bug in ask() function
Commit 6e18251 (send-email: refactor and ensure prompting doesn't loop
forever) introduced an ask function, which unfortunately had a nasty
bug. This caused it not to accept anything but the default reply to the
"Who should the emails appear to be from?" prompt, and nothing but
ctrl-d to the "Who should the emails be sent to?" and "Message-ID to be
used as In-Reply-To for the first email?" prompts.

This commit corrects the issues and adds a test to confirm the fix.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-04 22:53:32 -07:00
Johannes Schindelin bef3894847 Fix 'git checkout <submodule>' to update the index
While 'git checkout <submodule>' should not update the submodule's
working directory, it should update the index.  This is in line with
how submodules are handled in the rest of Git.

While at it, test 'git reset [<commit>] <submodule>', too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-02 13:16:42 -07:00
Junio C Hamano cb365a7a56 Merge branch 'js/maint-diff-temp-smudge' into maint
* js/maint-diff-temp-smudge:
  Smudge the files fed to external diff and textconv
2009-04-02 12:02:30 -07:00
Junio C Hamano 8afd317843 Merge branch 'bc/maint-1.6.1-branch-deleted-was' into maint
* bc/maint-1.6.1-branch-deleted-was:
  git-branch: display "was sha1" on branch deletion rather than just "sha1"

Conflicts:
	builtin-branch.c
2009-04-02 12:02:18 -07:00
Jay Soffian a61c0ffa44 send-email: ensure quoted addresses are rfc2047 encoded
sanitize_address assumes that quoted addresses (e.g., "first last"
<first.last@example.com) do not need rfc2047 encoding, but this is
not always the case.

For example, various places in send-email extract addresses using
parse_address_line. parse_address_line returns the addresses already
quoted (e.g., "first last" <first.last@example.com), but not rfc2047
encoded.

This patch makes sanitize_address stricter about what needs rfc2047
encoding and adds a test demonstrating where I noticed the problem.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-02 10:46:21 -07:00
Jay Soffian 3b3637c3f1 send-email: correct two tests which were going interactive
Commit c18f75a (send-email: add tests for refactored prompting, 2009-03-28)
added two tests which went interactive under the dash shell.

This patch corrects the issue, reported by Björn Steinbrink.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-02 10:46:21 -07:00
Junio C Hamano dffc13166b Merge branch 'ef/fast-export'
* ef/fast-export:
  builtin-fast-export.c: handle nested tags
  builtin-fast-export.c: fix crash on tagged trees
  builtin-fast-export.c: turn error into warning
  test-suite: adding a test for fast-export with tag variants
2009-04-01 22:49:28 -07:00
Junio C Hamano 37a13acb2e Merge branch 'mh/format-patch-add-header'
* mh/format-patch-add-header:
  format-patch: add arbitrary email headers
2009-04-01 22:49:24 -07:00
Junio C Hamano 3c91bf6805 Merge branch 'jc/maint-1.6.0-keep-pack'
* jc/maint-1.6.0-keep-pack:
  pack-objects: don't loosen objects available in alternate or kept packs
  t7700: demonstrate repack flaw which may loosen objects unnecessarily
  Remove --kept-pack-only option and associated infrastructure
  pack-objects: only repack or loosen objects residing in "local" packs
  git-repack.sh: don't use --kept-pack-only option to pack-objects
  t7700-repack: add two new tests demonstrating repacking flaws

Conflicts:
	t/t7700-repack.sh
2009-04-01 22:34:19 -07:00
Junio C Hamano 8092bfb6c2 match_tree_entry(): a pathspec only matches at directory boundaries
Previously the code did a simple prefix match, which means that a path in
a directory "frotz/" would have matched with pathspec "f".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-01 19:35:31 -07:00
Björn Steinbrink f0946cb826 tree_entry_interesting: a pathspec only matches at directory boundary
Previously the code did a simple prefix match, which means that a
path in a directory "frotz/" would have matched with pathspec "f".

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-01 19:35:16 -07:00
Michael J Gruber 5e6e2b487e Make local branches behave like remote branches when --tracked
This makes sure that local branches, when followed using --track, behave
the same as remote ones (e.g. differences being reported by git status
and git checkout). This fixes 1 known failure.

The fix is done within branch_get(): The first natural candidate,
namely remote_find_tracking(), does not have all the necessary info
because in general there is no remote struct for '.', and we don't want
one because it would show up in other places as well.

branch_get(), on the other hand, has access to merge_names[] (in
addition to merge[]) and therefore can set up the followed branch
easily.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-01 15:48:30 -07:00
Jay Soffian dc1460aa8d send-email: ask_default should apply to all emails, not just the first
Commit 6e18251 made the "Send this email?" prompt assume yes if confirm
= "inform" when it was unable to get a valid response. However, the
"yes" assumption only worked correctly for the first email. This commit
fixes the issue and confirms the fix by modifying the existing test for
the prompt to send multiple emails.

Reported by Matthieu Moy <Matthieu.Moy@imag.fr>

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-01 11:11:21 -07:00
Jeff King 1b89eaa4be t1301: loosen test for forced modes
One of the aspects of the test checked explicitly for the
g+s bit to be set on created directories. However, this is
only the means to an end (the "end" being having the correct
group set). And in fact, on systems where
DIR_HAS_BSD_GROUP_SEMANTICS is set, we do not even need to
use this "means" at all, causing the test to fail.

This patch removes that part of the test. In an ideal world
it would be replaced by a test to check that the group was
properly assigned, but that is difficult to automate because
it requires the user running the test suite be a member of
multiple groups.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-01 11:09:25 -07:00
Jay Soffian c18f75a1e9 send-email: add tests for refactored prompting
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-29 21:41:28 -07:00
Erik Faye-Lund 1982467d92 builtin-fast-export.c: handle nested tags
When tags that points to tags are passed to fast-export, an error is given,
saying "Tag [TAGNAME] points nowhere?". This fix calls parse_object() on the
object before referencing it's tag, to ensure the tag-info is fully initialized.
In addition, it inserts a comment to point out where nested tags are handled.
This is consistent with the comment for signed tags.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-29 19:48:43 -07:00
Erik Faye-Lund c0582c53bc builtin-fast-export.c: fix crash on tagged trees
If a tag object points to a tree (or another unhandled type), the commit-
pointer is left uninitialized and later dereferenced. This patch adds a
default case to the switch that issues a warning and skips the object.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-29 19:48:43 -07:00
Erik Faye-Lund 41a5c70f2c test-suite: adding a test for fast-export with tag variants
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-29 19:48:39 -07:00
Junio C Hamano b0085a7167 Merge branch 'maint'
* maint:
  test-lib: Clean up comments and Makefile.
  diff --no-index: Do not generate patch output if other output is requested
2009-03-28 01:16:46 -07:00
Junio C Hamano aa72a14a7f Merge branch 'jc/maint-1.6.0-diff-borrow-carefully'
* jc/maint-1.6.0-diff-borrow-carefully:
  diff --cached: do not borrow from a work tree when a path is marked as assume-unchanged
2009-03-28 00:42:31 -07:00
Junio C Hamano 9d5156496d Merge branch 'maint-1.6.1' into maint
* maint-1.6.1:
  test-lib: Clean up comments and Makefile.
  diff --no-index: Do not generate patch output if other output is requested
2009-03-28 00:41:50 -07:00
Emil Sit 81db4abf84 test-lib: Clean up comments and Makefile.
Bring documentation in test-lib and clean target
in Makefile in-line with abc5d372.

Signed-off-by: Emil Sit <sit@emilsit.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-28 00:11:27 -07:00
Michael Hendricks d7d9c2d049 format-patch: add arbitrary email headers
format-patch supports the format.headers configuration for adding
arbitrary email headers to the patches it outputs.  This patch adds
support for an --add-header argument which makes the same feature
available from the command line.  This is useful when the content of
custom email headers must change from branch to branch.

This patch has been sponsored by Grant Street Group

Signed-off-by: Michael Hendricks <michael@ndrix.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-27 23:49:50 -07:00
Junio C Hamano 5a688fe470 "core.sharedrepository = 0mode" should set, not loosen
This fixes the behaviour of octal notation to how it is defined in the
documentation, while keeping the traditional "loosen only" semantics
intact for "group" and "everybody".

Three main points of this patch are:

 - For an explicit octal notation, the internal shared_repository variable
   is set to a negative value, so that we can tell "group" (which is to
   "OR" in 0660) and 0660 (which is to "SET" to 0660);

 - git-init did not set shared_repository variable early enough to affect
   the initial creation of many files, notably copied templates and the
   configuration.  We set it very early when a command-line option
   specifies a custom value.

 - Many codepaths create files inside $GIT_DIR by various ways that all
   involve mkstemp(), and then call move_temp_to_file() to rename it to
   its final destination.  We can add adjust_shared_perm() call here; for
   the traditional "loosen-only", this would be a no-op for many codepaths
   because the mode is already loose enough, but with the new behaviour it
   makes a difference.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-27 21:51:04 -07:00
Michael J Gruber 57dac0bfe4 Test for local branches being followed with --track
According to the documentation, it is perfectly okay to follow local
branches using the --track option. Introduce a test which checks whether
they behave the same. Currently one test fails.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-27 01:08:36 -07:00
Junio C Hamano f504fa2acb Merge branch 'jk/reflog-date'
* jk/reflog-date:
  make oneline reflog dates more consistent with multiline format
2009-03-26 00:27:37 -07:00
Junio C Hamano 6ba8b079cb Merge branch 'jc/attributes-checkout'
* jc/attributes-checkout:
  Add a test for checking whether gitattributes is honored by checkout.
  Read attributes from the index that is being checked out
2009-03-26 00:27:33 -07:00
Junio C Hamano b71fdc590d Merge branch 'js/maint-diff-temp-smudge'
* js/maint-diff-temp-smudge:
  Smudge the files fed to external diff and textconv
2009-03-26 00:27:30 -07:00
Junio C Hamano 23fd723c9d Merge branch 'bc/maint-1.6.1-branch-deleted-was'
* bc/maint-1.6.1-branch-deleted-was:
  git-branch: display "was sha1" on branch deletion rather than just "sha1"

Conflicts:
	builtin-branch.c
2009-03-26 00:26:47 -07:00
Elijah Newren ebeec7dbc5 fast-export: Avoid dropping files from commits
When exporting a subset of commits on a branch that do not go back to a
root commit (e.g. master~2..master), we still want each exported commit to
have the same files in the exported tree as in the original tree.

Previously, when given such a range, we would omit master~2 as a parent of
master~1, but we would still diff against master~2 when selecting the list
of files to include in master~1.  This would result in only files that
had changed in the given range showing up in the resulting export.  In such
cases, we should diff master~1 against the root instead (i.e. use
diff_root_tree_sha1 instead of diff_tree_sha1).

There's a special case to consider here: incremental exports (i.e. exports
where the --import-marks flag is specified).  If master~2 is an imported
mark, then we still want to diff master~1 against master~2 when selecting
the list of files to include.

We can handle all cases, including the special case, by just checking
whether master~2 corresponds to a known object mark when deciding what to
diff against.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-25 22:53:45 -07:00
Junio C Hamano 8befac5d6f Merge branch 'for-junio' of git://repo.or.cz/git/mingw/j6t
* 'for-junio' of git://repo.or.cz/git/mingw/j6t:
  t7502-commit: Skip SIGTERM test on Windows
  t7005-editor: Use $SHELL_PATH in the editor scripts
2009-03-25 15:08:09 -07:00
Johannes Sixt fb9a2beab2 t7502-commit: Skip SIGTERM test on Windows
The implementation of exec on Windows is just a rough approximation of the
POSIX behavior. In particular, no real process "overlay" happens (a new
process is spawned instead and the parent process waits until the child
terminates). In particular, the process ID cannot be taken by the exec'd
process. But there is one test in t7502-commit.sh that depends on this.
We have to skip it on Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-25 21:25:57 +01:00
Johannes Sixt 80f0e53d6b t7005-editor: Use $SHELL_PATH in the editor scripts
The test sets up various shell scripts and uses them as commit message
editors.  On Windows, we need a shebang line in order to recognize the
files as executable shell scripts.  This adds it.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-25 21:25:53 +01:00
Junio C Hamano 78360b576a Merge branch 'js/windows-tests'
* js/windows-tests:
  t0060: fix whitespace in "wc -c" invocation
  t5503: GIT_DEBUG_SEND_PACK is not supported on MinGW
  t7004: Use prerequisite tags to skip tests that need gpg
  Use prerequisites to skip tests that need unzip
  t3700: Skip a test with backslashes in pathspec
  Skip tests that require a filesystem that obeys POSIX permissions
  t0060: Fix tests on Windows
  Use prerequisite tags to skip tests that depend on symbolic links
  t9100, t9129: Use prerequisite tags for UTF-8 tests
  t5302: Use prerequisite tags to skip 64-bit offset tests
  Skip tests that fail if the executable bit is not handled by the filesystem
  t3600: Use test prerequisite tags
  test-lib: Infrastructure to test and check for prerequisites
  t0050: Check whether git init detected symbolic link support correctly
  Tests on Windows: $(pwd) must return Windows-style paths
  test-lib: Work around missing sum on Windows
  test-lib: Work around incompatible sort and find on Windows

Conflicts:
	t/t3000-ls-files-others.sh
2009-03-24 14:42:50 -07:00
Jeff King 28baf82ea3 t0060: fix whitespace in "wc -c" invocation
Some platforms like to stick extra whitespace in the output
of "wc -c"; using the result without quotes gets the shell
to collapse the whitespace.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-23 00:18:02 -07:00
Stephen Boyd 747e25050b format-patch: --numbered-files and --stdout aren't mutually exclusive
For example:

    git format-patch --numbered-files --stdout --attach HEAD~~

will create two messages with files 1 and 2 attached respectively.
There is no effect when using --numbered-files and --stdout together
without an --attach or --inline, the --numbered-files option will be
ignored. Add a test to show this.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22 21:46:02 -07:00
Stephen Boyd 108dab2811 format-patch: --attach/inline uses filename instead of SHA1
Currently when format-patch is used with --attach or --inline the patch
attachment has the SHA1 of the commit for its filename.  This replaces
the SHA1 with the filename used by format-patch when outputting to
files.

Fix tests relying on the SHA1 output and add a test showing how the
--suffix option affects the attachment filename output.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22 21:45:19 -07:00
Junio C Hamano 150115aded diff --cached: do not borrow from a work tree when a path is marked as assume-unchanged
When the index says that the file in the work tree that corresponds to the
blob object that is used for comparison is known to be unchanged, "diff"
reads from the file and applies convert_to_git(), instead of inflating the
object, to feed the internal diff engine with, because an earlier
benchnark found that it tends to be faster to use this optimization.

However, the index can lie when the path is marked as assume-unchanged.
Disable the optimization for such paths.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22 15:26:07 -07:00
Johannes Schindelin 4e218f54b3 Smudge the files fed to external diff and textconv
When preparing temporary files for an external diff or textconv, it is
easier on the external tools, especially when they are implemented using
platform tools, if they are fed the input after convert_to_working_tree().

This fixes msysGit issue 177.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22 15:03:59 -07:00
Johannes Sixt 8b02c64a3c t5503: GIT_DEBUG_SEND_PACK is not supported on MinGW
The test opens fd 3 and instructs git-upload-pack (via GIT_DEBUG_SEND_PACK)
to log information to that channel.

The way in which new processes are spawned by git on MinGW does not inherit
all file descriptors to the child processes, but only 0, 1, and 2.
The tests in t5503 require that file descriptor 3 is inherited from
git-fetch to git-upload-pack.

A complete implementation is non-trivial and not warranted just to satisfy
this test.  Note that the incompleteness applies only to the executables
that use compat/mingw.c; bash and perl (the other important executables
used by git) are complete, of course.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:52:43 +01:00
Johannes Sixt a4df22ce49 t7004: Use prerequisite tags to skip tests that need gpg
The tests are skipped if no gpg was found or if gpg is version 1.0.6.
Previously, the latter condition was checked a bit later in the test file
so that the tag verification tests would be exercised. These are now
skipped as well, but only because we would need a facility to revoke a
test prerequisite, which we do not have.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:52:43 +01:00
Johannes Sixt 552a26c8c0 Use prerequisites to skip tests that need unzip
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:52:43 +01:00
Johannes Sixt 6fd1106aa4 t3700: Skip a test with backslashes in pathspec
The test verifies that glob special characters can be escaped with
backslashes.  In particular, the string fo\[ou\]bar is given to git.

On Windows, this does not work because backslashes are first of all
directory separators, and first thing git does with a pathspec from the
command line is to convert backslashes to forward slashes.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:49:52 +01:00
Johannes Sixt ee9fb68c39 Skip tests that require a filesystem that obeys POSIX permissions
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:26:44 +01:00
Johannes Sixt 2718e852e9 t0060: Fix tests on Windows
Since the MSYS bash mangles absolute paths that it passes as command line
arguments to non-MSYS progams (such as git or test-path-utils), we have to
bend over backwards to squeeze some usefulness out of the existing tests.

In particular, a set of path normalization tests is added that test
relative paths. Some paths in the ancestor path tests are adjusted to help
MSYS bash's path mangling heuristics.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:26:44 +01:00
Johannes Sixt 704a3143d5 Use prerequisite tags to skip tests that depend on symbolic links
Many tests depend on that symbolic links work.  This introduces a check
that sets the prerequisite tag SYMLINKS if the file system supports
symbolic links.  Since so many tests have to check for this prerequisite,
we do the check in test-lib.sh, so that we don't need to repeat the test
in many scripts.

To check for 'ln -s' failures, you can use a FAT partition on Linux:

$ mkdosfs -C git-on-fat 1000000
$ sudo mount -o loop,uid=j6t,gid=users,shortname=winnt git-on-fat /mnt

Clone git to /mnt and

$ GIT_SKIP_TESTS='t0001.1[34] t0010 t1301 t403[34] t4129.[47] t5701.7
          t7701.3 t9100 t9101.26 t9119 t9124.[67] t9200.10 t9600.6' \
        make test

(These additionally skipped tests depend on POSIX permissions that FAT on
Linux does not provide.)

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:26:44 +01:00
Johannes Sixt 7b7247b0d7 t9100, t9129: Use prerequisite tags for UTF-8 tests
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:26:44 +01:00
Johannes Sixt 18bf879817 t5302: Use prerequisite tags to skip 64-bit offset tests
The effects of this patch can be tested on Linux by commenting out

  #define _FILE_OFFSET_BITS 64

in git-compat-util.h.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:26:44 +01:00
Johannes Sixt 872f349e7b Skip tests that fail if the executable bit is not handled by the filesystem
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:26:44 +01:00
Johannes Sixt 56e78bfb29 t3600: Use test prerequisite tags
There are two prerequisites:

- The filesystem supports names with tabs or new-lines.

- Files cannot be removed if their containing directory is read-only.

Previously, whether these preconditions are satisified was tested inside
test_expect_success. We move these tests outside because, strictly
speaking, they are not part of the tests.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:25:47 +01:00
Junio C Hamano d291a9a6c8 Merge branch 'mg/test-installed'
* mg/test-installed:
  test-lib.sh: Allow running the test suite against installed git
  test-lib.sh: Test for presence of git-init in the right path.
2009-03-21 23:24:40 -07:00
Junio C Hamano 923cc82c48 Merge branch 'tr/maint-1.6.0-send-email-irt' into maint
* tr/maint-1.6.0-send-email-irt:
  send-email: test --no-thread --in-reply-to combination
  send-email: respect in-reply-to regardless of threading

Conflicts:
	t/t9001-send-email.sh
2009-03-21 23:09:21 -07:00
Junio C Hamano 8af95ca017 Merge branch 'mg/maint-submodule-normalize-path' into maint
* mg/maint-submodule-normalize-path:
  git submodule: Fix adding of submodules at paths with ./, .. and //
  git submodule: Add test cases for git submodule add
2009-03-21 23:08:27 -07:00
Junio C Hamano 10a73f5848 Merge branch 'js/rsync-local' into maint
* js/rsync-local:
  rsync transport: allow local paths, and fix tests
2009-03-21 23:03:17 -07:00
Junio C Hamano 0e1aa2f7af Merge branch 'jc/maint-1.6.0-read-tree-overlay' into maint
* jc/maint-1.6.0-read-tree-overlay:
  read-tree A B C: do not create a bogus index and do not segfault
2009-03-21 23:02:47 -07:00
Junio C Hamano e10d48de74 Merge branch 'js/maint-1.6.0-path-normalize' into maint-1.6.1
* js/maint-1.6.0-path-normalize:
  Remove unused normalize_absolute_path()
  Test and fix normalize_path_copy()
  Fix GIT_CEILING_DIRECTORIES on Windows
  Move sanitary_path_copy() to path.c and rename it to normalize_path_copy()
  Make test-path-utils more robust against incorrect use
2009-03-21 22:59:19 -07:00
Junio C Hamano 2990034f1e Merge branch 'jc/maint-1.6.0-pack-directory' into maint-1.6.1
* jc/maint-1.6.0-pack-directory:
  Fix odb_mkstemp() on AIX
  Make sure objects/pack exists before creating a new pack

Conflicts:
	wrapper.c
2009-03-21 22:53:36 -07:00
Brandon Casey 094085e336 pack-objects: don't loosen objects available in alternate or kept packs
If pack-objects is called with the --unpack-unreachable option then it
will unpack (i.e. loosen) all unreferenced objects from local not-kept
packs, including those that also exist in packs residing in an alternate
object database or a locally kept pack.  The only user of this option is
git-repack.

In this case, repack will follow the call to pack-objects with a call to
prune-packed, which will delete these newly loosened objects, making the
act of loosening a waste of time.  The unnecessary loosening can be
avoided by checking whether an object exists in a non-local pack or a
locally kept pack before loosening it.

This fixes the 'local packed unreachable obs that exist in alternate ODB
are not loosened' test in t7700.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-21 21:58:44 -07:00
Brandon Casey 869a3d34c1 t7700: demonstrate repack flaw which may loosen objects unnecessarily
If an unreferenced object exists in both a local pack and in either a pack
residing in an alternate object database or a local kept pack, then the
pack-objects call made by repack will loosen that object only to have it
immediately pruned by repack's call to prune-packed.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-21 21:31:24 -07:00
Brandon Casey 76aac71546 git-branch: display "was sha1" on branch deletion rather than just "sha1"
Make it more pleasant to read about a branch deletion by adding "was".
Jeff King suggested this, and I ignored it.  He was right.

Update t3200 test again to match the change in output.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-21 17:30:51 -07:00
Johannes Sixt a7bb394037 test-lib: Infrastructure to test and check for prerequisites
Some tests can be run only if a particular prerequisite is available. For
example, some tests require that an UTF-8 locale is available. Here we
introduce functions that are used in this way:

1. Insert code that checks whether the prerequisite is available. If it is,
   call test_set_prereq with an arbitrary tag name that subsequently can be
   used to check for the prerequisite:

      case $LANG in
      *.utf-8)
            test_set_prereq UTF8
            ;;
      esac

2. In the calls to test_expect_success pass the tag name:

      test_expect_success UTF8 '...description...' '...tests...'

3. There is an auxiliary predicate that can be used anywhere to test for
   a prerequisite explicitly:

      if test_have_prereq UTF8
      then
            ...code to be skipped if prerequisite is not available...
      fi

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-21 21:09:27 +01:00
Junio C Hamano a797b02f39 http tests: Darwin is not that special
We have PidFile definition in the file already, and we have added
necessary LoadModule for log_config_module recently.

This patch will end up giving LockFile to everybody not just limited to
Darwin, but why not?

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-20 14:41:14 -07:00
Junio C Hamano de2e3b04cd Merge branch 'mv/parseopt-ls-files'
* mv/parseopt-ls-files:
  ls-files: fix broken --no-empty-directory
  t3000: use test_cmp instead of diff
  parse-opt: migrate builtin-ls-files.
  Turn the flags in struct dir_struct into a single variable

Conflicts:
	builtin-ls-files.c
	t/t3000-ls-files-others.sh
2009-03-20 14:30:51 -07:00
Junio C Hamano 8e50ada553 Merge branch 'xx/db-refspec-vs-js-remote'
* xx/db-refspec-vs-js-remote:
  Support '*' in the middle of a refspec
  Keep '*' in pattern refspecs
  Use the matching function to generate the match results
  Use a single function to match names against patterns
  Make clone parse the default refspec with the normal code
2009-03-20 14:30:00 -07:00
Junio C Hamano 0f64f87431 Merge branch 'jc/clone-branch-rebase'
* jc/clone-branch-rebase:
  Improve "git branch --tracking" output
  Make git-clone respect branch.autosetuprebase

Conflicts:
	builtin-clone.c
2009-03-20 14:29:49 -07:00
Junio C Hamano 72c2de5c41 Merge branch 'js/rebase-i-opt'
* js/rebase-i-opt:
  rebase -i: avoid 'git reset' when possible
2009-03-20 14:29:10 -07:00
Junio C Hamano 17e46ea6fe Merge branch 'fc/parseopt-config'
* fc/parseopt-config:
  config: test for --replace-all with one argument and fix documentation.
  config: set help text for --bool-or-int
  git config: don't allow --get-color* and variable type
  git config: don't allow extra arguments for -e or -l.
  git config: don't allow multiple variable types
  git config: don't allow multiple config file locations
  git config: reorganize to use parseopt
  git config: reorganize get_color*
  git config: trivial rename in preparation for parseopt
  git_config(): not having a per-repo config file is not an error
2009-03-20 14:29:03 -07:00
Brandon Casey 79bc4c7155 pack-objects: only repack or loosen objects residing in "local" packs
These two features were invented for use by repack when repack will delete
the local packs that have been made redundant.  The packs accessible
through alternates are not deleted by repack, so the objects contained in
them are still accessible after the local packs are deleted.  They do not
need to be repacked into the new pack or loosened.  For the case of
loosening they would immediately be deleted by the subsequent prune-packed
that is called by repack anyway.

This fixes the test
'packed unreachable obs in alternate ODB are not loosened' in t7700.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-20 13:32:33 -07:00
Brandon Casey 171110a4a6 git-repack.sh: don't use --kept-pack-only option to pack-objects
The --kept-pack-only option to pack-objects treats all kept packs as equal.
This results in objects that reside in an alternate pack that has a .keep
file, not being packed into a newly created pack when the user specifies the
-a option to repack.  Since the user may not have any control over the
alternate database, git should not refrain from repacking those objects
even though they are in a pack with a .keep file.

This fixes the 'packed obs in alternate ODB kept pack are repacked' test in
t7700.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-20 13:32:33 -07:00
Brandon Casey 92cd872202 t7700-repack: add two new tests demonstrating repacking flaws
1) The new --kept-pack-only mechansim of rev-list/pack-objects has
     replaced --unpacked=.  This new mechansim does not operate solely on
     "local" packs now.  The result is that objects residing in an alternate
     pack which has a .keep file will not be repacked with repack -a.

     This flaw is only apparent when a commit object is the one residing in
     an alternate kept pack.

  2) The 'repack unpacked objects' and 'loosen unpacked objects' mechanisms
     of pack-objects, i.e. --keep-unreachable and --unpack-unreachable,
     now do not operate solely on local packs.  The --keep-unreachable
     option no longer has any callers, but --unpack-unreachable is used when
     repack is called with '-A -d' and the local repo has existing packs.
     In this case, objects residing in alternate, not-kept packs will be
     loosened, and then immediately deleted by repack's call to
     prune-packed.

     The test must manually call pack-objects to avoid the call to
     prune-packed that is made by repack when -d is used.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-20 13:32:33 -07:00
Kristian Amlie b997045e01 Add a test for checking whether gitattributes is honored by checkout.
The original bug will not honor new entries in gitattributes if they
are changed in the same checkout as the files they affect.

It will also keep using .gitattributes, even if it is deleted in the
same commit as the files it affects.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-20 09:36:16 -07:00
Jeff King cd4371208a make oneline reflog dates more consistent with multiline format
The multiline reflog format (e.g., as shown by "git log -g")
will show HEAD@{<date>} rather than HEAD@{<count>} in two
situations:

  1. If the user gave branch@{<date>} syntax to specify the
     reflog

  2. If the user gave a --date=<format> specifier

It uses the "normal" date format in case 1, and the
user-specified format in case 2.

The oneline reflog format (e.g., "git reflog show" or "git
log -g --oneline") will show the date in the same two
circumstances. However, it _always_ shows the date as a
relative date, and it always ignores the timezone.

In case 2, it seems ridiculous to trigger the date but use a
format totally different from what the user requested.

For case 1, it is arguable that the user might want to see
the relative date by default; however, the multiline version
shows the normal format.

This patch does three things:

  - refactors the "relative_date" parameter to
    show_reflog_message to be an actual date_mode enum,
    since this is how it is used (it is passed to show_date)

  - uses the passed date_mode parameter in the oneline
    format (making it consistent with the multiline format)

  - does not ignore the timezone parameter in oneline mode

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-20 00:57:27 -07:00
Johannes Sixt 64e61f2d17 t0050: Check whether git init detected symbolic link support correctly
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19 22:04:25 +01:00
Johannes Sixt 4114156ae9 Tests on Windows: $(pwd) must return Windows-style paths
Many tests pass $(pwd) in some form to git and later test that the output
of git contains the correct value of $(pwd). For example, the test of
'git remote show' sets up a remote that contains $(pwd) and then the
expected result must contain $(pwd).

Again, MSYS-bash's path mangling kicks in: Plain $(pwd) uses the MSYS style
absolute path /c/path/to/git. The test case would write this name into
the 'expect' file. But when git is invoked, MSYS-bash converts this name to
the Windows style path c:/path/to/git, and git would produce this form in
the result; the test would fail.

We fix this by passing -W to bash's pwd that produces the Windows-style
path.

There are a two cases that need an accompanying change:

- In t1504 the value of $(pwd) becomes part of a path list. In this case,
  the lone 'c' in something like /foo:c:/path/to/git:/bar inhibits
  MSYS-bashes path mangling; IOW in this case we want the /c/path/to/git
  form to allow path mangling. We use $PWD instead of $(pwd), which always
  has the latter form.

- In t6200, $(pwd) - the Windows style path - must be used to construct the
  expected result because that is the path form that git sees. (The change
  in the test itself is just for consistency: 'git fetch' always sees the
  Windows-style path, with or without the change.)

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19 22:04:25 +01:00
Johannes Sixt 5397ea314f test-lib: Work around missing sum on Windows
t1002-read-tree-m-u-2way.sh uses 'sum', but it does not rely on the exact
form of the sum, only that it is a hash digest. Therefore, we can sneak
in 'md5sum' under the name 'sum'.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19 22:04:25 +01:00
Johannes Sixt f17e9fbbe9 test-lib: Work around incompatible sort and find on Windows
If the PATH lists the Windows system directories before the MSYS
directories, Windows's own incompatible sort and find commands would be
picked up. We implement these commands as functions and call the real
tools by absolute path.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19 22:04:25 +01:00
Johannes Sixt a8cbc9ab02 t5602: Work around path mangling on MSYS
MSYS's bash rewrites /something/bin/... into a Windows path that looks like
c:/msysgit/something/bin/... before git sees it. But later the test case
verifies that the path was used and compares it to the unmangled version.
This fails, of course. This make the path relative so that the path
mangling is not triggered.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19 21:47:15 +01:00
Johannes Sixt b689ccf6c9 t5300, t5302, t5303: Do not use /dev/zero
We do not have /dev/zero on Windows. This replaces it by data generated
with printf, perl, or echo. Most of the cases do not depend on that the
data is a stream of zero bytes, so we use something printable; nor is an
unlimited stream of data needed, so we produce only as many bytes as the
test cases need.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19 21:47:15 +01:00
Johannes Sixt 0aaaef7b0f t2200, t7004: Avoid glob pattern that also matches files
On Windows, there is an unfortunate interaction between the MSYS bash and
git's command line processing:

- Since Windows's CMD does not do the wildcard expansion, but passes
  arguments like path* through to the programs, the programs must do the
  expansion themselves. This happens in the startup code before main() is
  entered.

- bash, however, passes the argument "path*" to git, assuming that git will
  see the unquoted word unchanged as a single argument.

But actually git expands the unquoted word before main() is entered.

In t2200, not all names that the test case is interested in exist as files
at the time when 'git ls-files' is invoked. git expands "path?" to only
the subset of files the exist, and only that subset was listed, so that the
test failed.  We now list all interesting paths explicitly.

In t7004, git exanded the pattern "*a*" to "actual" (the file that stdout
was redirected to), which is not what the was tested for. We fix it by
renaming the output file (and removing any existing files matching *a*).
This was originally fixed by Johannes Schindelin.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19 21:47:14 +01:00
Johannes Schindelin e2c2407683 t7300: fix clean up on Windows
On Windows, you cannot remove files that are in use, not even with
'rm -rf'.  So we need to run 'exec <foo/bar' inside a subshell lest
removing the whole test repository fail.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19 21:47:14 +01:00
Johannes Sixt 1f553918a8 test-lib: Introduce test_chmod and use it instead of update-index --chmod
This function replaces sequences of 'chmod +x' and 'git update-index
--chmod=+x' in the test suite, whose purpose is to help filesystems
that need core.filemode=false. Two places where only 'chmod +x' was used
we also use this new function.

The function calls 'git update-index --chmod' without checking
core.filemode (unlike some of the call sites did). We do this because the
call sites *expect* that the executable bit ends up in the index (ie. it
is not the purpose of the call sites to *test* whether git treats
'chmod +x' and 'update-index --chmod=+x' correctly). Therefore, on
filesystems with core.filemode=true the 'git update-index --chmod' is a
no-op.

The function uses --add with update-index to help one call site in
t6031-merge-recursive. It makes no difference for the other callers.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19 21:47:14 +01:00
Johannes Sixt 8586f98bd2 test-lib: Simplify test counting.
Since the test case counter was incremented very late, there were a few
users of the counter had to do their own incrementing. Now we increment it
early and simplify these users.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19 21:47:14 +01:00
Johannes Sixt d5d9de1b10 test-lib: Replace uses of $(expr ...) by POSIX shell features.
In particular:

- Test case counting can be achieved by arithmetic expansion.

- The name of the test, e.g. t1234, can be computed with ${0%%} and ${0##}.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19 21:47:14 +01:00
Johannes Sixt 5b46a4285f Call 'say' outside test_expect_success
There were some uses of 'say' inside test_expect_success. But if the tests
were not run in verbose mode, this message went to /dev/null. Pull them out
of test_expect_success.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19 21:47:14 +01:00
Johannes Sixt fae74a04d7 test suite: Use 'say' to say something instead of 'test_expect_success'
Some tests report that some tests will be skipped.  They used
'test_expect_success' with a trivially successful test.  Nowadays we have
the helper function 'say' for this purpose.

In on case, 'say_color skip' is replaced by 'say' because the former is
not intended as a public API.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19 21:44:04 +01:00
Johannes Sixt 7fd3ef1fd7 t9400, t9401: Do not force hard-linked clone
The tests do not depend on that the clones are hard-linked, but used
--local only as an optimization: At the time that --local was used first
in t9400 hard-linked clones were not the default, yet.

By removing --local, we help filesystems that do not support hard-links.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-18 20:35:01 +01:00
Junio C Hamano 7d4e3a72fb Merge branch 'jc/maint-1.6.0-read-tree-overlay'
* jc/maint-1.6.0-read-tree-overlay:
  read-tree A B C: do not create a bogus index and do not segfault
2009-03-17 18:58:55 -07:00
Junio C Hamano 9e6433a210 Merge branch 'js/rsync-local'
* js/rsync-local:
  rsync transport: allow local paths, and fix tests
2009-03-17 18:58:13 -07:00
Junio C Hamano ca8a36e6e0 Merge branch 'js/remote-improvements'
* js/remote-improvements: (23 commits)
  builtin-remote.c: no "commented out" code, please
  builtin-remote: new show output style for push refspecs
  builtin-remote: new show output style
  remote: make guess_remote_head() use exact HEAD lookup if it is available
  builtin-remote: add set-head subcommand
  builtin-remote: teach show to display remote HEAD
  builtin-remote: fix two inconsistencies in the output of "show <remote>"
  builtin-remote: make get_remote_ref_states() always populate states.tracked
  builtin-remote: rename variables and eliminate redundant function call
  builtin-remote: remove unused code in get_ref_states
  builtin-remote: refactor duplicated cleanup code
  string-list: new for_each_string_list() function
  remote: make match_refs() not short-circuit
  remote: make match_refs() copy src ref before assigning to peer_ref
  remote: let guess_remote_head() optionally return all matches
  remote: make copy_ref() perform a deep copy
  remote: simplify guess_remote_head()
  move locate_head() to remote.c
  move duplicated ref_newer() to remote.c
  move duplicated get_local_heads() to remote.c
  ...

Conflicts:
	builtin-clone.c
2009-03-17 18:55:06 -07:00
Junio C Hamano a57ca9dd40 Merge branch 'tr/maint-1.6.0-send-email-irt'
* tr/maint-1.6.0-send-email-irt:
  send-email: test --no-thread --in-reply-to combination
  send-email: respect in-reply-to regardless of threading

Conflicts:
	t/t9001-send-email.sh
2009-03-17 18:54:46 -07:00
Miklos Vajna 188c3827c1 Tests: use test_cmp instead of diff where possible
Several old tests were written before test_cmp was introduced, convert
these to test_cmp.

If were are at it, fix the order of the arguments where necessary to
make expected come first, so the command shows how the test result
deviates from the correct output.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-17 14:25:52 -07:00
Alex Riesen d42ec126aa disable post-checkout test on Cygwin
It is broken because of the tricks we have to play with
lstat to get the bearable perfomance out of the call.
Sadly, it disables access to Cygwin's executable attribute,
which Windows filesystems do not have at all.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-17 13:36:24 -07:00
Carlos Rica bf71b4b3ee config: test for --replace-all with one argument and fix documentation.
Option --replace-all only allows at least two arguments, so
documentation was needing to be updated accordingly. A test showing
that the command fails with only one parameter is also provided.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-17 09:30:00 -07:00
Michael J Gruber 6720721e15 test-lib.sh: Allow running the test suite against installed git
Introduce variables GIT_TEST_INSTALLED and GIT_TEST_EXEC_PATH such that
the test suite can be run against a git which is installed at
GIT_TEST_INSTALLED with subcommands at GIT_TEST_EXEC_PATH.

GIT_TEST_INSTALLED defaults to the git.git checkout, GIT_TEST_EXEC_PATH
defaults to the output of '$GIT_TEST_INSTALLED/git --exec-path'.

Run the suite e.g. as

    GIT_TEST_INSTALLED=/some/path make test

but note that this requires and uses parts of a compiled git in the
git.git checkout: test helpers, templates and perl libraries are taken
from there.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-16 12:19:10 -07:00
Michael J Gruber 7ee3760e2c test-lib.sh: Test for presence of git-init in the right path.
It just happens so that when GIT_EXEC_PATH points to a compiled checkout
of git.git it contains "git". Since this is not true in general make
test-lib check for "git-init" which is always in GIT_EXEC_PATH.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-16 12:18:18 -07:00
Johannes Schindelin bba2a7b22f test-lib: write test results to test-results/<basename>-<pid>
The earlier code meant to attempt to strip everything except the test
number, but only stripped the part starting with the last dash.

However, there is no reason why we should not use the whole basename.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-14 13:37:00 -07:00
Johannes Sixt 7f733de04e test-suite: Make test script numbers unique
In order to selectively skip tests, the environment variable GIT_SKIP_TESTS
can be set like this:

  $ GIT_SKIP_TESTS='t1301 t4150.18' make test

That is, its value can contain only the test script numbers, but not the
full script name. Therefore, it is important that the test scripts are
uniquely numbered. This makes it so.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-14 12:44:20 -07:00
Junio C Hamano bf0fe35c93 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  bisect: fix another instance of eval'ed string
  bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped
  Support "\" in non-wildcard exclusion entries

Conflicts:
	git-bisect.sh
2009-03-12 23:36:57 -07:00
Junio C Hamano 688ba09cad Merge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.0
* ks/maint-1.6.0-mailinfo-folded:
  mailinfo: tests for RFC2047 examples
  mailinfo: add explicit test for mails like '<a.u.thor@example.com> (A U Thor)'
  mailinfo: 'From:' header should be unfold as well
  mailinfo: correctly handle multiline 'Subject:' header
2009-03-12 21:48:43 -07:00
Junio C Hamano 3e186ef135 Merge branch 'cc/maint-1.6.0-bisect-fix' into maint-1.6.0
* cc/maint-1.6.0-bisect-fix:
  bisect: fix another instance of eval'ed string
  bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped
2009-03-12 21:48:26 -07:00
Junio C Hamano fa711bc198 Merge branch 'fg/maint-1.6.0-exclude-bq' into maint-1.6.0
* fg/maint-1.6.0-exclude-bq:
  Support "\" in non-wildcard exclusion entries
2009-03-12 21:48:07 -07:00
Junio C Hamano 2f5bfa7c7f Merge branch 'js/maint-1.6.1-remote-remove-mirror' into maint-1.6.1
* js/maint-1.6.1-remote-remove-mirror:
  builtin-remote: make rm operation safer in mirrored repository
  builtin-remote: make rm() use properly named variable to hold return value
2009-03-12 21:45:56 -07:00
Junio C Hamano 592ebd087a Merge branch 'ek/maint-1.6.1-filter-branch-bare' into maint-1.6.1
* ek/maint-1.6.1-filter-branch-bare:
  filter-branch: Fix fatal error on bare repositories
2009-03-12 21:45:21 -07:00
Junio C Hamano d9b04430d2 Merge branch 'jc/maint-1.6.1-add-u-remove-conflicted' into maint-1.6.1
* jc/maint-1.6.1-add-u-remove-conflicted:
  add -u: do not fail to resolve a path as deleted
2009-03-12 21:45:14 -07:00
Junio C Hamano 54e7e7891b Merge branch 'js/maint-1.6.1-rebase-i-submodule' into maint-1.6.1
* js/maint-1.6.1-rebase-i-submodule:
  Fix submodule squashing into unrelated commit
  rebase -i squashes submodule changes into unrelated commit
2009-03-12 21:45:02 -07:00
Junio C Hamano daf713dd49 Merge branch 'jc/maint-1.6.1-allow-uninteresting-missing' into maint-1.6.1
* jc/maint-1.6.1-allow-uninteresting-missing:
  revision traversal: allow UNINTERESTING objects to be missing
2009-03-12 21:44:48 -07:00
Junio C Hamano e89b991a7f Merge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.1
* ks/maint-1.6.0-mailinfo-folded:
  mailinfo: tests for RFC2047 examples
  mailinfo: add explicit test for mails like '<a.u.thor@example.com> (A U Thor)'
  mailinfo: 'From:' header should be unfold as well
  mailinfo: correctly handle multiline 'Subject:' header
2009-03-12 21:44:00 -07:00
Junio C Hamano de55390d36 Merge branch 'jc/maint-1.6.0-split-diff-metainfo' into maint-1.6.0
* jc/maint-1.6.0-split-diff-metainfo:
  diff.c: output correct index lines for a split diff
2009-03-12 20:01:28 -07:00
Junio C Hamano aab3b9a1aa read-tree A B C: do not create a bogus index and do not segfault
"git read-tree A B C..." without the "-m" (merge) option is a way to read
these trees on top of each other to get an overlay of them.

An ancient commit ee6566e (Rewrite read-tree, 2005-09-05) passed the
ADD_CACHE_SKIP_DFCHECK flag when calling add_index_entry() to add the
paths obtained from these trees to the index, but it is an incorrect use
of the flag.  The flag is meant to be used by callers who know the
addition of the entry does not introduce a D/F conflict to the index in
order to avoid the overhead of checking.

This bug resulted in a bogus index that records both "x" and "x/z" as a
blob after reading three trees that have paths ("x"), ("x", "y"), and
("x/z", "y") respectively.  34110cd (Make 'unpack_trees()' have a separate
source and destination index, 2008-03-06) refactored the callsites of
add_index_entry() incorrectly and added more codepaths that use this flag
when it shouldn't be used.

Also, 0190457 (Move 'unpack_trees()' over to 'traverse_trees()' interface,
2008-03-05) introduced a bug to call add_index_entry() for the tree that
does not have the path in it, passing NULL as a cache entry.  This caused
reading multiple trees, one of which has path "x" but another doesn't, to
segfault.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-12 17:06:07 -07:00
Thomas Rast aaab4b9fb9 send-email: test --no-thread --in-reply-to combination
3e0c4ff (send-email: respect in-reply-to regardless of threading,
2009-03-01) fixed the handling of the In-Reply-To header when both
--no-thread and --in-reply-to are in effect.  Add a test for it.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-11 20:54:42 -07:00
Junio C Hamano 7681ed2d2e Merge branch 'js/maint-send-email' into maint
* js/maint-send-email:
  send-email: don't create temporary compose file until it is needed
  send-email: --suppress-cc improvements
  send-email: handle multiple Cc addresses when reading mbox message
  send-email: allow send-email to run outside a repo
2009-03-11 14:01:24 -07:00
Junio C Hamano 5f7b338310 Merge branch 'fg/maint-exclude-bq' into maint
* fg/maint-exclude-bq:
  Support "\" in non-wildcard exclusion entries
2009-03-11 13:53:53 -07:00
Junio C Hamano 500ff11968 Merge branch 'mg/maint-submodule-normalize-path'
* mg/maint-submodule-normalize-path:
  git submodule: Fix adding of submodules at paths with ./, .. and //
  git submodule: Add test cases for git submodule add
2009-03-11 13:50:29 -07:00
Junio C Hamano e43997979e Merge branch 'tv/rebase-stat'
* tv/rebase-stat:
  git-pull: Allow --stat and --no-stat to be used with --rebase
  git-rebase: Add --stat and --no-stat for producing diffstat on rebase
2009-03-11 13:49:11 -07:00
Junio C Hamano 8a396c02fd Merge branch 'jk/clone-post-checkout'
* jk/clone-post-checkout:
  clone: run post-checkout hook when checking out
2009-03-11 13:48:31 -07:00
Junio C Hamano 5a5bd23486 Merge branch 'tr/format-patch-thread'
* tr/format-patch-thread:
  format-patch: support deep threading
  format-patch: thread as reply to cover letter even with in-reply-to
  format-patch: track several references
  format-patch: threading test reactivation

Conflicts:
	builtin-log.c
2009-03-11 13:48:07 -07:00
Junio C Hamano e785dadc90 Merge branch 'tr/gcov'
* tr/gcov:
  Test git-patch-id
  Test rev-list --parents/--children
  Test log --decorate
  Test fsck a bit harder
  Test log --graph
  Test diff --dirstat functionality
  Test that diff can read from stdin
  Support coverage testing with GCC/gcov
2009-03-11 13:47:01 -07:00
Johannes Schindelin 7d59ceed9d test: do not LoadModule log_config_module unconditionally
LoadModule directive for log_config_module will not work if the module is
built-in.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-11 12:41:56 -07:00
Johannes Schindelin 7efaeba2a8 rsync transport: allow local paths, and fix tests
Earlier, the rsync tests were disabled by default, as they needed a
running rsyncd daemon.  This was only due to the limitation that our
rsync transport only allowed full URLs of the form

	rsync://<host>/<path>

Relaxing the URLs to allow

	rsync:<path>

permitted the change in the tests to run whenever rsync is available,
without requiring a fully configured and running rsyncd.

While at it, the tests were fixed so that they run in directories with a
space in their name.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-10 23:17:56 -07:00
Daniel Barkalow 4d5d398474 Include log_config module in apache.conf
The log_config module is needed for at least some versions of apache to
support the LogFormat directive.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-10 23:09:48 -07:00
Junio C Hamano 5ad6b0252b Adjust js/remote-improvements and db/refspec-wildcard-in-the-middle
The latter topic changes the definition of how refspec's src and dst side
is stored in-core; it used to be that the asterisk for pattern was
omitted, but now it is included.  The former topic handcrafts an old style
refspec to feed the refspec matching machinery that lacks the asterisk and
triggers an error.

This resolves the semantic clash between the two topics early before they
need to be merged to integration branches.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-08 00:24:21 -08:00
Junio C Hamano 934f788981 Merge branch 'maint'
* maint:
  builtin-revert.c: release index lock when cherry-picking an empty commit
  document config --bool-or-int
  t1300: use test_must_fail as appropriate
  cleanup: add isascii()
  Documentation: fix badly indented paragraphs in "--bisect-all" description
2009-03-07 22:34:13 -08:00
Junio C Hamano 9a6682bab5 Merge branch 'maint-1.6.1' into maint
* maint-1.6.1:
  builtin-revert.c: release index lock when cherry-picking an empty commit
2009-03-07 21:00:27 -08:00
Johannes Schindelin 36adb4abbd MinGW: fix diff --no-index /dev/null ...
When launching "diff --no-index" with a parameter "/dev/null", the MSys
bash converts the "/dev/null" to a "nul", which usually makes sense.  But

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-07 20:36:16 -08:00
Johannes Schindelin ca31f0b5c2 Add an (optional, since expensive) test for >2gb clones
Define GIT_TEST_CLONE_2GB=t if you want the test not to be skipped.

The test works by constructing a repository larger than 2gb, and then
cloning it.

The repository is forced larger than 2gb by setting compression and
delta depth to zero, and then adding just enough unique objects of
a given size.

The objects consist of a running decimal number in ASCII, padded by
spaces.  Should that break in the future, e.g. when pack v4 becomes
default, there is a commented-out call to test-genrandom which can be
substituted, but that uses more cycles than the current method.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-07 20:27:48 -08:00
Jeff King 2fb6d6d6dd ls-files: fix broken --no-empty-directory
Commit ce8e880 converted ls-files to use parseopt; the
--no-empty-directory option was converted as an
OPT_BIT for "empty-directory" to set the
DIR_HIDE_EMPTY_DIRECTORY flag. However, that makes it do the
opposite of what it should: --empty-directory would hide,
but --no-empty-directory would turn off hiding.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-07 19:54:57 -08:00
Jeff King 8a3b25da8c t3000: use test_cmp instead of diff
These ancient tests predate test_cmp.

While we're at it, let's switch to our usual "expected
before actual" order of arguments; this makes the diff
output "here's what is changed from expected" instead of the
reverse.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-07 19:54:05 -08:00
Chris Johnsen 0d66e95903 builtin-revert.c: release index lock when cherry-picking an empty commit
When a cherry-pick of an empty commit is done, release the lock
held on the index.

The fix is the same as was applied to similar code in 4271666046.

Signed-off-by: Chris Johnsen <chris_johnsen@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-07 12:21:45 -08:00
Daniel Barkalow abd2bde78b Support '*' in the middle of a refspec
In order to keep the requirements strict, each * has to be a full path
component, and there may only be one * per side. This requirement is
enforced entirely by check_ref_format(); the matching implementation
will substitute the whatever matches the * in the lhs for the * in the
rhs.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-07 12:19:28 -08:00
Jeff King 003f69b282 t1300: use test_must_fail as appropriate
Some of the tests checked the exit code manually, even going
so far as to run git outside of the test_expect harness.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-07 11:28:53 -08:00
Junio C Hamano 458eaf5bf8 Merge branch 'ns/pretty-format'
* ns/pretty-format:
  bash completion: add --format= and --oneline options for "git log"
  Add tests for git log --pretty, --format and --oneline.
  Add --oneline that is a synonym to "--pretty=oneline --abbrev-commit"
  Give short-hands to --pretty=tformat:%formatstring
  Add --format that is a synonym to --pretty
2009-03-05 15:41:43 -08:00
Junio C Hamano 2fb9c421e1 Merge branch 'js/send-email'
* js/send-email:
  send-email: add --confirm option and configuration setting
  send-email: don't create temporary compose file until it is needed
  send-email: --suppress-cc improvements
  send-email: handle multiple Cc addresses when reading mbox message
  send-email: allow send-email to run outside a repo
2009-03-05 15:41:42 -08:00
Junio C Hamano 1456d964fa Merge branch 'fg/exclude-bq'
* fg/exclude-bq:
  Support "\" in non-wildcard exclusion entries
2009-03-05 15:41:39 -08:00
Junio C Hamano 814742672f Merge branch 'js/branch-symref'
* js/branch-symref:
  add basic branch display tests
  branch: clean up repeated strlen
  Avoid segfault with 'git branch' when the HEAD is detached
  builtin-branch: improve output when displaying remote branches

Conflicts:
	builtin-branch.c
2009-03-05 15:41:35 -08:00
Junio C Hamano 8a61097cde Merge branch 'js/valgrind'
* js/valgrind:
  valgrind: do not require valgrind 3.4.0 or newer
  test-lib: avoid assuming that templates/ are in the GIT_EXEC_PATH
  Tests: let --valgrind imply --verbose and --tee
  Add a script to coalesce the valgrind outputs
  t/Makefile: provide a 'valgrind' target
  test-lib.sh: optionally output to test-results/$TEST.out, too
  Valgrind support: check for more than just programming errors
  valgrind: ignore ldso and more libz errors
  Add valgrind support in test scripts
2009-03-05 15:41:18 -08:00
Carlos Manuel Duclos Vergara aec0c1bbfb git-archive: add --output=<file> to send output to a file
When archiving a repository there is no way to specify a file as output.
This patch adds a new option "--output" that redirects the output to a
file instead of stdout.

Signed-off-by: Carlos Manuel Duclos Vergara <carlos.duclos@nokia.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-04 00:56:52 -08:00
Junio C Hamano a9f2c13685 Make git-clone respect branch.autosetuprebase
When git-clone creates an initial branch it was not checking the
branch.autosetuprebase configuration option (which may exist in
~/.gitconfig).  Refactor the code used by "git branch" to create
a new branch, and use it instead of the insufficiently duplicated code
in builtin-clone.

Changes are partly, and the test is mostly, based on the previous work by
Pat Notz.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-03 22:58:52 -08:00
Michael J Gruber db75ada559 git submodule: Fix adding of submodules at paths with ./, .. and //
Make 'git submodule add' normalize the submodule path in the
same way as 'git ls-files' does, so that 'git submodule init' looks up
the information in .gitmodules with the same key under which 'git
submodule add' stores it.

This fixes 4 known breakages.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-03 21:46:09 -08:00
Michael J Gruber ac8463d2b4 git submodule: Add test cases for git submodule add
Add simple test cases for adding and initialising submodules. The
init step is necessary in order to verify the added information.

The second test exposes a known breakage due to './' in the path: git
ls-files simplifies the path but git add does not, which leads to git
init looking for different lines in .gitmodules than git add adds.

The other tests add test cases for '//' and '..' in the path which
currently fail for the same reason.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-03 21:46:09 -08:00
Johannes Schindelin 0e757e30c7 rebase -i: avoid 'git reset' when possible
When picking commits whose parents have not changed, we do not need to
rewrite the commit.  We do not need to reset the working directory to
the parent's state, either.

Requested by Sverre Rabbelier.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-03 10:56:22 -08:00
Jeff King dfa7a6c579 clone: run post-checkout hook when checking out
The mental model for clone is that the branch is "checked
out" (and it even says this in Documentation/git-clone.txt:
"...creates and checks out an initial branch"). Therefore it
is reasonable for users to expect that any post-checkout
hook would be run.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-02 23:50:44 -08:00
Jay Soffian c1f2aa45b7 send-email: add --confirm option and configuration setting
send-email violates the principle of least surprise by automatically
cc'ing additional recipients without confirming this with the user.

This patch teaches send-email a --confirm option. It takes the
following values:

 --confirm=always   always confirm before sending
 --confirm=never    never confirm before sending
 --confirm=cc       confirm before sending when send-email has
                    automatically added addresses from the patch to
                    the Cc list
 --confirm=compose  confirm before sending the first message when
                    using --compose. (Needed to maintain backwards
                    compatibility with existing behavior.)
 --confirm=auto     'cc' + 'compose'

If sendemail.confirm is unconfigured, the option defaults to 'compose'
if any suppress-Cc related options have been used, otherwise it defaults
to 'auto'.

Unfortunately, it is impossible to introduce this patch such that it
helps new users without potentially annoying some existing users. We
attempt to mitigate the latter by:

 * Allowing the user to set 'git config sendemail.confirm never'
 * Allowing the user to say 'all' after the first prompt to not be
   prompted on remaining emails during the same invocation.
 * Telling the user about the 'sendemail.confirm' setting if it is
   unconfigured whenever we prompt due to Cc before sending.
 * Only prompting if no --suppress related options have been passed, as
   using such an option is likely to indicate an experienced send-email
   user.

There is a slight fib in message informing the user of the
sendemail.confirm setting and this is intentional. Setting 'auto'
differs from leaving sendemail.confirm unset in two ways: 1) 'auto'
obviously squelches the informational message; 2) 'auto' prompts when
the Cc list has been expanded even in the presence of a --suppress
related option, where leaving sendemail.confirm unset does not. This is
intentional to keep the message simple, and to avoid adding another
sendemail.confirm value ('auto-except-suppress'?).

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-02 23:46:53 -08:00
Tor Arne Vestbø a9c3821ca2 git-rebase: Add --stat and --no-stat for producing diffstat on rebase
The behavior of --verbose is unchanged, but uses a different state
variable internally, so that the meaning of verbose output may be
expanded without affecting the diffstat. This is also reflected in
the documentation.

The configuration option rebase.stat works the same was as merg.stat,
but the default is currently false.

Signed-off-by: Tor Arne Vestbø <torarnv@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-02 23:22:32 -08:00
Johannes Sixt 2559bff32c t3400-rebase: Move detached HEAD check earlier
Short story: There is a section in t3400 that tests fundamental rebase
properties.  3ec7371f (Add two extra tests for git rebase, 2009-02-09)
added a check that rebase works on a detached HEAD, but the test was put
near the end of the file.  This moves it to a more suitable place.

Long story: The test that preceded the one in question tests that a
rebased commit degrades from a content change with mode change to a
mere mode change.  But on Windows, where we have core.filemode=false,
the original commit did not record the mode change, and so the rebase
operation did not rebase anything.  This caused the subsequent detached
HEAD test to fail.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-01 23:58:41 -08:00
Eric Wong 48679e5c2d git-svn: disable broken symlink workaround by default
Even though this will break things for some extremely rare repositories
used by broken Windows clients, it's probably not worth enabling this by
default as it has negatively affected many more users than it has helped
from what we've seen so far.

The extremely rare repositories that have broken symlinks in them will be
silently corrupted in import; but users can still reenable this option and
restart the import.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-27 21:53:09 -08:00
Jay Soffian e5dcbfd9ab builtin-remote: new show output style for push refspecs
The existing output of "git remote show <remote>" with respect to push
ref specs is basically just to show the raw refspec. This patch teaches
the command to interpret the refspecs and show how each branch will be
pushed to the destination. The output gives the user an idea of what
"git push" should do if it is run w/o any arguments.

Example new output:

1a. Typical output with no push refspec (i.e. matching branches only)

$ git remote show origin
* remote origin
  [...]
  Local refs configured for 'git push':
    master pushes to master (up to date)
    next   pushes to next   (local out of date)

1b. Same as above, w/o querying the remote:

$ git remote show origin -n
* remote origin
  [...]
  Local ref configured for 'git push' (status not queried):
    (matching) pushes to (matching)

2a. With a forcing refspec (+), and a new topic
    (something like push = refs/heads/*:refs/heads/*):

$ git remote show origin
* remote origin
  [...]
  Local refs configured for 'git push':
    master     pushes to master    (fast forwardable)
    new-topic  pushes to new-topic (create)
    next       pushes to next      (local out of date)
    pu         forces to pu        (up to date)

2b. Same as above, w/o querying the remote

$ git remote show origin -n
* remote origin
  [...]
  Local refs configured for 'git push' (status not queried):
    master     pushes to master
    new-topic  pushes to new-topic
    next       pushes to next
    pu         forces to pu

3. With a remote configured as a mirror:

* remote backup
  [...]
  Local refs will be mirrored by 'git push'

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-27 15:19:42 -08:00
Jay Soffian 7ecbbf877c builtin-remote: new show output style
The existing output of "git remote show <remote>" is too verbose for the
information it provides. This patch teaches it to provide more
information in less space.

The output for push refspecs is addressed in the next patch.

Before the patch:

$ git remote show origin
* remote origin
  URL: git://git.kernel.org/pub/scm/git/git.git
  HEAD branch: master
  Remote branch merged with 'git pull' while on branch master
    master
  Remote branch merged with 'git pull' while on branch next
    next
  Remote branches merged with 'git pull' while on branch octopus
    foo bar baz frotz
  New remote branch (next fetch will store in remotes/origin)
    html
  Stale tracking branch (use 'git remote prune')
    bogus
  Tracked remote branches
    maint
    man
    master
    next
    pu
    todo

After this patch:

$ git remote show origin
* remote origin
  URL: git://git.kernel.org/pub/scm/git/git.git
  HEAD branch: master
  Remote branches:
    bogus  stale (use 'git remote prune' to remove)
    html   new (next fetch will store in remotes/origin)
    maint  tracked
    man    tracked
    master tracked
    next   tracked
    pu     tracked
    todo   tracked
  Local branches configured for 'git pull':
    master  rebases onto remote master
    next    rebases onto remote next
    octopus  merges with remote foo
                and with remote bar
                and with remote baz
                and with remote frotz

$ git remote show origin -n
* remote origin
  URL: git://git.kernel.org/pub/scm/git/git.git
  HEAD branch: (not queried)
  Remote branches: (status not queried)
    bogus
    maint
    man
    master
    next
    pu
    todo
  Local branches configured for 'git pull':
    master  rebases onto remote master
    next    rebases onto remote next
    octopus  merges with remote foo
                and with remote bar
                and with remote baz
                and with remote frotz

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-27 15:19:42 -08:00
Jeff King fbb074c253 remote: make guess_remote_head() use exact HEAD lookup if it is available
Our usual method for determining the ref pointed to by HEAD
is to compare HEAD's sha1 to the sha1 of all refs, trying to
find a unique match.

However, some transports actually get to look at HEAD
directly; we should make use of that information when it is
available.  Currently, only http remotes support this
feature.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-27 15:19:23 -08:00
Jay Soffian bc14fac825 builtin-remote: add set-head subcommand
Provide a porcelain command for setting and deleting
$GIT_DIR/remotes/<remote>/HEAD.

While we're at it, document what $GIT_DIR/remotes/<remote>/HEAD is all
about.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-27 15:19:09 -08:00
Jay Soffian e61e0cc6b7 builtin-remote: teach show to display remote HEAD
This is in preparation for teaching remote how to set
refs/remotes/<remote>/HEAD to match what HEAD is set to at <remote>, but
is useful in its own right.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-27 15:19:09 -08:00
Jay Soffian 3bd925636c builtin-remote: fix two inconsistencies in the output of "show <remote>"
Remote and stale branches are emitted in alphabetical order, but new and
tracked branches are not. So sort the latter to be consistent with the
former. This also lets us use more efficient string_list_has_string()
instead of unsorted_string_list_has_string().

"show <remote>" prunes symrefs, but "show <remote> -n" does not. Fix the
latter to match the former.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-27 15:19:09 -08:00
Junio C Hamano 0c34735616 Merge branch 'cc/maint-1.6.0-bisect-fix'
* cc/maint-1.6.0-bisect-fix:
  bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped

Conflicts:
	git-bisect.sh
2009-02-27 01:03:21 -08:00
Christian Couder 1b249ffe8d bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped
When the "bad" commit was also "skip"ped and when more than one
commit was skipped, the "filter_skipped" function would have
printed something like:

    bisect_rev=<hash1>|<hash2>

(where <hash1> and <hash2> are hexadecimal sha1 hashes)

and this would have been evaled later as piping "bisect_rev=<hash1>"
into "<hash2>", which would have failed.

So this patch makes the "filter_skipped" function properly quote
what it outputs, so that it will print something like:

bisect_rev='<hash1>|<hash2>'

which will be properly evaled later.  The caller was not stopping
properly because the scriptlet this function returned to be evaled
was not strung together with && and because of this, an error in
an earlier part of the output was simply ignored.

A test case is added to the test suite.

And while at it, we also initialize the VARS, FOUND and TRIED
variables, so that we protect ourselves from environment variables
the user may have with these names.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-27 00:57:28 -08:00
Jay Soffian 2591838bee t5540-http-push.sh: avoid non-portable grep -P
OS X's GNU grep does not support -P/--perl-regexp.

We use a basic RE instead, and simplify the pattern slightly by
replacing '+' with '*' so it can be more easily expressed using a basic
RE.  The important part of pattern, checking for a SHA-1 has suffix in
the successful PUT/MOVE operations, remains the same.  Also, a-z instead
of a-f was an obvious mistake in the original RE. Here are samples of
what we want to match:

127.0.0.1 - - [26/Feb/2009:22:38:13 +0000] "PUT /test_repo.git/objects/3e/a4fbb9e18a401a6463c595d08118fcb9fb7426_fab55116904c665a95438bcc78521444a7db6096 HTTP/1.1" 201 277
127.0.0.1 - - [26/Feb/2009:22:38:13 +0000] "MOVE /test_repo.git/objects/3e/a4fbb9e18a401a6463c595d08118fcb9fb7426_fab55116904c665a95438bcc78521444a7db6096 HTTP/1.1" 201 277

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-26 16:20:58 -08:00
Jeff King 119c8eeede add basic http clone/fetch tests
This was mostly being tested implicitly by the "http push"
tests. But making a separate test script means that:

  - we will run fetch tests even when http pushing support
    is not built

  - when there are failures on fetching, they are easier to
    see and isolate, as they are not in the middle of push
    tests

This script defaults to running the webserver on port 5550,
and puts the original t5540 on port 5540, so that the two
can be run simultaneously without conflict (but both still
respect an externally set LIB_HTTPD_PORT).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-26 00:49:44 -08:00
Jeff King 75318a3bad test scripts: refactor start_httpd helper
There are some redirects and some error checking that need
to be done by the caller; let's move both into the
start_httpd function so that all callers don't have to
repeat them (there is only one caller now, but another will
follow in this series).

This doesn't violate any assumptions that aren't already
being made by lib-httpd, which is happy to say "skipping"
and call test_done for a number of other cases.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-26 00:49:44 -08:00
Junio C Hamano bb0cebd7d0 Merge branch 'jc/maint-1.6.0-pack-directory'
* jc/maint-1.6.0-pack-directory:
  Make sure objects/pack exists before creating a new pack
2009-02-25 14:50:05 -08:00
Junio C Hamano 6e180cdcec Make sure objects/pack exists before creating a new pack
In a repository created with git older than f49fb35 (git-init-db: create
"pack" subdirectory under objects, 2005-06-27), objects/pack/ directory is
not created upon initialization.  It was Ok because subdirectories are
created as needed inside directories init-db creates, and back then,
packfiles were recent invention.

After the said commit, new codepaths started relying on the presense of
objects/pack/ directory in the repository.  This was exacerbated with
8b4eb6b (Do not perform cross-directory renames when creating packs,
2008-09-22) that moved the location temporary pack files are created from
objects/ directory to objects/pack/ directory, because moving temporary to
the final location was done carefully with lazy leading directory creation.

Many packfile related operations in such an old repository can fail
mysteriously because of this.

This commit introduces two helper functions to make things work better.

 - odb_mkstemp() is a specialized version of mkstemp() to refactor the
   code and teach it to create leading directories as needed;

 - odb_pack_keep() refactors the code to create a ".keep" file while
   create leading directories as needed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-25 14:39:42 -08:00
Jay Soffian 69707d616f Allow HTTP tests to run on Darwin
This patch allows the HTTP tests to run on OS X 10.5. It is not
sufficient to be able to pass in LIB_HTTPD_PATH and
LIB_HTTPD_MODULE_PATH alone, as the apache.conf also needs a couple
tweaks.

These changes are put into an <IfDefine> to keep them Darwin specific,
but this means lib-httpd.sh needs to be modified to pass -DDarwin to
apache when running on Darwin. As long as we're making this change to
lib-httpd.sh, we may as well set LIB_HTTPD_PATH and
LIB_HTTPD_MODULE_PATH to appropriate default values for the platform.

Note that we now pass HTTPD_PARA to apache at shutdown as well.
Otherwise apache will emit a harmless, but noisy warning that LogFormat
is an unknown directive.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-25 13:58:57 -08:00
Felipe Contreras bb93afd515 Add tests for git log --pretty, --format and --oneline.
More specifically; --pretty=format, tformat and new %foo shortcut.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-25 00:07:17 -08:00
Eric Wong 83c2fcff21 git-svn: fix delete+add branch tracking with empty files
Original bug report and test case by Björn Steinbrink.

Björn Steinbrink <B.Steinbrink@gmx.de> wrote:
> Hi Eric,
>
> seems that the empty symlink stuff gets confused about which revision to
> use when looking for the parent's file.
>
> r3 = f1a6fcf6b0a1c4a373d0b2b65a3d70700084f361 (tags/1.0.1)
> Found possible branch point: file:///home/doener/h/svn/tags/1.0 => file:///home/doener/h/svn/branches/1.0, 4
> Found branch parent: (1.0) 63ae640ba01014ecbb3df590999ed1fa5914545b
> Following parent with do_switch
> Successfully followed parent
> r5 = 26fcfef5bcced97ab74faf1af7341a2ae0d272aa (1.0)
> Found possible branch point: file:///home/doener/h/svn/branches/1.0 => file:///home/doener/h/svn/tags/1.0.1, 5
> Found branch parent: (tags/1.0.1) 26fcfef5bcced97ab74faf1af7341a2ae0d272aa
> Following parent with do_switch
> Scanning for empty symlinks, this may take a while if you have many empty files
> You may disable this with `git config svn.brokenSymlinkWorkaround false'.
> This may be done in a different terminal without restarting git svn
> Filesystem has no item: File not found: revision 3, path '/branches/1.0/file' at /usr/local/libexec/git-core/git-svn line 3318
>
> Note how it tries to look at revision 3 instead of revision 5 (which it
> correctly detected as the parent). The import succeeds when
> svn.brokenSymlinkWorkaround is set to false. Testcase below.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-02-22 20:31:08 -08:00
Thomas Rast 30984ed2e9 format-patch: support deep threading
For deep threading mode, i.e., the mode that gives a thread structured
like

  + [PATCH 0/n] Cover letter
   `-+ [PATCH 1/n] First patch
      `-+ [PATCH 2/n] Second patch
         `-+ ...

we currently have to use 'git send-email --thread' (the default).  On
the other hand, format-patch also has a --thread option which gives
shallow mode, i.e.,

  + [PATCH 0/n] Cover letter
  |-+ [PATCH 1/n] First patch
  |-+ [PATCH 2/n] Second patch
  ...

To reduce the confusion resulting from having two indentically named
features in different tools giving different results, let format-patch
take an optional argument '--thread=deep' that gives the same output
as 'send-mail --thread'.  With no argument, or 'shallow', behave as
before.  Also add a configuration variable format.thread with the same
semantics.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-21 20:26:10 -08:00
Thomas Rast 2175c10d5a format-patch: thread as reply to cover letter even with in-reply-to
Currently, format-patch --thread --cover-letter --in-reply-to $parent
makes all mails, including the cover letter, a reply to $parent.
However, we would want the reader to consider the cover letter above
all the patches.

This changes the semantics so that only the cover letter is a reply to
$parent, while all the patches are formatted as replies to the cover
letter.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-21 20:26:10 -08:00
Thomas Rast b26d8d217d Test git-patch-id
So far, git-patch-id was untested.  Add some simple checks for output
format and patch (in)equality.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-20 00:02:48 -08:00
Thomas Rast fcbc6efc7c Test rev-list --parents/--children
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-20 00:02:48 -08:00
Thomas Rast 28fd76bd04 Test log --decorate
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-20 00:02:48 -08:00
Thomas Rast 02a6552c28 Test fsck a bit harder
git-fsck, of all tools, has very few tests.  This adds some more:
* a corrupted object;
* a branch pointing to a non-commit;
* a tag pointing to a nonexistent object;
* and a tag pointing to an object of a type other than what the tag
  itself claims.

Only the first two are caught.  At least the third probably should,
too, but currently slips through.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-20 00:02:48 -08:00
Thomas Rast 289e162318 Test log --graph
So far there were no tests checking that log --graph actually works.

Note that the tests strip trailing whitespace, as the current --graph
emits trailing whitespace on lines that do not contain anything but
graph lines.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-20 00:02:48 -08:00
Thomas Rast f37bfb7a4d Test diff --dirstat functionality
This is only a very rudimentary test, but it was untested before.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-20 00:02:48 -08:00
Thomas Rast 85569d7498 Test that diff can read from stdin
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-20 00:02:40 -08:00
Johannes Schindelin 4fcc86b07d Introduce the function strip_path_suffix()
The function strip_path_suffix() will try to strip a given suffix from
a given path.  The suffix must start at a directory boundary (i.e. "core"
is not a path suffix of "libexec/git-core", but "git-core" is).

Arbitrary runs of directory separators ("slashes") are assumed identical.

Example:

	strip_path_suffix("C:\\msysgit/\\libexec\\git-core",
		"libexec///git-core", &prefix)

will set prefix to "C:\\msysgit" and return 0.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-19 22:45:48 -08:00
Thomas Rast 484cf6c3f1 format-patch: threading test reactivation
t4014 tests format-patch --thread since 7d812145, but the tests were
ineffective right from the start at least for bash and dash.  The
loops of the form

  for ...; do something || break; done

introduced by 7d812145 and 5d02294 always exit with status 0, even if
'something' failed, because 'break' returns 0 unless there was no loop
to break.

We take a rather different approach that uses an admittedly heinous
inline Perl script to mangle all interesting information into a format
that is invariant between runs.  We can then test the full patch
sequence in one go (with --stdout), doing away with the loop problem.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-19 21:41:57 -08:00
Jeff King 0afc304406 add basic branch display tests
We were not testing the output of "git branch" anywhere.
Not only does this not protect us against regressions in the
output, but we are not exercising code paths which may have
bugs (such as the one fixed by 45e2b61).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-18 19:59:21 -08:00
Junio C Hamano 25487f8e2a Merge branch 'maint'
* maint:
  tests: fix "export var=val"
  Skip timestamp differences for diff --no-index
  Documentation/git-push: --all, --mirror, --tags can not be combined
2009-02-18 11:31:52 -08:00
Junio C Hamano 91e80b984e tests: fix "export var=val"
Some shells do not like "export var=val"; the right way to write
it is to do an assignment and then export just the variable name.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-18 11:17:27 -08:00
Lars Noschinski 88e38808cd filter-branch -d: Export GIT_DIR earlier
The improved error handling catches a bug in filter-branch when using
-d pointing to a path outside any git repository:

$ git filter-branch -d /tmp/foo master
fatal: Not a git repository (or any of the parent directories): .git

This error message comes from git for-each-ref in line 224. GIT_DIR is
set correctly by git-sh-setup (to the foo.git repository), but not
exported (yet).

Signed-off-by: Lars Noschinski <lars@public.noschinski.de>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-18 11:15:17 -08:00
Michael Spang d61027b21f Skip timestamp differences for diff --no-index
We display empty diffs for files whose timestamps have changed.
Usually, refreshing the index makes those empty diffs go away.
However, when not using the index they are not very useful and
there is no option to suppress them.

This forces on the skip_stat_unmatch option for diff --no-index,
suppressing any empty diffs. This option is also used for diffs
against the index when "diff.autorefreshindex" is set, but that
option does not apply to diff --no-index.

Signed-off-by: Michael Spang <mspang@uwaterloo.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-18 10:55:33 -08:00
Marcel M. Cary df5d10a32e gitweb: Fix warnings with override permitted but no repo override
When a feature like "blame" is permitted to be overridden in the
repository configuration but it is not actually set in the repository,
a warning is emitted due to the undefined value of the repository
configuration, even though it's a perfectly normal condition.
Emitting warning is grounds for test failure in the gitweb test
script.

This error was caused by rewrite of git_get_project_config from using
"git config [<type>] <name>" for each individual configuration
variable checked to parsing "git config --list --null" output in
commit b201927 (gitweb: Read repo config using 'git config -z -l').
Earlier version of git_get_project_config was returning empty string
if variable do not exist in config; newer version is meant to return
undef in this case, therefore change in feature_bool was needed.

Additionally config_to_* subroutines were meant to be invoked only if
configuration variable exists; therefore we added early return to
git_get_project_config: it now returns no value if variable does not
exists in config.  Otherwise config_to_* subroutines (config_to_bool
in paryicular) wouldn't be able to distinguish between the case where
variable does not exist and the case where variable doesn't have value
(the "[section] noval" case, which evaluates to true for boolean).

While at it fix bug in config_to_bool, where checking if $val is
defined (if config variable has value) was done _after_ stripping
leading and trailing whitespace, which lead to 'Use of uninitialized
value' warning.

Add test case for features overridable but not overriden in repo
config, and case for no value boolean configuration variable.

Signed-off-by: Marcel M. Cary <marcel@oak.homeunix.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-18 10:43:21 -08:00
Giuseppe Bilotta 81d3fe9f48 gitweb: fix wrong base URL when non-root DirectoryIndex
CGI::url() has some issues when rebuilding the script URL if the script
is a DirectoryIndex.

One of these issue is the inability to strip PATH_INFO, which is why
we had to do it ourselves.

Another issue is that the resulting URL cannot be used for the <base>
tag: it works if we're the DirectoryIndex at the root level, but not
otherwise.

We fix this by building the proper base URL ourselves, and improve the
comment about the need to strip PATH_INFO manually while we're at it.

Additionally t/t9500-gitweb-standalone-no-errors.sh had to be modified
to set SCRIPT_NAME variable (CGI standard states that it MUST be set,
and now gitweb uses it if PATH_INFO is not empty, as is the case for
some of tests in t9500).

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-16 16:19:07 -08:00
Junio C Hamano f7a2bdb1f0 Merge branch 'mc/setup-cd-p'
* mc/setup-cd-p:
  git-sh-setup: Use "cd" option, not /bin/pwd, for symlinked work tree
2009-02-15 01:44:58 -08:00
Junio C Hamano 160d2bc353 Merge branch 'ms/mailmap'
* ms/mailmap:
  Move mailmap documentation into separate file
  Change current mailmap usage to do matching on both name and email of author/committer.
  Add map_user() and clear_mailmap() to mailmap
  Add find_insert_index, insert_at_index and clear_func functions to string_list
  Add mailmap.file as configurational option for mailmap location
2009-02-15 01:44:15 -08:00
Junio C Hamano c42b04bbb0 Merge branch 'rc/http-push'
* rc/http-push:
  use a hash of the lock token as the suffix for PUT/MOVE
2009-02-15 01:43:57 -08:00
Tay Ray Chuan dfab7c144e use a hash of the lock token as the suffix for PUT/MOVE
After 753bc91 ("Remove the requirement opaquelocktoken uri scheme"),
lock tokens are in the URI forms in which they are received from the
server, eg. 'opaquelocktoken:', 'urn:uuid:'.

However, "start_put" (and consequently "start_move"), which attempts to
create a unique temporary file using the UUID of the lock token,
inadvertently uses the lock token in its URI form. These file
operations on the server may not be successful (specifically, in
Windows), due to the colon ':' character from the URI form of the lock
token in the file path.

This patch uses a hash of the lock token instead, guaranteeing only
"safe" characters (a-f, 0-9) are used in the file path.

The token's hash is generated when the lock token is received from the
server in handle_new_lock_ctx, minimizing the number of times of
hashing.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-15 00:57:43 -08:00
Junio C Hamano 43e35f6bc1 Merge branch 'js/gc-prune'
* js/gc-prune:
  gc: make --prune useful again by accepting an optional parameter
2009-02-15 00:05:11 -08:00
Junio C Hamano b43174ebf1 Merge branch 'tr/abbrev-commit-no-ellipses'
* tr/abbrev-commit-no-ellipses:
  log: do not print ellipses with --abbrev-commit
2009-02-15 00:03:43 -08:00
Junio C Hamano 472e4744ad Merge branch 'jc/branch-previous'
* jc/branch-previous:
  Teach @{-1} to git merge
  Teach the "@{-1} syntax to "git branch"
2009-02-15 00:03:29 -08:00
Jay Soffian 3531e2703d send-email: --suppress-cc improvements
Since 6564828 (git-send-email: Generalize auto-cc recipient
mechanism., 2007-12-25) we can suppress automatic Cc generation
separately for each of the possible address sources.  However,
--suppress-cc=sob suppressed both SOB lines and body (but not header)
Cc lines, contrary to the name.

Change --suppress-cc=sob to mean only SOB lines, and add separate
choices 'bodycc' (body Cc lines) and 'body' (both 'sob' and 'bodycc').
The option --no-signed-off-by-cc now acts like --suppress-cc=sob,
which is not backwards compatible but matches the name of the option.

Also update the documentation and add a few tests.

Original patch by me. Revised by Thomas Rast, who contributed the
documentation and test updates.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-14 21:48:38 -08:00
Jay Soffian 5012699d98 send-email: handle multiple Cc addresses when reading mbox message
When git format-patch is given multiple --cc arguments, it generates a
Cc header that looks like:

 Cc: first@example.com,
     second@example.com,
     third@example.com

Before this commit, send-email was unable to handle such a message as it
did not handle folded header lines, nor multiple recipients in a Cc
line.

This patch:

- Unfolds header lines by pre-processing the header before extracting
  any of its fields.

- Handles Cc lines with multiple recipients.

- Adds use of Mail::Address if available for splitting Cc line and
  the "Who should the emails be sent to?" prompt", with fall back to
  existing split_addrs() function.

- Tests the new functionality and adds two tests for detecting whether
  "From:" appears correctly in message body when patch author differs
  from patch sender.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-14 21:48:38 -08:00
SZEDER Gábor db7fee8758 t1500: more 'git rev-parse --git-dir' tests
Extend t1500 with tests of 'git rev-parse --git-dir' when invoked from
other directories of the repository or the work tree.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-14 21:29:50 -08:00
SZEDER Gábor 8fb3c00d2e Move 'rev-parse --git-dir' test to t1500
Commit 72183cb2 (Fix gitdir detection when in subdir of
gitdir, 2009-01-16) added a test to 't1501-worktree' to check the
behaviour of 'git rev-parse --git-dir' in a special case.  However,
t1501 is about testing separate work tree setups, and not about basic
'rev-parse' functionality, which is tested in t1500-rev-parse.
Therefore, this patch moves that test to t1500.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-14 21:29:46 -08:00
Johannes Schindelin 58e9d9d472 gc: make --prune useful again by accepting an optional parameter
With this patch, "git gc --no-prune" will not prune any loose (and
dangling) object, and "git gc --prune=5.minutes.ago" will prune
all loose objects older than 5 minutes.

This patch benefitted from suggestions by Thomas Rast and Jan Krï¿œger.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-14 21:14:07 -08:00
Junio C Hamano c9717ee970 Teach @{-1} to git merge
1.6.2 will have @{-1} syntax advertised as "usable anywhere you can use
a branch name".  However, "git merge @{-1}" did not work.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-13 23:46:42 -08:00
Junio C Hamano 8415d5c7ef Teach the "@{-1} syntax to "git branch"
This teaches the new "@{-1} syntax to refer to the previous branch to "git
branch".  After looking at somebody's faulty patch series on a topic
branch too long, if you decide it is not worth merging, you can just say:

    $ git checkout master
    $ git branch -D @{-1}

to get rid of it without having to type the name of the topic you now hate
so much for wasting a lot of your time.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-13 23:46:28 -08:00
Jeff King e9cc02f0e4 symbolic-ref: allow refs/<whatever> in HEAD
Commit afe5d3d5 introduced a safety valve to symbolic-ref to
disallow installing an invalid HEAD. It was accompanied by
b229d18a, which changed validate_headref to require that
HEAD contain a pointer to refs/heads/ instead of just refs/.
Therefore, the safety valve also checked for refs/heads/.

As it turns out, topgit is using refs/top-bases/ in HEAD,
leading us to re-loosen (at least temporarily) the
validate_headref check made in b229d18a. This patch does the
corresponding loosening for the symbolic-ref safety valve,
so that the two are in agreement once more.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-13 18:20:44 -08:00
Thomas Rast 7fcda9201e log: do not print ellipses with --abbrev-commit
'git log --abbrev-commit' added an ellipsis to all commit names that
were abbreviated.  This was particularly annoying if you wanted to
cut&paste the sha1 from the terminal, since selecting by word would
pick up '...'  too.

So use find_unique_abbrev() instead of diff_unique_abbrev() in all
log-related commit sha1 printing routines, and also change the
formatting of the 'Merge: parent1 parent2' line output via
pretty_print_commit().

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-13 17:18:22 -08:00
Junio C Hamano 5cd12b85fe Install the default "master" branch configuration after cloning a void
After "cloning from an empty repository", we have a configuration to
describe the remote's URL and the default ref mappings, but we lack the
branch configuration for the default branch we create on our end,
"master".

It is likely that the empty repository we cloned from will point the
default "master" branch with its HEAD, so prepare the local configuration
to match.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-12 22:37:35 -08:00
Nazri Ramliy a8344abe0f Bugfix: GIT_EXTERNAL_DIFF with more than one changed files
When there is more than one file that are changed, running git diff with
GIT_EXTERNAL_DIFF incorrectly diagnoses an programming error and dies.
The check introduced in 479b0ae (diff: refactor tempfile cleanup handling,
2009-01-22) to detect a temporary file slot that forgot to remove its
temporary file was inconsistent with the way the codepath to remove the
temporary to mark the slot that it is done with it.

This patch fixes this problem and adds a test case for it.

Signed-off-by: Nazri Ramliy <ayiehere@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-12 12:31:52 -08:00
Finn Arne Gangstad dd482eeac2 Support "\" in non-wildcard exclusion entries
"\" was treated differently in exclude rules depending on whether a
wildcard match was done. For wildcard rules, "\" was de-escaped in
fnmatch, but this was not done for other rules since they used strcmp
instead.  A file named "#foo" would not be excluded by "\#foo", but would
be excluded by "\#foo*".

We now treat all rules with "\" as wildcard rules.

Another solution could be to de-escape all non-wildcard rules as we
read them, but we would have to do the de-escaping exactly as fnmatch
does it to avoid inconsistencies.

Signed-off-by: Finn Arne Gangstad <finnag@pvv.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-12 11:36:43 -08:00
Eric Kidd 0ea29cce4d filter-branch: Add more error-handling
9273b56 (filter-branch: Fix fatal error on bare repositories, 2009-02-03)
fixed a missing check of return status from an underlying command in
git-filter-branch, but there still are places that do not check errors.
For example, the command does not pay attention to the exit status of the
command given by --commit-filter.  It should abort in such a case.

This attempts to fix all the remaining places that fails to checks errors.

In two places, I've had to break apart pipelines in order to check the
error code for the first stage of the pipeline, as discussed here:

  http://kerneltrap.org/mailarchive/git/2009/1/28/4835614

Feedback on this patch was provided by Johannes Sixt, Johannes Schindelin
and Junio C Hamano.  Thomas Rast helped with pipeline error handling.

Signed-off-by: Eric Kidd <git@randomhacks.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-11 18:26:52 -08:00
Junio C Hamano 7b73d828f0 Merge git://git.bogomips.org/git-svn
* git://git.bogomips.org/git-svn:
  test case for regression caused by git-svn empty symlink fix
  git-svn: fix broken symlink workaround when switching branches
  git-svn: Print revision while searching for earliest use of path
  git-svn: abstract out a block into new method other_gs()
  git-svn: allow disabling expensive broken symlink checks
2009-02-11 10:20:12 -08:00
Anton Gyllenberg 39111f6b7a test case for regression caused by git-svn empty symlink fix
Commit dbc6c74d08 "git-svn: handle empty
files marked as symlinks in SVN" caused a regression in an unusual case
where a branch has been created in SVN, later deleted and then created
again from another branch point and the original branch point had empty
files not in the new branch. In some cases git svn fetch will then fail
while trying to fetch the empty file from the wrong SVN revision.

This adds a test case that reproduces the issue.

[ew: added additional test to ensure file was created correctly
     made test file executable ]

Signed-off-by: Anton Gyllenberg <anton@iki.fi>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-02-11 02:02:04 -08:00
Eric Wong 4c58a7111d git-svn: allow disabling expensive broken symlink checks
Since dbc6c74d08, git-svn has had
an expensive check for broken symlinks that exist in some
repositories.  This leads to a heavy performance hit on
repositories with many empty blobs that are not supposed to be
symlinks.

The workaround is enabled by default; and may be disabled via:

  git config svn.brokenSymlinkWorkaround false

Reported by Markus Heidelberg.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-02-11 02:00:42 -08:00
Junio C Hamano aff4e8dc21 Merge branch 'maint'
* maint:
  revision traversal and pack: notice and die on missing commit
2009-02-11 02:00:22 -08:00
Junio C Hamano 268c015495 Merge branch 'maint-1.5.6' into maint
* maint-1.5.6:
  revision traversal and pack: notice and die on missing commit
2009-02-11 02:00:07 -08:00
Junio C Hamano afce435000 Merge branch 'maint-1.5.5' into maint-1.5.6
* maint-1.5.5:
  revision traversal and pack: notice and die on missing commit

Conflicts:
	revision.c
2009-02-11 01:41:22 -08:00
Junio C Hamano 92798702cf Merge branch 'maint-1.5.4' into maint-1.5.5
* maint-1.5.4:
  revision traversal and pack: notice and die on missing commit
2009-02-11 01:40:12 -08:00
Junio C Hamano ed62089c1c revision traversal and pack: notice and die on missing commit
cc0e6c5 (Handle return code of parse_commit in revision machinery,
2007-05-04) attempted to tighten error checking in the revision machinery,
but it wasn't enough.  When get_revision_1() was asked for the next commit
to return, it tries to read and simplify the parents of the commit to be
returned, but an error while doing so was silently ignored and reported as
a truncated history to the caller instead.

This resulted in an early end of "git log" output or a pack that lacks
older commits from "git pack-objects", without any error indication in the
exit status from these commands, even though the underlying parse_commit()
issues an error message to the end user.

Note that the codepath in add_parents_list() that paints parents of an
UNINTERESTING commit UNINTERESTING silently ignores the error when
parse_commit() fails; this is deliberate and in line with aeeae1b
(revision traversal: allow UNINTERESTING objects to be missing,
2009-01-27).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-11 01:29:52 -08:00
Junio C Hamano 747ca2455a receive-pack: receive.denyDeleteCurrent
This is a companion patch to the recent 3d95d92 (receive-pack: explain
what to do when push updates the current branch, 2009-01-31).

Deleting the current branch from a remote will result in the next clone
from it not check out anything, among other things.  It also is one of the
cause that makes remotes/origin/HEAD a dangling symbolic ref.  This patch
still allows the traditional behaviour but with a big warning, and promises
that the default will change to 'refuse' in a future release.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-10 22:26:49 -08:00
Junio C Hamano 057e71384a Warn use of "origin" when remotes/origin/HEAD is dangling
The previous one squelched the diagnositic message we used to issue every
time we enumerated the refs and noticed a dangling ref.  This adds the
warning back to the place where the user actually attempts to use it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-10 22:26:32 -08:00
Junio C Hamano f8948e2fbc remote prune: warn dangling symrefs
If you prune from the remote "frotz" that deleted the ref your tracking
branch remotes/frotz/HEAD points at, the symbolic ref will become
dangling.  We used to detect this as an error condition and issued a
message every time refs are enumerated.

This stops the error message, but moves the warning to "remote prune".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-10 22:26:20 -08:00
Junio C Hamano 2f33415563 Modernize t5400 test script
Many tests checked for failure by hand without using test_must_fail (they
probably predate the shell function).

When we know the desired outcome, explicitly check for it, instead of
checking if the result does not match one possible incorrect outcome.
E.g. if you expect a push to be refused, you do not test if the result is
different from what was pushed.  Instead, make sure that the ref did not
before and after the push.

The test sequence chdir'ed around and any failure at one point could have
started the next test in an unexpected directory.  Fix this problem by
using subshells as necessary.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-10 22:25:25 -08:00
Junio C Hamano 954cfb5cfd Revert "Merge branch 'js/notes'"
This reverts commit 7b75b331f6, reversing
changes made to 5d680a67d7.
2009-02-10 21:32:10 -08:00
Junio C Hamano 8c5514906a Merge branch 'js/git-submodule-trailing-slash'
* js/git-submodule-trailing-slash:
  submodule: warn about non-submodules
  Let ls-files strip trailing slashes in submodules' paths
2009-02-10 21:31:08 -08:00
Junio C Hamano 6e5d7ddc49 Merge branch 'js/maint-1.6.0-path-normalize'
* js/maint-1.6.0-path-normalize:
  Remove unused normalize_absolute_path()
  Test and fix normalize_path_copy()
  Fix GIT_CEILING_DIRECTORIES on Windows
  Move sanitary_path_copy() to path.c and rename it to normalize_path_copy()
  Make test-path-utils more robust against incorrect use
2009-02-10 21:30:52 -08:00
Johannes Schindelin 3ec7371f63 Add two extra tests for git rebase 2009-02-08 21:40:52 -08:00
Marius Storm-Olsen d20d654fe8 Change current mailmap usage to do matching on both name and email of author/committer.
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-08 12:36:54 -08:00
Marius Storm-Olsen d551a48816 Add mailmap.file as configurational option for mailmap location
This allows us to augment the repo mailmap file, and to use
mailmap files elsewhere than the repository root. Meaning
that the entries in mailmap.file will override the entries
in "./.mailmap", should they match.

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-08 12:36:26 -08:00
Johannes Schindelin 496917b721 submodule: warn about non-submodules
Earlier, when you called

        git submodule some/bogus/path

Git would silently ignore the path, without warning the user about the
likely mistake.  Now it does.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-07 12:49:58 -08:00
Johannes Schindelin f3670a5749 Let ls-files strip trailing slashes in submodules' paths
Tab completion makes it easy to add a trailing slash to a submodule path.
As it is completely clear what the user actually wanted to say, be nice
and strip that slash at the end.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-07 12:49:50 -08:00
Johannes Sixt f42302b493 Test and fix normalize_path_copy()
This changes the test-path-utils utility to invoke normalize_path_copy()
instead of normalize_absolute_path() because the latter is about to be
removed.

The test cases in t0060 are adjusted in two regards:

- normalize_path_copy() more often leaves a trailing slash in the result.
  This has no negative side effects because the new user of this function,
  longest_ancester_length(), already accounts for this behavior.

- The function can fail.

The tests uncover a flaw in normalize_path_copy(): If there are
sufficiently many '..' path components so that the root is reached, such as
in "/d1/s1/../../d2", then the leading slash was lost. This manifested
itself that (assuming there is a repository at /tmp/foo)

  $ git add /d1/../tmp/foo/some-file

reported 'pathspec is outside repository'. This is now fixed.

Moreover, the test case descriptions of t0060 now include the test data and
expected outcome.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-07 12:23:30 -08:00
René Scharfe 43a7ddb55d Fix GIT_CEILING_DIRECTORIES on Windows
Using git with GIT_CEILING_DIRECTORIES crashed on Windows due to a failed
assertion in normalize_absolute_path(): This function expects absolute
paths to start with a slash, while on Windows they can start with a drive
letter or a backslash.

This fixes it by using the alternative, normalize_path_copy() instead,
which can handle Windows-style paths just fine.

Secondly, the portability macro PATH_SEP is used instead of expecting
colons to be used as path list delimiter.

The test script t1504 is also changed to help MSYS's bash recognize some
program arguments as path list. (MSYS's bash must translate POSIX-style
path lists to Windows-style path lists, and the heuristic did not catch
some cases.)

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-07 12:23:29 -08:00
Junio C Hamano df4364a429 Merge branch 'js/filter-branch-submodule'
* js/filter-branch-submodule:
  filter-branch: do not consider diverging submodules a 'dirty worktree'
  filter-branch: Fix fatal error on bare repositories
2009-02-07 11:09:48 -08:00
Marcel M. Cary 2c3c395e84 git-sh-setup: Use "cd" option, not /bin/pwd, for symlinked work tree
In cd_to_toplevel, instead of 'cd $(unset PWD; /bin/pwd)/$path'
use 'cd -P $path'.  The "-P" option yields a desirable similarity to
C chdir.

While the "-P" option may be slightly less commonly supported than
/bin/pwd, it is more concise, better tested, and less error prone.
I've already added the 'unset PWD' to fix the /bin/pwd solution on
BSD; there may be more edge cases out there.

This still passes all the same test cases in t5521-pull-symlink.sh and
t2300-cd-to-toplevel.sh, even before updating them to use 'pwd -P'.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-07 00:45:29 -08:00
Junio C Hamano ba743d1b0c Merge branch 'js/maint-remote-remove-mirror'
* js/maint-remote-remove-mirror:
  builtin-remote: make rm operation safer in mirrored repository
  builtin-remote: make rm() use properly named variable to hold return value
2009-02-05 19:40:41 -08:00
Junio C Hamano 7b75b331f6 Merge branch 'js/notes'
* js/notes:
  git-notes: fix printing of multi-line notes
  notes: fix core.notesRef documentation
  Add an expensive test for git-notes
  Speed up git notes lookup
  Add a script to edit/inspect notes
  Introduce commit notes

Conflicts:
	pretty.c
2009-02-05 19:40:39 -08:00
Junio C Hamano 5d680a67d7 Merge branch 'jc/refuse-push-to-current'
* jc/refuse-push-to-current:
  receive-pack: explain what to do when push updates the current branch
2009-02-05 19:40:36 -08:00
Junio C Hamano 74b11bc3be Merge branch 'jk/head-symref'
* jk/head-symref:
  symbolic ref: refuse non-ref targets in HEAD
  validate_headref: tighten ref-matching to just branches
2009-02-05 19:40:35 -08:00
Junio C Hamano b371922aa5 Merge branch 'cb/mergetool'
* cb/mergetool:
  mergetool: fix running mergetool in sub-directories
  mergetool: Add a test for running mergetool in a sub-directory
  mergetool: respect autocrlf by using checkout-index
2009-02-05 19:40:35 -08:00
Junio C Hamano f20408dadb Merge branch 'sg/maint-gitdir-in-subdir' into maint
* sg/maint-gitdir-in-subdir:
  Fix gitdir detection when in subdir of gitdir
2009-02-05 18:05:43 -08:00
Junio C Hamano cc91e1bd05 Merge branch 'jc/maint-split-diff-metainfo' into maint
* jc/maint-split-diff-metainfo:
  diff.c: output correct index lines for a split diff
2009-02-05 17:54:17 -08:00
Junio C Hamano 8abc61880d Merge branch 'js/maint-all-implies-HEAD' into maint
* js/maint-all-implies-HEAD:
  bundle: allow the same ref to be given more than once
  revision walker: include a detached HEAD in --all
2009-02-05 17:54:12 -08:00
Junio C Hamano 8c4c286c39 Merge branch 'kc/maint-diff-bwi-fix' into maint
* kc/maint-diff-bwi-fix:
  Fix combined use of whitespace ignore options to diff
  test more combinations of ignore-whitespace options to diff
2009-02-05 17:52:22 -08:00
Johannes Schindelin 5caa81d1b4 valgrind: do not require valgrind 3.4.0 or newer
Valgrind 3.4.0 is pretty new, and even if --track-origins is a nice
feature, it is not the end of the world if that is not available.  So
play nice and use that option only when only an older version of
valgrind is available.

In the same spirit, refrain from the use of '...' in suppression
files, which is also a feature only valgrind 3.4 and newer understand.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-05 17:48:22 -08:00
Junio C Hamano 88ccb9f974 Merge branch 'jc/fsck' (early part)
* 'jc/fsck' (early part):
  fsck: check loose objects from alternate object stores by default
  fsck: HEAD is part of refs
2009-02-04 16:40:15 -08:00