Commit graph

9062 commits

Author SHA1 Message Date
Alexandre Julliard d55552f6e3 git.el: Add support for commit hooks.
Run the pre-commit and post-commit hooks at appropriate places, and
display their output if any.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-19 01:40:27 -07:00
Junio C Hamano 94b9816c5c Merge branch 'jb/gc'
* jb/gc:
  Make gc a builtin.
2007-03-18 22:46:30 -07:00
Junio C Hamano de5e61eb0d Merge branch 'fl/cvsserver'
* fl/cvsserver:
  cvsserver: further improve messages on commit and status
  cvsserver: Be more chatty
2007-03-18 22:44:25 -07:00
Shawn O. Pearce 18bdec1118 Limit the size of the new delta_base_cache
The new configuration variable core.deltaBaseCacheLimit allows the
user to control how much memory they are willing to give to Git for
caching base objects of deltas.  This is not normally meant to be
a user tweakable knob; the "out of the box" settings are meant to
be suitable for almost all workloads.

We default to 16 MiB under the assumption that the cache is not
meant to consume all of the user's available memory, and that the
cache's main purpose was to cache trees, for faster path limiters
during revision traversal.  Since trees tend to be relatively small
objects, this relatively small limit should still allow a large
number of objects.

On the other hand we don't want the cache to start storing 200
different versions of a 200 MiB blob, as this could easily blow
the entire address space of a 32 bit process.

We evict OBJ_BLOB from the cache first (credit goes to Junio) as
we want to favor OBJ_TREE within the cache.  These are the objects
that have the highest inflate() startup penalty, as they tend to
be small and thus don't have that much of a chance to ammortize
that penalty over the entire data.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-18 22:43:37 -07:00
Junio C Hamano 3635a18770 Merge branch 'sp/run-command'
* sp/run-command:
  Use run_command within send-pack
  Use run_command within receive-pack to invoke index-pack
  Use run_command within merge-index
  Use run_command for proxy connections
  Use RUN_GIT_CMD to run push backends
  Correct new compiler warnings in builtin-revert
  Replace fork_with_pipe in bundle with run_command
  Teach run-command to redirect stdout to /dev/null
  Teach run-command about stdout redirection
2007-03-18 22:21:06 -07:00
J. Bruce Fields abec100c33 Make git-send-email aware of Cc: lines.
In the Linux kernel, for example, it's common to include Cc: lines
for cases when you want to remember to cc someone on a patch without
necessarily claiming they signed off on it.  Make git-send-email
aware of these.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-18 21:10:03 -07:00
Theodore Ts'o d6678c28e3 mergetool: print an appropriate warning if merge.tool is unknown
Also add support for vimdiff

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-18 22:30:10 -04:00
James Bowes 9cec65399d mergetool: Add support for vimdiff.
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-18 22:13:48 -04:00
Junio C Hamano 7976ce1b90 Update main git.html page to point at 1.5.0.5 documentation
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-18 15:58:07 -07:00
Junio C Hamano d54fe394ac Merge branch 'ar/diff'
* ar/diff:
  Add tests for --quiet option of diff programs
  try-to-simplify-commit: use diff-tree --quiet machinery.
  revision.c: explain what tree_difference does
  Teach --quiet to diff backends.
  diff --quiet
  Remove unused diffcore_std_no_resolve
  Allow git-diff exit with codes similar to diff(1)
2007-03-18 15:48:06 -07:00
Linus Torvalds 304de2d2d6 Avoid unnecessary strlen() calls
This is a micro-optimization that grew out of the mailing list discussion
about "strlen()" showing up in profiles.

We used to pass regular C strings around to the low-level tree walking
routines, and while this worked fine, it meant that we needed to call
strlen() on strings that the caller always actually knew the size of
anyway.

So pass the length of the string down wih the string, and avoid
unnecessary calls to strlen(). Also, when extracting a pathname from a
tree entry, use "tree_entry_len()" instead of strlen(), since the length
of the pathname is directly calculable from the decoded tree entry itself
without having to actually do another strlen().

This shaves off another ~5-10% from some loads that are very tree
intensive (notably doing commit filtering by a pathspec).

Signed-off-by: Linus Torvalds  <torvalds@linux-foundation.org>"
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-18 15:36:59 -07:00
Nicolas Pitre a0cba10847 Reuse cached data out of delta base cache.
A malloc() + memcpy() will always be faster than mmap() +
malloc() + inflate().  If the data is already there it is
certainly better to copy it straight away.

