Commit graph

273 commits

Author SHA1 Message Date
Carl Worth 60ace8790f git-add: Add support for --, documentation, and test.
This adds support to git-add to allow the common -- to separate
command-line options and file names. It adds documentation and a new
git-add test case as well.

[jc: this should apply to 1.2.X maintenance series, so I reworked
 git-ls-files --error-unmatch test. ]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-21 17:33:43 -08:00
Junio C Hamano 6643688867 Merge part of jc/portable branch 2006-02-21 00:52:18 -08:00
Johannes Schindelin 39c015c556 Fixes for ancient versions of GNU make
Some versions of GNU make do not understand $(call), and have problems to
interpret rules like this:

some_target: CFLAGS += -Dsome=defs

[jc: simplified substitution a bit. ]

Signed-off-by: Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-18 23:17:01 -08:00
Johannes Schindelin abb7c7b31c Optionally work without python
In some setups (notably server setups) you do not need that dependency.
Gracefully handle the absence of python when NO_PYTHON is defined.

Signed-off-by: Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-18 23:16:09 -08:00
Shawn Pearce 772d8a3b63 Make git-reset delete empty directories
When git-reset --hard is used and a subdirectory becomes
empty (as it contains no tracked files in the target tree)
the empty subdirectory should be removed.  This matches
the behavior of git-checkout-index and git-read-tree -m
which would not have created the subdirectory or would
have deleted it when updating the working directory.

Subdirectories which are not empty will be left behind.
This may happen if the subdirectory still contains object
files from the user's build process (for example).

[jc: simplified the logic a bit, while keeping the test script.]
2006-02-17 23:52:57 -08:00
Carl Worth eedf8f97e5 Abstract test_create_repo out for use in tests.
Signed-off-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-17 16:16:53 -08:00
Alex Riesen 0dbc4e89bb avoid echo -e, there are systems where it does not work
FreeBSD 4.11 being one example: the built-in echo doesn't have -e,
and the installed /bin/echo does not do "-e" as well.
"printf" works, laking just "\e" and "\xAB'.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-12 11:36:19 -08:00
Alex Riesen ef1af9d9af fix "test: 2: unexpected operator" on bsd
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-12 11:36:17 -08:00
Junio C Hamano 16139f9035 t5500: adjust to change in pack-object reporting behaviour.
Now pack-object is not as chatty when its stderr is not connected
to a terminal, so the test needs to be adjusted for that.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-11 23:08:23 -08:00
Junio C Hamano 29e55cd5ad Define GIT_(AUTHOR|COMMITTER)_(NAME|EMAIL) to known values.
Without these, running tests with an account with empty gecos
field would fail.

We might want to loosen error from "git-var -l" (but not
"git-var GIT_AUTHOR_NAME") later, but that is more or less an
independent issue.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-10 19:11:23 -08:00
Junio C Hamano 47e013f920 t6000: fix a careless test library add-on.
It tried to "restore" GIT_AUTHOR_EMAIL environment variable but
the variable started out as unset, so ended up setting it to an
empty string.  This is now caught as an error.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-08 21:55:34 -08:00
Junio C Hamano 130fcca63f git-commit: revamp the git-commit semantics.
- "git commit" without _any_ parameter keeps the traditional
   behaviour.  It commits the current index.

   We commit the whole index even when this form is run from a
   subdirectory.

 - "git commit --include paths..." (or "git commit -i paths...")
   is equivalent to:

   	git update-index --remove paths...
        git commit

 - "git commit paths..." acquires a new semantics.  This is an
   incompatible change that needs user training, which I am
   still a bit reluctant to swallow, but enough people seem to
   have complained that it is confusing to them.  It

   1. refuses to run if $GIT_DIR/MERGE_HEAD exists, and reminds
      trained git users that the traditional semantics now needs
      -i flag.

   2. refuses to run if named paths... are different in HEAD and
      the index (ditto about reminding).  Added paths are OK.

   3. reads HEAD commit into a temporary index file.

   4. updates named paths... from the working tree in this
      temporary index.

   5. does the same updates of the paths... from the working
      tree to the real index.

   6. makes a commit using the temporary index that has the
      current HEAD as the parent, and updates the HEAD with this
      new commit.

 - "git commit --all" can run from a subdirectory, but it updates
   the index with all the modified files and does a whole tree
   commit.

 - In all cases, when the command decides not to create a new
   commit, the index is left as it was before the command is
   run.  This means that the two "git diff" in the following
   sequence:

       $ git diff
       $ git commit -a
       $ git diff

   would show the same diff if you abort the commit process by
   making the commit log message empty.

