1
0
mirror of https://github.com/git/git.git synced 2024-10-01 11:51:22 +02:00
Commit Graph

6216 Commits

Author SHA1 Message Date
Junio C Hamano
d751864cf7 builtin-archive.c: rename remote_request() to extract_remote_arg()
Suggested by Franck, and I think it makes sense.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-12 22:43:22 -07:00
Junio C Hamano
d3788e19e2 upload-archive: monitor child communication more carefully.
Franck noticed that the code around polling and relaying messages
from the child process was quite bogus.  Here is an attempt to
clean it up a bit, based on his patch:

 - When POLLHUP is set, it goes ahead and reads the file
   descriptor.  Worse yet, it does not check the return value of
   read() for errors when it does.

 - When we processed one POLLIN, we should just go back and see
   if any more data is available.  We can check if the child is
   still there when poll gave control back at us but without any
   actual input.

[jc: with simplification suggested by Franck. ]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-12 22:39:45 -07:00
Junio C Hamano
23d6d112c0 Add sideband status report to git-archive protocol
Using the refactored sideband code from existing upload-pack protocol,
this lets the error condition and status output sent from the remote
process to be shown locally.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-10 18:10:55 -07:00
Junio C Hamano
56f9686c4d Merge branch 'jc/sideband' into jc/archive
* jc/sideband:
  Prepare larger packet buffer for upload-pack protocol.
  Move sideband server side support into reusable form.
  Move sideband client side support into reusable form.
  get_sha1_hex() micro-optimization
2006-09-10 17:58:45 -07:00
Junio C Hamano
d47f3db75c Prepare larger packet buffer for upload-pack protocol.
The original side-band support added to the upload-pack protocol used the
default 1000-byte packet length.  The pkt-line format allows up to 64k, so
prepare the receiver for the maximum size, and have the uploader and
downloader negotiate if larger packet length is allowed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-10 16:27:08 -07:00
Junio C Hamano
fe5ab763f8 Teach --exec to git-archive --remote
Some people needed --exec to specify the location of the upload-pack
executable, because their default SSH log-in does not include the
directory they have their own private copy of git on the $PATH.
These people need to be able to say --exec to git-archive --remote
for the same reason.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-10 13:39:32 -07:00
Junio C Hamano
e0ffb24877 Add --verbose to git-archive
And teach backends about it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from 9e2c44a2893ae90944a0b7c9f40a9d22b759b5c0 commit)
2006-09-10 13:39:25 -07:00
Junio C Hamano
8142f603b9 archive: force line buffered output to stderr
Otherwise the remote notification that comes with -v option can get
clumped together.

Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from a675cda60ead41f439b04bc69e0f19ace04e59d3 commit)
2006-09-10 13:39:24 -07:00
Rene Scharfe
326711c168 Use xstrdup instead of strdup in builtin-{tar,zip}-tree.c
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from 5d2aea4cb383a43e40d47ab69d8ad7a495df6ea2 commit)
2006-09-10 13:39:01 -07:00
Junio C Hamano
958c24b1b8 Move sideband server side support into reusable form.
The server side support; this is just the very low level, and the
caller needs to know which band it wants to send things out.

Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from b786552b67878c7780c50def4c069d46dc54efbe commit)
2006-09-10 13:36:50 -07:00
Junio C Hamano
49a52b1d1f Move sideband client side support into reusable form.
This moves the receiver side of the sideband support from
fetch-clone.c to sideband.c and its header file, so that
archiver protocol can use it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-10 13:36:35 -07:00
Junio C Hamano
37f944363d archive: allow remote to have more formats than we understand.
This fixes git-archive --remote not to parse archiver arguments;
otherwise if the remote end implements formats other than the
one known locally we will not be able to access that format.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-09 23:57:46 -07:00
Junio C Hamano
a41fae9c46 get_sha1_hex() micro-optimization
The function appeared high on a gprof output for a rev-list run of
a non-trivial size, and it was an obvious low-hanging fruit.

The code is from Linus.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-09 22:21:27 -07:00
Rene Scharfe
854c4168e7 git-archive: make compression level of ZIP archives configurable
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-09 13:39:57 -07:00
Franck Bui-Huu
39345a216f Add git-upload-archive
This command implements the git archive protocol on the server
side. This command is not intended to be used by the end user.
Underlying git-archive command line options are sent over the
protocol from "git-archive --remote=...", just like upload-tar
currently does with "git-tar-tree=...".