With this patch below I can do 'git log drivers/scsi/ >
/dev/null' about 7% faster.  I bet it might be even more on
those platforms with bad mmap() support.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-18 15:36:59 -07:00
Linus Torvalds e5e01619bc Implement a simple delta_base cache
This trivial 256-entry delta_base cache improves performance for some
loads by a factor of 2.5 or so.

Instead of always re-generating the delta bases (possibly over and over
and over again), just cache the last few ones. They often can get re-used.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-18 15:36:59 -07:00
Linus Torvalds 62f255ad58 Make trivial wrapper functions around delta base generation and freeing
This doesn't change any code, it just creates a point for where we'd
actually do the caching of delta bases that have been generated.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-18 15:36:59 -07:00
Junio C Hamano 5bb44a5103 Merge 1.5.0.5 in from 'maint' 2007-03-18 15:36:44 -07:00
Junio C Hamano 6bf035f278 GIT 1.5.0.5
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-18 14:43:29 -07:00
James Bowes 6757ada403 Make gc a builtin.
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-17 00:34:19 -07:00
Junio C Hamano 1589e0517f Merge branch 'maint'
* maint:
  git-merge: finish when git-read-tree fails
2007-03-17 00:33:17 -07:00
Nicolas Pitre 4287307833 [PATCH] clean up pack index handling a bit
Especially with the new index format to come, it is more appropriate
to encapsulate more into check_packed_git_idx() and assume less of the
index format in struct packed_git.

To that effect, the index_base is renamed to index_data with void * type
so it is not used directly but other pointers initialized with it. This
allows for a couple pointer cast removal, as well as providing a better
generic name to grep for when adding support for new index versions or
formats.

And index_data is declared const too while at it.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-16 21:27:36 -07:00
Nicolas Pitre ac527b0b7c [PATCH] add test for OFS_DELTA objects
Make sure pack-objects with --delta-base-offset works fine, and that
it actually produces smaller packs as expected.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-16 21:27:36 -07:00
Nicolas Pitre 82868f72b5 [PATCH] fix t5300-pack-object.sh
The 'use packed deltified objects' test was flawed as it failed to
remove the pack and index from the previous test, effectively preventing
the desired pack from being exercised as objects could be found in that
other pack instead.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-16 21:27:35 -07:00
Nicolas Pitre e8e91fece8 [PATCH] local-fetch.c: some error printing cleanup
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-16 21:27:35 -07:00
Junio C Hamano 0d38ab259e applymbox: brown paper bag fix.
An earlier patch 87ab7992 broke applymbox by blindly copying piece
from git-am, causing a harmless but annoying series of error messages.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-16 21:22:05 -07:00
Santi Béjar 2be08a84ba git-merge: finish when git-read-tree fails
The message formating (commit v1.5.0.3-28-gbe242d5) broke the && chain.

