1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-09 09:26:35 +02:00
Commit Graph

128 Commits

Author SHA1 Message Date
Junio C Hamano 4cac42b132 free(NULL) is perfectly valid.
Jonas noticed some places say "if (X) free(X)" which is totally
unnecessary.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-27 21:19:39 -07:00
Shawn Pearce e702496e43 Convert memcpy(a,b,20) to hashcpy(a,b).
This abstracts away the size of the hash values when copying them
from memory location to memory location, much as the introduction
of hashcmp abstracted away hash value comparsion.

A few call sites were using char* rather than unsigned char* so
I added the cast rather than open hashcpy to be void*.  This is a
reasonable tradeoff as most call sites already use unsigned char*
and the existing hashcmp is also declared to be unsigned char*.

[jc: Splitted the patch to "master" part, to be followed by a
 patch for merge-recursive.c which is not in "master" yet.

 Fixed the cast in the latter hunk to combine-diff.c which was
 wrong in the original.

 Also converted ones left-over in combine-diff.c, diff-lib.c and
 upload-pack.c ]

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 13:53:10 -07:00
David Rientjes a89fccd281 Do not use memcmp(sha1_1, sha1_2, 20) with hardcoded length.
Introduces global inline:

	hashcmp(const unsigned char *sha1, const unsigned char *sha2)

Uses memcmp for comparison and returns the result based on the length of
the hash name (a future runtime decision).

Acked-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-17 14:23:53 -07:00
David Rientjes 96f1e58f52 remove unnecessary initializations
[jc: I needed to hand merge the changes to the updated codebase,
 so the result needs to be checked.]

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-15 21:22:20 -07:00
Rene Scharfe 5bb1cda5f7 drop length argument of has_extension
As Fredrik points out the current interface of has_extension() is
potentially confusing.  Its parameters include both a nul-terminated
string and a length-limited string.

This patch drops the length argument, requiring two nul-terminated
strings; all callsites are updated.  I checked that all of them indeed
provide nul-terminated strings.  Filenames need to be nul-terminated
anyway if they are to be passed to open() etc.  The performance penalty
of the additional strlen() is negligible compared to the system calls
which inevitably surround has_extension() calls.

Additionally, change has_extension() to use size_t inside instead of
int, as that is the exact type strlen() returns and memcmp() expects.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-11 16:06:34 -07:00
Rene Scharfe 83a2b841d6 Add has_extension()
The little helper has_extension() documents through its name what we are
trying to do and makes sure we don't forget the underrun check.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-10 14:13:53 -07:00
Ramsay Jones 19c4588178 commit walkers: setup_ident() to record correct committer in ref-log.
The function pull() in fetch.c calls write_ref_sha1(), which may
need committer identity to update the ref-log, so they need to
call setup_ident() before calling git_config() function.

Acked-by: Shawn Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-05 13:51:58 -07:00
Petr Baudis 8e29f6a07e Teach git-http-fetch the --stdin switch
Speeds up things quite a lot when fetching tags with Cogito.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-27 19:33:48 -07:00
Petr Baudis 4211e4d10c Make pull() support fetching multiple targets at once
pull() now takes an array of arguments instead of just one of each kind.
Currently, no users use the new capability, but that'll change.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-27 19:33:48 -07:00
Petr Baudis c6b69bdbc1 Make pull() take some implicit data as explicit arguments
Currently it's a bit weird that pull() takes a single argument
describing the commit but takes the write_ref from a global variable.
This makes it take that as a parameter as well, which might be nicer
for the libification in the future, but especially it will make for
nicer code when we implement pull()ing multiple commits at once.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-27 19:33:48 -07:00
Petr Baudis cc41cd2e60 Remove -d from *-fetch usage strings
This is a really ancient remnant of the short era of delta objects stored
directly in the object database.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-27 14:21:03 -07:00
Pavel Roskin a9486b02ec Avoid C99 comments, use old-style C comments instead.
This doesn't make the code uglier or harder to read, yet it makes the
code more portable.  This also simplifies checking for other potential
incompatibilities.  "gcc -std=c89 -pedantic" can flag many incompatible
constructs as warnings, but C99 comments will cause it to emit an error.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-10 00:47:13 -07:00
Peter Eriksen 817151e61a Rename safe_strncpy() to strlcpy().
This cleans up the use of safe_strncpy() even more.  Since it has the
same semantics as strlcpy() use this name instead.  Also move the
definition from inside path.c to its own file compat/strlcpy.c, and use
it conditionally at compile time, since some platforms already has
strlcpy().  It's included in the same way as compat/setenv.c.

Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-24 23:16:25 -07:00
Florian Forster 1d7f171c3a Remove all void-pointer arithmetic.
ANSI C99 doesn't allow void-pointer arithmetic. This patch fixes this in
various ways. Usually the strategy that required the least changes was used.

