Commit Graph

4440 Commits

Author SHA1 Message Date
Junio C Hamano
9bdef78fb0 Merge branch 'jk/maint-apply-no-binary' into maint
* jk/maint-apply-no-binary:
  apply: don't segfault on binary files with missing data
2010-11-24 12:47:04 -08:00
Junio C Hamano
a274f5b21d Merge branch 'ak/submodule-sync' into maint
* ak/submodule-sync:
  submodule sync: Update "submodule.<name>.url" for empty directories
2010-11-24 12:46:40 -08:00
Junio C Hamano
e7b9b80e2f Merge branch 'jk/maint-rev-list-nul' into maint
* jk/maint-rev-list-nul:
  rev-list: handle %x00 NUL in user format
2010-11-24 12:46:32 -08:00
Junio C Hamano
9cffe2018a Merge branch 'cb/diff-fname-optim' into maint
* cb/diff-fname-optim:
  diff: avoid repeated scanning while looking for funcname
  do not search functions for patch ID
  add rebase patch id tests
2010-11-24 12:46:26 -08:00
Junio C Hamano
78bce6c7e9 Merge branch 'jk/no-textconv-symlink' into maint
* jk/no-textconv-symlink:
  diff: don't use pathname-based diff drivers for symlinks
2010-11-24 12:46:20 -08:00
Junio C Hamano
2f9d2e22cb Merge branch 'bc/fix-cherry-pick-root' into maint
* bc/fix-cherry-pick-root:
  builtin/revert.c: don't dereference a NULL pointer
2010-11-24 12:44:46 -08:00
Junio C Hamano
71d35bdb36 Merge branch 'tr/send-email-refuse-sending-unedited-cover-letter' into maint
* tr/send-email-refuse-sending-unedited-cover-letter:
  send-email: Refuse to send cover-letter template subject
2010-11-24 12:44:12 -08:00
Junio C Hamano
71fc224fe8 t3402: test "rebase -s<strategy> -X<opt>"
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-11 13:30:55 -08:00
Nguyễn Thái Ngọc Duy
ae3cdfe112 dir.c: fix EXC_FLAG_MUSTBEDIR match in sparse checkout
Commit c84de70 (excluded_1(): support exclude files in index -
2009-08-20) tries to work around the fact that there is no
directory/file information in index entries, therefore
EXC_FLAG_MUSTBEDIR match would fail.

Unfortunately the workaround is flawed. This fixes it.

Reported-by: Thomas Rinderknecht <thomasr@sailguy.org>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-08 11:39:23 -08:00
Jeff King
24305cd700 apply: don't segfault on binary files with missing data
Usually when applying a binary diff generated without
--binary, it will be rejected early, as we don't even have
the full sha1 of the pre- and post-images.

However, if the diff is generated with --full-index (but not
--binary), then we will actually try to apply it. If we have
the postimage blob, then we can take a shortcut and never
even look at the binary diff at all (e.g., this can happen
when rebasing changes within a repository).

If we don't have the postimage blob, though, we try to look
at the actual fragments, of which there are none, and get a
segfault. This patch checks explicitly for that case and
complains to the user instead of segfaulting. We need to
keep the check at a low level so that the "shortcut" case
above continues to work.

We also add a test that demonstrates the segfault. While
we're at it, let's also explicitly test the shortcut case.

Reported-by: Rafaël Carré <rafael.carre@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-29 14:13:33 -07:00
Antonio Ospite
5b57413cb3 t/t9001-send-email.sh: fix stderr redirection in 'Invalid In-Reply-To'
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-19 14:15:30 -07:00
Kevin Ballard
27eea66b28 Update test script annotate-tests.sh to handle missing/extra authors
The current script used by annotate-tests.sh (used by t8001 and t8002) fails
to emit a warning if any of the expected authors never show up in the output
or if authors that show up in the output were never specified as expected.
Update the script to fail in both of these scenarios.

Helped-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-19 14:15:30 -07:00
Jeff King
9130ac9fe1 rev-list: handle %x00 NUL in user format
The code paths for showing commits in "git log" and "git
rev-list --graph" correctly handle embedded NULs by looking
only at the resulting strbuf's length, and never treating it
as a C string. The code path for regular rev-list, however,
used printf("%s"), which resulted in truncated output. This
patch uses fwrite instead, like the --graph code path.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13 18:58:33 -07:00
Andreas Köhler
33f072f891 submodule sync: Update "submodule.<name>.url" for empty directories
If a submodule directory has not been filled by "git submodule update"
yet, then "git submodule sync" must still update the super-project's
configuration for submodule.<name>.url.

