1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-17 14:34:49 +01:00
Commit graph

1940 commits

Author SHA1 Message Date
Linus Torvalds
8805ccac40 [PATCH] Avoid building object ref lists when not needed
The object parsing code builds a generic "this object references that
object" because doing a full connectivity check for fsck requires it.

However, nothing else really needs it, and it's quite expensive for
git-rev-list that can have tons of objects in flight.

So, exactly like the commit buffer save thing, add a global flag to
disable it, and use it in git-rev-list.

Before:

	$ /usr/bin/time git-rev-list --objects v2.6.12..HEAD | wc -l
	12.28user 0.29system 0:12.57elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+26718minor)pagefaults 0swaps
	59124

After this change:

	$ /usr/bin/time git-rev-list --objects v2.6.12..HEAD | wc -l
	10.33user 0.18system 0:10.54elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+18509minor)pagefaults 0swaps
	59124

and note how the number of pages touched by git-rev-list for this
particular object list has shrunk from 26,718 (104 MB) to 18,509 (72 MB).

Calculating the total object difference between two git revisions is still
clearly the most expensive git operation (both in memory and CPU time),
but it's now less than 40% of what it used to be.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:32:23 -07:00
Linus Torvalds
b0d8923ec0 [PATCH] Improve git-rev-list memory usage further
This avoids keeping tree entries around, and free's them as it traverses
the list. This avoids building up a huge memory footprint just for these
small but very common allocations.

Before:

	$ /usr/bin/time git-rev-list --objects v2.6.12..HEAD | wc -l
	11.65user 0.38system 0:12.65elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+42934minor)pagefaults 0swaps
	59124

After:

	$ /usr/bin/time git-rev-list --objects v2.6.12..HEAD | wc -l
	12.28user 0.29system 0:12.57elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+26718minor)pagefaults 0swaps
	59124

Note how the minor fault numbers - which ends up being how many pages we
needed to map - go down from 42934 (167 MB) to 26718 (104 MB).  That is:

Before:
	42934 minor pagefaults

After:

	26718 minor pagefaults

This is all in _addition_ to the previous fixes.  It used to be
~48,000 pagefaults.

That's still a honking big memory footprint, but it's about half of what
it was just a day or two ago (and this is the object list for a pretty big
update - almost 60,000 objects. Smaller updates need less memory).

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:19:07 -07:00
Junio C Hamano
d0ac30f20c [PATCH] fetch.c: cleanups
Clean-ups suggested by Sergey Vlasov and acked by Daniel Barkalow.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:16:45 -07:00
Matthias Urlichs
2842375859 [PATCH] Debian: build-depend on "bc"
Build systems should run tests. This patch adds the necessary
debian/control and debian/rules bits ("bc" was missing,
t/t4002-diff-basic.sh wants it).

Signed-off-by: Matthias Urlichs <smurf@smurf.noris.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:16:42 -07:00
Junio C Hamano
6b82d16bfc [PATCH] Make git-checkout failure message more friendly.
... or less so, perhaps ;-).  Suggested by Jeff Garzik.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:16:40 -07:00
Chris Wright
0e60471c2a [PATCH] Update git-core.spec.in
Update git-core spec file based on feedback from Fedora Extras review.

- update BuildRoot to be more specific
- eliminate Requires that must be satisfied for base system install
- drop Vendor
- use dist tag to differentiate between branches
- own %{_datadir}/git-core/
- use RPM_OPT_FLAGS in spec file

Signed-off-by: Chris Wright <chrisw@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:16:37 -07:00
Peter Hagervall
ed0a84883e [PATCH] PATCH Documentation/git-rev-list.txt typo fix
An earlier commit causes a mismatch in <emphasis> and <superscript>
tags, one way of fixing it is having no more than one caret symbol per
line, which is the only solution I found in the asciidoc
documentation. Ugly, but it works.

[jc: ugly indeed but that is not Peter's fault.]

Signed-off-by: Peter Hagervall <hager@cs.umu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-16 15:16:35 -07:00
Junio C Hamano
b93aa3ec95 Recommend 'less' for Debian.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 23:33:03 -07:00
Horst von Brand
c6ae61590f [PATCH] Require less in RPM spec
... and the next one will be the one to do Debian, naturally.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 23:31:44 -07:00
Junio C Hamano
b4416b432b Revert breakage introduced by c80522e30f.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 17:38:26 -07:00
jdl@freescale.com
316eee8fe0 [PATCH] Documentation/git-rev-list.txt typo fix
Fix the "superscript" problem on the git-rev-list doc page.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 17:06:58 -07:00
Linus Torvalds
5bdbaaa4e9 [PATCH] Re-organize "git-rev-list --objects" logic
The logic to calculate the full object list used to be very inter-twined
with the logic that looked up the commits.

For no good reason - it's actually a lot simpler to just do that logic
as a separate pass.

This improves performance a bit, and uses slightly less memory in my
tests, but more importantly it makes the code simpler to work with and
follow what it does.

The performance win is less than I had hoped for, but I get:

Before:

	[torvalds@g5 linux]$ /usr/bin/time git-rev-list --objects v2.6.12..HEAD | wc -l
	13.64user 0.42system 0:14.13elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+47947minor)pagefaults 0swaps
	58945