Signed-off-by: Florian Forster <octo@verplant.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-20 01:59:46 -07:00
Florian Forster cfd432e63d Remove ranges from switch statements.
Though very nice and readable, the "case 'a'...'z':" construct is not ANSI C99
compliant. This patch unfolds the range in `quote.c' and substitutes the
switch-statement with an if-statement in `http-fetch.c' and `http-push.c'.

Signed-off-by: Florian Forster <octo@verplant.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 21:19:09 -07:00
Peter Eriksen bfbd0bb6ec Implement safe_strncpy() as strlcpy() and use it more.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-16 22:45:12 -07:00
Nick Hengeveld e8dff6ba8b http-fetch: fix possible segfault
Initialize an object request's slot to a safe value.  A non-NULL value
can cause a segfault if the request is aborted before it starts.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-06 22:32:51 -07:00
Junio C Hamano f0679f474a Merge branch 'sp/reflog'
* sp/reflog:
  fetch.c: do not pass uninitialized lock to unlock_ref().
  Test that git-branch -l works.
  Verify git-commit provides a reflog message.
  Enable ref log creation in git checkout -b.
  Create/delete branch ref logs.
  Include ref log detail in commit, reset, etc.
  Change order of -m option to update-ref.
  Correct force_write bug in refs.c
  Change 'master@noon' syntax to 'master@{noon}'.
  Log ref updates made by fetch.
  Force writing ref if it doesn't exist.
  Added logs/ directory to repository layout.
  General ref log reading improvements.
  Fix ref log parsing so it works properly.
  Support 'master@2 hours ago' syntax
  Log ref updates to logs/refs/<ref>
  Convert update-ref to use ref_lock API.
  Improve abstraction of ref lock/write.
2006-06-03 23:59:03 -07:00
Sean 07001f95a6 Remove possible segfault in http-fetch.
Free the curl string lists after running http_cleanup to
avoid an occasional segfault in the curl library.  Seems
to only occur if the website returns a 405 error.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-22 18:52:58 -07:00
Shawn Pearce d0740d92be Log ref updates made by fetch.
If a ref is changed by http-fetch, local-fetch or ssh-fetch
record the change and the remote URL/name in the log for the ref.
This requires loading the config file to check logAllRefUpdates.