This situation occurs when switching between branches with a module from
different urls and other branches without the submodule.

Signed-off-by: Andreas Köhler <andi5.py@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13 18:31:45 -07:00
Junio C Hamano
69ae92bda1 shell portability: no "export VAR=VAL"
It is more portable to say "VAR=VAL && export VAR" instead.

Noticed by Ævar.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13 11:36:36 -07:00
Yann Dirson
7c6eafa35a t/t3415: use && where applicable.
Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06 13:46:02 -07:00
Junio C Hamano
d4da4bc764 Merge early part of git-svn into maint
* commit 'git-svn/master~1':
  git-svn: fix processing of decorated commit hashes
  git-svn: check_cherry_pick should exclude commits already in our history
  Documentation/git-svn: discourage "noMetadata"
2010-10-05 08:36:15 -07:00
Elijah Newren
2d2ef5ec82 t3020 (ls-files-error-unmatch): remove stray '1' from end of file
Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-03 17:55:22 -07:00
Jonathan Nieder
dbda967684 t0004 (unwritable files): simplify error handling
Instead of

	... normal test script ...
	status=$?
	... cleanup ...
	(exit $status)

set up cleanup commands with test_when_finished.  This makes the
test script a little shorter, and more importantly, it ensures errors
during cleanup are reported.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-30 10:39:06 -07:00
Jon Seymour
57693d03db stash: fix git stash branch regression when branch creation fails
"git stash branch <branch> <stash>" started discarding the stash
when the branch creation fails.  It should have kept the stash
intact when aborting.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-29 10:07:09 -07:00
Tomas Carnecky
835d6a1f9f stash drops the stash even if creating the branch fails because it already exists
This bug was disovered by someone on IRC when he tried to

    $ git stash branch <branch> <stash>

while <branch> already existed. In that case the stash is dropped even
though it isn't applied on any branch, so the stash is effectively lost.

Signed-off-by: Tomas Carnecky <tom@dbservice.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-29 09:59:42 -07:00
Christian Couder
d212cef936 t6050 (replace): fix bogus "fetch branch with replacement" test
The test was missing some "&&" at the end of some lines and it
was wrong because, as the replacement refs were not fetched,
the commits from the parallel branch should not show up. This
was found by Elijah Newren.

This is fixed by checking that after the branch from HASH6 is
fetched, the commits from the parallel branch don't show up,
and then by fetching the replacement refs and checking that
they do show up afterwards.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27 11:40:45 -07:00
Jeff King
afa0876050 prefer test -h over test -L in shell scripts
Even though "-L" is POSIX, the former is more portable, and
we tend to prefer it already.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27 10:48:23 -07:00
Ramsay Jones
4098f6717b t1503: Fix arithmetic expansion syntax error when using dash
On systems which have dash as /bin/sh, such as Ubuntu, the final
test (master@{n} for various n) fails with a syntax error while
processing an arithmetic expansion. The syntax error is caused by
using a bare name ('N') as a variable reference in the expression.

In order to avoid the syntax error, we spell the variable reference
as '$N' rather than simply 'N'.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27 10:43:49 -07:00
Brandon Casey
6355e505ba builtin/revert.c: don't dereference a NULL pointer
cherry-pick will segfault when transplanting a root commit if the --ff
option is used.  This happens because the "parent" pointer is set to NULL
when the commit being cherry-picked has no parents.  Later, when "parent"
is dereferenced, the cherry-pick segfaults.

Fix this by checking whether "parent" is NULL before dereferencing it and
add a test for this case of cherry-picking a root commit with --ff.

Reported-by: Zbyszek Szmek <zbyszek@in.waw.pl>
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27 10:39:54 -07:00
Brian Gernhardt
9027fa9eb7 git-stash: fix flag parsing
Currently git-stash uses `git rev-parse --no-revs -- "$@"` to set its
FLAGS variable.  This is the same as `FLAGS="-- $@"`.  It should use
`git rev-parse --no-revs --flags "$@"`, but that eats any "-q" or
"--quiet" argument.  So move the check for quiet before rev-parse.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-26 21:27:37 -07:00
Brandon Casey
3fcb88785d t/t3903-stash: improve testing of git-stash show
Recently, the 'stash show' functionality was broken for the case when a
stash-like argument was supplied.  Since, commit 9bf09e, 'stash show' when
supplied a stash-like argument prints nothing and still exists with a zero
status.  Unfortunately, the flaw slipped through the test suite cracks
since the output of 'stash show' was not verified to be correct.

