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>
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>
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>
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>
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>
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>
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>
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>
... 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>
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)
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Very convenient shorthand for
git-ls-files [file-patterns] | xargs grep <pattern>
which I tend to do all the time.
Yes, it's trivial, but it's really nice. I can do
git grep '\<some_variable\>' arch/i386 include/asm-i386
and it does exactly what you'd think it does. And since it just uses the
normal git-ls-files file patterns, you can do things like
git grep something 'include/*.h'
and it will search all header files under the include/ subdirectory.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
The git port (9418) is officially listed by IANA now.
So document it.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This should work around the compilation problem Johannes Schindelin
and others had on Mac OS/X.
Quoting Linus:
Any operating system where socklen_t is anything else than "int" is
terminally broken. The people who introduced that typedef were confused,
and I actually had to argue with them that it was fundamentally wrong:
there is no other valid type than "int" that makes sense for it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
When the git diff status 'N' was changed to 'A', diff-helper.c was
not updated accordingly. This means that it no longer shows the
diff for newly added files.
This patch makes that change in diff-helper.c.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Switched from backwards hard-coded tmp directory creation to using
File::Temp::tempdir() to create the directory inside $TMP_PATH or
what the user has provided via the -t parameter.
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Use GIT_DIR from the environment instead of a hardcoded '.git' string.
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Updated the usage/help message to match asciidoc documentation. The perldoc
documentation now includes the first paragraph from the asciidoc documentation
and points users to the manpage.
Updated TODO section.
Removed some redundant options from the getopt() invocation.
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>