Also fixed a bug in the ref lock generation; the log file name was
not being produced right due to a bad prefix length.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:02:52 -07:00
Dennis Stosberg ef9e58c826 Replace index() with strchr().
strchr() is more portable than index() and is used everywhere in
git already.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-11 11:45:37 -07:00
Nick Hengeveld 8d9fbe57b3 http-fetch: add optional DAV-based pack list
If git is not built with NO_EXPAT, this patch changes git-http-fetch to
attempt using DAV to get a list of remote packs and fall back to using
objects/info/packs if the DAV request fails.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-04 18:06:35 -07:00
Junio C Hamano bb52807916 http-fetch: nicer warning for a server with unreliable 404 status
When a repository otherwise properly prepared is served by a
dumb HTTP server that sends "No such page" output with 200
status for human consumption to a request for a page that does
not exist, the users will get an alarming "File X corrupt" error
message.  Hint that they might be dealing with such a server at
the end and suggest running fsck-objects to check if the result
is OK (the pack-fallback code does the right thing in this case
so unless a loose object file was actually corrupt the result
should check OK).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-20 14:07:59 -08:00
Nick Hengeveld c982647310 Fix broken slot reuse when fetching alternates
When fetching alternates, http-fetch may reuse the slot to fetch non-http
alternates if http-alternates does not exist.  When doing so, it now needs
to update the slot's finished status so run_active_slot waits for the
non-http alternates request to finish.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-15 09:10:41 -08:00
Junio C Hamano bd2afde8a3 Give no terminating LF to error() function.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-22 19:10:26 -08:00
Mark Wooding 53f313897e http-fetch: Abort requests for objects which arrived in packs
In fetch_object, there's a call to release an object request if the
object mysteriously arrived, say in a pack.  Unfortunately, the fetch
attempt for this object might already be in progress, and we'll leak the
descriptor.  Instead, try to tidy away the request.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-07 02:13:02 -08:00
Mark Wooding a3f583cbf7 http-fetch: Tidy control flow in process_alternate_response
It's a bit convoluted.  Tidy it up.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-05 16:49:17 -08:00
Mark Wooding 7b934ec015 http-fetch: Fix message reporting rename of object file.
move_temp_to_file returns 0 or -1.  This is not a good thing to pass to
strerror(3).  Fortunately, someone already reported the error, so don't
worry too much.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-05 16:49:16 -08:00
Mark Wooding 09db444fdb http-fetch: Fix object list corruption in fill_active_slots().
In fill_active_slots() -- if we find an object which has already arrived,
say as part of a pack, /don't/ remove it from the list.  It's already been
prefetched and someone will ask for it later.  Just label it as done and
carry blithely on.  (As it was, the code would dereference a freed object
to continue through the list anyway.)

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-05 16:49:16 -08:00
Junio C Hamano 8fcf7f9af5 whitespace cleanup.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-02 17:54:24 -08:00
Nick Hengeveld cb754fdf5a Use local structs for HTTP slot callback data
There's no need for these structures to be static, and it could potentially
cause problems down the road.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-31 18:03:46 -08:00
Nick Hengeveld c8568e139e Fix HTTP request result processing after slot reuse
Add a way to store the results of an HTTP request when a slot finishes
so the results can be processed after the slot has been reused.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-31 16:17:24 -08:00
Nick Hengeveld a14c225661 Fix for http-fetch from file:// URLs
Recognize missing files when using http-fetch with file:// URLs

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-22 12:52:35 -08:00
Junio C Hamano 455c161c47 http-fetch.c: fix objects/info/pack parsing.
It failed to register the last pack in the objects/info/packs
file.  Also it had an independent overrun error.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 12:13:53 -08:00
Junio C Hamano 5a3277133d Make networking commands to work from a subdirectory.
These are whole-tree operations and there is not much point
making them operable from within a subdirectory, but it is easy
to do so, and using setup_git_directory() upfront helps git://
proxy specification picked up from the correct place.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-28 23:13:02 -08:00
Nick Hengeveld 5e3a769186 Improve pack list response handling
Better response handling for pack list requests - a 404 means we do have
the list but it happens to be empty.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-19 20:17:24 -08:00
Nick Hengeveld e388ab74db Make http-fetch request types more clear
Rename object request functions and data to make it more clear which type
of request is being processed - this is a response to the introduction of
slot callbacks and the definition of different types of requests such as
alternates_request.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-19 20:17:24 -08:00
Nick Hengeveld 29508e1efb Isolate shared HTTP request functionality
Move shared HTTP request functionality out of http-fetch and http-push,
and replace the two fwrite_buffer/fwrite_buffer_dynamic functions with
one fwrite_buffer function that does dynamic buffering.  Use slot
callbacks to process responses to fetch object transfer requests and
push transfer requests, and put all of http-push into an #ifdef check
for curl multi support.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-19 20:17:24 -08:00
Petr Baudis 313c4714c5 Fix bunch of fd leaks in http-fetch
The current http-fetch is rather careless about fd leakage, causing
problems while fetching large repositories. This patch does not reserve
exhaustiveness, but I covered everything I spotted. I also left some
safeguards in place in case I missed something, so that we get to know,
sooner or later.