After:

	[torvalds@g5 linux]$ /usr/bin/time git-rev-list --objects v2.6.12..HEAD | wc -l
	11.80user 0.36system 0:12.16elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+42684minor)pagefaults 0swaps
	58945

ie it improved by 2 seconds, and took a 5000+ fewer pages (hey, that's
20MB out of 174MB to go). And got the same number of objects (in theory,
the more expensive one might find some more shared objects to avoid. In
practice it obviously doesn't).

I know how to make it use _lots_ less memory, which will probably speed it
up. But that's for another time, and I'd prefer to see this go in first.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 16:19:44 -07:00
Junio C Hamano
5098bafb75 Plug diff leaks.
It is a bit embarrassing that it took this long for a fix since the
problem was first reported on Aug 13th.

    Message-ID: <87y876gl1r.wl@mail2.atmark-techno.com>
    From: Yasushi SHOJI <yashi@atmark-techno.com>
    Newsgroups: gmane.comp.version-control.git
    Subject: [patch] possible memory leak in diff.c::diff_free_filepair()
    Date: Sat, 13 Aug 2005 19:58:56 +0900

This time I used valgrind to make sure that it does not overeagerly
discard memory that is still being used.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 16:13:43 -07:00
Junio C Hamano
98533b90cb Avoid wasting memory while keeping track of what we have during fetch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 15:06:39 -07:00
Linus Torvalds
60ab26de99 [PATCH] Avoid wasting memory in git-rev-list
As pointed out on the list, git-rev-list can use a lot of memory.

One low-hanging fruit is to free the commit buffer for commits that we
parse. By default, parse_commit() will save away the buffer, since a lot
of cases do want it, and re-reading it continually would be unnecessary.
However, in many cases the buffer isn't actually necessary and saving it
just wastes memory.

We could just free the buffer ourselves, but especially in git-rev-list,
we actually end up using the helper functions that automatically add
parent commits to the commit lists, so we don't actually control the
commit parsing directly.

Instead, just make this behaviour of "parse_commit()" a global flag.
Maybe this is a bit tasteless, but it's very simple, and it makes a
noticable difference in memory usage.

Before the change:

	[torvalds@g5 linux]$ /usr/bin/time git-rev-list v2.6.12..HEAD > /dev/null
	0.26user 0.02system 0:00.28elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3714minor)pagefaults 0swaps

after the change:

	[torvalds@g5 linux]$ /usr/bin/time git-rev-list v2.6.12..HEAD > /dev/null
	0.26user 0.00system 0:00.27elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+2433minor)pagefaults 0swaps

note how the minor faults have decreased from 3714 pages to 2433 pages.
That's all due to the fewer anonymous pages allocated to hold the comment
buffers and their metadata.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 14:57:52 -07:00
Junio C Hamano
f71a69ab05 Be more backward compatible with git-ssh-{push,pull}.
HPA reminded me that these programs knows about the name of the
counterpart on the other end and simply symlinking the old name to
new name locally would not be enough.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 14:56:37 -07:00
H. Peter Anvin
0de68d28d3 [PATCH] rsh.c env and quoting cleanup, take 2
This patch does proper quoting, and uses "env" to be compatible with
tcsh.  As a side benefit, I believe the code is a lot cleaner to read.

[jc: I am accepting this not because I necessarily agree with the
 quoting approach taken by it, but because (1) the code is only used
 by ssh-fetch/ssh-upload pair which I do not care much about (if you
 have ssh account on the remote end you should be using git-send-pack
 git-fetch-pack pair over ssh anyway), and (2) HPA is one of the more
 important customers belonging to the Linux kernel community and I
 want to help his workflow -- which includes not wasting his time by
 asking him to switch to git-send-pack/git-fetch-pack pair, nor to use
 a better shell ;-).  I might not have taken this patch if it mucked
 with git_connect in connect.c in its current form.]

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 13:42:03 -07:00
Daniel Barkalow
22c6e1d0f7 [PATCH] Fix fetch completeness assumptions
Don't assume that any commit we have is complete; assume that any ref
we have is complete.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 13:19:29 -07:00
Sergey Vlasov
61420a2cb4 [PATCH] Document git-fetch options
Add documentation for git-fetch options

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 13:16:31 -07:00
Junio C Hamano
60d0526aaa Unoptimize info/refs creation.
The code did not catch the case where you removed an existing ref
without changing anything else.  We are not talking about hundreds of
refs anyway, so remove that optimization.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 12:46:32 -07:00
Junio C Hamano
0f56479d73 Retire info/rev-cache
It was one of those things that were well intentioned but did not turn
out to be useful in practice.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 12:46:31 -07:00
Peter Eriksen
53764ee43d [PATCH] Use '-d' as the first flag to 'install'
... in order to please Solaris 'install'.  GNU install is not harmed
with this.

