Commit graph

5524 commits

Author SHA1 Message Date
Junio C Hamano c3fb0e358e Add renaming-rebase test.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-21 03:56:29 -07:00
Eric Wong 58634dbff8 rebase: Allow merge strategies to be used when rebasing
This solves the problem of rebasing local commits against an
upstream that has renamed files.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-21 03:56:29 -07:00
Andre Noll 86f660b1f1 object-refs: avoid division by zero
Currently, we don't check refs_hash_size size and happily call
lookup_object_refs() even if refs_hash_size is zero which leads to
a division by zero in hash_obj().

Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-21 03:56:00 -07:00
Junio C Hamano 9d24ed4f01 Merge branch 'ff/c99' into next
* ff/c99:
  Remove all void-pointer arithmetic.
2006-06-21 03:51:59 -07:00
Junio C Hamano 3bec0da08d Merge branch 'jc/upload-corrupt' into next
* jc/upload-corrupt:
  upload-pack/fetch-pack: support side-band communication
  Retire git-clone-pack
  upload-pack: prepare for sideband message support.
  upload-pack: avoid sending an incomplete pack upon failure
  Fix possible out-of-bounds array access
2006-06-21 02:50:59 -07:00
Junio C Hamano 583b7ea31b upload-pack/fetch-pack: support side-band communication
This implements a protocol extension between fetch-pack and
upload-pack to allow stderr stream from upload-pack (primarily
used for the progress bar display) to be passed back.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-21 02:50:32 -07:00
Junio C Hamano efc7fa5355 Retire git-clone-pack
The program is not used by git-clone since git-fetch-pack was extended
to allow its caller do what git-clone-pack alone did, and git-clone was
updated to use it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-21 02:34:14 -07:00
Junio C Hamano 363b7817e0 upload-pack: prepare for sideband message support.
This does not implement sideband for propagating the status to
the downloader yet, but add code to capture the standard error
output from the pack-objects process in preparation for sending
it off to the client when the protocol extension allows us to do
so.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-21 02:34:14 -07:00
Junio C Hamano b1c71b7281 upload-pack: avoid sending an incomplete pack upon failure
When the repository on the remote side is corrupted, rev-list
spawned from upload-pack would die with error, but pack-objects
that reads from the rev-list happily created a packfile that can
be unpacked by the downloader.  When this happens, the resulting
packfile is not corrupted and unpacks cleanly, but the list of
the objects contained in it is not what the protocol exchange
computed.

This update makes upload-pack to monitor its subprocesses, and
when either of them dies with error, sends an incomplete pack
data to the downloader to cause it to fail.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-21 02:34:14 -07:00
Junio C Hamano 48401221b3 Merge branch 'jn/web' into next
* jn/web:
  Move $gitbin earlier in gitweb.cgi
  Add git version to gitweb output
  gitweb: whitespace cleanup
2006-06-21 02:33:43 -07:00
Uwe Zeisberger bb9e15a83c Fix possible out-of-bounds array access
If match is "", match[-1] is accessed.  Let pathspec_matches return 1 in that
case indicating that "" matches everything.

Incidently this fixes git-grep'ing in ".".

Signed-off-by: Uwe Zeisberger <Uwe_Zeisberger@digi.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-21 02:30:46 -07:00
Jakub Narebski 3f7f271004 Move $gitbin earlier in gitweb.cgi
(cherry picked from 9dca843086356b964f27d8fabe1e3c48074a9f02 commit)

Signed-off-by: Jakub Narebski <jnareb.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-21 02:02:01 -07:00
Jakub Narebski ae20de5386 Add git version to gitweb output
Add git-core binaries used version as the comment at the beginning of HTML
output, just below the comment with version of git web interface version.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-21 02:02:01 -07:00
Jakub Narebski 7a9b4c5fe3 gitweb: whitespace cleanup
Do not use tabs to align variable initialization (actually use
tabs only at the beginning of line, for code indent).  Remove trailing
whitespace.  Make whitespace usage more consistent.

Signed-off-by: Jakub Narebski <jnareb.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-21 02:02:00 -07:00
Junio C Hamano ad9f72a704 Merge branch 'master' into next
* master:
  checkout -f: do not leave untracked working tree files.
  Log peer address when git-daemon called from inetd