Reported by Becky Bruce <becky.bruce@freescale.com>.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-15 00:34:50 -08:00
Nick Hengeveld 54a9ba0d44 Fix fd leak in http-fetch
Added a call to finish_request to clean up resources if the server
returned a 404 and there are no alternates left to try.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-12 23:43:11 -08:00
Nick Hengeveld acc075a8ad Fix for multiple alternates requests in http-fetch
Stop additional alternates requests from starting if one is already in
progress.  This adds an optional callback which is processed after a slot
has finished running.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-12 23:43:11 -08:00
Petr Baudis 6fd72e39af Show URL in the "Getting <foo> list" http-fetch messages
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-11 21:14:46 -08:00
Josef Weidendorfer 66c9ec2555 Let git-clone/git-fetch follow HTTP redirections
Otherwise, git-clone silently failed to clone a remote
repository where redirections (ie. a response with a
"Location" header line) are used.

This includes the fixes from Nick Hengeveld.

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-10 15:57:56 -08:00
Peter Hagervall f4f440a039 sparse fixes for http-{fetch,push}.c
Make a bunch of needlessly global functions static, and replace two
K&R-style declarations.

Signed-off-by: Peter Hagervall <hager@cs.umu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-08 21:33:32 -08:00
Johannes Schindelin 90279074ca http-fetch: do not use curl_message after releasing it
When curl_message is released using curl_multi_remove_handle(), it's
contents are undefined. Therefore, get the information before releasing it.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-06 18:31:47 -08:00
Nick Hengeveld 50496b2170 Remove the temp file if it is empty after the request has failed
After using cg-update to pull, empty files named *.temp are left in
the various subdirectories of .git/objects/.  These are created by
git-http-fetch to hold data as it's being fetched from the remote
repository.  They are left behind after a transfer error so that the
next time git-http-fetch runs it can pick up where it left off.  If
they're empty though, it would make more sense to delete them rather
than leaving them behind for the next attempt.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-03 18:35:18 -08:00
Petr Baudis e2029eb963 Silence confusing and false-positive curl error message
git-http-fetch spits out curl 404 error message when unable to fetch an object,
but that's confusing since no error really happened and the object is usually
found in a pack it tries right after that. And if the object still cannot be
retrieved, it will say another error message anyway. OTOH other HTTP errors
(403 etc) are likely fatal and the user should be still informed about them.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-23 11:49:25 -07:00
Nick Hengeveld 7b9ae53ea3 [PATCH 3/3] Allow running requests to finish after a pull error
Allow running requests to finish after a pull error

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-21 19:20:18 -07:00
Nick Hengeveld f7eb290fa0 [PATCH 2/3] Switched back to loading alternates as needed
Switched back to loading alternates as needed

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-21 19:20:18 -07:00
Nick Hengeveld f1a906a387 [PATCH 1/3] Clean up CURL handles in unused request slots
Clean up CURL handles in unused request slots

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-21 19:20:17 -07:00
Nick Hengeveld e0004e286c Support for HTTP transfer timeouts based on transfer speed
Add configuration settings to abort HTTP requests if the transfer rate
drops below a threshold for a specified length of time.  Environment
variables override config file settings.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-19 14:27:01 -07:00
Peter Hagervall f5dce80611 Sparse fixes for http-fetch
This patch cleans out all sparse warnings from http-fetch.c

I'm a bit uncomfortable with adding extra #ifdefs to avoid either
'mixing declaration with code' or 'unused variable' warnings, but I
figured that since those functions are already littered with #ifdefs I
might just get away with it. Comments?