This commit also introduces much requested --author option.

	$ git commit --author 'A U Thor <author@example.com>'

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-06 23:20:32 -08:00
Junio C Hamano 205df2796d tests: adjust breakage by stricter rev-parse
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-25 15:10:22 -08:00
Junio C Hamano 5df9140c92 t4011: "sleep 1" is not enough on FAT
This test depended on "sleep 1" to be enough to dirty the index
entry for a symlink.  Alex noticed that on his Cygwin installation
"sleep 1" was sometimes not enough, and after further discussion with
Christopher Faylor, it was brought up that on FAT filesystem timestamp
granularity is 2 seconds so sleeping 1 second is not enough.

For now this patch takes an easy workaround of sleeping for 3 seconds.

Very strictly speaking, POSIX requires lstat to fill only S_IFMT part
of st_mode and st_size for symlinks, and depending on timestamp might
be considered a bug, but we depend on that anyway, so it is better to
test that.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-21 19:33:22 -08:00
Junio C Hamano ebedc31952 show-branch: make the current branch and merge commits stand out.
This changes the character used to mark the commits that is on the
branch from '+' to '*' for the current branch, to make it stand out.
Also we show '-' for merge commits.

When you have a handful branches with relatively long diversion, it
is easier to see which one is the current branch this way.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-15 00:04:23 -08:00
Junio C Hamano 59617ebb74 GIT 1.1.2 2006-01-13 16:47:05 -08:00
Junio C Hamano 2c817df25d name-rev: do not omit leading components of ref name.
In a repository with mainto/1.0 (to keep maintaining the 1.0.X
series) and fixo/1.0 (to keep fixes that apply to both 1.0.X
series and upwards) branches, "git-name-rev mainto/1.0" answered
just "1.0" making things ambiguous.  Show refnames unambiguously
like show-branch does.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-11 14:47:20 -08:00
Junio C Hamano 5a2282de13 GIT 1.1.0 2006-01-08 14:22:19 -08:00
Yann Dirson e77f489edf Add a test for rebase when a change was picked upstream
This test exercises the standard feature that makes rebase useful.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-08 12:33:13 -08:00
Yann Dirson b91db2707a Add a minimal test for git-cherry
This test checks that git-cherry finds the expected number of patches
in two simple cases, and then tests the new limit arguments.

[jc: collapsed two patches into one and added sleep to make sure
 the two commits would get different timestamps]

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-08 00:54:31 -08:00
Junio C Hamano 78c2cff61f ls-files --others --directory: test
Add a test to run with --directory option.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 21:34:03 -08:00
Yann Dirson 36071af305 Fix typo in debug stanza of t2001
Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 18:13:44 -08:00
Junio C Hamano 5df466c507 Merge fixes up to GIT 1.0.7
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 20:54:42 -08:00
Junio C Hamano 6ce183216d t3300: skip when filesystem does not like TAB in filenames.
Instead of checking Cygwin explicitly, see if the filesystem lets us
create funny filenames.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 20:14:40 -08:00
Alex Riesen 2ccd2027b0 trivial: check, if t/trash directory was successfully created
and was successfully entered. Otherwise git-init-db will create it directly
in the working directory (t/) which can be dangerous.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:24:47 -08:00
Alex Riesen b484ef28fb trivial: use git-repo-config to detect how to run tests in the test repository
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:23:46 -08:00
Alex Riesen e58b97af31 trivial: use git-repo-config to detect if the test can be run on the repository
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:23:44 -08:00
Gerrit Pape f1ec72ba1e Fix skipping merge-order test with NO_OPENSSL=1.
Move git-rev-list --merge-order usage check for 'OpenSSL not linked' after
test 1; we cannot trigger this unless we try to actually use --merge-order
by giving some ref, and we do not have any ref until we run the first test
to create commits.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-28 11:09:53 -08:00
Junio C Hamano 58e3fb40f7 Merge fixes up to GIT 1.0.6 2005-12-27 18:13:30 -08:00
Junio C Hamano e9add36007 Fix bogus tests on rev-list output.
These tests seem to mean checking the output with expected
result, but was not doing its handrolled test helper function.