Noticed by Dmitry Torokhov.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-16 04:34:17 -07:00
Alex Riesen 0c66d6be4f Add tests for --quiet option of diff programs
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
2007-03-16 02:13:27 -07:00
Shawn O. Pearce dbb2b41aa4 use xstrdup please
We generally prefer xstrdup to just plain strdup.
Make it so.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-16 02:12:14 -07:00
Paolo Bonzini 9debc3241b git-fetch, git-branch: Support local --track via a special remote '.'
This patch adds support for a dummy remote '.' to avoid having
to declare a fake remote like

        [remote "local"]
                url = .
                fetch = refs/heads/*:refs/heads/*

Such a builtin remote simplifies the operation of "git-fetch",
which will populate FETCH_HEAD but will not pretend that two
repositories are in use, will not create a thin pack, and will
not perform any useless remapping of names.  The speed
improvement is around 20%, and it should improve more if
"git-fetch" is converted to a builtin.

To this end, git-parse-remote is grown with a new kind of
remote, 'builtin'.  In git-fetch.sh, we treat the builtin remote
specially in that it needs no pack/store operations.  In fact,
doing git-fetch on a builtin remote will simply populate
FETCH_HEAD appropriately.

The patch also improves of the --track/--no-track support,
extending it so that branch.<name>.remote items referring '.'
can be created.  Finally, it fixes a typo in git-checkout.sh.

Signed-off-by: Paolo Bonzini  <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-16 02:10:12 -07:00
Junio C Hamano dd47aa3133 try-to-simplify-commit: use diff-tree --quiet machinery.
This uses diff-tree --quiet machinery to terminate the internal
diff-tree between a commit and its parents via revs.pruning (not
revs.diffopt) as soon as we find enough about the tree change.

With respect to the optionally given pathspec, we are interested
if the tree of commit is identical to the parent's, only adds
new paths to the parent's, or there are other differences.  As
soon as we find out that there is one such other kind of
difference, we do not have to compare the rest of the tree.

Because we do not call standard diff_addremove/diff_change, we
instruct the diff-tree machinery to stop early by setting
has_changes when we say we found the trees to be different.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 16:21:19 -07:00
Junio C Hamano 0a4ba7f8c6 revision.c: explain what tree_difference does
This explains how tree_difference variable is used, and updates two
places where the code knows symbolic constant REV_TREE_SAME is 0.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 16:21:19 -07:00
Junio C Hamano 822cac0155 Teach --quiet to diff backends.
This teaches git-diff-files, git-diff-index and git-diff-tree
backends to exit early under --quiet option.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 16:21:19 -07:00
Junio C Hamano 68aacb2f3c diff --quiet
This adds the command line option 'quiet' to tell 'git diff-*'
that we are not interested in the actual diff contents but only
want to know if there is any change.  This option automatically
turns --exit-code on, and turns off output formatting, as it
does not make much sense to show the first hit we happened to
have found.

The --quiet option is silently turned off (but --exit-code is
still in effect, so is silent output) if postprocessing filters
such as pickaxe and diff-filter are used.  For all practical
purposes I do not think of a reason to want to use these filters
and not viewing the diff output.

The backends have not been taught about the option with this patch.
That is a topic for later rounds.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 16:21:19 -07:00
Junio C Hamano 3161b4b521 Remove unused diffcore_std_no_resolve
This was only used by diff-tree-helper program, whose purpose
was to translate a raw diff to a patch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 16:21:19 -07:00
Alex Riesen 41bbf9d585 Allow git-diff exit with codes similar to diff(1)
This introduces a new command-line option: --exit-code. The diff
programs will return 1 for differences, return 0 for equality, and
something else for errors.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 16:21:19 -07:00
Junio C Hamano 803527f1d9 Merge GIT 1.5.0.4 2007-03-14 15:59:04 -07:00
Junio C Hamano 3d4e1932f2 GIT 1.5.0.4
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 15:56:49 -07:00
Yann Dirson 9debca9aac Clarify doc for git-config --unset-all.
Previous formulation could make it appear as removing all lines
matching a regexp (at least, I was looking for such a flag, and
confused this flag for what I was looking for).

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 14:38:38 -07:00
Junio C Hamano 41f5d73391 git-checkout: fix "eval" used for merge labelling.
The symbolic notation of the fork point can contain whitespaces (e.g.
"git checkout -m 'HEAD@{9 hours ago}'").  Quote strings properly
when using eval to prepare GITHEAD_$new

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 09:48:13 -07:00
Andy Parkins c47e6a43d3 update-hook: fix incorrect use of git-describe and sed for finding previous tag
Previously git-describe would output lines of the form
 v1.1.1-gf509d56
The update hook found the dash and stripped it off using
 sed 's/-g.*//'
The remainder was then used as the previous tag name.

However, git-describe has changed format.  The output is now of the form
 v1.1.1-23-gf509d56
The above sed fragment doesn't strip the middle "-23", and so the
previous tag name used would be "v1.1.1-23".  This is incorrect.

Since the hook script was written, git-describe now gained support for
"--abbrev=0", which it uses as a special flag to tell it not to output
anything other than the nearest tag name.  This patch fixes the problem,
and prevents any future recurrence by using this new flag rather than
sed to find the previous tag.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 09:14:51 -07:00
Frank Lichtenheld 392e28170b cvsserver: further improve messages on commit and status
commit: Also print the old revision similar to how cvs does it and
prepend a line stating the filename so that one can actually
understand what happened when commiting more than one file.

status: Fix the RCS filename displayed. The directory was
printed twice.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 02:09:33 -07:00
Frank Lichtenheld 459bad77e7 cvsserver: Be more chatty
Submit some additional messages to the client on commit and update.
Inspired by the standard CVS server though a little more terse.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 02:09:32 -07:00
Junio C Hamano c49b260e99 Merge branch 'jc/repack'
* jc/repack:
  prepare_packed_git(): sort packs by age and localness.
