1
0
mirror of https://github.com/git/git.git synced 2024-10-06 21:31:30 +02:00
Commit Graph

132 Commits

Author SHA1 Message Date
Johannes Schindelin
0a81552e06 Use git-update-ref and git-symbolic-ref in tests
This makes all tests pass on cygwin.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-11 15:15:15 -07:00
Junio C Hamano
b12bbd5986 Merge branch 'fixes'
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-10 16:03:43 -07:00
Johannes Schindelin
18e410f1ea t5400-send-pack relies on a working cpio
Since cygwin does not install cpio by default, t5400 results in a very
cryptic failure. So, test for cpio explicitely.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-10 14:14:22 -07:00
Junio C Hamano
4769948afe Deal with $(bindir) and friends with whitespaces.
... using HPA's shellquote macro.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-10 13:51:52 -07:00
Junio C Hamano
899460f336 Also force LC_ALL in test scripts.
Noticed by Junichi Uekawa.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-09 21:58:02 -07:00
Linus Torvalds
230f13225d Create object subdirectories on demand
This makes it possible to have a "sparse" git object subdirectory
structure, something that has become much more attractive now that people
use pack-files all the time.

As a result of pack-files, a git object directory doesn't necessarily have
any individual objects lying around, and in that case it's just wasting
space to keep the empty first-level object directories around: on many
filesystems the 256 empty directories will be aboue 1MB of diskspace.

Even more importantly, after you re-pack a project that _used_ to be
unpacked, you could be left with huge directories that no longer contain
anything, but that waste space and take time to look through.

With this change, "git prune-packed" can just do an rmdir() on the
directories, and they'll get removed if empty, and re-created on demand.

This patch also tries to fix up "write_sha1_from_fd()" to use the new
common infrastructure for creating the object files, closing a hole where
we might otherwise leave half-written objects in the object database.

[jc: I unoptimized the part that really removes the fan-out directories
 to ease transition.  init-db still wastes 1MB of diskspace to hold 256
 empty fan-outs, and prune-packed rmdir()'s the grown but empty directories,
 but runs mkdir() immediately after that -- reducing the saving from 150KB
 to 146KB.  These parts will be re-introduced when everybody has the
 on-demand capability.]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-08 15:54:01 -07:00
Junio C Hamano
0d0b7c237a Merge branch 'fixes' 2005-10-07 17:06:21 -07:00
robfitz@273k.net
ab1630a3ed Fix wrong filename listing bug in git-ls-tree.
This patch fixes a bug in git-ls-tree in which the wrong filenames are
listed if the exact same file and directory contents are present in
another location in the tree.

Added a new series of test cases for directory and filename handling.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-07 16:54:06 -07:00
Junio C Hamano
ec1fcc16af Show original and resulting blob object info in diff output.
This adds more cruft to diff --git header to record the blob SHA1 and
the mode the patch/diff is intended to be applied against, to help the
receiving end fall back on a three-way merge.  The new header looks
like this:

    diff --git a/apply.c b/apply.c
    index 7be5041..8366082 100644
    --- a/apply.c
    +++ b/apply.c
    @@ -14,6 +14,7 @@
     //    files that are being modified, but doesn't apply the patch
     //  --stat does just a diffstat, and doesn't actually apply
    +//  --show-index-info shows the old and new index info for...
    ...

Upon receiving such a patch, if the patch did not apply cleanly to the
target tree, the recipient can try to find the matching old objects in
her object database and create a temporary tree, apply the patch to
that temporary tree, and attempt a 3-way merge between the patched
temporary tree and the target tree using the original temporary tree
as the common ancestor.

The patch lifts the code to compute the hash for an on-filesystem
object from update-index.c and makes it available to the diff output
routine.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-07 03:42:00 -07:00
Fredrik Kuivinen
500b97e4bb [PATCH] Teach git-ls-files about '--' to denote end of options.
Useful if you have a file whose name starts with a dash.

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-02 10:31:18 -07:00
Junio C Hamano
455a7f3275 More portability.
- The location of openssl development files got customizable.
 - The location of iconv development files got customizable.
 - Pass $TAR down to t5000 test so that the user can override with
   'gmake TAR=gtar'.
 - Solaris 'bc' does not seem to grok "define abs()".  There is no
   reason to use bc there -- expr would do.

