aboutsummaryrefslogtreecommitdiff
path: root/builtin-fetch--tool.c
Commit message (Collapse)AuthorAge
* Replace calls to strbuf_init(&foo, 0) with STRBUF_INIT initializerBrandon Casey2008-10-12
| | | | | | | | | | | Many call sites use strbuf_init(&foo, 0) to initialize local strbuf variable "foo" which has not been accessed since its declaration. These can be replaced with a static initialization using the STRBUF_INIT macro which is just as readable, saves a function call, and takes up fewer lines. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Error out when user doesn't have access permission to the repositoryAndré Goddard Rosa2007-11-30
| | | | Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
* Add strchrnul()René Scharfe2007-11-09
| | | | | | | | | | As suggested by Pierre Habouzit, add strchrnul(). It's a useful GNU extension and can simplify string parser code. There are several places in git that can be converted to strchrnul(); as a trivial example, this patch introduces its usage to builtin-fetch--tool.c. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Improved const correctness for stringsShawn O. Pearce2007-10-21
| | | | Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Merge branch 'maint'Shawn O. Pearce2007-10-19
|\ | | | | | | | | | | | | | | | | | | * maint: Further 1.5.3.5 fixes described in release notes Avoid invoking diff drivers during git-stash attr: fix segfault in gitattributes parsing code Define NI_MAXSERV if not defined by operating system Ensure we add directories in the correct order Avoid scary errors about tagged trees/blobs during git-fetch
| * Avoid scary errors about tagged trees/blobs during git-fetchLinus Torvalds2007-10-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ok, what is going on is: - append_fetch_head() looks up the SHA1 for all heads (including tags): if (get_sha1(head, sha1)) return error("Not a valid object name: %s", head); - it then wants to check if it's a candidate for merging (because fetching also does the whole "list which heads to merge" in case it is going to be part of a "pull"): commit = lookup_commit_reference(sha1); if (!commit) not_for_merge = 1; - and that "lookup_commit_reference()" is just very vocal about the case where it fails. It really shouldn't be, and it shouldn't affect the actual end result, but that basically explains why you get that scary warning. In short, the warning is just bogus, and should be harmless, but I agree that it's ugly. I think the appended patch should fix it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | strbuf change: be sure ->buf is never ever NULL.Pierre Habouzit2007-09-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For that purpose, the ->buf is always initialized with a char * buf living in the strbuf module. It is made a char * so that we can sloppily accept things that perform: sb->buf[0] = '\0', and because you can't pass "" as an initializer for ->buf without making gcc unhappy for very good reasons. strbuf_init/_detach/_grow have been fixed to trust ->alloc and not ->buf anymore. as a consequence strbuf_detach is _mandatory_ to detach a buffer, copying ->buf isn't an option anymore, if ->buf is going to escape from the scope, and eventually be free'd. API changes: * strbuf_setlen now always works, so just make strbuf_reset a convenience macro. * strbuf_detatch takes a size_t* optional argument (meaning it can be NULL) to copy the buffer's len, as it was needed for this refactor to make the code more readable, and working like the callers. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Use xmemdupz() in many places.Pierre Habouzit2007-09-18
| | | | | | | | | | Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Now that cache.h needs strbuf.h, remove useless includes.Pierre Habouzit2007-09-16
| | | | | | | | | | | | Signed-off-by: Pierre Habouzit <madcoder@debian.org> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Use strbuf_read in builtin-fetch-tool.c.Pierre Habouzit2007-09-10
| | | | | | | | | | | | | | xrealloc.use --; Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Function for updating refs.Carlos Rica2007-09-05
|/ | | | | | | | | | | A function intended to be called from builtins updating refs by locking them before write, specially those that came from scripts using "git update-ref". [jc: with minor fixups] Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Make every builtin-*.c file #include "builtin.h"Peter Hagervall2007-07-14
| | | | | | | | | Make every builtin-*.c file #include "builtin.h". Also takes care of some declaration/definition mismatches. Signed-off-by: Peter Hagervall <hager@cs.umu.se> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'sv/checkout'Junio C Hamano2007-05-20
|\ | | | | | | | | * sv/checkout: git-update-ref: add --no-deref option for overwriting/detaching ref
| * git-update-ref: add --no-deref option for overwriting/detaching refSven Verdoolaege2007-05-10
| | | | | | | | | | | | | | | | git-checkout is also adapted to make use of this new option instead of the handcrafted command sequence. Signed-off-by: Sven Verdoolaege <skimo@kotnet.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Ensure return value from xread() is always stored into an ssize_tJohan Herland2007-05-15
|/ | | | | | | | | This patch fixes all calls to xread() where the return value is not stored into an ssize_t. The patch should not have any effect whatsoever, other than putting better/more appropriate type names on variables. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'maint'Junio C Hamano2007-04-29
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | * maint: http.c: Fix problem with repeated calls of http_init Add missing reference to GIT_COMMITTER_DATE in git-commit-tree documentation Fix import-tars fix. Update .mailmap with "Michael" Do not barf on too long action description Catch empty pathnames in trees during fsck Don't allow empty pathnames in fast-import import-tars: be nice to wrong directory modes git-svn: Added 'find-rev' command git shortlog documentation: add long options and fix a typo
| * Do not barf on too long action descriptionJunio C Hamano2007-04-29
| | | | | | | | | | | | | | Reflog message is primarily about easier identification, and leaving truncated entry is much better than dying. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | git-fetch: Fix "argument list too long"OGAWA Hirofumi2007-04-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If $ls_remote_result was too long, git-fetch--tool -s pick-rref "$rref" "$ls_remote_result" in git-fetch will fail with "argument list too long". This patch fixes git-fetch--tool and git-fetch by passing $ls_remote_result via stdin. Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | git-fetch--tool pick-rrefJunio C Hamano2007-04-10
|/ | | | | | | | This script helper takes list of fully qualified refnames and results from ls-remote and grabs only the lines for the named refs from the latter. Signed-off-by: Junio C Hamano <junkio@cox.net>
* builtin-fetch--tool: fix reflog notes.Junio C Hamano2007-02-28
| | | | | | | Also the verbose output had unnecessary SHA1 and not-for-merge markers leaked because append_fetch_head() cheated Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-fetch: retire update-local-ref which is not used anymore.Junio C Hamano2007-02-28
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* builtin-fetch--tool: make sure not to overstep ls-remote-result buffer.Junio C Hamano2007-02-27
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* fetch--tool: fix uninitialized buffer when reading from stdinJunio C Hamano2007-02-27
| | | | | | | The original code allocates too much space and forgets to NUL terminate the string. Signed-off-by: Junio C Hamano <junkio@cox.net>
* builtin-fetch--tool: adjust to updated sha1_object_info().Junio C Hamano2007-02-27
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* Allow fetch--tool to read from stdinJulian Phillips2007-02-13
| | | | | | | | | If the reflist is "-" then read the reflist data from stdin instead, this will allow the passing of more than 128K of reflist data - which won't fit in the environment passed by execve. Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-fetch: rewrite expand_ref_wildcard in CJunio C Hamano2007-02-13
| | | | | | | | This does not seem to make measurable improvement when dealing with 1000 unpacked refs, but we would need something like it if we were to do a full rewrite in C somedaoy. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-fetch: rewrite another shell loop in CJunio C Hamano2007-02-13
| | | | | | | | | | | Move another shell loop that canonicalizes the list of refs for underlying git-fetch-pack and fetch-native-store into C. This seems to shave the runtime for the same 1000 branch repository from 30 seconds down to 15 seconds (it used to be 2 and half minutes with the original version). Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-fetch: move more code into C.Junio C Hamano2007-02-13
| | | | | | | | | This adds "native-store" subcommand to git-fetch--tool to move a huge loop implemented in shell into C. This shaves about 70% of the runtime to fetch and update 1000 tracking branches with a single fetch. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-fetch--tool: start rewriting parts of git-fetch in C.Junio C Hamano2007-02-13
Signed-off-by: Junio C Hamano <junkio@cox.net>