summaryrefslogtreecommitdiff
path: root/builtin-upload-archive.c
AgeCommit message (Collapse)Author
2010-02-22Move 'builtin-*' into a 'builtin/' subdirectoryLinus Torvalds
This shrinks the top-level directory a bit, and makes it much more pleasant to use auto-completion on the thing. Instead of [torvalds@nehalem git]$ em buil<tab> Display all 180 possibilities? (y or n) [torvalds@nehalem git]$ em builtin-sh builtin-shortlog.c builtin-show-branch.c builtin-show-ref.c builtin-shortlog.o builtin-show-branch.o builtin-show-ref.o [torvalds@nehalem git]$ em builtin-shor<tab> builtin-shortlog.c builtin-shortlog.o [torvalds@nehalem git]$ em builtin-shortlog.c you get [torvalds@nehalem git]$ em buil<tab> [type] builtin/ builtin.h [torvalds@nehalem git]$ em builtin [auto-completes to] [torvalds@nehalem git]$ em builtin/sh<tab> [type] shortlog.c shortlog.o show-branch.c show-branch.o show-ref.c show-ref.o [torvalds@nehalem git]$ em builtin/sho [auto-completes to] [torvalds@nehalem git]$ em builtin/shor<tab> [type] shortlog.c shortlog.o [torvalds@nehalem git]$ em builtin/shortlog.c which doesn't seem all that different, but not having that annoying break in "Display all 180 possibilities?" is quite a relief. NOTE! If you do this in a clean tree (no object files etc), or using an editor that has auto-completion rules that ignores '*.o' files, you won't see that annoying 'Display all 180 possibilities?' message - it will just show the choices instead. I think bash has some cut-off around 100 choices or something. So the reason I see this is that I'm using an odd editory, and thus don't have the rules to cut down on auto-completion. But you can simulate that by using 'ls' instead, or something similar. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-23Merge branch 'tc/format-attribute'Junio C Hamano
* tc/format-attribute: Check the format of more printf-type functions
2009-11-18Merge branch 'np/maint-sideband-favor-status'Junio C Hamano
* np/maint-sideband-favor-status: give priority to progress messages
2009-11-16Check the format of more printf-type functionsTarmigan Casebolt
We already have these checks in many printf-type functions that have prototypes which are in header files. Add these same checks to some more prototypes in header functions and to static functions in .c files. cc: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-13give priority to progress messagesNicolas Pitre
In theory it is possible for sideband channel #2 to be delayed if pack data is quick to come up for sideband channel #1. And because data for channel #2 is read only 128 bytes at a time while pack data is read 8192 bytes at a time, it is possible for many pack blocks to be sent to the client before the progress message fifo is emptied, making the situation even worse. This would result in totally garbled progress display on the client's console as local progress gets mixed with partial remote progress lines. Let's prevent such situations by giving transmission priority to progress messages over pack data at all times. Signed-off-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-21Merge branch 'pb/maint-1.6.2-userdiff-fix'Junio C Hamano
* pb/maint-1.6.2-userdiff-fix: upload-archive: fix infinite loop on Cygwin avoid exponential regex match for java and objc function names
2009-06-18upload-archive: fix infinite loop on CygwinRené Scharfe
On Cygwin, poll() reports POLLIN even for file descriptors that have reached their end. This caused git upload-archive to be stuck in an infinite loop, as it only looked at the POLLIN flag. In addition to POLLIN, check if read() returned 0, which indicates end-of-file, and keep looping only as long as at least one of the file descriptors has input. This lets the following command finish on its own when run in a git repository on Cygwin, instead of it getting stuck after printing all file names: $ git archive -v --remote . HEAD >/dev/null Reported-by: Bob Kagy <bobkagy@gmail.com> Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-05improve missing repository error messageJeff King
Certain remote commands, when asked to do something in a particular directory that was not actually a git repository, would say "unable to chdir or not a git archive". The "chdir" bit is an unnecessary detail, and the term "git archive" is much less common these days than "git repository". So let's switch them all to: fatal: '%s' does not appear to be a git repository Signed-off-by: Jeff King <peff@peff.net> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-26archive: define MAX_ARGS where it's neededRene Scharfe
MAX_EXTRA_ARGS is not used anymore, so remove it. MAX_ARGS is used only in builtin-upload-archive.c, so define it there. Also report the actual value we're comparing against when the number of args is too big. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-26archive: add write_archive()Rene Scharfe
Both archive and upload-archive have to parse command line arguments and then call the archiver specific write function. Move the duplicate code to a new function, write_archive(). Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-17Merge branch 'sb/dashless'Junio C Hamano
* sb/dashless: Make usage strings dash-less t/: Use "test_must_fail git" instead of "! git" t/test-lib.sh: exit with small negagive int is ok with test_must_fail Conflicts: builtin-blame.c builtin-mailinfo.c builtin-mailsplit.c builtin-shortlog.c git-am.sh t/t4150-am.sh t/t4200-rerere.sh
2008-07-15archive: remove args member from struct archiverRené Scharfe
Pass struct archiver and struct archiver_args explicitly to parse_archive_args and remove the latter from the former. This allows us to get rid of struct archiver_desc and simplifies the code a bit. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13Make usage strings dash-lessStephan Beyer
When you misuse a git command, you are shown the usage string. But this is currently shown in the dashed form. So if you just copy what you see, it will not work, when the dashed form is no longer supported. This patch makes git commands show the dash-less version. For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh generates a dash-less usage string now. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-28avoid off-by-one error in run_upload_archiveJochen Voss
Make sure that buf has enough space to store the trailing \0 of the command line argument, too. Signed-off-by: Jochen Voss <voss@seehuhn.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-01-08short i/o: fix calls to read to use xread or read_in_fullAndy Whitcroft
We have a number of badly checked read() calls. Often we are expecting read() to read exactly the size we requested or fail, this fails to handle interrupts or short reads. Add a read_in_full() providing those semantics. Otherwise we at a minimum need to check for EINTR and EAGAIN, where this is appropriate use xread(). Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-20simplify inclusion of system header files.Junio C Hamano
This is a mechanical clean-up of the way *.c files include system header files. (1) sources under compat/, platform sha-1 implementations, and xdelta code are exempt from the following rules; (2) the first #include must be "git-compat-util.h" or one of our own header file that includes it first (e.g. config.h, builtin.h, pkt-line.h); (3) system headers that are included in "git-compat-util.h" need not be included in individual C source files. (4) "git-compat-util.h" does not have to include subsystem specific header files (e.g. expat.h). Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24builtin-upload-archive.c broken on openbsdRandal L. Schwartz
Looks like ctype again. Gotta be careful with that on BSD releases: $ gmake prefix=/opt/git all GIT_VERSION = 1.4.2.GIT gcc -o builtin-upload-archive.o -c -g -O2 -Wall -I/usr/local/include -DSHA1_HEADER='<openssl/sha.h>' -DNO_STRCASESTR builtin-upload-archive.c In file included from /usr/include/sys/poll.h:54, from builtin-upload-archive.c:11: /usr/include/ctype.h:68: error: syntax error before ']' token /usr/include/ctype.h:69: error: syntax error before ']' token ... /usr/include/sys/poll.h:53:1: unterminated #ifndef /usr/include/sys/poll.h:28:1: unterminated #ifndef gmake: *** [builtin-upload-archive.o] Error 1 This fixes it. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-17upload-archive: monitor child communication even more carefully.Franck Bui-Huu
The current code works like this: if others flags than POLLIN is raised we assume that (a) something bad happened and the child died or (b) the child has closed the pipe because it had no more data to send. For the latter case, we assume wrongly that one call to process_input() will empty the pipe. Indeed it reads only 16Ko of data by call and the the pipe capacity can be larger than that (on current Linux kernel, it is 65536 bytes). Therefore the child can write 32ko of data, for example, and close the pipe. After that poll will return POLLIN _and_ POLLHUP and the parent will read only 16ko of data. This patch forces the parent to empty the pipe as soon as POLLIN is raised and even if POLLHUP or something else is raised too. Moreover, some implementations of poll might return POLLRDNORM flag even if it is non standard. Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-13upload-archive: monitor child communication more carefully.Junio C Hamano
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-11Add sideband status report to git-archive protocolJunio C Hamano
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-09Add git-upload-archiveFranck Bui-Huu
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>