Commit graph

1578 commits

Author SHA1 Message Date
Junio C Hamano 032bea55a3 builtin-apply: do not declare patch is creation when we do not know it
When we see no context nor deleted line in the patch, we used to declare
that the patch creates a new file.  But some people create an empty file
and then apply a patch to it.  Similarly, a patch that delete everything
is not a deletion patch either.

This commit corrects these two issues.  Together with the previous commit,
it allows a diff between an empty file and a line-ful file to be treated
as both creation patch and "add stuff to an existing empty file",
depending on the context.  A new test t4126 demonstrates the fix.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-17 02:57:33 -07:00
Marcel Koeppen d16d5cdf59 Replace in-place sed in t7502-commit
The in-place mode of sed used in t7502-commit is a non-POSIX extension.
That call of sed is replaced by a more portable version using a temporary file.

Signed-off-by: Marcel Koeppen <git-dev@marzelpan.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-16 22:05:22 -07:00
Johannes Schindelin be4d2c83b6 submodule update: add convenience option --init
When a submodule is not initialized and you do not want to change the
defaults from .gitmodules anyway, you can now say

	$ git submodule update --init <name>

When "update" is called without --init on an uninitialized submodule,
a hint to use --init is printed.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-16 13:03:55 -07:00
Junio C Hamano b66ae7955c Merge branch 'sb/committer'
* sb/committer:
  commit: Show committer if automatic
  commit: Show author if different from committer
  Preparation to call determine_author_info from prepare_to_commit
2008-05-14 13:45:20 -07:00
Junio C Hamano 761adeb4db Merge branch 'bd/tests'
* bd/tests:
  Rename the test trash directory to contain spaces.
  Fix tests breaking when checkout path contains shell metacharacters
  Don't use the 'export NAME=value' in the test scripts.
  lib-git-svn.sh: Fix quoting issues with paths containing shell metacharacters
  test-lib.sh: Fix some missing path quoting
  Use test_set_editor in t9001-send-email.sh
  test-lib.sh: Add a test_set_editor function to safely set $VISUAL
  git-send-email.perl: Handle shell metacharacters in $EDITOR properly
  config.c: Escape backslashes in section names properly
  git-rebase.sh: Fix --merge --abort failures when path contains whitespace

Conflicts:

	t/t9115-git-svn-dcommit-funky-renames.sh
2008-05-14 13:45:16 -07:00
Junio C Hamano 486d1a5644 Merge branch 'mv/format-cc'
* mv/format-cc:
  Add tests for sendemail.cc configuration variable
  git-send-email: add a new sendemail.cc configuration variable
  git-format-patch: add a new format.cc configuration variable
2008-05-14 13:34:34 -07:00
Junio C Hamano adf59ec127 Merge branch 'jk/renamelimit' (early part)
* 'jk/renamelimit' (early part):
  diff: make "too many files" rename warning optional
  bump rename limit defaults
  add merge.renamelimit config option
2008-05-14 12:37:28 -07:00
Jeff King 30684dfaf8 t5000: tar portability fix
The output of 'tar tv' varies from system to system. In
particular, the t5000 was expecting to parse the date from
something like:

  -rw-rw-r-- root/root         0 2008-05-13 04:27 file

but FreeBSD's tar produces this:

  -rw-rw-r--  0 root   root        0 May 13 04:27 file

Instead of relying on tar's output, let's just extract the
file using tar and stat the result using perl.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-13 21:45:28 -07:00
Jeff King bbf08124e0 fix bsd shell negation
On some shells (notably /bin/sh on FreeBSD 6.1), the
construct

  foo && ! bar | baz

is true if

  foo && baz

whereas for most other shells (such as bash) is true if

  foo && ! baz

We can work around this by specifying

  foo && ! (bar | baz)

which works everywhere.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-13 21:44:48 -07:00
Junio C Hamano eafa29b7cb Merge branch 'gp/bisect-fix'
* gp/bisect-fix:
  bisect: print an error message when "git rev-list --bisect-vars" fails
  git-bisect.sh: don't accidentally override existing branch "bisect"
2008-05-12 15:44:43 -07:00
Junio C Hamano dccb3a6acb Merge branch 'lt/core-optim'
* lt/core-optim:
  Optimize symlink/directory detection
  Avoid some unnecessary lstat() calls
  is_racy_timestamp(): do not check timestamp for gitlinks
  diff-lib.c: rename check_work_tree_entity()
  diff: a submodule not checked out is not modified
  Add t7506 to test submodule related functions for git-status
  t4027: test diff for submodule with empty directory
  Make git-add behave more sensibly in a case-insensitive environment
  When adding files to the index, add support for case-independent matches
  Make unpack-tree update removed files before any updated files
  Make branch merging aware of underlying case-insensitive filsystems
  Add 'core.ignorecase' option
  Make hash_name_lookup able to do case-independent lookups
  Make "index_name_exists()" return the cache_entry it found
  Move name hashing functions into a file of its own
  Make unpack_trees_options bit flags actual bitfields
