1
0
mirror of https://github.com/git/git.git synced 2024-10-06 01:31:26 +02:00
Commit Graph

6407 Commits

Author SHA1 Message Date
Liu Yubao
d48ffdbb0b Fix duplicate xmalloc in builtin-add
[jc: patch came without sign-off but it was too obvious and trivial.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-15 13:46:07 -07:00
Jakub Narebski
fc2b2be031 gitweb: Add git_project_index for generating index.aux
Add git_project_index, which generates index.aux file that can be used
as a source of projects list, instead of generating projects list from
a directory.  Using file as a source of projects list allows for some
projects to be not present in gitweb main (project_list) page, and/or
correct project owner info. And is probably faster.

Additionally it can be used to get the list of all available repositories
for scripts (in easily parseable form).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-14 22:54:40 -07:00
Jakub Narebski
c83a77e4e1 gitweb: Do not parse refs by hand, use git-peek-remote instead
This is in response to Linus's work on packed refs. Additionally it
makes gitweb work with symrefs, too.

Do not parse refs by hand, using File::Find and reading individual
heads to get hash of reference, but use git-peek-remote output
instead.  Assume that the hash for deref (with ^{}) always follows hash
for ref, and that we have derefs only for tag objects; this removes
call to git_get_type (and git-cat-file -t invocation) for tags, which
speeds "summary" and "tags" views generation, but might slow generation
of "heads" view a bit.  For now, we do not save and use the deref hash.

Remove git_get_hash_by_ref while at it, as git_get_refs_list was the
only place it was used.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-14 22:41:13 -07:00
Jakub Narebski
c0011ff8c8 gitweb: Use File::Find::find in git_get_projects_list
Earlier code to get list of projects when $projects_list is a
directory (e.g. when it is equal to $projectroot) had a hardcoded flat
(one level) list of directories.  Allow for projects to be in
subdirectories also for $projects_list being a directory by using
File::Find.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-14 22:38:19 -07:00
Dmitry V. Levin
5b6df8e45f Handle invalid argc gently
describe, git: Handle argc==0 case the same way as argc==1.
merge-tree: Refuse excessive arguments.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-14 11:48:11 -07:00
Linus Torvalds
7977f0ea53 Add "-h/-H" parsing to "git grep"
It turns out that I actually wanted to avoid the filenames (because I
didn't care - I just wanted to see the context in which something was
used) when doing a grep. But since "git grep" didn't take the "-h"
parameter, I ended up having to do "grep -5 -h *.c" instead.

So here's a trivial patch that adds "-h" (and thus has to enable -H too)
to "git grep" parsing.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-14 11:46:11 -07:00
Sasha Khapyorsky
38529e28a4 Trivial support for cloning and fetching via ftp://.
This adds trivial support for cloning and fetching via ftp://.

Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-13 23:39:43 -07:00
Dmitry V. Levin
b85c4bbbd7 Documentation: Fix broken links
core-tutorial.txt, cvs-migration.txt, tutorial-2.txt:
	Fix broken links.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-13 23:39:33 -07:00
Dmitry V. Levin
8112894d82 Make count-objects, describe and merge-tree work in subdirectory
Call setup_git_directory() to make these commands work in subdirectory.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-13 23:38:46 -07:00
Jeff King
db830b4f23 wt-status: remove extraneous newline from 'deleted:' output
This was accidentally introduced during the fixes to avoid putting newlines
inside of colorized output.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-13 23:37:57 -07:00
Rene Scharfe
2232c0c69f git-archive: inline default_parse_extra()
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-13 23:37:14 -07:00
Junio C Hamano
551029af30 Merge branches 'maint' and 'jc/http'
* maint:
  http-fetch: fix alternates handling.

* jc/http:
  http-fetch: fix alternates handling.
2006-09-13 23:36:03 -07:00
Junio C Hamano
1718aab3e4 Merge branch 'jc/unpack'
* jc/unpack:
  unpack-objects -r: call it "recover".
  unpack-objects desperately salvages objects from a corrupt pack
2006-09-13 13:00:02 -07:00
Junio C Hamano
3b67d2917a unpack-objects -r: call it "recover".
The code called this operation "desperate" but the option flag is -r
and the word "recover" describes what it does better.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-13 12:59:49 -07:00
Junio C Hamano
ae44b235d4 Merge branch 'jc/binary'
* jc/binary:
  diff --binary generates full index on binary files.
  Make apply --binary a no-op.
2006-09-13 12:39:02 -07:00
Junio C Hamano
f6e8dd3b43 Merge branch 'aw/send-pack'
* aw/send-pack:
  send-pack: switch to using git-rev-list --stdin
2006-09-13 12:30:20 -07:00
Franck Bui-Huu
8a5dbef8ac Test return value of finish_connect()
Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-13 12:20:15 -07:00
Junio C Hamano
883653babd http-fetch: fix alternates handling.
Fetch over http from a repository that uses alternates to borrow
from neighbouring repositories were quite broken, apparently for
some time now.

We parse input and count bytes to allocate the new buffer, and
when we copy into that buffer we know exactly how many bytes we
want to copy from where.  Using strlcpy for it was simply
stupid, and the code forgot to take it into account that strlcpy
terminated the string with NUL.

Signed-off-by: Junio C Hamano <junkio@cox.net>
v1.4.2.1
2006-09-13 00:54:43 -07:00
Junio C Hamano
5df1e0d05c http-fetch: fix alternates handling.
Fetch over http from a repository that uses alternates to borrow
from neighbouring repositories were quite broken, apparently for
some time now.

We parse input and count bytes to allocate the new buffer, and
when we copy into that buffer we know exactly how many bytes we
want to copy from where.  Using strlcpy for it was simply
stupid, and the code forgot to take it into account that strlcpy
terminated the string with NUL.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-13 00:33:14 -07:00
Jeff King
cdad8bbe92 contrib/vim: add syntax highlighting file for commits
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-13 00:31:58 -07:00
Jeff King
b982592d66 git-status: document colorization config options
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-12 23:20:17 -07:00
Johannes Schindelin
2074cb0af3 Teach runstatus about --untracked
Actually, teach runstatus what to do if it is not passed; it should not list
the contents of completely untracked directories, but only the name of that
directory (plus a trailing '/').

[jc: with comments by Jeff King to match hide-empty-directories
 behaviour of the original.]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-12 23:20:17 -07:00
Junio C Hamano
4321134cd8 pack-objects: document --revs, --unpacked and --all.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-12 22:59:15 -07:00
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
Christian Couder
6d2489235f Fix space in string " false" problem in "trace.c".
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-12 22:36:19 -07:00
Franck Bui-Huu
f42a5c4eb0 connect.c: finish_connect(): allow null pid parameter
git_connect() can return 0 if we use git protocol for example.
Users of this function don't know and don't care if a process
had been created or not, and to avoid them to check it before
calling finish_connect() this patch allows finish_connect() to
take a null pid. And in that case return 0.

[jc: updated function signature of git_connect() with a comment on
 its return value. ]

Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-12 22:30:32 -07:00
Christian Couder
0f503d77ac Fix a memory leak in "connect.c" and die if command too long.
Use "add_to_string" instead of "sq_quote" and "snprintf", so
that there is no memory allocation and no memory leak.
Also check if the command is too long to fit into the buffer
and die if this is the case, instead of truncating it to the
buffer size.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-10 22:48:11 -07:00
Christian Couder
86257aa324 Move add_to_string to "quote.c" and make it extern.
So that this function may be used in places other than "rsh.c".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-10 22:47:30 -07:00
Jakub Narebski
8be683520e gitweb: Paginate history output
git_history output is now divided into pages, like git_shortlog,
git_tags and git_heads output. As whole git-rev-list output is now
read into array before writing anything, it allows for better
signaling of errors.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-10 19:33:09 -07:00
Jakub Narebski
04f7a94f65 gitweb: Make pickaxe search a feature
As pickaxe search (selected using undocumented 'pickaxe:' operator in
search query) is resource consuming, allow to turn it on/off using
feature meachanism.  Turned on by default, for historical reasons.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-10 19:32:58 -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
Jeff King
c91f0d92ef git-commit.sh: convert run_status to a C builtin
This creates a new git-runstatus which should do roughly the same thing
as the run_status function from git-commit.sh. Except for color support,
the main focus has been to keep the output identical, so that it can be
verified as correct and then used as a C platform for other improvements to
the status printing code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-08 16:46:35 -07:00
Jeff King
7c92fe0eaa Move color option parsing out of diff.c and into color.[ch]
The intent is to lib-ify colorizing code so it can be reused.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-08 16:44:10 -07:00
Jeff King
0424558190 diff: support custom callbacks for output
Users can request the DIFF_FORMAT_CALLBACK output format to get a callback
consisting of the whole diff_queue_struct.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-07 15:40:25 -07:00