1
0
mirror of https://github.com/git/git.git synced 2024-10-03 17:32:35 +02:00
Commit Graph

701 Commits

Author SHA1 Message Date
Junio C Hamano
99ebd06c18 Merge branch 'np/pack'
* np/pack: (27 commits)
  document --index-version for index-pack and pack-objects
  pack-objects: remove obsolete comments
  pack-objects: better check_object() performances
  add get_size_from_delta()
  pack-objects: make in_pack_header_size a variable of its own
  pack-objects: get rid of create_final_object_list()
  pack-objects: get rid of reuse_cached_pack
  pack-objects: clean up list sorting
  pack-objects: rework check_delta_limit usage
  pack-objects: equal objects in size should delta against newer objects
  pack-objects: optimize preferred base handling a bit
  clean up add_object_entry()
  tests for various pack index features
  use test-genrandom in tests instead of /dev/urandom
  simple random data generator for tests
  validate reused pack data with CRC when possible
  allow forcing index v2 and 64-bit offset treshold
  pack-redundant.c: learn about index v2
  show-index.c: learn about index v2
  sha1_file.c: learn about index version 2
  ...
2007-04-21 17:20:50 -07:00
Junio C Hamano
e660e11b20 Merge branch 'jc/quickfetch'
* jc/quickfetch:
  Make sure quickfetch is not fooled with a previous, incomplete fetch.
  git-fetch: use fetch--tool pick-rref to avoid local fetch from alternate
  git-fetch--tool pick-rref
2007-04-21 17:19:25 -07:00
Brian Gernhardt
744747ef1d Remove case-sensitive file in t3030-merge-recursive.
Rename "A" to the unused "c"

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-19 23:28:15 -07:00
Junio C Hamano
6fb8e8f401 Merge branch 'maint'
* maint:
  git-shortlog: Fix two formatting errors in asciidoc documentation
  Fix overwriting of files when applying contextually independent diffs
  git-svn: don't allow globs to match regular files
2007-04-18 16:17:28 -07:00
Alex Riesen
0afa7644f2 Fix overwriting of files when applying contextually independent diffs
Noticed by applying two diffs of different contexts to the same file.

The check for existence of a file was wrong: the test assumed it was
a directory and reset the errno (twice: directly and by calling
lstat). So if an entry existed and was _not_ a directory no attempt
was made to rename into it, because the errno (expected by renaming
code) was already reset to 0. This resulted in error:

    fatal: unable to write file file mode 100644

For Linux, removing "errno = 0" is enough, as lstat wont modify errno
if it was successful. The behavior should not be depended upon,
though, so modify the "if" as well.

The test simulates this situation.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-18 15:33:01 -07:00
Junio C Hamano
35812d8305 Merge branch 'jc/read-tree-df'
* jc/read-tree-df:
  t3030: merge-recursive backend test.
  merge-recursive: handle D/F conflict case more carefully.
  merge-recursive: do not barf on "to be removed" entries.
  Treat D/F conflict entry more carefully in unpack-trees.c::threeway_merge()
  t1000: fix case table.
2007-04-17 16:55:46 -07:00
Steven Grimm
bb1faf0d5b Add --ignore-unmatch option to exit with zero status when no files are removed.
Signed-off-by: Steven Grimm <koreth@midwinter.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-17 00:19:11 -07:00
Junio C Hamano
b9849a1ab6 Make sure quickfetch is not fooled with a previous, incomplete fetch.
This updates git-rev-list --objects to be a bit more careful
when listing a blob object to make sure the blob actually
exists, and uses it to make sure the quick-fetch optimization we
introduced earlier is not fooled by a previous incomplete fetch.

The quick-fetch optimization works by running this command:

	git rev-list --objects <<commit-list>> --not --all

where <<commit-list>> is a list of commits that we are going to
fetch from the other side.  If there is any object missing to
complete the <<commit-list>>, the rev-list would fail and die
(say, the commit was in our repository, but its tree wasn't --
then it will barf while trying to list the blobs the tree
contains because it cannot read that tree).

Usually we do not have the objects (otherwise why would we
fetching?), but in one important special case we do: when the
remote repository is used as an alternate object store
(i.e. pointed by .git/objects/info/alternates).  We could check
.git/objects/info/alternates to see if the remote we are
interacting with is one of them (or is used as an alternate,
recursively, by one of them), but that check is more cumbersome
than it is worth.

The above check however did not catch missing blob, because
object listing code did not read nor check blob objects, knowing
that blobs do not contain any further references to other
objects.  This commit fixes it with practically unmeasurable
overhead.

I've benched this with

	git rev-list --objects --all >/dev/null