Signed-off-by: Junio C Hamano <junio@twinsun.com>
2005-10-01 23:19:48 -07:00
Junio C Hamano
8098a178b2 Add git-symbolic-ref
This adds the counterpart of git-update-ref that lets you read
and create "symbolic refs".  By default it uses a symbolic link
to represent ".git/HEAD -> refs/heads/master", but it can be compiled
to use the textfile symbolic ref.

The places that did 'readlink .git/HEAD' and 'ln -s refs/heads/blah
.git/HEAD' have been converted to use new git-symbolic-ref command, so
that they can deal with either implementation.

Signed-off-by: Junio C Hamano <junio@twinsun.com>
2005-10-01 23:19:33 -07:00
Junio C Hamano
3e03aaf523 Update the case table in t/t1000.
It still talked about "the proposed alternative semantics" but we have
used those alternative semantics for quite some time.  Update them to
avoid confusion.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-28 12:56:18 -07:00
Peter Eriksen
edde7a8b53 [PATCH] Make the test more shell generic and fix missing Solaris find option
This is from Peter Eriksen, but further fixed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-27 00:16:39 -07:00
Junio C Hamano
5cfcd07c93 Retire diff-helper.
The textual diff generation with built-in '-p' in diff-* brothers has
proven to be useful enough that git-diff-helper outlived its usefulness.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-22 01:54:13 -07:00
Junio C Hamano
b0391890d2 Show modified files in git-ls-files
Add -m/--modified to show files that have been modified wrt. the index.