[jc: Documentation/Makefile also fixed.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 12:46:31 -07:00
Sergey Vlasov
1db69b571c [PATCH] git-http-fetch: Allow caching of retrieved objects by proxy servers
By default the curl library adds "Pragma: no-cache" header to all
requests, which disables caching by proxy servers.  However, most
files in a GIT repository are immutable, and caching them is safe and
could be useful.

This patch removes the "Pragma: no-cache" header from requests for all
files except the pack list (objects/info/packs) and references
(refs/*), which are really mutable and should not be cached.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from 3b2a4c46fd5093ec79fb60e1b14b8d4a58c74612 commit)
2005-09-15 12:46:30 -07:00
Junio C Hamano
ba65af9c1f git-branch -d <branch>: delete unused branch.
The new flag '-d' lets you delete a branch.  For safety, it does not
lets you delete the branch you are currently on, nor a branch that
has been fully merged into your current branch.

The credit for the safety check idea goes to Daniel Barkalow.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-15 12:46:30 -07:00
Junio C Hamano
19397b4521 Revert "[PATCH] plug memory leak in diff.c::diff_free_filepair()"
This reverts 068eac91ce commit.
2005-09-14 14:06:50 -07:00
Linus Torvalds
705a7148ba [PATCH] Fix alloc_filespec() initialization
This simplifies and fixes the initialization of a "diff_filespec" when
allocated.

The old code would not initialize "sha1_valid". Noticed by valgrind.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-14 13:57:34 -07:00
Junio C Hamano
c80522e30f Make merge comment git-pull makes for an octopus a bit prettier.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-13 23:49:55 -07:00
Junio C Hamano
4803c2802c Merge branch 'master' of . 2005-09-13 22:30:13 -07:00
Junio C Hamano
2ba6c47be1 read-tree: fix bogus debugging statement.
We wanted to detect case #16 which should be rare, but botched the
case when some paths are missing, causing a segfault.  My fault.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-13 22:27:42 -07:00
Junio C Hamano
74376a6864 git-merge-recursive: Trivial RE fixes.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-13 21:09:03 -07:00
Fredrik Kuivinen
daae669949 [PATCH] Use the 'die' function where it is appropriate.
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-13 15:45:26 -07:00
Fredrik Kuivinen
6511cce24b [PATCH] Use a temporary index file when we merge the common ancestors.
With this change we can get rid of a call to 'git-update-index
--refresh'.

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-13 15:45:25 -07:00
Fredrik Kuivinen
87a71b65ac [PATCH] Adjust git-merge-recursive.py for the new tool names.
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-13 15:45:25 -07:00
Fredrik Kuivinen
0d214b6619 [PATCH] Don't output 'Automatic merge failed, ...'
git-merge.sh does this for us.

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-13 15:45:24 -07:00
Fredrik Kuivinen
d9a23fa6f7 [PATCH] Be more like the 'resolve' strategy.
If there are non-mergeable changes leave the head contents in the
cache and update the working directory with the output from merge(1).

In the add/add and delete/modify conflict cases leave unmerged cache
entries in the index.

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-13 15:45:23 -07:00
Junio C Hamano
ccfd3e9962 [PATCH] Define relative .git/objects/info/alternates semantics.
An entry in the alternates file can name a directory relative to
the object store it describes.  A typical linux-2.6 maintainer
repository would have "../../../torvalds/linux-2.6.git/objects" there,
because the subsystem maintainer object store would live in

    /pub/scm/linux/kernel/git/$u/$system.git/objects/

and the object store of Linus tree is in

    /pub/scm/linux/kernel/git/torvalds/linux-2.6.git/objects/

This unfortunately is different from GIT_ALTERNATE_OBJECT_DIRECTORIES
which is relative to the cwd of the running process, but there is no
way to make it consistent with the behaviour of the environment
variable.  The process typically is run in $system.git/ directory for
a naked repository, or one level up for a repository with a working
tree, so we just define it to be relative to the objects/ directory
to be different from either ;-).

Later, the dumb transport could be updated to read from info/alternates
and make requests for the repository the repository borrows from.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-13 13:39:23 -07:00
Junio C Hamano
a5cd85e084 Detect ls-remote failure properly.
The part that can fail is before the pipe, so we need to propagate the
error properly to the main process.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-13 13:39:06 -07:00
Fredrik Kuivinen
e4cf17ce0d [PATCH] Rename the 'fredrik' merge strategy to 'recursive'.
Otherwise we would regret when Fredrik comes up with another merge
algorithm with different pros-and-cons with the current one.

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-13 00:20:54 -07:00
Junio C Hamano
f88ed172e7 Fix off-by-one error in git-merge
'git-merge -s' without a strategy name does not fail and does
not give usage as it should.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-12 22:52:52 -07:00
Junio C Hamano
22c67ca88e Propagate errors from fetch-pack correctly to git-fetch.
When git-fetch-pack fails, the command does not notice the failure
and instead pretended nothing was fetched and there was nothing wrong.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-12 22:52:52 -07:00
Junio C Hamano
365527adbf Fix CDPATH problem.
CDPATH has two problems:

 * It takes scripts to unexpected places (somebody had
   CDPATH=..:../..:$HOME and the "cd" in git-clone.sh:get_repo_base
   took him to $HOME/.git when he said "clone foo bar" to clone a
   repository in "foo" which had "foo/.git").  CDPATH mechanism does
   not implicitly give "." at the beginning of CDPATH, which is
   the most irritating part.

 * The extra echo when it does its thing confuses scripts further.

Most of our scripts that use "cd" includes git-sh-setup so the problem
is primarily fixed there.  git-clone starts without a repository, and
it needs its own fix.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-12 22:52:51 -07:00
Junio C Hamano
3db6b224cf Merge branch 'master' of . 2005-09-12 22:02:42 -07:00
Junio C Hamano
2aba319a52 Document git-grep and link it from the main git(7) page.
Also adjust missing description in the git.txt page while we are at it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-12 19:39:15 -07:00
Junio C Hamano
7f88c8463c [PATCH] Make 'git checkout' a bit more forgiving when switching branches.
If you make a commit on a path, and then make the path
cache-dirty afterwards without changing its contents, 'git
checkout' to switch to another branch is prevented because
switching the branches done with 'read-tree -m -u $current
$next' detects that the path is cache-dirty, but it does not
bother noticing that the contents of the path has not been
actualy changed.

Since switching branches would involve checking out paths
different in the two branches, hence it is reasonably expensive
operation, we can afford to run update-index before running
read-tree to reduce this kind of false change from triggering
the check needlessly.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-12 19:15:03 -07:00
Junio C Hamano
4a5b63e3e9 [PATCH] Omit patches that have already been merged from format-patch output.
This switches the logic to pick which commits to include in the output
from git-rev-list to git-cherry; as a side effect, 'format-patch ^up mine'
would stop working although up..mine would continue to work.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-12 19:15:02 -07:00
Horst von Brand
663a5ed5ca [PATCH] There are several undocumented dependencies
There are several undocumented dependencies in the .spec and in the
INSTALL files. The following is from Fedora, perhaps other RPM
distributions call the packages differently.

Also, the manpages aren't always installed gzipped.

Updates to git-core.spec.in file:
 - Some git scripts use Perl
 - gitk needs wish, which is part of TCL/Tk.
 - curl is used all over
 - Need the ssh program from openssh-clients

Updates to INSTALL:
 - Mention wish
 - Mention ssh

Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
2005-09-12 19:15:02 -07:00
Linus Torvalds
5d9d831a51 Improve "git grep" flags handling
This allows any arbitrary flags to "grep", and knows about the few
special grep flags that take an argument too.

It also allows some flags for git-ls-files, although their usefulness
is questionable.

With this, something line

	git grep -w -1 pattern

works, without the script enumerating every possible flag.

[jc: this is the version Linus sent out after I showed him a
 barf-o-meter test version that avoids shell arrays.  He must
 have typed this version blindly, since he said:

    I'm not barfing, but that's probably because my brain just shut
    down and is desperately trying to gouge my eyes out with a spoon.

 I slightly fixed it to catch the remaining arguments meant to be
 given git-ls-files.]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-12 19:15:02 -07:00
Fredrik Kuivinen
4e48fe3f1c [PATCH] Make the ProgramError class printable.
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-12 14:54:00 -07:00
Fredrik Kuivinen
206e587cb8 [PATCH] Make sure we die if we don't get enough arguments.
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-12 14:53:59 -07:00
Fredrik Kuivinen
654291a2ac [PATCH] Introduce a 'die' function.
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-12 14:53:58 -07:00