Improve and expand on the existing tests so that this flaws is detected.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-26 21:25:40 -07:00
Steven Walter
a3c75056dc git-svn: check_cherry_pick should exclude commits already in our history
The merge-base between @$parents and $merge_tip may have been reached
through a merge commit.  This means that some commits that are ancestors
of @$parents will not be ancestors of $merge_base.  The mergeinfo
property will not list commits that are ancestors of @$parents, so we
need to explicitly exclude them.

[ew: squashed and cleaned up test case from Steven]

Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2010-09-24 08:23:53 +00:00
Clemens Buchacher
beb172172f add rebase patch id tests
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-23 18:34:58 -07:00
Jeff King
d391c0ff94 diff: don't use pathname-based diff drivers for symlinks
When we're diffing symlinks, we consider the contents to be
the pathname that the symlink points to. When a user sets up
a userdiff driver like "*.pdf diff=pdf", their "diff.pdf.*"
config generally tells us what to do with the content of
pdf files.

With the current code, we will actually process a symlink
like "link.pdf" using a configured pdf driver, meaning we
are using contents which consist of a pathname with
configuration that is expecting contents that consist of an
actual pdf file.

The most noticeable example of this would have been
textconv; however, it was already protected in its own
textconv-specific code path. We can still see the breakage
with something like "diff.*.binary", though. You could
also see it with diff.*.funcname, though it is a bit harder
to trigger accidentally there.

This patch adds a check for S_ISREG lower in the callstack
than the textconv-specific check, which should block use of
any userdiff config for non-regular files. We can drop the
check in the textconv code, which is now redundant.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-23 18:32:32 -07:00
Brandon Casey
84d694027f t/t7300: workaround ancient touch by rearranging arguments
The ancient touch on Solaris 7 thinks that a decimal number supplied as
the first argument specifies a date_time to give to the files specified by
the remaining arguments.  In this case, it fails to parse '1' as a proper
date_time and exits with a failure status.  Workaround this flaw by
rearranging the arguments supplied to touch so that a non-digit appears
first and touch will not be confused.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-17 14:42:13 -07:00
Junio C Hamano
02567e88ee Merge branch 'bg/fix-t7003'
* bg/fix-t7003:
  t7003: Use test_commit instead of custom function
2010-09-16 07:43:41 -07:00
Junio C Hamano
2e1e96126f Merge branch 'dr/maint-ls-tree-prefix-recursion-fix'
* dr/maint-ls-tree-prefix-recursion-fix:
  ls-tree $di $dir: do not mistakenly recurse into directories
2010-09-15 12:41:13 -07:00
Junio C Hamano
e3f213c7af Merge branch 'jl/fix-test'
* jl/fix-test:
  t1020: Get rid of 'cd "$HERE"' at the start of each test
  t2016 (checkout -p): add missing &&
  t1302 (core.repositoryversion): style tweaks
  t2105 (gitfile): add missing &&
  t1450 (fsck): remove dangling objects
  tests: subshell indentation stylefix
  Several tests: cd inside subshell instead of around
2010-09-15 12:40:12 -07:00
Junio C Hamano
43d268e9dd Merge branch 'ch/filter-branch-deprecate-remap-to-ancestor'
* ch/filter-branch-deprecate-remap-to-ancestor:
  filter-branch: retire --remap-to-ancestor
2010-09-15 12:39:32 -07:00
Junio C Hamano
d42cb5804f Merge branch 'ch/maint-cannot-create-bundle-error'
* ch/maint-cannot-create-bundle-error:
  bundle: detect if bundle file cannot be created
2010-09-15 12:39:22 -07:00
Junio C Hamano
9f0ccb5b0a Merge branch 'ks/recursive-rename-add-identical'
* ks/recursive-rename-add-identical:
  RE: [PATCH] Avoid rename/add conflict when contents are identical
2010-09-15 12:39:12 -07:00
Brian Gernhardt
77f2e4f5f3 t7003: Use test_commit instead of custom function
t7003-filter-branch.sh had a make_commit() function that was identical
to test_commit() in test-lib.sh except that it used tr to create a
lowercase file name from the uppercase branch name instead of
appending ".t".

Not only is this unneeded code duplication, it also was something
simply waiting to fail on case-insensitive file systems.  So replace
all uses of make_commit with test_commit.

While we're editing the setup, chain it together with && so that
failures early in the sequence don't get lost and add a commit graph.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-13 10:59:06 -07:00
Junio C Hamano
5879b6bbca Merge branch 'maint'
* maint:
  t3101: modernise style
  compat/nedmalloc: don't force NDEBUG on the rest of git