[jc: I adjusted Peter's patch to address uncomfortableness issues.]

Signed-off-by: Peter Hagervall <hager@cs.umu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-16 00:01:08 -07:00
Junio C Hamano f80376c597 Show curl error a bit better.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-15 11:13:55 -07:00
Johannes Schindelin 7baa3e8694 Some curl versions lack curl_easy_duphandle()
Hi,

On Fri, 14 Oct 2005, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > This patch looks bigger than it really is: The code to get the
> > default handle was refactored into a function, and is called
> > instead of curl_easy_duphandle() if that does not exist.
>
> I'd like to take Nick's config file patch first, which
> unfortunately interferes with your patch.  I'd hate to ask you
> this, but could you rebase it on top of Nick's patch, [...]

No need to hate it. Here comes the rebased patch, and this time, I
actually tested it a bit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-15 11:10:46 -07:00
Nick Hengeveld d402d5566f Use config file settings for http
Use "http." config file settings if they exist.  Environment variables
still work, and they will override config file settings.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-14 17:16:01 -07:00
Sergey Vlasov bc8f265270 git-http-fetch: Remove size limit for objects/info/{packs,alternates}
git-http-fetch received objects/info/packs into a fixed-size buffer
and started to fail when this file became larger than the buffer.
Change it to grow the buffer dynamically, and do the same thing for
objects/info/alternates.  Also add missing free() calls for these
buffers.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-14 17:15:46 -07:00
Junio C Hamano 94fa447ace Quote reference names while fetching with curl.
curl_escape ought to do this, but we should not let it quote
slashes (nobody said refs/tags cannot have subdirectories), so
we roll our own safer version.  With this, the last part of
git-clone from Martin's moodle repository that used to fail now
works, which reads:

 $ git-http-fetch -v -a -w 'tags/MOODLE_15_MERGED **INVALID**' \
   'tags/MOODLE_15_MERGED **INVALID**' \
   http://locke.catalyst.net.nz/git/moodle.git/

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-11 22:05:09 -07:00
Junio C Hamano dc1b5ea878 Remove unused 'got_alternates' variable.
The function fetch_alternates() is called only once from the
main now.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-10 23:22:02 -07:00
Junio C Hamano b721e01f6e Use the same move_temp_to_file in git-http-fetch.
The http commit walker cannot use the same temporary file
creation code because it needs to use predictable temporary
filename for partial fetch continuation purposes, but the code
to move the temporary file to the final location should be
usable from the ordinary object creation codepath.

Export move_temp_to_file from sha1_file.c and use it, while
losing the custom relink_or_rename function from http-fetch.c.

Also the temporary object file creation part needs to make sure
the leading path exists, in preparation of the really lazy
fan-out directory creation.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-10 23:22:01 -07:00
Nick Hengeveld 0312600648 Restore functionality to allow proxies to cache objects
The parallel request changes didn't properly implement the previous patch to
allow caching of retrieved objects by proxy servers.  Restore the previous
functionality such that by default requests include the "Pragma: no-cache"
header, and this header is removed on requests for pack indexes, packs, and
objects.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-10 23:22:01 -07:00
Nick Hengeveld 11f0dafe2b [PATCH] Don't fetch objects that exist in the local repository
Be sure not to fetch objects that already exist in the local repository.
The main process loop no longer performs this check, http-fetch now checks
prior to starting a new request queue entry and when fetch_object() is called,
and local-fetch now checks when fetch_object() is called.

As discussed in this thread: http://marc.theaimsgroup.com/?t=112854890500001

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
2005-10-10 23:22:01 -07:00
Nick Hengeveld 380792390e Set the parallel HTTP request limit via an environment variable
Use an environment variable rather than a command-line argument to set the
parallel HTTP request limit.  This allows the setting to work whether
git-http-fetch is run directly or via git-fetch.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-10 23:22:01 -07:00
Nick Hengeveld a7a8d3786e Only compile parallel HTTP support with CURL >= 7.9.8
Only compile parallel HTTP support with CURL >= 7.9.8

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-10 23:22:01 -07:00
Nick Hengeveld 1d389ab65d Add support for parallel HTTP transfers
Add support for parallel HTTP transfers.  Prefetch populates a queue of
objects to transfer and starts feeding requests to an active request
queue for processing; fetch_object keeps the active queue moving
while the specified object is being transferred.  The size of the active
queue can be restricted using -r and defaults to 5 concurrent transfers.
Requests for objects that are not prefetched are also processed via the
active queue.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-10 23:22:01 -07:00
Nick Hengeveld 4fa2197e61 [PATCH] HTTP partial transfer support fix.
Don't unlink the temp file when an object transfer fails, so next attempt
will pick up where the failed transfer left off

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-01 23:17:15 -07:00
Junio C Hamano 271421cd34 Update partial HTTP transfers.
Add the sanity checks discussed on the list with Nick Hengeveld in
<20050927000931.GA15615@reactrix.com>.

 * unlink of previous and rename from temp to previous can fail for
   reasons other than benign ones (missing previous and missing temp).
   Report these failures when we encounter them, to make diagnosing
   problems easier.

 * when rewinding the partially written result, make sure to
   truncate the file.

Also verify the pack after downloading by calling
verify_packfile().

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-01 23:17:14 -07:00
Nick Hengeveld 49a0f240f7 [PATCH] HTTP partial transfer support for object, pack, and index transfers
HTTP partial transfer support for object, pack, and index transfers

[jc: this should not be placed in "master" -- it does not have any
 fixes requested on the list.]

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-01 23:17:14 -07:00
Johannes Schindelin 7d167feb8b [PATCH] Old curl does not know about CURLOPT_SSLKEY
... so try to set it only in later versions.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-29 22:47:37 -07:00
Peter Hagervall a7928f8ec7 [PATCH] Make some needlessly global stuff static
Insert 'static' where appropriate.

Signed-off-by: Peter Hagervall <hager@cs.umu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-28 16:38:52 -07:00
Nick Hengeveld 5acb6de13d [PATCH] Support for more CURL SSL settings via environment variables
Added support for additional CURL SSL settings via environment variables.
Client certificate/key files can be specified as well as alternate CA
information.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-28 16:38:51 -07:00
Nick Hengeveld 1ddea77e44 [PATCH] Return CURL error message when object transfer fails
Return CURL error message when object transfer fails

[jc: added similar curl_errorstr errors to places where we
 use curl_easy_perform() to run fetch that _must_ succeed.]

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-27 00:19:18 -07:00
Daniel Barkalow 820eca68c2 [PATCH] Implement --recover for git-*-fetch
With the --recover option, we verify that we have absolutely
everything reachable from the target, not assuming that things
reachable from refs will be complete.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-27 00:16:40 -07:00
Junio C Hamano 09d920831e Make object creation in http fetch a bit safer.
Unlike write_sha1_file() that tries to create the object file in a
temporary location and then move it to the final location, fetch_object
could have been interrupted in the middle, leaving a corrupt file.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-21 02:47:16 -07:00
Daniel Barkalow 1b0c1e672a [PATCH] Support alternates and http-alternates in http-fetch
This allows the remote repository to refer to additional repositories
in a file objects/info/http-alternates or
objects/info/alternates. Each line may be:

 a relative path, starting with ../, to get from the objects directory
  of the starting repository to the objects directory of the added
  repository.

 an absolute path of the objects directory of the added repository (on
  the same server).

 (only in http-alternates) a full URL of the objects directory of the
  added repository.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-18 14:14:52 -07:00
Daniel Barkalow b3661567cf [PATCH] Add support for alternates in HTTP
This tries .../objects/info/http-alternates and then
.../objects/info/alternates, looking for a file which specifies where
else to download objects and packs from.

It currently only supports absolute paths, and doesn't support full URLs.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-17 11:57:50 -07:00
Sergey Vlasov 1db69b571c [PATCH] git-http-fetch: Allow caching of retrieved objects by proxy servers
By default the curl library adds "Pragma: no-cache" header to all
requests, which disables caching by proxy servers.  However, most
files in a GIT repository are immutable, and caching them is safe and
could be useful.

This patch removes the "Pragma: no-cache" header from requests for all
files except the pack list (objects/info/packs) and references
(refs/*), which are really mutable and should not be cached.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from 3b2a4c46fd5093ec79fb60e1b14b8d4a58c74612 commit)
2005-09-15 12:46:30 -07:00
Junio C Hamano a9ab586a5d Retire support for old environment variables.
We have deprecated the old environment variable names for quite a
while and now it's time to remove them.  Gone are:

    SHA1_FILE_DIRECTORIES AUTHOR_DATE AUTHOR_EMAIL AUTHOR_NAME
    COMMIT_AUTHOR_EMAIL COMMIT_AUTHOR_NAME SHA1_FILE_DIRECTORY

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-09 14:48:54 -07:00
Junio C Hamano 215a7ad1ef Big tool rename.
As promised, this is the "big tool rename" patch.  The primary differences
since 0.99.6 are:

  (1) git-*-script are no more.  The commands installed do not
      have any such suffix so users do not have to remember if
      something is implemented as a shell script or not.

  (2) Many command names with 'cache' in them are renamed with
      'index' if that is what they mean.

There are backward compatibility symblic links so that you and
Porcelains can keep using the old names, but the backward
compatibility support  is expected to be removed in the near
future.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-07 17:45:20 -07:00