in the kernel repository, with three different implementations
of the "check-blob".

 - Checking with has_sha1_file() has negligible (unmeasurable)
   performance penalty.

 - Checking with sha1_object_info() makes it somewhat slower,
   perhaps by 5%.

 - Checking with read_sha1_file() to cause a fully re-validation
   is prohibitively expensive (about 4 times as much runtime).

In my original patch, I had this as a command line option, but
the overhead is small enough that it is not really worth it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-17 00:14:59 -07:00
Christian Couder
f948792990 Bisect: rename "t/t6030-bisect-run.sh" to "t/t6030-bisect-porcelain.sh".
[jc: also fix 0a5280a9 that incorrectly changed the title of one test.]

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-16 22:07:12 -07:00
Junio C Hamano
aa36985161 Merge branch 'js/wrap-log'
* js/wrap-log:
  Fix permissions on test scripts
  Fix t4201: accidental arithmetic expansion
  shortlog -w: make wrap-line behaviour optional.
  Use print_wrapped_text() in shortlog
2007-04-16 16:53:29 -07:00
Alex Riesen
4848509a97 Fix permissions on test scripts
Make every test executable. Remove exec-attribute from included shell files,
they can't used standalone anyway.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-16 16:53:09 -07:00
Alex Riesen
238128d888 Fix t4201: accidental arithmetic expansion
instead of embedded subshell. It actually breaks here (dash as /bin/sh):

t4201-shortlog.sh: 27: Syntax error: Missing '))'
FATAL: Unexpected exit with code 2

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-16 16:52:55 -07:00
Steven Grimm
b48caa20de Add --quiet option to suppress output of "rm" commands for removed files.
Signed-off-by: Steven Grimm <koreth@midwinter.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-16 01:06:02 -07:00
Nicolas Pitre
6e5417769c tests for various pack index features
This is a fairly complete list of tests for various aspects of pack
index versions 1 and  2.

Tests on index v2 include 32-bit and 64-bit offsets, as well as a nice
demonstration of the flawed repacking integrity checks that index
version 2 intend to solve over index version 1 with the per object CRC.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-11 19:32:03 -07:00
Nicolas Pitre
39551b6926 use test-genrandom in tests instead of /dev/urandom
This way tests are completely deterministic and possibly more portable.

Signed-off-by: Nicolas Pitre <nico@cam.org>
2007-04-11 19:31:24 -07:00
Robin H. Johnson
171ddd9177 Add testcase for format-patch --subject-prefix (take 3)
Add testcase for format-patch --subject-prefix support.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-11 18:48:40 -07:00
Junio C Hamano
885b981075 t3030: merge-recursive backend test.
We have fairly extensive coverage of read-tree 3-way machinery,
and many Porcelain-ish tests use git-merge front-end tests, but
we did not have good basic test for merge-recursive, which made
it very hard to hack on it.

I used this during the recent work to teach D/F conflicts to
merge-recursive.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-10 12:55:51 -07:00
Junio C Hamano
ea4b52a86f t1000: fix case table.
Case #10 is not handled with unpack-trees.c:threeway_merge()
internally, unless under the agressive rule, and it is not a
bug.  As the test expects, ND (one side did not do anything,
other side deleted) case was meant to be handled by the caller's
policy (e.g. git-merge-one-file or git-merge-recursive).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-10 12:55:51 -07:00
Junio C Hamano
3d711d97a0 shortlog -w: make wrap-line behaviour optional.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-10 12:48:35 -07:00
Johannes Schindelin
3714e7c895 Use print_wrapped_text() in shortlog
Some oneline descriptions are just too long. In shortlog, it looks much
nicer when they are wrapped. Since print_wrapped_text() is UTF-8 aware,
it also works with those descriptions.

[jc: with minimum fixes]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-10 12:48:35 -07:00
René Scharfe
8ff21b1a33 git-archive: make tar the default format
As noted by Junio, --format=tar should be assumed if no format
was specified.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-09 18:51:40 -07:00
Junio C Hamano
5bba1b355e Merge branch 'cc/bisect'
* cc/bisect:
  git-bisect: allow bisecting with only one bad commit.
  t6030: add a bit more tests to git-bisect
  git-bisect: modernization
  Documentation: bisect: "start" accepts one bad and many good commits
  Bisect: teach "bisect start" to optionally use one bad and many good revs.
2007-04-07 02:20:39 -07:00
Junio C Hamano
b7108a16a6 Merge branch 'jc/checkout' (early part)
* 'jc/checkout' (early part):
  checkout: allow detaching to HEAD even when switching to the tip of a branch