Conflicts:
	Makefile
2010-09-12 13:53:03 -07:00
Junio C Hamano
b294ed637d ls-tree $di $dir: do not mistakenly recurse into directories
When applying two pathspecs, one of which is named as a prefix to the
other, we mistakenly recursed into the shorter one.

Noticed and fixed by David Reis.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-12 13:52:03 -07:00
Junio C Hamano
e22148f406 t3101: modernise style
Also add a few " &&" cascade that were missing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-12 13:46:58 -07:00
Brandon Casey
99f55ebc67 t/t4018: avoid two unnecessary sub-shell invocations
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-10 09:30:14 -07:00
Brandon Casey
bff4206121 t/t4018: test whether the word_regex patterns compile
Previously (e3bf5e43), a test was added to test whether the builtin
xfuncname regular expressions could be compiled without error by regcomp.
Let's do the same for the word_regex patterns.  This should help catch any
cross-platform incompatibilities that exist between the pattern creator's
system and the various platforms that the test suite is commonly run on.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09 17:19:18 -07:00
Brandon Casey
042cca3886 t/t5510-fetch.sh: improve testing with explicit URL and merge spec
Commit 6106ce46 introduced a test to demonstrate fetch's failure to
retrieve any objects or update FETCH_HEAD when it was supplied a repository
URL and the current branch had a configured merge spec.  This commit
expands the original test based on comments from Junio Hamano.  In addition
to actually verifying that the fetch updates FETCH_HEAD correctly, and does
not update the current branch, two more tests are added to ensure that the
merge configuration is ignored even when the supplied URL matches the URL
of the remote configured for the branch.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09 17:16:08 -07:00
Brandon Casey
f98548764e t/t7008: workaround broken handling of \000 by printf on IRIX
On IRIX 6.5, the printf utility in /usr/bin does not appear to handle the
\ddd notation according to POSIX.  This printf appears to halt processing
of the string argument and ignore any additional characters in the string.
Work around this flaw by replacing the \000's with 'Q' and using the
q_to_nul helper function provided by test-lib.sh

This problem with printf is not apparent when using the Bash shell since
Bash implements a POSIX compatible printf function internally.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09 17:11:06 -07:00
Jens Lehmann
fd3c32c981 t1020: Get rid of 'cd "$HERE"' at the start of each test
To achieve that, all cd commands which weren't inside a subshell had to
be put into a new one.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09 16:03:11 -07:00
Jonathan Nieder
a814615a6a t2016 (checkout -p): add missing &&
Although the set_state command is not likely to fail, it is best to
stay in the habit of checking for failures.

Cc: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09 16:02:47 -07:00
Jonathan Nieder
8fe5aeddcb t1302 (core.repositoryversion): style tweaks
This test is from 2007, which is late enough for the style to be
recognizably modern but still a while ago.  Freshen it up to
follow new best practices:

 - guard setup commands with test_expect_setup, so errors at
   that stage can be caught;
 - use <<\EOF in preference to <<EOF, to save reviewers the
   trouble of looking for variable interpolations;
 - use test_cmp instead of test "$foo" = "$bar", for better
   output with -v on failure;
 - indent commands in subshells and let them span multiple lines;
 - combine the two "gitdir required mode" tests that do not make
   as much sense alone.

Cc: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09 16:01:10 -07:00
Jonathan Nieder
76bbcd4382 t2105 (gitfile): add missing &&
Make sure early failures are not masked by later successes.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09 15:58:45 -07:00
Jonathan Nieder
dbedf8bf42 t1450 (fsck): remove dangling objects
The fsck test is generally careful to remove the corrupt objects
it inserts, but dangling objects are left behind due to some typos
and omissions.  It is better to clean up more completely, to
simplify the addition of later tests.  So:

 - guard setup and cleanup with test_expect_success to catch
   typos and errors;
 - check both stdout and stderr when checking for empty fsck
   output;
 - use test_cmp empty file in place of test $(wc -l <file) = 0,
   for better debugging output when running tests with -v;
 - add a remove_object () helper and use it to replace broken
   object removal code that forgot about the fanout in
   .git/objects;
 - disable gc.auto, to avoid tripping up object removal if the
   number of objects ever reaches that threshold.
 - use test_when_finished to ensure cleanup tasks are run and
   succeed when tests fail;
 - add a new final test that no breakage or dangling objects
   was left behind.

While at it, add a brief description to test_description of the
history that is expected to persist between tests.

Part of a campaign to clean up subshell usage in tests.

Cc: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09 15:58:32 -07:00