[jc: The original came from Brian Gerst on Sep 1st but it only checked
if the paths were cache dirty without actually checking the files were
modified.  I also added the usage string and a new test.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-20 15:07:53 -07:00
Junio C Hamano
50d69ef4f5 Fix typo in test comment.
I do not know why it was spelled git-rev-tree when I meant to say
git-read-tree, but the typo was left since day one.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-17 11:57:50 -07:00
Junio C Hamano
4d3fe0c5f3 [PATCH] Add debugging help for case #16 to read-tree.c
This will help us detect if real-world example merges have multiple
merge-base candidates and one of them matches one head while another
matches the other head.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-10 18:27:42 -07:00
Daniel Barkalow
ee6566e8d7 [PATCH] Rewrite read-tree
Adds support for multiple ancestors, removes --emu23, much simplification.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-10 18:27:41 -07:00
Junio C Hamano
a9ab586a5d Retire support for old environment variables.
We have deprecated the old environment variable names for quite a
while and now it's time to remove them.  Gone are:

    SHA1_FILE_DIRECTORIES AUTHOR_DATE AUTHOR_EMAIL AUTHOR_NAME
    COMMIT_AUTHOR_EMAIL COMMIT_AUTHOR_NAME SHA1_FILE_DIRECTORY

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-09 14:48:54 -07:00
Junio C Hamano
bc6146d2ab 'build' scripts before installing.
Earlier we renamed git-foo.sh to git-foo while installing, which
was mostly done by inertia than anything else.  This however
made writing tests to use scripts harder.

This patch builds the scripts the same way as we build binaries
from their sources.  As a side effect, you can now specify
non-standard paths you have your Perl binary is in when running
the make.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-08 18:50:33 -07:00
Amos Waterland
a3b427b9fa [PATCH] Do not create bogus branch from flag to git branch
If you run `git branch --help', you will unexpectedly have created a new
branch named "--help".  This simple patch adds logic and a usage
statement to catch this and similar problems, and adds a testcase for it.

Signed-off-by: Amos Waterland <apw@rossby.metr.ou.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-07 22:08:30 -07:00
Junio C Hamano
215a7ad1ef Big tool rename.
As promised, this is the "big tool rename" patch.  The primary differences
since 0.99.6 are:

  (1) git-*-script are no more.  The commands installed do not
      have any such suffix so users do not have to remember if
      something is implemented as a shell script or not.

  (2) Many command names with 'cache' in them are renamed with
      'index' if that is what they mean.

There are backward compatibility symblic links so that you and
Porcelains can keep using the old names, but the backward
compatibility support  is expected to be removed in the near
future.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-07 17:45:20 -07:00
Junio C Hamano
52be5fcd29 Add copy/rename check for git-apply.
The new test pattern is taken from HPA's klibc and klibc-kbuild trees,
which has many interesting renames (the commits
001eef5a19219e5b0601068a3d13874b88c0653e and
0037d1bc0deaf7daec3778496656cb04b4e4b9d0).  The test pattern exposes
problems in the apply.c changes currently in the proposed updates
branch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-04 15:44:55 -07:00
Robert Fitzsimons
debb9d8444 [PATCH] New git-apply test cases for scanning forwards and backwards.
Added a new test case for the scanning forwards and backwards for the
correct location to apply a patch fragment.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-28 14:24:06 -07:00
Robert Fitzsimons
ff3412ee1f [PATCH] New git-apply test cases for patches with mulitple fragments.
Added a test case for patches with multiple fragments.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-28 14:24:05 -07:00
Junio C Hamano
d57306c794 Create objects/info/ directory in init-db.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-20 10:59:28 -07:00
Johannes Schindelin
35cc4bcd10 [PATCH] When copying or renaming, keep the mode, please
Without this patch, git-apply does not retain the mode when renaming or
copying files.

[jc: Good catch, Johannes.  I added a test case to demonstrate the
breackage in the original.]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-17 12:13:12 -07:00
Brad Roberts
e54c5ea93e [PATCH] fix null TZ problems on os/x
It seems that the localtime() libc routine doesn't care for finding a TZ
that's empty.  It's ok with TZ not being set.  Setting the TZ to GMT allowed
these tests to pass.

$ uname -v
Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC

Signed-off-by: Brad Roberts <braddr@puremagic.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-13 18:28:54 -07:00
Pavel Roskin
41184273d1 [PATCH] Trapping exit in tests, using return for errors: further fixes.
"return" from a test would leave the exit trap set, which could cause a
spurious error message if it's the last test in the script or
--immediate is used.

The easiest solution would be to have a global trap that is set when
test-lib.sh is sourced and unset either by test_done(), error() or by
test_failure_() with --immediate.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-11 18:26:16 -07:00
Pavel Roskin
4d9d62fa7c [PATCH] Trapping exit in tests, using return for errors
I have noticed that "make test" fails without any explanations when the
"merge" utility is missing.  I don't think tests should be silent in
case of failure.

It turned out that the particular test was using "exit" to interrupt the
test in case of an error.  This caused the whole test script to exit.
No further tests would be run even if "--immediate" wasn't specified.
No error message was printed.

This patch does following:

All instances of "exit", "exit 1" and "(exit 1)" in tests have been
replaced with "return 1".  In fact, "(exit 1)" had no effect.

File descriptor 5 is duplicated from file descriptor 1.  This is needed
to print important error messages from tests.

New function test_run_() has been introduced.  Any "return" in the test
would merely cause that function to return without skipping calls to
test_failure_() and test_ok_().  The new function also traps "exit" and
treats it like a fatal error (in case somebody reintroduces "exit" in
the tests).

test_expect_failure() and test_expect_success() check both the result of
eval and the return value of test_run_().  If the later is not 0, it's
always a failure because it indicates the the test didn't complete.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-11 18:26:16 -07:00
Pavel Roskin
d9bdd39eee [PATCH] Need to set PAGER in tests
"t5400-send-pack.sh --verbose" stops waiting for user input.  It happens
because "git log" uses less for output now.  To prevent this, PAGER
should be set to cat.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-11 18:26:15 -07:00
Pavel Roskin
da7bc9b081 [PATCH] Missing test_done
All test scripts should end with test_done, which reports the test
results.  In the future, it could be used for other purposes, e.g. to
distinguish graceful end from "exit" in a test.  This patch fixes
scripts that don't call test_done.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-11 18:26:15 -07:00
Junio C Hamano
8e832ebce6 String comparison of test is done with '=', not '=='.
Caught this during a test setting /bin/sh to (d)ash.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-11 18:26:14 -07:00
Johannes Schindelin
ef0bd2e6e6 [PATCH] Fix git-rev-parse's parent handling
git-rev-parse HEAD^1 would fail, because of an off-by-one bug (but HEAD^
would yield the expected result). Also, when the parent does not exist, do
not silently return an incorrect SHA1. Of course, this no longer applies
to git-rev-parse alone, but every user of get_sha1().

While at it, add a test.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-10 10:22:49 -07:00
Junio C Hamano
eb3c430a85 Skip --merge-order test when built with NO_OPENSSL
When built with NO_OPENSSL, rev-list --merge-order does not
work, causing t6001 test to fail.  Detect that and skip this
test to allow continuing to the rest of the tests.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-29 17:21:53 -07:00
Junio C Hamano
1df092d211 Documentation and tests: ls-files exclude pattern.
Update the tests and documentation to match the new "last one
determines its fate" semantics.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-29 17:21:47 -07:00
Johannes Schindelin
148519b7dc [PATCH] support bc version 1.04
Test t6002 unnecessarily fails when bc is a bit older than average.

Signed-off-by: Johannes.Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-29 00:12:03 -07:00
Linus Torvalds
bdf25142aa Fix potential send-pack SIGSEGV
The check that the source is ahead of the destination incorrectly expects 
pop_most_recent_commit() to gracefully handle an empty list. 

Fix by just checking the list itself, rather than the return value of the 
pop function.

[jc: I did the test script that demonstrated the problem]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-26 22:23:18 -07:00
Junio C Hamano
2bbcddee87 Adjust diff-raw tests to the status letter change.
We use 'A' for added files instead of 'N' to make the it
visually easier to distinguish from 'M' now.

While we are at it, make the test scripts executable.  Yes, I
know it does not matter because t/Makefile runs them explicitly
with "sh tXXXX-blah.sh", but being consistent is always better.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-26 00:22:43 -07:00
Junio C Hamano
f87f949748 git-ls-files: --exclude mechanism updates.
Add --exclude-per-directory=<name> option that specifies a file
to contain exclude patterns local to that directory and its
subdirectories.  Update the exclusion logic to be able to say
"include files that match this more specific pattern, even
though later exclude patterns may match them".  Also enhances
that a pattern can contain '/' in which case fnmatch is called
with FNM_PATHNAME flag to match the entire path. 

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-25 17:03:52 -07:00
Junio C Hamano
bf0dd8a8de [PATCH] Test framework: prettyprint the failed command.
The output from a failure case had the test description message
and the first line of the actual test script concatenated on the
same line, which was ugly.  Correct the output routine a bit to
make it more readable.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-22 20:34:16 -07:00
Junio C Hamano
8b64647dd9 [PATCH] apply.c: handle incomplete lines correctly.
The parsing code had a bug that failed to recognize an
incomplete line at the end of a fragment, and the fragment
application code had a comparison bug to recognize such.  Fix
them to handle incomplete lines correctly.

Add a test script for patches with various combinations of
complete and incomplete lines to make sure the fix works.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-22 10:26:01 -07:00
Junio C Hamano
776566000f [PATCH] Prevent t6000 series from dropping useless sed.script in t/
The Makefile in the test suite directory considers any file
matching t[0-9][0-9][0-9][0-9]-*.sh as the top-level test script
to be executed.  Unfortunately this was not documented, and the
common test library, t6000-lib.sh was named to match that
pattern.  This caused t6000-lib.sh to be called from Makefile as
the top-level program, causing it to leave t/sed.script file
behind.  Rename it to t6000lib.sh to prevent this, and document
the naming convention a bit more clearly.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 15:53:35 -07:00
Jon Seymour
28346d2d3c [PATCH] Write sed script directly into temp file, rather than a variable
When sed uses \n rather than ; as a separator (for BSD sed(1) compat),
it is cleaner to use a file directly, rather than an environment
variable containing \n characters.

This change changes t/t6000 write to sed.script directly and changes
the other tests to remove knowledge of sed.script.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-06 18:00:28 -07:00
Jon Seymour
f573571a21 [PATCH] Add t/t6003 with some --topo-order tests
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-06 18:00:28 -07:00
Jon Seymour
4d3a63ba3a [PATCH] Add a t/t6001 test case for a --merge-order bug
This test case demonstrates a problem with --merge-order.

A
|
B
|\
C D
|/
E
|
F

git-rev-list --merge-order A B doesn't produce the expected output of

A
B
D
C
E
F

The problem is fixed by a subsequent patch.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-06 10:29:30 -07:00
Jon Seymour
f6069c5995 [PATCH] Change the sed seperator in t/t6000-lib.sh.
This trivial patch removes the semicolon as the sed seperator in the t/t6000-lib.sh test script
and replaces it with white space.  This makes BSD sed(1) much happier.

Signed-off-by: Mark Allen <mrallen1@yahoo.com>
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-06 09:26:13 -07:00
Jon Seymour
8904591a9b [PATCH] Introduce unit tests for git-rev-list --bisect
This patch introduces some unit tests for the git-rev-list --bisect functionality.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-06 09:26:13 -07:00
Jon Seymour
ce11895d5c [PATCH] Factor out useful test case infrastructure from t/t6001... into t/t6000-lib.sh
Functions that are useful to other t6xxx testcases are moved into t6000-lib.sh

To use these functions in a test case, use a test-case pre-amble like:

. ./test-lib.sh
. ../t6000-lib.sh # t6xxx specific functions

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-06 09:26:13 -07:00