As for "git-archive" command implementation, this new command
does not execute any existing "git-{tar,zip}-tree" but rely
on the archive API defined by "git-archive" patch. Hence we
get 2 good points:

 - "git-archive" and "git-upload-archive" share all option
   parsing code.

 - All kind of git-upload-{tar,zip} can be deprecated.

Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-09 11:57:37 -07:00
Franck Bui-Huu
ec06bff5e6 git-archive: wire up ZIP format.
Again, this is based on Rene Scharfe's earlier patch, but uses
the archiver support introduced by the previous patch.

Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
Acked-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-09 11:57:37 -07:00
Franck Bui-Huu
efd8696cd7 git-archive: wire up TAR format.
This is based on Rene Scharfe's earlier patch, but uses the
archiver support introduced by the previous patch.

Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
Acked-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-09 11:57:37 -07:00
Franck Bui-Huu
4df096a5ca Add git-archive
git-archive is a command to make TAR and ZIP archives of a git tree.
It helps prevent a proliferation of git-{format}-tree commands.

Instead of directly calling git-{tar,zip}-tree command, it defines
a very simple API, that archiver should implement and register in
"git-archive.c". This API is made up by 2 functions whose prototype
is defined in "archive.h" file.

 - The first one is used to parse 'extra' parameters which have
   signification only for the specific archiver. That would allow
   different archive backends to have different kind of options.

 - The second one is used to ask to an archive backend to build
   the archive given some already resolved parameters.

The main reason for making this API is to avoid using
git-{tar,zip}-tree commands, hence making them useless. Maybe it's
time for them to die ?