2008-05-11 12:08:20 -07:00
Christian Couder dfd1b749be rev-parse --verify: do not output anything on error
Before this patch, when "git rev-parse --verify" was passed at least one
good rev and then anything, it would output something for the good rev
even if it would latter exit on error.

With this patch, we only output something if everything is ok.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-11 11:51:12 -07:00
Christian Couder 28bfa145e4 rev-parse: fix using "--default" with "--verify"
Before this patch, something like:

$ git rev-parse --verify HEAD --default master

did not work, while:

$ git rev-parse --default master --verify HEAD

worked.

This patch fixes that, so that they both work (assuming
HEAD and master can be parsed).

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-11 11:36:07 -07:00
Christian Couder 921df15f1d rev-parse: add test script for "--verify"
This patch documents the current behavior of "git rev-parse --verify".

This command is tested both with and without the "--quiet" and
"--default" options.

This shows some problems with the current behavior that will be fixed
in latter patches:

	- in case of errors, there should be no good rev output on
	stdout,
	- with "--default" one test case is broken

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-11 11:35:42 -07:00
Dustin Sallings c998ae9baa Allow tracking branches to set up rebase by default.
Change cd67e4d4 introduced a new configuration parameter that told
pull to automatically perform a rebase instead of a merge.  This
change provides a configuration option to enable this feature
automatically when creating a new branch.

If the variable branch.autosetuprebase applies for a branch that's
being created, that branch will have branch.<name>.rebase set to true.

Signed-off-by: Dustin Sallings <dustin@spy.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-11 09:28:52 -07:00
Eric Wong d1a8d0ea5f git-svn: fix cloning of HTTP URLs with '+' in their path
With this, git svn clone -s http://svn.gnome.org/svn/gtk+
is successful.

Also modified the funky rename test for this, which _does_
include escaped '+' signs for HTTP URLs.  SVN seems to accept
either "+" or "%2B" in filenames and directories (just not the
main URL), so I'll leave it alone for now.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-11 09:06:39 -07:00
Junio C Hamano 2855e70ad1 Merge branch 'py/diff-submodule'
* py/diff-submodule:
  is_racy_timestamp(): do not check timestamp for gitlinks
  diff-lib.c: rename check_work_tree_entity()
  diff: a submodule not checked out is not modified
  Add t7506 to test submodule related functions for git-status
  t4027: test diff for submodule with empty directory
2008-05-10 18:16:25 -07:00
Junio C Hamano ca1c9913f8 Merge branch 'sg/merge-options' (early part)
* 'sg/merge-options' (early part):
  merge, pull: add '--(no-)log' command line option
  fmt-merge-msg: add '--(no-)log' options and 'merge.log' config variable
  add 'merge.stat' config variable
  merge, pull: introduce '--(no-)stat' option
  doc: moved merge.* config variables into separate merge-config.txt
2008-05-08 20:06:36 -07:00
Christian Couder 42ba5ee776 bisect: print an error message when "git rev-list --bisect-vars" fails
Before this patch no error was printed when "git rev-list --bisect-vars"
failed. This can happen when bad and good revs are mistaken.

This patch prints an error message on stderr that describe the likely
failure cause.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-08 17:50:00 -07:00
Santi Béjar bb1ae3f6ff commit: Show committer if automatic
To warn the user in case he/she might be using an unintended
committer identity.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-06 16:50:17 -07:00
Santi Béjar e83dbe802f commit: Show author if different from committer
That would help reassure anybody while committing other's changes.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-06 16:43:52 -07:00
Junio C Hamano e9dd751866 Merge branch 'bc/filter-branch'
* bc/filter-branch:
  filter-branch.sh: support nearly proper tag name filtering
2008-05-05 19:16:20 -07:00
Junio C Hamano e2e2defc14 Merge branch 'lh/git-file'
* lh/git-file:
  Teach GIT-VERSION-GEN about the .git file
  Teach git-submodule.sh about the .git file
  Teach resolve_gitlink_ref() about the .git file
  Add platform-independent .git "symlink"
2008-05-05 19:16:16 -07:00
Junio C Hamano b79c9859c8 Merge branch 'lh/branch-merged'
* lh/branch-merged:
  Add tests for `branch --[no-]merged`
  git-branch.txt: compare --contains, --merged and --no-merged
  git-branch: add support for --merged and --no-merged