2007-03-14 02:08:48 -07:00
Junio C Hamano c1f5086e23 Merge branch 'jc/fetch'
* jc/fetch:
  .gitignore: add git-fetch--tool
  builtin-fetch--tool: fix reflog notes.
  git-fetch: retire update-local-ref which is not used anymore.
  builtin-fetch--tool: make sure not to overstep ls-remote-result buffer.
  fetch--tool: fix uninitialized buffer when reading from stdin
  builtin-fetch--tool: adjust to updated sha1_object_info().
  git-fetch--tool takes flags before the subcommand.
  Use stdin reflist passing in git-fetch.sh
  Use stdin reflist passing in parse-remote
  Allow fetch--tool to read from stdin
  git-fetch: rewrite expand_ref_wildcard in C
  git-fetch: rewrite another shell loop in C
  git-fetch: move more code into C.
  git-fetch--tool: start rewriting parts of git-fetch in C.
  git-fetch: split fetch_main into fetch_dumb and fetch_native
2007-03-14 01:40:19 -07:00
Junio C Hamano 5a27b3211a Merge branch 'dz/mailinfo'
* dz/mailinfo:
  Add a couple more test cases to the suite.
  restrict the patch filtering
  builtin-mailinfo.c infrastrcture changes
2007-03-14 01:39:19 -07:00
Junio C Hamano c746e44fb8 Merge branch 'jb/per-user-exclude'
* jb/per-user-exclude:
  add: Support specifying an excludes file with a configuration variable
2007-03-14 01:38:57 -07:00
Junio C Hamano c379c4b176 Merge branch 'maint'
* maint:
  cvsserver: asciidoc formatting changes
2007-03-14 01:38:39 -07:00
Junio C Hamano 36db2399e0 Merge branch 'pb/branch-track'
* pb/branch-track:
  Fix broken create_branch() in builtin-branch.
  git-branch, git-checkout: autosetup for remote branch tracking
2007-03-14 01:38:28 -07:00
Jim Meyering 09f2825147 git-grep: don't use sscanf
If you use scanf or sscanf to parse integers, your code probably
accepts bogus inputs.  For example, builtin-grep (aka git-grep) uses
sscanf(scan, "%u", &num) to parse the integer argument to -A, -B, -C.
Currently, "-C 1,000" and "-C 4294967297" are both treated just like
"-C 1":

    $ git-grep -h -C 4294967297 juggle
    out and you may find it easier to switch back and forth if you
    juggle multiple lines of development simultaneously. Of
    course, you will pay the price of more disk usage to hold

The obvious fix is to use strtoul instead.  But using a bare strtoul is
too messy, at least when done properly, so I've added a wrapper function.

The new function in the patch below belongs elsewhere if it would be
useful in replacing any of the four remaining uses of sscanf.

One final note:  With this change, I get a slightly different
diagnostic depending on the context size:

  $ ./git-grep -h -C 4294967296 juggle
  fatal: 4294967296: invalid context length argument
  [Exit 128]
  $ ./git-grep -h -C 4294967295 juggle
  grep: 4294967295: invalid context length argument

  [Exit 1]

A common convention that makes it easy to identify the source
of a diagnostic is to include the program name before the first ":".
Whether that should be "git" or "git-grep" is another question.
Using "grep" or "fatal" is misleading.

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 01:37:50 -07:00
Johannes Schindelin 6cd7895fee Do not output "GEN " when generating perl.mak
This fixes the same issue as 8bef6204, which became an issue again
after 31d0399c.

Besides, it is not really helpful to print just "GEN " (_without_
"perl.mak").

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 01:33:49 -07:00
Junio C Hamano 0497c620ca shortlog: prompt when reading from terminal by mistake
I was trying to see who have been active recently to find GSoC
mentor candidates by running:

	$ git shortlog -s -n --since=4.months | head -n 20

After waiting for about 20 seconds, I started getting worried,
thinking that the recent revision traversal updates might have
had an unintended side effect.

Not so.  "git shortlog" acts as a filter when no revs are given,
unlike "git log" which defaults to HEAD.  It was reading from
its standard input.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 01:33:41 -07:00
Junio C Hamano 86952cdabd Documentation: add git-mergetool to the command list.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 01:29:26 -07:00