2007-04-07 02:19:54 -07:00
Junio C Hamano
ced38ea252 Merge branch 'maint'
* maint:
  Documentation: tighten dependency for git.{html,txt}
  Makefile: iconv() on Darwin has the old interface
  t5300-pack-object.sh: portability issue using /usr/bin/stat
  t3200-branch.sh: small language nit
  usermanual.txt: some capitalization nits
  Make builtin-branch.c handle the git config file
  rename_ref(): only print a warning when config-file update fails
  Distinguish branches by more than case in tests.
  Avoid composing too long "References" header.
  cvsimport: Improve formating consistency
  cvsimport: Reorder options in documentation for better understanding
  cvsimport: Improve usage error reporting
  cvsimport: Improve documentation of CVSROOT and CVS module determination
  cvsimport: sync usage lines with existing options

Conflicts:

	Documentation/Makefile
2007-04-07 01:30:43 -07:00
Arjen Laarhoven
d93f7c1817 t5300-pack-object.sh: portability issue using /usr/bin/stat
In the test 'compare delta flavors', /usr/bin/stat is used to get file size.
This isn't portable.  There already is a dependency on Perl, use its '-s'
operator to get the file size.

Signed-off-by: Arjen Laarhoven <arjen@yaph.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-06 21:19:28 -07:00
Junio C Hamano
0a5280a9f4 git-bisect: allow bisecting with only one bad commit.
This allows you to say:

	git bisect start
	git bisect bad $bad
	git bisect next

to start bisection without knowing a good commit.  This would
have you try a commit that is half-way since the beginning of
the history, which is rather wasteful if you already know a good
commit, but if you don't (or your history is short enough that
you do not care), there is no reason not to allow this.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-06 17:55:57 -07:00
Junio C Hamano
4f50671699 t6030: add a bit more tests to git-bisect
Verify that git-bisect does not start before getting one bad and
one good commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-06 17:55:48 -07:00
Arjen Laarhoven
4c84f0dcc6 t3200-branch.sh: small language nit
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-06 17:21:11 -07:00
Brian Gernhardt
08b984fb54 Distinguish branches by more than case in tests.
The renaming without config test changed a branch from q to Q, which
fails on non-case sensitive file systems.  Change the test to use q
and q2.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-06 16:51:46 -07:00
Junio C Hamano
77e6f5bc10 Merge branch 'maint'
* maint:
  Fix lseek(2) calls with args 2 and 3 swapped
  Honor -p<n> when applying git diffs
  Fix dependency of common-cmds.h
  Fix renaming branch without config file
  DESTDIR support for git/contrib/emacs
  gitweb: Fix bug in "blobdiff" view for split (e.g. file to symlink) patches
  Document --left-right option to rev-list.
  Revert "builtin-archive: use RUN_SETUP"
  rename contrib/hooks/post-receieve-email to contrib/hooks/post-receive-email.
  rerere: make sorting really stable.
  Fix t4200-rerere for white-space from "wc -l"
2007-04-05 16:34:51 -07:00
Christian Couder
38a47fd6e3 Bisect: teach "bisect start" to optionally use one bad and many good revs.
One bad commit is fundamentally needed for bisect to run,
and if we beforehand know more good commits, we can narrow
the bisect space down without doing the whole tree checkout
every time we give good commits.

This patch implements:

    git bisect start [<bad> [<good>...]] [--] [<pathspec>...]

as a short-hand for this command sequence:

    git bisect start
    git bisect bad $bad
    git bisect good $good1 $good2...

On the other hand, there may be some confusion between revs
(<bad> and <good>...) and <pathspec>... if -- is not used
and if an invalid rev or a pathspec that looks like a rev is
given.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-05 15:13:14 -07:00
Shawn O. Pearce
79ee194e52 Honor -p<n> when applying git diffs
If the user is trying to apply a Git generated diff file and they
have specified a -p<n> option, where <n> is not 1, the user probably
has a good reason for doing this.  Such as they are me, trying to
apply a patch generated in git.git for the git-gui subdirectory to
the git-gui.git repository, where there is no git-gui subdirectory
present.

Users shouldn't supply -p2 unless they mean it.  But if they are
supplying it, they probably have thought about how to make this
patch apply to their working directory, and want to risk whatever
results may come from that.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-05 15:06:58 -07:00
Geert Bosch
01ebb9dc88 Fix renaming branch without config file
Make git_config_rename_section return success if no config file
exists.  Otherwise, renaming a branch would abort, leaving the
repository in an inconsistent state.

[jc: test]