It also implements remote operations by defining a very simple
protocol: it first sends the name of the specific uploader followed
the repository name (git-upload-tar git://example.org/repo.git).
Then it sends options. It's done by sending a sequence of one
argument per packet, with prefix "argument ", followed by a flush.

The remote protocol is implemented in "git-archive.c" for client
side and is triggered by "--remote=<repo>" option. For example,
to fetch a TAR archive in a remote repo, you can issue:

$ git archive --format=tar --remote=git://xxx/yyy/zzz.git HEAD

We choose to not make a new command "git-fetch-archive" for example,
avoind one more GIT command which should be nice for users (less
commands to remember, keeps existing --remote option).

Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
Acked-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-09 11:57:36 -07:00
Jakub Narebski
2878836c50 autoconf: Add config.cache to .gitignore
Add generated file config.cache (default cache file, when running
./configure with -C, --config-cache option) to the list of ignored
files.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-07 13:04:33 -07:00
Jakub Narebski
baf1219acb autoconf: Add support for setting NO_ICONV and ICONVDIR
Add support for ./configure options --without-iconv (if neither libc
nor libiconv properly support iconv), and for --with-iconv=PATH (to
set prefix to libiconv library and headers, used only when
NEED_LIBICONV is set).  While at it, make ./configure set or unset
NO_ICONV always (it is not autodetected in Makefile).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-07 13:04:21 -07:00
Jakub Narebski
6ff88de7f7 autoconf: Set NO_ICONV if iconv is found neither in libc, nor in libiconv
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-07 13:02:29 -07:00
Junio C Hamano
7bbf88c52b Merge branch 'jc/daemon'
* jc/daemon:
  Revert "daemon: add upload-tar service."
  multi-service daemon: documentation
  daemon: add upload-tar service.
2006-09-07 02:37:18 -07:00
Junio C Hamano
d9edcbd606 Revert "daemon: add upload-tar service."
This reverts parts of commit 74c0cc2 and part of commit 355f541.

Franck and Rene are working on a unified upload-archive which
would supersede this when done, so better not to get in their
way.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-07 02:36:31 -07:00
Junio C Hamano
8895cbcda1 Merge branch 'pm/diff'
* pm/diff:
  diff-index --cc shows a 3-way diff between HEAD, index and working tree.
2006-09-07 01:33:45 -07:00
Martin Langhoff
0ea2582d1c git-repack: create new packs inside $GIT_DIR, not cwd
Avoid failing when cwd is !writable by writing the
packfiles in $GIT_DIR, which is more in line with other commands.

Without this, git-repack was failing when run from crontab
by non-root user accounts. For large repositories, this
also makes the mv operation a lot cheaper, and avoids leaving
temp packfiles around the fs upon failure.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-06 00:21:57 -07:00
Junio C Hamano
42cabc341c Teach rev-list an option to read revs from the standard input.
When --stdin option is given, in addition to the <rev>s listed
on the command line, the command can read one rev parameter per
line from the standard input.  The list of revs ends at the
first empty line or EOF.

Note that you still have to give all the flags from the command
line; only rev arguments (including A..B, A...B, and A^@ notations)
can be give from the standard input.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-05 21:39:02 -07:00
Junio C Hamano
5d6f0935e6 revision.c: allow injecting revision parameters after setup_revisions().
setup_revisions() wants to get all the parameters at once and
then postprocesses the resulting revs structure after it is done
with them.  This code structure is a bit cumbersome to deal with
efficiently when we want to inject revision parameters from the
side (e.g. read from standard input).

Fortunately, the nature of this postprocessing is not affected by
revision parameters; they are affected only by flags.  So it is
Ok to do add_object() after the it returns.

This splits out the code that deals with the revision parameter
out of the main loop of setup_revisions(), so that we can later
call it from elsewhere after it returns.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-05 21:28:36 -07:00
Christian Couder
0caea90be0 Fix memory leak in prepend_to_path (git.c).
Some memory was allocated for a new path but not freed
after the path was used.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-05 17:40:49 -07:00
Andy Whitcroft
c41e20b30b send-pack: remove remote reference limit
When build a pack for a push we query the remote copy for existant
heads.  These are used to prune unnecessary objects from the pack.
As we receive the remote references in get_remote_heads() we validate
the reference names via check_ref() which includes a length check;
rejecting those >45 characters in size.

This is a miss converted change, it was originally designed to reject
messages which were less than 45 characters in length (a 40 character
sha1 and refs/) to prevent comparing unitialised memory.  check_ref()
now gets the raw length so check for at least 5 characters.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-05 17:40:46 -07:00
Jakub Narebski
825b045f52 autoconf: Fix copy'n'paste error
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-05 13:36:19 -07:00
Paul Mackerras
cb2b9f5ee1 diff-index --cc shows a 3-way diff between HEAD, index and working tree.
This implements a 3-way diff between the HEAD commit, the state in the
index, and the working directory.  This is like the n-way diff for a
merge, and uses much of the same code.  It is invoked with the -c flag
to git-diff-index, which it already accepted and did nothing with.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-05 00:13:25 -07:00
Junio C Hamano
8f5d6b469f Merge branch 'jc/pack'
* jc/pack:
  more lightweight revalidation while reusing deflated stream in packing
  pack-objects: fix thinko in revalidate code
  pack-objects: re-validate data we copy from elsewhere.
2006-09-04 18:57:35 -07:00
Jakub Narebski
f685d07de0 autoconf: Quote AC_CACHE_CHECK arguments
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-04 18:56:09 -07:00
Jakub Narebski
f8affe317d autoconf: Check for subprocess.py
Add custom test for checking if Python comes with subprocess.py, or
should we use our own subprocess.py by defining WITH_OWN_SUBPROCESS_PY.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-04 18:55:35 -07:00
Jakub Narebski
c23cca1720 autoconf: Add -liconv to LIBS when NEEDS_LIBICONV
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-04 18:54:27 -07:00
Jakub Narebski
762c7205f6 gitweb: Divide page path into directories -- path's "breadcrumbs"
Divide page path into directories, so that each part of path links to
the "tree" view of the $hash_base (or HEAD, if $hash_base is not set)
version of the directory.

If the entity is blob, final part (basename) links to $hash_base or
HEAD revision of the "raw" blob ("blob_plain" view).  If the entity is
tree, link to the "tree" view.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-04 15:46:44 -07:00
Jakub Narebski
72dbafa1e6 gitweb: Correct typo: '==' instead of 'eq' in git_difftree_body
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-04 15:46:32 -07:00
Jakub Narebski
0b5deba132 gitweb: Add GIT favicon, assuming image/png type
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-04 15:33:04 -07:00
Linus Torvalds
5d44cd1c8b Fix git-fsck-objects SIGSEGV/divide-by-zero
If you try to fsck a repository that isn't entirely empty, but that has no
inter-object references (ie all the objects are blobs, and don't refer to
anything else), git-fsck-objects currently fails.

This probably cannot happen in practice, but can be tested with something
like

	git init-db
	touch dummy
	git add dummy
	git fsck-objects

where the fsck will die by a divide-by-zero when it tries to look up the
references from the one object it found (hash_obj() will do a modulus by
refs_hash_size).

On some other archiectures (ppc, sparc) the divide-by-zero will go
unnoticed, and we'll instead SIGSEGV when we hit the "refs_hash[j]"
access.

So move the test that should protect against this from mark_reachable()
into lookup_object_refs(), which incidentally in the process also fixes
mark_reachable() itself (it used to not mark the one object that _was_
reachable, because it decided that it had no refs too early).

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-04 15:24:10 -07:00
Junio C Hamano
72518e9c26 more lightweight revalidation while reusing deflated stream in packing
When copying from an existing pack and when copying from a loose
object with new style header, the code makes sure that the piece
we are going to copy out inflates well and inflate() consumes
the data in full while doing so.

The check to see if the xdelta really apply is quite expensive
as you described, because you would need to have the image of
the base object which can be represented as a delta against
something else.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-03 21:09:18 -07:00
Jakub Narebski
f2e609473c gitweb: Change the name of diff to parent link in "commit" view to "diff
Change the name of diff to parent (current commit to one of parents)
link in "commit" view (git_commit subroutine) from "commitdiff" to
"diff".  Let's leave "commitdiff" for equivalent of git-show, or
git-diff-tree with one revision, i.e. diff for a given commit to its
parent (parents).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-03 16:15:11 -07:00
Junio C Hamano
7042dbf7a1 pack-objects: fix thinko in revalidate code
When revalidating an entry from an existing pack entry->size and
entry->type are not necessarily the size of the final object
when the entry is deltified, but for base objects they must
match.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-03 14:44:46 -07:00
Christian Couder
2886bdb118 Update GIT_TRACE documentation.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-03 14:18:55 -07:00
Junio C Hamano
1bbb2cff62 Merge branch 'master' into cc/trace
* master:
  Trace into a file or an open fd and refactor tracing code.
  Replace uses of strdup with xstrdup.
  consolidate two copies of new style object header parsing code.
  Documentation: Fix howto/revert-branch-rebase.html generation
  fmt-merge-msg: fix off-by-one bug
  git-rev-list(1): group options; reformat; document more options
  Constness tightening for move/link_temp_to_file()
  gitweb: Fix git_blame
  Include config.mak.autogen in the doc Makefile
  Use xmalloc instead of malloc
  git(7): move gitk(1) to the list of porcelain commands
  gitk: Fix some bugs in the new cherry-picking code
  gitk: Improve responsiveness while reading and layout out the graph
  gitk: Update preceding/following tag info when creating a tag
  gitk: Add a menu item for cherry-picking commits
  gitk: Fix a couple of buglets in the branch head menu items
  gitk: Add a context menu for heads
  gitk: Add a row context-menu item for creating a new branch
  gitk: Recompute ancestor/descendent heads/tags when rereading refs
  gitk: Minor cleanups
2006-09-02 17:10:16 -07:00
Junio C Hamano
df6d61017a pack-objects: re-validate data we copy from elsewhere.
When reusing data from an existing pack and from a new style
loose objects, we used to just copy it staight into the
resulting pack.  Instead make sure they are not corrupt, but
do so only when we are not streaming to stdout, in which case
the receiving end will do the validation either by unpacking
the stream or by constructing the .idx file.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-02 17:08:10 -07:00
Christian Couder
6ce4e61f1b Trace into a file or an open fd and refactor tracing code.
If GIT_TRACE is set to an absolute path (starting with a
'/' character), we interpret this as a file path and we
trace into it.

Also if GIT_TRACE is set to an integer value greater than
1 and lower than 10, we interpret this as an open fd value
and we trace into it.

Note that this behavior is not compatible with the
previous one.

We also trace whole messages using one write(2) call to
make sure messages from processes do net get mixed up in
the middle.

This patch makes it possible to get trace information when
running "make test".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-02 14:47:53 -07:00
Shawn Pearce
9befac470b Replace uses of strdup with xstrdup.
Like xmalloc and xrealloc xstrdup dies with a useful message if
the native strdup() implementation returns NULL rather than a
valid pointer.

I just tried to use xstrdup in new code and found it to be missing.
However I expected it to be present as xmalloc and xrealloc are
already commonly used throughout the code.

[jc: removed the part that deals with last_XXX, which I am
 finding more and more dubious these days.]

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-02 03:24:37 -07:00
Junio C Hamano
ad1ed5ee89 consolidate two copies of new style object header parsing code.
Also while we are at it, remove redundant typename[] array from
unpack_sha1_header.  The only reason it is different from the
type_names[] array in object.c module is that this code cares
about the subset of object types that are valid in a loose
object, so prepare a separate array of boolean that tells us
which types are valid, and share the name translation with the
others.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-01 15:17:01 -07:00
Sergey Vlasov
501524e938 Documentation: Fix howto/revert-branch-rebase.html generation
The rule for howto/*.html used "$?", which expands to the list of all
newer prerequisites, including asciidoc.conf added by another rule.
"$<" should be used instead.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-01 12:41:34 -07:00
Johannes Schindelin
af04b12710 fmt-merge-msg: fix off-by-one bug
Thanks to the recent malloc()->xmalloc() change, and XMALLOC_POISON, this bug
was found.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-01 05:20:03 -07:00