summaryrefslogtreecommitdiff
path: root/transport-helper.c
AgeCommit message (Collapse)Author
2010-04-01remote-helpers: add support for an export commandSverre Rabbelier
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-31remote-helpers: allow requesing the path to the .git directorySverre Rabbelier
The 'gitdir' capability is reported by the remote helper if it requires the location of the .git directory. The location of the .git directory can then be used by the helper to store status files even when the current directory is not a git repository (such as is the case when cloning). The location of the .git dir is specified as an absolute path. Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-15Merge branch 'tc/transport-verbosity'Junio C Hamano
* tc/transport-verbosity: transport: update flags to be in running order fetch and pull: learn --progress push: learn --progress transport->progress: use flag authoritatively clone: support multiple levels of verbosity push: support multiple levels of verbosity fetch: refactor verbosity option handling into transport.[ch] Documentation/git-push: put --quiet before --verbose Documentation/git-pull: put verbosity options before merge/fetch ones Documentation/git-clone: mention progress in -v Conflicts: transport.h
2010-02-24transport->progress: use flag authoritativelyTay Ray Chuan
Set transport->progress in transport.c::transport_set_verbosity() after checking for the appropriate conditions (eg. --progress, isatty(2)), and thereafter use it without having to check again. The rules used are as follows (processing aborts when a rule is satisfied): 1. Report progress, if force_progress is 1 (ie. --progress). 2. Don't report progress, if verbosity < 0 (ie. -q/--quiet). 3. Report progress if isatty(2) is 1. This changes progress reporting behaviour such that if both --progress and --quiet are specified, progress is reported. In two areas, the logic to determine whether to *not* show progress is changed to simply use the negation of transport->progress. This changes behaviour in some ways (see previous paragraph for details). Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-24push: support multiple levels of verbosityTay Ray Chuan
Remove the flags TRANSPORT_PUSH_QUIET and TRANSPORT_PUSH_VERBOSE; use transport->verbose instead to determine verbosity for pushing. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-04Typofixes outside documentation areaJunio C Hamano
begining -> beginning canonicalizations -> canonicalization comand -> command dewrapping -> unwrapping dirtyness -> dirtiness DISCLAMER -> DISCLAIMER explicitely -> explicitly feeded -> fed impiled -> implied madatory -> mandatory mimick -> mimic preceeding -> preceding reqeuest -> request substition -> substitution Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-20Merge branch 'js/exec-error-report'Junio C Hamano
* js/exec-error-report: Improve error message when a transport helper was not found start_command: detect execvp failures early run-command: move wait_or_whine earlier start_command: report child process setup errors to the parent's stderr Conflicts: Makefile
2010-01-20Merge branch 'tr/http-push-ref-status'Junio C Hamano
* tr/http-push-ref-status: transport-helper.c::push_refs(): emit "no refs" error message transport-helper.c::push_refs(): ignore helper-reported status if ref is not to be pushed transport.c::transport_push(): make ref status affect return value refactor ref status logic for pushing t5541-http-push.sh: add test for unmatched, non-fast-forwarded refs t5541-http-push.sh: add tests for non-fast-forward pushes Conflicts: transport-helper.c
2010-01-17Merge branch 'tc/clone-v-progress'Junio C Hamano
* tc/clone-v-progress: clone: use --progress to force progress reporting clone: set transport->verbose when -v/--verbose is used git-clone.txt: reword description of progress behaviour check stderr with isatty() instead of stdout when deciding to show progress Conflicts: transport.c
2010-01-12Improve error message when a transport helper was not foundIlari Liusvaara
Perviously, the error message was: git: 'remote-foo' is not a git-command. See 'git --help'. By not treating the transport helper as a git command, a more suitable error is reported: fatal: Unable to find remote helper for 'foo' Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-10transport-helper.c::push_refs(): emit "no refs" error messageTay Ray Chuan
Emit an error message when remote_refs is not set. This behaviour is consistent with that of builtin-send-pack.c and http-push.c. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-10transport-helper.c::push_refs(): ignore helper-reported status if ref is not ↵Tay Ray Chuan
to be pushed If the status of a ref is REF_STATUS_NONE, the remote helper will not be told to push the ref (via a 'push' command). However, the remote helper may still act on these refs. If the helper does act on the ref, and prints a status for it, ignore the report (ie. don't overwrite the status of the ref with it, nor the message in the remote_status member) if the reported status is 'no match'. This allows the user to be alerted to more "interesting" ref statuses, like REF_STATUS_NONFASTFORWARD. Cc: Jeff King <peff@peff.net> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-10refactor ref status logic for pushingTay Ray Chuan
Move the logic that detects up-to-date and non-fast-forward refs to a new function in remote.[ch], set_ref_status_for_push(). Make transport_push() invoke set_ref_status_for_push() before invoking the push_refs() implementation. (As a side-effect, the push_refs() implementation in transport-helper.c now knows of non-fast-forward pushes.) Removed logic for detecting up-to-date refs from the push_refs() implementation in transport-helper.c, as transport_push() has already done so for it. Make cmd_send_pack() invoke set_ref_status_for_push() before invoking send_pack(), as transport_push() can't do it for send_pack() here. Mark the test on the return status of non-fast-forward push to fail. Git now exits with success, as transport.c::transport_push() does not check for refs with status REF_STATUS_REJECT_NONFASTFORWARD nor does it indicate rejected pushes with its return value. Mark the test for ref status to succeed. As mentioned earlier, refs might be marked as non-fast-forwards, triggering the push status printing mechanism in transport.c. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-29check stderr with isatty() instead of stdout when deciding to show progressTay Ray Chuan
Make transport code (viz. transport.c::fetch_refs_via_pack() and transport-helper.c::standard_options()) that decides to show progress check if stderr is a terminal, instead of stdout. After all, progress reports (via the API in progress.[ch]) are sent to stderr. Update the documentation for git-clone to say "standard error" as well. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-28Support remote archive from all smart transportsIlari Liusvaara
Previously, remote archive required internal (non remote-helper) smart transport. Extend the remote archive to also support smart transports implemented by remote helpers. Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-28Support remote helpers implementing smart transportsIlari Liusvaara
Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-26Merge branch 'sr/vcs-helper'Junio C Hamano
* sr/vcs-helper: tests: handle NO_PYTHON setting builtin-push: don't access freed transport->url Add Python support library for remote helpers Basic build infrastructure for Python scripts Allow helpers to report in "list" command that the ref is unchanged Fix various memory leaks in transport-helper.c Allow helper to map private ref names into normal names Add support for "import" helper command Allow specifying the remote helper in the url Add a config option for remotes to specify a foreign vcs Allow fetch to modify refs Use a function to determine whether a remote is valid Allow programs to not depend on remotes having urls Fix memory leak in helper method for disconnect Conflicts: Documentation/git-remote-helpers.txt Makefile builtin-ls-remote.c builtin-push.c transport-helper.c
2009-12-09Support taking over transportsIlari Liusvaara
Add support for taking over transports that turn out to be smart. Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-09Pass unknown protocols to external protocol handlersIlari Liusvaara
Change URL handling to allow external protocol handlers to implement new protocols without the '::' syntax if helper name does not conflict with any built-in protocol. foo:// now invokes git-remote-foo with foo:// as the URL. Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-09Support mandatory capabilitiesIlari Liusvaara
Add support for marking capability as mandatory for hosting git version to understand. This is useful for helpers which require various types of assistance from main git binary. Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-09Add remote helper debug modeIlari Liusvaara
Remote helpers deadlock easily, so support debug mode which shows the interaction steps. Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-07Merge branch 'master' into il/vcs-helperJunio C Hamano
* master: (334 commits) bash: update 'git commit' completion Git 1.6.5.5 Fix diff -B/--dirstat miscounting of newly added contents reset: improve worktree safety valves Documentation: Avoid use of xmlto --stringparam archive: clarify description of path parameter rerere: don't segfault on failure to open rr-cache Prepare for 1.6.5.5 gitweb: Describe (possible) gitweb.js minification in gitweb/README Documentation: xmlto 0.0.18 does not know --stringparam Fix crasher on encountering SHA1-like non-note in notes tree t9001: use older Getopt::Long boolean prefix '--no' rather than '--no-' t4201: use ISO8859-1 rather than ISO-8859-1 Git 1.6.5.4 Unconditionally set man.base.url.for.relative.links Documentation/Makefile: allow man.base.url.for.relative.link to be set from Make Git 1.6.6-rc1 git-pull.sh: Fix call to git-merge for new command format Prepare for 1.6.5.4 merge: do not add standard message when message is given with -m option ... Conflicts: Documentation/git-remote-helpers.txt Makefile builtin-ls-remote.c builtin-push.c transport-helper.c Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-18Allow helpers to report in "list" command that the ref is unchangedDaniel Barkalow
Helpers may use a line like "? name unchanged" to specify that there is nothing new at that name, without any git-specific code to determine the correct response. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-18Fix various memory leaks in transport-helper.cSverre Rabbelier
Found with: valgrind --tool=memcheck --leak-check=full --show-reachable=yes Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-18Allow helper to map private ref names into normal namesDaniel Barkalow
This allows a helper to say that, when it handles "import refs/heads/topic", the script it outputs will actually write to refs/svn/origin/branches/topic; therefore, transport-helper should read it from the latter location after git-fast-import completes. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-18Add support for "import" helper commandDaniel Barkalow
This command, supported if the "import" capability is advertized, allows a helper to support fetching by outputting a git-fast-import stream. If both "fetch" and "import" are advertized, git itself will use "fetch" (although other users may use "import" in this case). Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-18Allow fetch to modify refsDaniel Barkalow
This allows the transport to use the null sha1 for a ref reported to be present in the remote repository to indicate that a ref exists but its actual value is presently unknown and will be set if the objects are fetched. Also adds documentation to the API to specify exactly what the methods should do and how they should interpret arguments. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-18Fix memory leak in helper method for disconnectDaniel Barkalow
Since some cases may need to disconnect from the helper and reconnect, wrap the function that just disconnects in a function that also frees transport->data. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-31remote-helpers: return successfully if everything up-to-dateClemens Buchacher
Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-31Move WebDAV HTTP push under remote-curlShawn O. Pearce
The remote helper interface now supports the push capability, which can be used to ask the implementation to push one or more specs to the remote repository. For remote-curl we implement this by calling the existing WebDAV based git-http-push executable. Internally the helper interface uses the push_refs transport hook so that the complexity of the refspec parsing and matching can be reused between remote implementations. When possible however the helper protocol uses source ref name rather than the source SHA-1, thereby allowing the helper to access this name if it is useful. >From Clemens Buchacher <drizzd@aon.at>: update http tests according to remote-curl capabilities o Pushing packed refs is now fixed. o The transport helper fails if refs are already up-to-date. Add a test for that. o The transport helper will notice if refs are already up-to-date. We therefore need to update server info in the unpacked-refs test. o The transport helper will purge deleted branches automatically. o Use a variable ($ORIG_HEAD) instead of full SHA-1 name. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Shawn O. Pearce <spearce@spearce.org> CC: Daniel Barkalow <barkalow@iabervon.org> CC: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-31remote-helpers: Support custom transport optionsShawn O. Pearce
Some transports, like the native pack transport implemented by fetch-pack, support useful features like depth or include tags. These should be exposed if the underlying helper knows how to use them. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> CC: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-31remote-helpers: Fetch more than one ref in a batchShawn O. Pearce
Some network protocols (e.g. native git://) are able to fetch more than one ref at a time and reduce the overall transfer cost by combining the requests into a single exchange. Instead of feeding each fetch request one at a time to the helper, feed all of them at once so the helper can decide whether or not it should batch them. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> CC: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13don't dereference NULL upon fdopen failureJim Meyering
There were several unchecked use of fdopen(); replace them with xfdopen() that checks and dies. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13use write_str_in_full helper to avoid literal string lengthsJim Meyering
This is the same fix to use write_str_in_full() helper to write a constant string out without counting the length of it ourselves. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-04Use a clearer style to issue commands to remote helpersDaniel Barkalow
This style is overkill for some commands, but it's worthwhile to use the same style to issue all commands, and it's useful to avoid open-coding string lengths. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-04Make the "traditionally-supported" URLs a special caseDaniel Barkalow
Instead of trying to make http://, https://, and ftp:// URLs indicative of some sort of pattern of transport helper usage, make them a special case which runs the "curl" helper, and leave the mechanism by which arbitrary helpers will be chosen entirely to future work. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-06git-http-fetch: not a builtinLinus Torvalds
This splits up git-http-fetch so that it isn't built-in. It also removes the general dependency on curl, because it is no longer used by any built-in code. Because they are no longer LIB_OBJS, add LIB_H to the dependencies of http-related object files, and remove http.h from the dependencies of transport.o Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-05Add support for external programs for handling native fetchesDaniel Barkalow
transport_get() can call transport_native_helper_init() to have list and fetch-ref operations handled by running a separate program as: git remote-<something> <remote> [<url>] This program then accepts, on its stdin, "list" and "fetch <hex> <name>" commands; the former prints out a list of available refs and either their hashes or what they are symrefs to, while the latter fetches them into the local object database and prints a newline when done. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>