2008-05-05 19:16:06 -07:00
Junio C Hamano dc484f2213 Merge branch 'pb/remote-mirror-config'
* pb/remote-mirror-config:
  Add a remote.*.mirror configuration option
2008-05-05 19:15:39 -07:00
Gerrit Pape ee831f7ddf git-bisect.sh: don't accidentally override existing branch "bisect"
If a branch named "bisect" or "new-bisect" already was created in the
repo by other means than git bisect, doing a git bisect used to override
the branch without a warning.  Now if the branch "bisect" or
"new-bisect" already exists, and it was not created by git bisect itself,
git bisect start fails with an appropriate error message.  Additionally,
if checking out a new bisect state fails due to a merge problem, git
bisect cleans up the temporary branch "new-bisect".

The accidental override has been noticed by Andres Salomon, reported
through
 http://bugs.debian.org/478647

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 17:18:20 -07:00
Bryan Donlan 4a7aaccd83 Rename the test trash directory to contain spaces.
In order to help prevent regressions in the future, rename the trash directory
for all tests to contain spaces. This patch also corrects two failures that
were caused or exposed by this change.

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:37:51 -07:00
Bryan Donlan f69e836fab Fix tests breaking when checkout path contains shell metacharacters
This fixes the remainder of the issues where the test script itself is at
fault for failing when the git checkout path contains whitespace or other
shell metacharacters.

The majority of git svn tests used the idiom

  test_expect_success "title" "test script using $svnrepo"

These were changed to have the test script in single-quotes:

  test_expect_success "title" 'test script using "$svnrepo"'

which unfortunately makes the patch appear larger than it really is.

One consequence of this change is that in the verbose test output the
value of $svnrepo (and in some cases other variables, too) is no
longer expanded, i.e. previously we saw

  * expecting success:
	test script using /path/to/git/t/trash/svnrepo

but now it is:

  * expecting success:
	test script using "$svnrepo"

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:37:02 -07:00
Bryan Donlan 0e46e70462 Don't use the 'export NAME=value' in the test scripts.
This form is not portable across all shells, so replace instances of:

  export FOO=bar

with:

  FOO=bar
  export FOO

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:01 -07:00
Bryan Donlan cdf3ec01ac lib-git-svn.sh: Fix quoting issues with paths containing shell metacharacters
Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:01 -07:00
Bryan Donlan b480f5cf1a test-lib.sh: Fix some missing path quoting
Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:01 -07:00
Bryan Donlan 7f0475c308 Use test_set_editor in t9001-send-email.sh
Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:01 -07:00
Bryan Donlan 02b3566003 test-lib.sh: Add a test_set_editor function to safely set $VISUAL
In particular, this function correctly handles cases where the pwd contains
spaces, quotes, and other troublesome metacharacters.

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:01 -07:00
Bryan Donlan 065096c2b5 git-send-email.perl: Handle shell metacharacters in $EDITOR properly
This fixes the git-send-perl semantics for launching an editor when
$GIT_EDITOR (or friends) contains shell metacharacters to match
launch_editor() in builtin-tag.c. If we use the current approach
(sh -c '$0 $@' "$EDITOR" files ...), we see it fails when $EDITOR has
shell metacharacters:

  $ sh -x -c '$0 $@' "$VISUAL" "foo"
  + "$FAKE_EDITOR" foo
  "$FAKE_EDITOR": 1: "$FAKE_EDITOR": not found

Whereas builtin-tag.c will invoke sh -c "$EDITOR \"$@\"".

Thus, this patch changes git-send-email.perl to use the same method as the
C utilities, and additionally updates t/t9001-send-email.sh to test for
this bug.

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:00 -07:00
Bryan Donlan e5c349ba11 config.c: Escape backslashes in section names properly
If an element of the configuration key name other than the first or last
contains a backslash, it is not escaped on output, but is treated as an
escape sequence on input. Thus, the backslash is lost when re-loading
the configuration.

This patch corrects this by having backslashes escaped properly, and
introduces a new test for this bug.

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:00 -07:00
Bryan Donlan 97b88dd58c git-rebase.sh: Fix --merge --abort failures when path contains whitespace
Also update t/t3407-rebase-abort.sh to expose the bug.

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:00 -07:00
Junio C Hamano 050288d52d is_racy_timestamp(): do not check timestamp for gitlinks
Because we do not even check the timestamp to determie if a gitlink
is up to date or not, triggering the racy-timestamp check for gitlinks
does not make sense.

This fixes the recently added test in t7506.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-04 17:41:27 -07:00
Junio C Hamano 1392a37721 diff: a submodule not checked out is not modified
948dd34 (diff-index: careful when inspecting work tree items, 2008-03-30)
made the work tree check careful not to be fooled by a new directory that
exists at a place the index expects a blob.  For such a change to be a
typechange from blob to submodule, the new directory has to be a
repository.