2006-06-21 01:24:45 -07:00
Junio C Hamano 4170af8232 checkout -f: do not leave untracked working tree files.
Earlier we did not consider untracked working tree files
"precious", but we have always considered them fair game to
clobber.  These days, branch switching by read-tree is more
careful and tries to protect untracked working tree files.  This
caused the following workflow to stop working:

	git checkout one-branch-with-file-F
	git checkout -f another-without-file-F
	git pull . one-branch-with-file-F

Because the second checkout leaves F from the previous state as
untracked file in the working tree, the merge would fail, trying
to protect F from being clobbered.

This changes "git checkout -f" to remove working tree files that
are known to git in the switched-from state but do not exist in
the switched-to state, borrowing the same logic from "reset --hard".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-20 22:21:11 -07:00
David Woodhouse 5b276ee4fb Log peer address when git-daemon called from inetd
When we run git-daemon from inetd, even with the --verbose option, it
doesn't log the peer address. That logic was only in the standalone
daemon code -- move it to the execute() function instead. Tested with
both IPv6 and Legacy IP clients, in both inetd and daemon mode.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Acked-by: Jon Loeliger <jdl@jdl.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-20 22:19:29 -07:00
Junio C Hamano 69d830d1a3 Merge branch 'jn/web' into next
* jn/web:
  gitweb: style done with stylesheet
  gitweb: A couple of page title tweaking
2006-06-20 14:06:32 -07:00
Jakub Narebski 1f1ab5f05b gitweb: style done with stylesheet
Replace (almost) all 'style' attributes with 'class' attribute
and adding rule to CSS file. Some tables use CSS for styling
instead of legacy styling attributes.

[jc: too many rejects -- hand fixed and reindented]
2006-06-20 14:01:13 -07:00
Jakub Narebski 7bedd9fc81 gitweb: A couple of page title tweaking
[jc: the e-mailed patch did not apply, so I had to guess but I think
 I got the result right.]
2006-06-20 13:46:30 -07:00
Junio C Hamano 02ca920481 Merge branch 'jn/web' into next 2006-06-20 03:00:13 -07:00
Jakub Narebski 57bd4d3523 Fix: Support for the standard mime.types map in gitweb
Temporary fix: commented out offending line in mimetype_guess.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-20 02:59:55 -07:00
Junio C Hamano 753fa210cc Merge branch 'master' into next 2006-06-20 02:51:23 -07:00
Junio C Hamano a796b89511 Merge branch 'jn/web' into next 2006-06-20 02:39:53 -07:00
Junio C Hamano 9e37f72afe Merge branch 'pb/config' into next 2006-06-20 02:39:48 -07:00
Florian Forster 1d7f171c3a Remove all void-pointer arithmetic.
ANSI C99 doesn't allow void-pointer arithmetic. This patch fixes this in
various ways. Usually the strategy that required the least changes was used.

Signed-off-by: Florian Forster <octo@verplant.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-20 01:59:46 -07:00
Eric Wong c07eee1f2a git-svn: fix --rmdir when using SVN:: libraries
When tracking directories with nearly all of its files at
the most nested levels, --rmdir would accidentally go too
far when deleting.

Of course, we'll add a test for this condition, too.

Makefile: automatically run new tests as they appear in t/

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-20 01:31:57 -07:00
Johannes Schindelin e33d0611c0 git_config: access() returns 0 on success, not > 0
Another late-night bug. Sorry again.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-20 01:21:53 -07:00
Johannes Schindelin 92a28be0ce repo-config: Fix late-night bug
This bug was hidden by the "future-proofing" of the test. Sigh.

When neither GIT_CONFIG nor GIT_CONFIG_LOCAL is set, do not use NULL,
but $GIT_DIR/config. Instead of using $GIT_DIR/config when only
GIT_CONFIG_LOCAL is set. Sorry.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-20 01:21:51 -07:00
Jakub Narebski 7b6511a13f gitweb: add type="text/css" to stylesheet link
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19 21:16:09 -07:00
Junio C Hamano 592689c461 Merge branch 'jc/waitpid' into next
* jc/waitpid:
  Restore SIGCHLD to SIG_DFL where we care about waitpid().