Also fix the guard to workaround wc output that have whitespace
padding, which was broken but not exposed because the test was
not testing it ;-).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 11:08:57 -08:00
Junio C Hamano 8eafa3da62 Guard a test against wc that pads its output with whitespace
Spotted by Johannes.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 11:08:57 -08:00
Junio C Hamano 36de72aa9d Merge fixes up to GIT 1.0.5 2005-12-26 18:45:30 -08:00
Johannes Schindelin 975b31dc6e Handle symlinks graciously
This patch converts a stat() to an lstat() call, thereby fixing the case
when the date of a symlink was not the same as the one recorded in the
index. The included test case demonstrates this.

This is for the case that the symlink points to a non-existing file. If
the file exists, worse things than just an error message happen.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-26 18:33:27 -08:00
Junio C Hamano c97451ce09 t5300: avoid false failures.
Johannes found that the test has 1/256 chance of falsely
producing an uncorrupted idx file, causing the check to detect
corruption fail.  Now we have 1/2^160 chance of false failure
;-).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-26 18:23:41 -08:00
Junio C Hamano c5ced64578 check_packed_git_idx(): check integrity of the idx file itself.
Although pack-check.c had routine to verify the checksum for the
pack index file itself, the core did not check it before using
it.

This is stolen from the patch to tighten packname requirements.

Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from 797bd6f490 commit)
2005-12-23 14:14:28 -08:00
Junio C Hamano 797bd6f490 check_packed_git_idx(): check integrity of the idx file itself.
Although pack-check.c had routine to verify the checksum for the
pack index file itself, the core did not check it before using
it.

This is stolen from the patch to tighten packname requirements.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-22 22:57:20 -08:00
Junio C Hamano 724b511d4f merge-recursive: conflicting rename case.
This changes the way the case two branches rename the same path
to different paths is handled.  Earlier, the code removed the
original path and added both destinations to the index at
stage0.  This commit changes it to leave the original path at
stage1, and two destination paths at stage2 and stage3,
respectively.

