summaryrefslogtreecommitdiff
path: root/transport.c
AgeCommit message (Collapse)Author
2008-10-22Merge branch 'rs/alloc-ref'Junio C Hamano
* rs/alloc-ref: make alloc_ref_from_str() the new alloc_ref() use alloc_ref_from_str() everywhere add alloc_ref_with_prefix()
2008-10-18make alloc_ref_from_str() the new alloc_ref()René Scharfe
With all calls to alloc_ref() gone, we can remove it and then we're free to give alloc_ref_from_str() the shorter name. It's a much nicer interface, as the callers always need to have a name string when they allocate a ref anyway and don't need to calculate and pass its length+1 any more. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-18use alloc_ref_from_str() everywhereRené Scharfe
Replace pairs of alloc_ref() and strcpy() with alloc_ref_from_str(), simplifying the code. In connect.c, also a pair of alloc_ref() and memcpy() is replaced -- the additional cost of a strlen() call should not have too much of an impact. Consistency and simplicity are more important. In remote.c, the code was allocating 11 bytes more than needed for the name part, but I couldn't see them being used for anything. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-09Implement git clone -vMiklos Vajna
The new -v option forces the progressbar, even in case the output is not a terminal. This can be useful if the caller is an IDE or wrapper which wants to scrape the progressbar from stderr and show its information in a different format. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-06Merge branch 'maint'Shawn O. Pearce
* maint: Update release notes for 1.6.0.3 Teach rebase -i to honor pre-rebase hook docs: describe pre-rebase hook do not segfault if make_cache_entry failed make prefix_path() never return NULL fix bogus "diff --git" header from "diff --no-index" Fix fetch/clone --quiet when stdout is connected builtin-blame: Fix blame -C -C with submodules. bash: remove fetch, push, pull dashed form leftovers Conflicts: diff.c
2008-10-06Fix fetch/clone --quiet when stdout is connectedTuncer Ayaz
Fixes the `git clone --quiet` issue raised by Dave Jones in http://marc.info/?l=git&m=121529226023180&w=2 With this simple patch applied we no longer see the following remote messages as no-progress is correctly sent to the remote site: remote: Counting objects: 84102, done. remote: Compressing objects: 100% (24720/24720), done. remote: Total 84102 (delta 60949), reused 80810 (delta 57900) Signed-off-by: Tuncer Ayaz <tuncer.ayaz@gmail.com> Acked-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-09push: prepare sender to receive extended ref information from the receiverJunio C Hamano
"git push" enhancement allows the receiving end to report not only its own refs but refs in repositories it borrows from via the alternate object store mechanism. By telling the sender that objects reachable from these extra refs are already complete in the receiving end, the number of objects that need to be transfered can be cut down. These entries are sent over the wire with string ".have", instead of the actual names of the refs. This string was chosen so that they are ignored by older programs at the sending end. If we sent some random but valid looking refnames for these entries, "matching refs" rule (triggered when running "git push" without explicit refspecs, where the sender learns what refs the receiver has, and updates only the ones with the names of the refs the sender also has) and "delete missing" rule (triggered when "git push --mirror" is used, where the sender tells the receiver to delete the refs it itself does not have) would try to update/delete them, which is not what we want. This prepares the send-pack (and "push" that runs native protocol) to accept extended existing ref information and make use of it. The ".have" entries are excluded from ref matching rules, and are exempt from deletion rule while pushing with --mirror option, but are still used for pack generation purposes by providing more "bottom" range commits. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-09Merge branch 'maint'Junio C Hamano
* maint: asciidoc markup fixes Fail properly when cloning from invalid HTTP URL Conflicts: Documentation/git-push.txt
2008-08-07Fail properly when cloning from invalid HTTP URLPetr Baudis
Currently, when cloning from invalid HTTP URL, git clone will possibly return curl error, then a confusing message about remote HEAD and then return success and leave an empty repository behind, confusing either the end-user or the automated service calling it (think repo.or.cz). This patch changes the error() calls in get_refs_via_curl() to die()s, akin to the other get_refs_*() functions. Cc: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-06Merge branch 'qq/maint'Junio C Hamano
* qq/maint: clone -q: honor "quiet" option over native transports. attribute documentation: keep EXAMPLE at end builtin-commit.c: Use 'git_config_string' to get 'commit.template' http.c: Use 'git_config_string' to clean up SSL config. diff.c: Use 'git_config_string' to get 'diff.external' convert.c: Use 'git_config_string' to get 'smudge' and 'clean' builtin-log.c: Use 'git_config_string' to get 'format.subjectprefix' and 'format.suffix' Documentation cvs: Clarify when a bare repository is needed Documentation: be precise about which date --pretty uses Conflicts: Documentation/gitattributes.txt
2008-07-06clone -q: honor "quiet" option over native transports.Junio C Hamano
The earlier built-in conversion seems to have broken "git-clone"; this teaches the command to honor the "-q" option again when talking to the remote end over native transports (file://, git:// and ssh://). Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26Windows: Disambiguate DOS style paths from SSH URLs.Johannes Sixt
If on Windows a path is specified as C:/path, then this is also a valid SSH URL. To disambiguate between the two interpretations we take an URL that looks like a path with a drive letter as a local URL. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
2008-05-25Merge branch 'db/clone-in-c'Junio C Hamano
* db/clone-in-c: Add test for cloning with "--reference" repo being a subset of source repo Add a test for another combination of --reference Test that --reference actually suppresses fetching referenced objects clone: fall back to copying if hardlinking fails builtin-clone.c: Need to closedir() in copy_or_link_directory() builtin-clone: fix initial checkout Build in clone Provide API access to init_db() Add a function to set a non-default work tree Allow for having for_each_ref() list extra refs Have a constant extern refspec for "--tags" Add a library function to add an alternate to the alternates file Add a lockfile function to append to a file Mark the list of refs to fetch as const Conflicts: cache.h t/t5700-clone-reference.sh
2008-05-11alloc_ref_from_str(): factor out a common pattern of alloc_ref from stringKrzysztof Kowalczyk
Also fix an underallocation in walker.c::interpret_target(). Signed-off-by: Krzysztof Kowalczyk <kkowalczyk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05Mark the list of refs to fetch as constDaniel Barkalow
Fetching the objects doesn't actually modify the list in any of the code paths, so this will allow code that fetches the entire (const) list of available refs to just pass the list in directly. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-27Make ls-remote http://... list HEAD, like for git://...Daniel Barkalow
This makes a struct ref able to represent a symref, and makes http.c able to recognize one, and makes transport.c look for "HEAD" as a ref in the list, and makes it dereference symrefs for the resulting ref, if any. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-05Teach git-fetch to exploit server side automatic tag followingShawn O. Pearce
If the remote peer upload-pack process supports the include-tag protocol extension then we can avoid running a second fetch cycle on the client side by letting the server send us the annotated tags along with the objects it is packing for us. In the following graph we can now fetch both "tag1" and "tag2" on the same connection that we fetched "master" from the remote when we only have L available on the local side: T - tag1 S - tag2 / / L - o ------ o ------ B \ \ \ \ origin/master master The objects for "tag1" are implicitly downloaded without our direct knowledge. The existing "quickfetch" optimization within git-fetch discovers that tag1 is complete after the first connection and does not open a second connection. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-02Merge branch 'mh/maint-http-proxy-fix'Junio C Hamano
* mh/maint-http-proxy-fix: Set proxy override with http_init()
2008-02-29Always use the current connection's remote ref list in git protocolDaniel Barkalow
We always report to the user the list of refs we got from the first connection, even if we do multiple connections. But we should always use each connection's own list of refs in the communication with the server, in case we got a different server out of DNS rotation or the timing was surprising or something. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-27Set proxy override with http_init()Mike Hommey
In transport.c, proxy setting (the one from the remote conf) was set through curl_easy_setopt() call, while http.c already does the same with the http.proxy setting. We now just use this infrastructure instead, and make http_init() now take the struct remote as argument so that it can take the http_proxy setting from there, and any other property that would be added later. At the same time, we make get_http_walker() take a struct remote argument too, and pass it to http_init(), which makes remote defined proxy be used for more than get_refs_via_curl(). We leave out http-fetch and http-push, which don't use remotes for the moment, purposefully. Signed-off-by: Mike Hommey <mh@glandium.org> Acked-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-12Merge branch 'db/no-separate-ls-remote-connection' (early part)Junio C Hamano
* 'db/no-separate-ls-remote-connection' (early part): Fix "git clone" for git:// protocol Reduce the number of connects when fetching
2008-02-11Work around curl-gnutls not liking to be reinitializedMike Hommey
curl versions 7.16.3 to 7.18.0 included had a regression in which https requests following curl_global_cleanup/init sequence would fail with ASN1 parser errors with curl-gnutls. Such sequences happen in some cases such as git fetch. We work around this by removing the http_init and http_cleanup calls from get_refs_via_curl, replacing them with a transport->data initialization with the http_walker (which does http_init). While the http_walker is not currently used in get_refs_via_curl, http and walker code refactor will make it use it. Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-10Work around curl-gnutls not liking to be reinitializedMike Hommey
curl versions 7.16.3 to 7.18.0 included had a regression in which https requests following curl_global_cleanup/init sequence would fail with ASN1 parser errors with curl-gnutls. Such sequences happen in some cases such as git fetch. We work around this by removing the http_init and http_cleanup calls from get_refs_via_curl, replacing them with a transport->data initialization with the http_walker (which does http_init). While the http_walker is not currently used in get_refs_via_curl, http and walker code refactor will make it use it. Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-05Reduce the number of connects when fetchingDaniel Barkalow
This shares the connection between getting the remote ref list and getting objects in the first batch. (A second connection is still used to follow tags). When we do not fetch objects (i.e. either ls-remote disconnects after getting list of refs, or we decide we are already up-to-date), we clean up the connection properly; otherwise the connection is left open in need of cleaning up to avoid getting an error message from the remote end when ssh is used. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-04Don't access line[-1] for a zero-length "line" from fgets.Jim Meyering
A NUL byte at beginning of file, or just after a newline would provoke an invalid buf[-1] access in a few places. * builtin-grep.c (cmd_grep): Don't access buf[-1]. * builtin-pack-objects.c (get_object_list): Likewise. * builtin-rev-list.c (read_revisions_from_stdin): Likewise. * bundle.c (read_bundle_header): Likewise. * server-info.c (read_pack_info_file): Likewise. * transport.c (insert_packed_refs): Likewise. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-15Use strbuf in http codeMike Hommey
Also, replace whitespaces with tabs in some places Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-15Avoid redundant declaration of missing_target()Mike Hommey
Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06do not discard status in fetch_refs_via_pack()Junio C Hamano
The code calls fetch_pack() to get the list of refs it fetched, and discards refs and always returns 0 to signal success. But builtin-fetch-pack.c::fetch_pack() has error cases. The function returns NULL if error is detected (shallow-support side seems to choose to die but I suspect that is easily fixable to error out as well). Make fetch_refs_via_pack() propagate that error to the caller. Acked-By: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-04Add remote.<name>.proxySam Vilain
As well as allowing a default http.proxy option, allow it to be set per-remote. Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-25Merge branch 'jk/send-pack'Junio C Hamano
* jk/send-pack: (24 commits) send-pack: cluster ref status reporting send-pack: fix "everything up-to-date" message send-pack: tighten remote error reporting make "find_ref_by_name" a public function Fix warning about bitfield in struct ref send-pack: assign remote errors to each ref send-pack: check ref->status before updating tracking refs send-pack: track errors for each ref git-push: add documentation for the newly added --mirror mode Add tests for git push'es mirror mode Update the tracking references only if they were succesfully updated on remote Add a test checking if send-pack updated local tracking branches correctly git-push: plumb in --mirror mode Teach send-pack a mirror mode send-pack: segfault fix on forced push Reteach builtin-ls-remote to understand remotes send-pack: require --verbose to show update of tracking refs receive-pack: don't mention successful updates more terse push output Build in ls-remote ...
2007-11-21avoid "defined but not used" warning for fetch_objs_via_walkerJeff King
Because this function is static and used only by the http-walker, when NO_CURL is defined, gcc emits a "defined but not used" warning. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14Merge branch 'aw/mirror-push' into jk/send-packJunio C Hamano
* aw/mirror-push: git-push: add documentation for the newly added --mirror mode Add tests for git push'es mirror mode git-push: plumb in --mirror mode Teach send-pack a mirror mode send-pack: segfault fix on forced push send-pack: require --verbose to show update of tracking refs receive-pack: don't mention successful updates more terse push output Conflicts: transport.c transport.h
2007-11-14Merge branch 'db/remote-builtin' into jk/send-packJunio C Hamano
* db/remote-builtin: Reteach builtin-ls-remote to understand remotes Build in ls-remote Use built-in send-pack. Build-in send-pack, with an API for other programs to call. Build-in peek-remote, using transport infrastructure. Miscellaneous const changes and utilities Conflicts: transport.c
2007-11-11push: teach push to pass --verbose option to transport layerSteffen Prohaska
A --verbose option to push should also be passed to the transport layer, i.e. git-send-pack, git-http-push. git push is modified to do so. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-10git-push: plumb in --mirror modeAndy Whitcroft
Plumb in the --mirror mode for git-push. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-10Merge master into aw/mirror-pushJunio C Hamano
2007-11-08Style: place opening brace of a function definition at column 1Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-03Use built-in send-pack.Daniel Barkalow
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-03Miscellaneous const changes and utilitiesDaniel Barkalow
The list of remote refs in struct transport should be const, because builtin-fetch will get confused if it changes. The url in git_connect should be const (and work on a copy) instead of requiring the caller to copy it. match_refs doesn't modify the refspecs it gets. get_fetch_map and get_remote_ref don't change the list they get. Allow transport get_refs_list methods to modify the struct transport. Add a function to copy a list of refs, when a function needs a mutable copy of a const list. Add a function to check the type of a ref, as per the code in connect.c Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-02transport.c: squelch a gcc 4.0.1 complaint about an uninitialized variableBlake Ramsdell
The variable is always set if it is going to be used; gcc just does not notice it. Signed-off-by: Blake Ramsdell <blaker@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-21Change git_connect() to return a struct child_process instead of a pid_t.Johannes Sixt
This prepares the API of git_connect() and finish_connect() to operate on a struct child_process. Currently, we just use that object as a placeholder for the pid that we used to return. A follow-up patch will change the implementation of git_connect() and finish_connect() to make full use of the object. Old code had early-return-on-error checks at the calling sites of git_connect(), but since git_connect() dies on errors anyway, these checks were removed. [sp: Corrected style nit of "conn == NULL" to "!conn"] Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-16Support 'push --dry-run' for http transportShawn O. Pearce
If the end-user requested a dry-run push we need to pass that flag over to http-push and additionally make sure it does not actually upload any changes to the remote server. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-16Support 'push --dry-run' for rsync transportShawn O. Pearce
If the end-user requested a dry-run push we should pass that flag though to rsync so that the rsync command can show what it would do (or not do) if push was to be executed without the --dry-run flag. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-16Merge branch 'master' into db/fetch-packShawn O. Pearce
There's a number of tricky conflicts between master and this topic right now due to the rewrite of builtin-push. Junio must have handled these via rerere; I'd rather not deal with them again so I'm pre-merging master into the topic. Besides this topic somehow started to depend on the strbuf series that was in next, but is now in master. It no longer compiles on its own without the strbuf API. * master: (184 commits) Whip post 1.5.3.4 maintenance series into shape. Minor usage update in setgitperms.perl manual: use 'URL' instead of 'url'. manual: add some markup. manual: Fix example finding commits referencing given content. Fix wording in push definition. Fix some typos, punctuation, missing words, minor markup. manual: Fix or remove em dashes. Add a --dry-run option to git-push. Add a --dry-run option to git-send-pack. Fix in-place editing functions in convert.c instaweb: support for Ruby's WEBrick server instaweb: allow for use of auto-generated scripts Add 'git-p4 commit' as an alias for 'git-p4 submit' hg-to-git speedup through selectable repack intervals git-svn: respect Subversion's [auth] section configuration values gtksourceview2 support for gitview fix contrib/hooks/post-receive-email hooks.recipients error message Support cvs via git-shell rebase -i: use diff plumbing instead of porcelain ... Conflicts: Makefile builtin-push.c rsh.c
2007-10-16Fix compilation when NO_CURL is definedJohannes Schindelin
There were a few places which did not cope well without curl. This fixes all of them. We still need to link against the walker.o part of the library as some parts of transport.o still call into there even though we don't have HTTP support enabled. If compiled with NO_CURL=1 we now get the following useful error message: $ git-fetch http://www.example.com/git error: git was compiled without libcurl support. fatal: Don't know how to fetch from http://www.example.com/git Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-03Restore default verbosity for http fetches.Daniel Barkalow
This adds a verbosity level below 0 for suppressing default messages with --quiet, and makes the default for http be verbose instead of quiet. This matches the behavior of the shell script version of git-fetch. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-01fetch/push: readd rsync supportJohannes Schindelin
We lost rsync support when transitioning from shell to C. Support it again (even if the transport is technically deprecated, some people just do not have any chance to use anything else). Also, add a test to t5510. Since rsync transport is not configured by default on most machines, and especially not such that you can write to rsync://127.0.0.1$(pwd)/, it is disabled by default; you can enable it by setting the environment variable TEST_RSYNC. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-30bundle transport: fix an alloc_ref() callJunio C Hamano
Currently alloc_ref() expects the length of the refname plus 1 as its parameter, prepares that much space and returns a "ref" structure for the caller to fill the refname. One caller in transport.c::get_refs_from_bundle() however allocated one byte less. It may be a good idea to change the calling convention to give alloc_ref() the length of the refname, but that clean-up can be done in a separate patch. This patch only fixes the bug and makes all callers consistent. There was also one overallocation in connect.c, which would not hurt but was wasteful. This patch fixes it as well. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-19Fix memory leaks when disconnecting transport instancesShawn O. Pearce
Most transport implementations tend to allocate a data buffer in the struct transport instance during transport_get() so we need to free that data buffer when we disconnect it. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-19Ensure builtin-fetch honors {fetch,transfer}.unpackLimitShawn O. Pearce
The only way to configure the unpacking limit is currently through the .git/config (or ~/.gitconfig) mechanism as we have no existing command line option interface to control this threshold on a per invocation basis. This was intentional by design as the storage policy of the repository should be a repository-wide decision and should not be subject to variations made on individual command executions. Earlier builtin-fetch was bypassing the unpacking limit chosen by the user through the configuration file as it did not reread the configuration options through fetch_pack_config if we called the internal fetch_pack() API directly. We now ensure we always run the config file through fetch_pack_config at least once in this process, thereby setting our unpackLimit properly. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>