2006-06-19 18:47:51 -07:00
Junio C Hamano b19beecd94 Merge branch 'lt/objlist' into next
* lt/objlist:
  Add "named object array" concept
  xdiff: minor changes to match libxdiff-0.21
  fix rfc2047 formatter.
  Fix t8001-annotate and t8002-blame for ActiveState Perl
  Add specialized object allocator
2006-06-19 18:47:29 -07:00
Junio C Hamano 474bc4e274 Merge branches 'js/lsfix', 'pb/config' and 'jn/web' into next
* js/lsfix:
  Initialize lock_file struct to all zero.

* pb/config:
  Read configuration also from $HOME/.gitconfig
  Fix setting config variables with an alternative GIT_CONFIG

* jn/web:
  Make CSS file gitweb/gitweb.css more readable
2006-06-19 18:46:56 -07:00
Linus Torvalds 1f1e895fcc Add "named object array" concept
We've had this notion of a "object_list" for a long time, which eventually
grew a "name" member because some users (notably git-rev-list) wanted to
name each object as it is generated.

That object_list is great for some things, but it isn't all that wonderful
for others, and the "name" member is generally not used by everybody.

This patch splits the users of the object_list array up into two: the
traditional list users, who want the list-like format, and who don't
actually use or want the name. And another class of users that really used
the list as an extensible array, and generally wanted to name the objects.

The patch is fairly straightforward, but it's also biggish. Most of it
really just cleans things up: switching the revision parsing and listing
over to the array makes things like the builtin-diff usage much simpler
(we now see exactly how many members the array has, and we don't get the
objects reversed from the order they were on the command line).

One of the main reasons for doing this at all is that the malloc overhead
of the simple object list was actually pretty high, and the array is just
a lot denser. So this patch brings down memory usage by git-rev-list by
just under 3% (on top of all the other memory use optimizations) on the
mozilla archive.

It does add more lines than it removes, and more importantly, it adds a
whole new infrastructure for maintaining lists of objects, but on the
other hand, the new dynamic array code is pretty obvious. The change to
builtin-diff-tree.c shows a fairly good example of why an array interface
is sometimes more natural, and just much simpler for everybody.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19 18:45:48 -07:00
Junio C Hamano f0b7367cb1 Restore SIGCHLD to SIG_DFL where we care about waitpid().
It was reported that under one implementation of socks client
"git clone" fails with "error: waitpid failed (No child processes)",
because "git" is spawned after setting SIGCHLD to SIG_IGN.

Arguably it may be a broken setting, but we should protect
ourselves so that we can get reliable results from waitpid() for
the children we care about.

This patch resets SIGCHLD to SIG_DFL in three places:

 - connect.c::git_connect() - initiators of git native
   protocol transfer are covered with this.

 - daemon.c::main() - obviously.

 - merge-index.c::main() - obviously.

There are other programs that do fork() but do not waitpid():
http-push, imap-send.  upload-pack does not either, but in the
case of that program, each of the forked halves runs exec()
another program, so this change would not have much effect
there.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19 18:44:58 -07:00
Junio C Hamano d281786fcd xdiff: minor changes to match libxdiff-0.21
This reformats the change 621c53cc08
introduced to match what upstream author implemented in libxdiff-0.21
without changing any logic (hopefully ;-).  This is to help keep
us in sync with the upstream.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19 18:43:49 -07:00
Junio C Hamano 0da4677149 fix rfc2047 formatter.
Running git-format-patch on patches from Lukas destroyed
the From: line.  This fixes it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19 18:43:30 -07:00
Dennis Stosberg 0e26f7a1c3 Fix t8001-annotate and t8002-blame for ActiveState Perl
There seems to be at least one implementation of Perl which requires the
user to specify an extension for backup files.

Reported by Alex Riesen.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19 18:43:20 -07:00
Linus Torvalds 855419f764 Add specialized object allocator
This creates a simple specialized object allocator for basic
objects.

This avoids wasting space with malloc overhead (metadata and
extra alignment), since the specialized allocator knows the
alignment, and that objects, once allocated, are never freed.

It also allows us to track some basic statistics about object
allocations. For example, for the mozilla import, it shows
object usage as follows:

     blobs:   627629 (14710 kB)
     trees:  1119035 (34969 kB)
   commits:   196423  (8440 kB)
      tags:     1336    (46 kB)