However, if the index expects a submodule there, we should not insist the
work tree entity to be a repository --- a simple directory that is not a
full fledged repository (even an empty directory would do) should be
considered an unmodified subproject, because that is how a superproject
with a submodule is checked out sparsely by default.

This makes the function check_work_tree_entity() even more careful not to
report a submodule that is not checked out as removed.  It fixes the
recently added test in t4027.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-04 17:41:27 -07:00
Ping Yin 27bfd950c1 Add t7506 to test submodule related functions for git-status
Signed-off-by: Ping Yin <pkufranky@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-04 17:41:27 -07:00
Ping Yin 7c08a2a637 t4027: test diff for submodule with empty directory
Signed-off-by: Ping Yin <pkufranky@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-04 17:41:27 -07:00
Jeff King 2a2ac92654 add merge.renamelimit config option
The point of rename limiting is to bound the amount of time
we spend figuring out inexact renames. Currently we use a
single value, diff.renamelimit, for all situations. However,
it is probably the case that a user is willing to spend more
time finding renames during a merge than they are while
looking at git-log.

This patch provides a way of setting those values separately
(though for backwards compatibility, merge still falls back
on the diff renamelimit).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-03 13:39:51 -07:00
Junio C Hamano ec845695c4 Merge commit 'sg/merge-options^' into jk/renamelimit
* commit 'sg/merge-options^':
  merge, pull: add '--(no-)log' command line option
  fmt-merge-msg: add '--(no-)log' options and 'merge.log' config variable
  add 'merge.stat' config variable
  merge, pull: introduce '--(no-)stat' option
  doc: moved merge.* config variables into separate merge-config.txt
2008-05-03 13:18:20 -07:00
Alex Riesen 97ad535b01 Use the modern syntax of git-diff-files in t2002-checkout-cache-u.sh
As a nice side effect it also fixes t2002-checkout-cache-u.sh on FreeBSD 4,
/bin/sh of which has problems interpreting "! command" construction.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-29 23:11:57 -07:00
Miklos Vajna 33c592ddd5 Add tests for sendemail.cc configuration variable
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-29 19:56:26 -07:00
Junio C Hamano 633d1fe9d0 Merge branch 'maint'
* maint:
  clone: detect and fail on excess parameters
  Remove 'header' from --signoff option description
2008-04-27 21:47:51 -07:00
Junio C Hamano a2b26acd7a clone: detect and fail on excess parameters
"git clone [options] $src $dst excess-garbage" simply ignored
excess-garbage without giving any diagnostic message.  Fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-27 21:47:39 -07:00
Junio C Hamano 36c79d2bf8 Merge branch 'ho/shared'
* ho/shared:
  Make core.sharedRepository more generic
2008-04-25 12:17:45 -07:00
Junio C Hamano 049a226fa1 Merge branch 'maint'
* maint:
  remote: create fetch config lines with '+'
  push: allow unqualified dest refspecs to DWIM
  doc/git-gc: add a note about what is collected
  t5516: remove ambiguity test (1)
  Linked glossary from cvs-migration page
  write-tree: properly detect failure to write tree objects
2008-04-24 22:40:02 -07:00
Jeff King 1ce89cc4bb remote: create fetch config lines with '+'
Since git-remote always uses remote tracking branches, it
should be safe to always force updates of those branches.
I.e., we should generate

  fetch = +refs/heads/*:refs/remotes/$remote/*

instead of

  fetch = refs/heads/*:refs/remotes/$remote/*

This was the behavior of the perl version, which seems to
have been lost in the C rewrite.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-24 22:30:31 -07:00
Jeff King f8aae12034 push: allow unqualified dest refspecs to DWIM
Previously, a push like:

  git push remote src:dst

would go through the following steps:

  1. check for an unambiguous 'dst' on the remote; if it
     exists, then push to that ref
  2. otherwise, check if 'dst' begins with 'refs/'; if it
     does, create a new ref
  3. otherwise, complain because we don't know where in the
     refs hierarchy to put 'dst'

However, in some cases, we can guess about the ref type of
'dst' based on the ref type of 'src'. Specifically, before
complaining we now check:

  2.5. if 'src' resolves to a ref starting with refs/heads
       or refs/tags, then prepend that to 'dst'

So now this creates a new branch on the remote, whereas it
previously failed with an error message:

  git push master:newbranch

Note that, by design, we limit this DWIM behavior only to
source refs which resolve exactly (including symrefs which
resolve to existing refs). We still complain on a partial
destination refspec if the source is a raw sha1, or a ref
expression such as 'master~10'.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-24 22:13:24 -07:00