Signed-off-by: Geert Bosch <bosch@gnat.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-05 14:53:22 -07:00
René Scharfe
265d528032 Revert "builtin-archive: use RUN_SETUP"
Commit 64edf4b2 cleaned up the initialization of git-archive,
at the cost of 'git-archive --list' now requiring a git repo.
This patch reverts the cleanup and documents the requirement
for this particular dirtyness in a test.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-05 14:10:10 -07:00
Junio C Hamano
2b93edbf32 rerere: make sorting really stable.
The earlier code does not swap hunks when the beginning of the
first side is identical to the whole of the second side.  In
such a case, the first one should sort later.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-04 14:12:03 -07:00
Brian Gernhardt
364b852352 Fix t4200-rerere for white-space from "wc -l"
On OS X, wc outputs 6 spaces before the number of lines, so the test
expecting the string "10" failed.  Do not quote $cmd to strip away
the problematic whitespace as other tests do.

Also fix the grammar of the test name while making changes to it.
There's only one preimage, so it's "has", not "have".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-04 13:11:33 -07:00
Junio C Hamano
c0718268e8 Merge branch 'jc/bisect'
* jc/bisect:
  make the previous optimization work also on path-limited rev-list --bisect
  rev-list --bisect: Fix "halfway" optimization.
  t6004: add a bit more path optimization test.
  git-rev-list --bisect: optimization
  git-rev-list: add --bisect-vars option.
  t6002: minor spelling fix.
2007-04-04 00:10:21 -07:00
Junio C Hamano
3e0318a361 checkout: allow detaching to HEAD even when switching to the tip of a branch
You cannot currently checkout the tip of an existing branch
without moving to the branch.

This allows you to detach your HEAD and place it at such a
commit, with:

    $ git checkout master^0

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-03 23:43:59 -07:00
Junio C Hamano
045f5759c9 Merge 1.5.0.7 in
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-03 21:52:14 -07:00
Junio C Hamano
eb3359663d rerere should not repeat the earlier hunks in later ones
When a file has more then one conflicting hunks, it repeated the
contents of previous hunks in output for later ones.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-03 19:01:36 -07:00
Don Zickus
86747c132b git-mailinfo fixes for patch munging
Don't translate the patch to UTF-8, instead preserve the data as
is.  This also reverts a test case that was included in the
original patch series.

Also allow overwriting the authorship and title information we
gather from RFC2822 mail headers with additional in-body
headers, which was pointed out by Linus.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-31 00:59:19 -07:00
Johannes Schindelin
75c962c99a t4118: be nice to non-GNU sed
Elias Pipping:
> I'm on a mac, hence /usr/bin/sed is not gnu sed, which makes
> t4118 fail.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Ack'd-by: Elias Pipping <pipping@macports.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-28 14:54:30 -07:00
Jeff King
03bcaacaad t/t6006: add tests for a slightly more complex commit messages
Especially this tests i18n messages and encoding header.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-28 14:28:00 -07:00
Junio C Hamano
542e165cdc Fix "--pretty=format:" for parent related items.
There are two breakages in the %P/%p interpolation.  It appended
an excess SP at the end of the list, and it gave uninitialized
contents of a buffer on the stack for root commits.

This fixes it, while updating the t6006 test which expected the
wrong output.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-28 13:44:04 -07:00
Jeff King
fa21b60232 Add some basic tests of rev-list --pretty=format
These could stand to be a little more complex, but it should
at least catch obvious problems (like the recently fixed %ct
bug).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-27 18:57:01 -07:00
Junio C Hamano
1c2c6112a4 Merge branch 'master' into jc/bisect
This is to merge in the fix for path-limited bisection
from the 'master' branch.
2007-03-23 23:38:04 -07:00
Junio C Hamano
bab36bf57d t6004: add a bit more path optimization test.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-23 02:32:26 -07:00
Christian Couder
a17c410100 Bisect: implement "git bisect run <cmd>..." to automatically bisect.
This idea was suggested by Bill Lear
(Message-ID: <17920.38942.364466.642979@lisa.zopyra.com>)
and I think it is a very good one.

This patch adds a new test file for "git bisect run", but there
is currently only one basic test.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-23 01:54:47 -07:00
Johannes Schindelin
3007a78033 t4118: be nice to non-GNU sed
Elias Pipping:
> I'm on a mac, hence /usr/bin/sed is not gnu sed, which makes
> t4118 fail.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Ack'd-by: Elias Pipping <pipping@macports.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-22 18:08:37 -07:00
Junio C Hamano
7054b6089d t6002: minor spelling fix.
The test expects --bisect option can be configured with by setting
$_bisect_option.  So let's allow that uniformly.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-22 01:00:12 -07:00