[jc: I am not really sure if this makes much difference in the
real life merge situations.  What should happen when our branch
renames A to B and M to N, while their branch renames A to M?
That is, M remains in our tree as is.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 22:34:59 -08:00
Junio C Hamano 407c8eb0d0 Racy GIT (part #2)
The previous round caught the most trivial case well, but broke
down once index file is updated again.  Smudge problematic
entries (they should be very few if any under normal interactive
workflow) before writing a new index file out.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-20 12:12:18 -08:00
Junio C Hamano 29e4d36357 Racy GIT
This fixes the longstanding "Racy GIT" problem, which was pretty
much there from the beginning of time, but was first
demonstrated by Pasky in this message on October 24, 2005:

    http://marc.theaimsgroup.com/?l=git&m=113014629716878

If you run the following sequence of commands:

	echo frotz >infocom
        git update-index --add infocom
        echo xyzzy >infocom

so that the second update to file "infocom" does not change
st_mtime, what is recorded as the stat information for the cache
entry "infocom" exactly matches what is on the filesystem
(owner, group, inum, mtime, ctime, mode, length).  After this
sequence, we incorrectly think "infocom" file still has string
"frotz" in it, and get really confused.  E.g. git-diff-files
would say there is no change, git-update-index --refresh would
not even look at the filesystem to correct the situation.

Some ways of working around this issue were already suggested by
Linus in the same thread on the same day, including waiting
until the next second before returning from update-index if a
cache entry written out has the current timestamp, but that
means we can make at most one commit per second, and given that
the e-mail patch workflow used by Linus needs to process at
least 5 commits per second, it is not an acceptable solution.
Linus notes that git-apply is primarily used to update the index
while processing e-mailed patches, which is true, and
git-apply's up-to-date check is fooled by the same problem but
luckily in the other direction, so it is not really a big issue,
but still it is disturbing.

The function ce_match_stat() is called to bypass the comparison
against filesystem data when the stat data recorded in the cache
entry matches what stat() returns from the filesystem.  This
patch tackles the problem by changing it to actually go to the
filesystem data for cache entries that have the same mtime as
the index file itself.  This works as long as the index file and
working tree files are on the filesystems that share the same
monotonic clock.  Files on network mounted filesystems sometimes
get skewed timestamps compared to "date" output, but as long as
working tree files' timestamps are skewed the same way as the
index file's, this approach still works.  The only problematic
files are the ones that have the same timestamp as the index
file's, because two file updates that sandwitch the index file
update must happen within the same second to trigger the
problem.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-20 00:22:28 -08:00
Junio C Hamano 1fdfd05db2 tests: make scripts executable
just for consistency.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-19 18:27:04 -08:00
Junio C Hamano c054d64e87 Revert "get_sha1_basic(): corner case ambiguity fix"
This reverts 6677c4665a commit.

The misguided disambiguation has been reverted, so there is no point
testing that misfeature.
2005-12-17 23:10:56 -08:00
Junio C Hamano 6677c4665a get_sha1_basic(): corner case ambiguity fix
When .git/refs/heads/frotz and .git/refs/tags/frotz existed, and
the object name stored in .git/refs/heads/frotz were corrupt, we
ended up picking tags/frotz without complaining.  Worse yet, if
the corrupt .git/refs/heads/frotz was more than 40 bytes and
began with hexadecimal characters, it silently overwritten the
initial part of the returned result.

This commit adds a couple of tests to demonstrate these cases,
with a fix.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-15 12:54:00 -08:00
Amos Waterland 294c695d8c git rebase loses author name/email if given bad email address
If GIT_AUTHOR_EMAIL is of a certain form, `git rebase master' will blow
away the author name and email when fast-forward merging commits.  I
have not tracked it down, but here is a testcase that demonstrates the
behavior.

Signed-off-by: Amos Waterland <apw@us.ibm.com>
Acked-by: Michal Ostrowski <mostrows@watson.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-14 17:04:47 -08:00
Junio C Hamano aa9dc7afd2 t3200: branch --help does not die anymore.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-14 02:53:43 -08:00
Petr Baudis ed24928e12 Make git-send-pack exit with error when some refs couldn't be pushed out
In case some refs couldn't be pushed out due to an error (mostly the
not-a-proper-subset error), make git-send-pack exit with non-zero status
after the push is over (that is, it still tries to push out the rest
of the refs).

[jc: I adjusted a test for this change.]

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-13 18:15:02 -08:00
Junio C Hamano 86c9523305 Revert "Add deltifier test."
This reverts e726715a52 commit,
because reverting diff-delta emptiness change would break this test.
2005-12-12 16:43:15 -08:00
Junio C Hamano e726715a52 Add deltifier test.
This test kicks in only if you built test-delta executable, and
makes sure that the basic delta routine is working properly even
on empty files.

This commit is to make sure we have a test to catch the
breakage.  The delitifier code is still broken, which will be
fixed with the next commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-12 12:57:25 -08:00
Junio C Hamano b825e6ff5d t/t6022: a new test for renaming merge.
This adds a couple of tests to cover the following renaming
merge cases:

 - one side renames and the other side does not, with and without
   content conflicts.

 - both side rename to the same path, with and without content
   conflicts.

The test setup also prepares a case in which both side rename to
different destination, but currently the code collapses these
destination paths and removes the original path, which may be
wrong.  The outcome of this case is not checked by the tests in
this round.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-11 12:44:46 -08:00
Junio C Hamano eea420693b t0000: catch trivial pilot errors.
People seem to be getting test failure from t6021 not becuase
git is faulty but because they forgot to install "merge".  Check
this and other trivial pilot errors in the first test.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-10 20:55:32 -08:00
Junio C Hamano 73ab46d6d0 t3300: funny name test
Add double quote character to the test pattern.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-10 19:00:24 -08:00
Junio C Hamano 10b94e283a Use GIT_EXEC_PATH explicitly for initial git-init-db in tests.
This is just a belts-and-suspenders check, but makes sure we
have both "git" and "git-init-db" built, executable, and
checking.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-09 17:32:18 -08:00
Alex Riesen 0f737464a6 use "git init-db" in tests
This is to catch an error where tests are run without first
building what are being tested.  Relying on prefixing $PATH with
the build directory and expect that the PATH mechanism would
find what we just built would silently run an already installed
binaries from the PATH.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-09 12:51:04 -08:00
Junio C Hamano 49ccb0877f Make sure we use compat/subprocess.py with Python 2.3 while running tests.
Otherwise the test will not succeed without installing.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-07 22:05:05 -08:00
Junio C Hamano 8d69195124 Fix 5501 test
Not everybody can rely on /bin/sh to be sane, and we support
SHELL_PATH for that.  Use it.

mktemp(1) is not used anywhere else in the core git.  Do not
introduce dependency on it.

Not everybody's "which" gives a sane return value.  For example,
on Solaris 'which XXX' says "no XXX in /usr/bin /bin ..." and
exits with zero status.  The lesson here is to never use 'which'
in your scripts.

Signed-off-by: Junio C Hamano <junkio@twinsun.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-05 19:12:26 -08:00
Junio C Hamano 53e7181cd9 config.c: remove unnecessary header in minimum configuration file.
It is just silly to start the file called "config" with a
comment that says "This is the config file."

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-05 12:58:53 -08:00
Fredrik Kuivinen 7057463463 New test case: Criss-cross merge
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-03 12:29:07 -08:00
Fredrik Kuivinen 72d1216a04 New test case: merge with directory/file conflicts
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-03 12:29:05 -08:00
Fredrik Kuivinen d3bfdb755e test-lib.sh: Add new function, test_expect_code
The test is considered OK if it exits with code $1

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-03 12:28:57 -08:00
Junio C Hamano 57ae0d09ed t3100: add ls-tree -t and -d tests.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-01 22:49:52 -08:00
Junio C Hamano 5401f3040b Merge branches 'jc/apply', 'lt/ls-tree', 'lt/bisect' and 'lt/merge' 2005-11-30 11:05:48 -08:00
Alex Riesen 8bf2c69c2d [PATCH] Add tests for git-mv in subdirectories
Junio C Hamano, Sat, Nov 26, 2005 03:45:52 +0100:

> I haven't seriously used git-mv myself, so
> somebody needs to test it, and if it actually works and Ack on
> it, please.

It actually works in subdirs.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-29 15:43:20 -08:00
Junio C Hamano 246cc52f38 ls-tree: match the test to the new semantics.
The diff for this commit is a good illustration of what changed
in ls-tree behaviour.

 - With -r, tree nodes themselves are not shown anymore, but
   blobs in subtrees are shown.

 - The order of paths parameters do not matter, since they are
   not like arguments to /bin/ls, but are filter patterns.

 - When filter patterns overlap, unintuitive things happen.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-28 23:06:29 -08:00
Johannes Schindelin ee72aeaf00 Rename git-config-set to git-repo-config
... and adjust all references.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-24 11:10:40 -08:00
Johannes Schindelin b17e659dd4 Allow hierarchical section names
A .git/config like follows becomes valid with this patch:

	[remote.junio]
		url = git://git.kernel.org/pub/scm/git/git.git
		pull = master:junio todo:todo +pu:pu

	[remote.ibook]
		url = ibook:git/
		pull = master:ibook
		push = master:quetzal

(This patch only does the ini file thing, git-fetch and friends still
ignore these values).

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 14:04:28 -08:00
Johannes Schindelin f98d863d21 git-config-set: support selecting values by non-matching regex
Extend the regex syntax of value_regex so that prepending an exclamation
mark means non-match:

	[core]
		quetzal = "Dodo" for Brainf*ck
		quetzal = "T. Rex" for Malbolge
		quetzal = "cat"

You can match the third line with

	git-config-set --get quetzal '! for '

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-20 10:53:06 -08:00
Johannes Schindelin 4ddba79db7 git-config-set: add more options
... namely

--replace-all, to replace any amount of matching lines, not just 0 or 1,
--get, to get the value of one key,
--get-all, the multivar version of --get, and
--unset-all, which deletes all matching lines from .git/config

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-19 23:15:07 -08:00
Junio C Hamano fbba222f5d tests: binary diff application.
This adds more tests to cover cases where binary diff
application succeeds.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-16 16:20:41 -08:00
Junio C Hamano 011f4274bb apply: allow-binary-replacement.
A new option, --allow-binary-replacement, is introduced.

When you feed a diff that records full SHA1 name of pre- and
post-image blob on its index line to git-apply with this option,
the post-image blob replaces the path if what you have in the
working tree matches the pre-image _and_ post-image blob is
already available in the object directory.

Later we _might_ want to enhance the diff output to also include
the full binary data of the post-image, to make this more
useful, but this is good enough for local rebasing application.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-16 16:20:40 -08:00
Junio C Hamano 92927ed0aa git-apply: fail if a patch cannot be applied.
Recently we fixed 'git-apply --stat' not to barf on a binary
differences.  But it accidentally broke the error detection when
we actually attempt to apply them.

This commit fixes the problem and adds test cases.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-16 14:12:56 -08:00
Johannes Schindelin a0fa2a10b4 Fix tests with new git in C
GIT_EXEC_PATH *has* to be set.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-15 22:10:58 -08:00
Junio C Hamano d7bba81575 Update topo-order test.
The recently we updated rev-list --topo-order to show the heads
in date order, but we had a test that expected to see the old
behaviour.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-14 18:15:30 -08:00
Alex Riesen 08db81a9f1 allow git-update-ref create refs with slashes in names
Make git-update-ref create references with slashes in them. git-branch
and git-checkout already support such reference names.

git-branch can use git-update-ref to create the references in a more
formal manner now.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-14 17:15:32 -08:00
Junio C Hamano 631ba30907 Merge branches 'jc/sb' and 'jc/mb' 2005-11-11 10:52:59 -08:00
Junio C Hamano 4bc51db0fe t1200: use --topo-order to keep the show-branch output stable.
Because a batch-oriented script creates many commits within a second
on a fast machine, show-branch output of the test results are unstable
without topo-order.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-11 10:52:39 -08:00
Junio C Hamano 53de71f88b Add test case for merge-base.
Although it was shown that the "full contamination" was not really full
during the list discussion, the series improves things without incurring
extra parsing cost, and here is a test to check that.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-11 10:52:31 -08:00
Alex Riesen 23fc63bf8f make tests ignorable with "make -i"
Allow failed tests to be ignored using make's "-i". The patch also
disables parallel make in t/. This doesn't make the testing any
different as before: the tests were run sequentially before.

It also allows to run more tests, ignoring the ones usually failing
just to figure out if something else broke.  (Or to ignore plainly
uninteresting situations because of the testing being done on say...
cygwin ;)

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-08 11:26:07 -08:00
Alex Riesen cb34882bd6 fix t5000-tar-tree.sh when $TAR isn't set
$TAR isn't set everywhere. Provide a default (tar)

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-08 11:26:03 -08:00
Junio C Hamano b52d9f9ba7 test: t4102-apply-rename fails with strict umask.
We checked the result of patch application for full permission bits,
when the only thing we cared about was to make sure the executable
bit was correctly set.

Noticed by Peter Baumann.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-05 13:08:18 -08:00
Alex Riesen d317e4384a remove CR/LF from .gitignore
For everyone cursed by dos/windows line endings (aka CRLF):

The code reading the .gitignore files (excludes and excludes per
directory) leaves \r in the patterns, which causes fnmatch to fail for
no obvious reason. Just remove a "\r" preceding a "\n"
unconditionally.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-02 16:50:58 -08:00
Johannes Schindelin 8d7d1670a8 make t5501 less annoying
On Linux, "mktemp tmp-XXXX" will not work. Also, redirect stderr on which,
so it does not complain too loudly. After all, this test should only be
executed when old binaries are available.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-28 22:57:01 -07:00
Johannes Schindelin eebda31d21 Implement an interoperability test for fetch-pack/upload-pack
The next patches will extend the pack protocol. This test assures that this
extension is compatible to earlier versions of git-fetch-pack/git-upload-pack.

All you need to do to take advantage of this test, is to install older
known-to-be-working binaries in the path as "old-git-fetch-pack" and
"old-git-upload-pack".

Note that the warning when testing with old-git-fetch-pack is to be
expected (it just says that the old version was not taking advantage
of all the information which the server sent).

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-28 22:56:59 -07:00
Johannes Schindelin 6b17c674aa Implement a test for git-fetch-pack/git-upload-pack
This test provides a minimal example of what went wrong with the old
git-fetch-pack (and now works beautifully).

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-28 22:56:58 -07:00
Pavel Roskin f07a524195 fix testsuite to tolerate spaces in path
This patch allows the testsuite to run properly when the full path to
the git sources contains spaces or other symbols that need to be quoted.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-28 02:59:01 -07:00
Linus Torvalds 9106c097ad Create object subdirectories on demand (phase II)
This removes the unoptimization.  The previous round does not mind
missing fan-out directories, but still makes sure they exist, lest
older versions choke on a repository created/packed by it.

This round does not play that nicely anymore -- empty fan-out
directories are not created by init-db, and will stay removed by
prune-packed.  The prune command also removes empty fan-out directories.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-28 02:01:42 -07:00
Johannes Schindelin 5f93926c3c No funny names on cygwin...
On FAT/NTFS, filenames cannot contain tabs. So t3300-funny-names would
reliably fail already when trying to create such files.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-18 11:35:17 -07:00
Junio C Hamano 508c1d1c9b Adjust tests for not quoting SP.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-17 17:41:59 -07:00
Junio C Hamano 4d2060efeb Add tests for funny pathnames.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-17 17:41:57 -07:00
Junio C Hamano c09a69a83e Disable hooks during tests.
Individual tests for hooks would want to have their own tests when
written.  Also we should not pick up from random templates the user
happens to have.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-16 00:24:34 -07:00
Junio C Hamano f51248eb48 Merge branch 'fixes' 2005-10-15 11:19:09 -07:00
Johannes Schindelin 2ae6c70674 Adapt tutorial to cygwin and add test case
Lacking reliable symlinks, the instructions in the tutorial did not work
in a cygwin setup. Also, a few outputs were not correct.

This patch fixes these, and adds a test case which follows the
instructions of the tutorial (except git-clone, -fetch and -push, which I
have not done yet).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-13 11:36:37 -07:00
Sergey Vlasov 9cf6d3357a Add git-index-pack utility
git-index-pack builds a pack index file for an existing packed
archive.  With this utility a packed archive which was transferred
without the corresponding pack index can be added to objects/pack/
without repacking.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-12 18:32:02 -07:00
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