and the simpler allocator shaves off about 2.5% off the memory
footprint off a "git-rev-list --all --objects", and is a bit
faster too.

[ Side note: this concludes the series of "save memory in object storage".
  The thing is, there simply isn't much more to be saved on the objects.

  Doing "git-rev-list --all --objects" on the mozilla archive has a final
  total RSS of 131498 pages for me: that's about 513MB. Of that, the
  object overhead is now just 56MB, the rest is going somewhere else (put
  another way: the fact that this patch shaves off 2.5% of the total
  memory overhead, considering that objects are now not much more than 10%
  of the total shows how big the wasted space really was: this makes
  object allocations much more memory- and time-efficient).

  I haven't looked at where the rest is, but I suspect the bulk of it is
  just the pack-file loading. It may be that we should pack the tree
  objects separately from the blob objects: for git-rev-list --objects, we
  don't actually ever need to even look at the blobs, but since trees and
  blobs are interspersed in the pack-file, we end up not being dense in
  the tree accesses, so we end up looking at more pages than we strictly
  need to.

  So with a 535MB pack-file, it's entirely possible - even likely - that
  most of the remaining RSS is just the mmap of the pack-file itself. We
  don't need to map in _all_ of it, but we do end up mapping a fair
  amount. ]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19 18:42:21 -07:00
Johannes Schindelin 5f1a63e0ef Read configuration also from $HOME/.gitconfig
This patch is based on Pasky's, with three notable differences:

- I did not yet update the documentation
- I named it .gitconfig, not .gitrc
- git-repo-config does not barf when a unique key is overridden locally

The last means that if you have something like

	[alias]
		l = log --stat -M

in ~/.gitconfig, and

	[alias]
		l = log --stat -M next..

in $GIT_DIR/config, then

	git-repo-config alias.l

returns only one value, namely the value from $GIT_DIR/config.

If you set the environment variable GIT_CONFIG, $HOME/.gitconfig is not
read, and neither $GIT_DIR/config, but $GIT_CONFIG instead.

If you set GIT_CONFIG_LOCAL instead, it is interpreted instead of
$GIT_DIR/config, but $HOME/.gitconfig is still read.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19 17:53:13 -07:00
Johannes Schindelin 9c3796fc04 Fix setting config variables with an alternative GIT_CONFIG
When setting a config variable, git_config_set() ignored the variables
GIT_CONFIG and GIT_CONFIG_LOCAL. Now, when GIT_CONFIG_LOCAL is set, it
will write to that file. If not, GIT_CONFIG is checked, and only as a
fallback, the change is written to $GIT_DIR/config.

Add a test for it, and also future-proof the test for the upcoming
$HOME/.gitconfig support.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19 17:30:34 -07:00
Johannes Schindelin 928e47e3d5 Initialize lock_file struct to all zero.
hold_lock_file_for_update() relies on that.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19 17:04:27 -07:00
Jakub Narebski 75c84ddb46 Make CSS file gitweb/gitweb.css more readable
Taken from git://git.xmms.se/xmms2/gitweb-xmms2.git
commit  561262030d58a6325f500b36d836dbe02a5abc68
"Make CSS readable" by Daniel Svensson, with extra
parts removed and consistent whitespace usage.

[jc: tabified the results to cleaning things up, and removed an
 added item that was commented out. ]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19 13:13:07 -07:00
Junio C Hamano 275fb96ae6 Merge early parts of branch 'ff/c99' 2006-06-18 22:13:54 -07:00
Junio C Hamano 69c18d8872 Merge early parts of branch 'ls/am' 2006-06-18 22:13:11 -07:00
Lukas Sandström 854b4629f9 Make git-update-ref a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 22:12:20 -07:00
Lukas Sandström fefe81c996 Make git-update-index a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 22:12:19 -07:00
Lukas Sandström 7499c99615 Make git-stripspace a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 22:12:16 -07:00
Lukas Sandström 34488e3c37 Make git-mailinfo a builtin
[jc: with a bit of constness tightening]

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 22:10:28 -07:00
Lukas Sandström e690e84315 Make git-mailsplit a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 21:58:20 -07:00