aboutsummaryrefslogtreecommitdiff
path: root/server-info.c
Commit message (Collapse)AuthorAge
* Replace uses of strdup with xstrdup.Shawn Pearce2006-09-02
| | | | | | | | | | | | | | | | Like xmalloc and xrealloc xstrdup dies with a useful message if the native strdup() implementation returns NULL rather than a valid pointer. I just tried to use xstrdup in new code and found it to be missing. However I expected it to be present as xmalloc and xrealloc are already commonly used throughout the code. [jc: removed the part that deals with last_XXX, which I am finding more and more dubious these days.] Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Remove TYPE_* constant macros and use object_type enums consistently.Linus Torvalds2006-07-12
| | | | | | | | | | | | | | | This updates the type-enumeration constants introduced to reduce the memory footprint of "struct object" to match the type bits already used in the packfile format, by removing the former (i.e. TYPE_* constant macros) and using the latter (i.e. enum object_type) throughout the code for consistency. Eventually we can stop passing around the "type strings" entirely, and this will help - no confusion about two different integer enumeration. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Assorted typo fixesPavel Roskin2006-07-09
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* Shrink "struct object" a bitLinus Torvalds2006-06-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This shrinks "struct object" by a small amount, by getting rid of the "struct type *" pointer and replacing it with a 3-bit bitfield instead. In addition, we merge the bitfields and the "flags" field, which incidentally should also remove a useless 4-byte padding from the object when in 64-bit mode. Now, our "struct object" is still too damn large, but it's now less obviously bloated, and of the remaining fields, only the "util" (which is not used by most things) is clearly something that should be eventually discarded. This shrinks the "git-rev-list --all" memory use by about 2.5% on the kernel archive (and, perhaps more importantly, on the larger mozilla archive). That may not sound like much, but I suspect it's more on a 64-bit platform. There are other remaining inefficiencies (the parent lists, for example, probably have horrible malloc overhead), but this was pretty obvious. Most of the patch is just changing the comparison of the "type" pointer from one of the constant string pointers to the appropriate new TYPE_xxx small integer constant. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* server-info: skip empty lines.Junio C Hamano2005-12-21
| | | | | | | Now we allow an empty line in objects/info/packs file, recognize that and stop complaining. Signed-off-by: Junio C Hamano <junkio@cox.net>
* objects/info/packs: work around bug in http-fetch.c::fetch_indices()Junio C Hamano2005-12-21
| | | | | | | | | The code to fetch pack index files in deployed clients have a bug that causes it to ignore the pack file on the last line of objects/info/packs file, so append an empty line to work it around. Signed-off-by: Junio C Hamano <junkio@cox.net>
* qsort(): ptrdiff_t may be larger than intJunio C Hamano2005-12-08
| | | | | | | | | This is a companion patch to e23eff8be92a2a2cb66b53deef020063cff285ed commit. The same logic, the same rationale that a comparison function that returns an int should not just compute a ptrdiff_t and return it. Signed-off-by: Junio C Hamano <junkio@cox.net>
* server-info.c: and two functions are not used anymore.Junio C Hamano2005-12-05
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* server-info.c: use pack_local like everybody else.Junio C Hamano2005-12-05
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* server-info: throw away T computation as well.Junio C Hamano2005-12-04
| | | | | | | | | | | Again, dumb transport clients are too dumb to make use of the top objects information to make a choice among multiple packs, so computing these lines are useless for now. We could resurrect them if needed later. Also dumb transport clients presumably can do their own approximation by downloading idx files to see how relevant each pack is for their fetch. Signed-off-by: Junio C Hamano <junkio@cox.net>
* server-info: stop sorting packs by latest date.Junio C Hamano2005-12-04
| | | | | | | This does not seem to buy us much, for the same reason as the previous change. Dumb clients are still too dumb. Signed-off-by: Junio C Hamano <junkio@cox.net>
* server-info.c: drop unused D lines.Junio C Hamano2005-12-04
| | | | | | | | | We tried to compute pack interdependency information in $GIT_DIR/objects/info/packs, hoping that dumb transports would make use of it when choosing from multiple choice, but that has never materialized, so stop computing D lines for now. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Rework object refs tracking to reduce memory usageSergey Vlasov2005-11-15
| | | | | | | | | | | | | Store pointers to referenced objects in a variable sized array instead of linked list. This cuts down memory usage of utilities which use object references; e.g., git-fsck-objects --full on the git.git repository consumes about 2 MB of memory tracked by Massif instead of 7 MB before the change. Object refs are still the biggest consumer of memory (57%), but the malloc overhead for a single block instead of a linked list is substantially smaller. Signed-off-by: Sergey Vlasov <vsu@altlinux.ru> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Be careful when dereferencing tags.Junio C Hamano2005-11-02
| | | | | | | | | | One caller of deref_tag() was not careful enough to make sure what deref_tag() returned was not NULL (i.e. we found a tag object that points at an object we do not have). Fix it, and warn about refs that point at such an incomplete tag where needed. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Show peeled onion from upload-pack and server-info.Junio C Hamano2005-10-15
| | | | | | | | | | | | | | | | | | | | | This updates git-ls-remote to show SHA1 names of objects that are referred by tags, in the "ref^{}" notation. This would make git-findtags (without -t flag) almost trivial. git-peek-remote . | sed -ne "s:^$target "'refs/tags/\(.*\)^{}$:\1:p' Also Pasky could do: git-ls-remote --tags $remote | sed -ne 's:\( refs/tags/.*\)^{}$:\1:p' to find out what object each of the remote tags refers to, and if he has one locally, run "git-fetch $remote tag $tagname" to automatically catch up with the upstream tags. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Reduce memory usage in git-update-server-info.robfitz@273k.net2005-10-08
| | | | | | | | Modify parse_object_cheap() to also free all the entries from the tree data structures. Signed-off-by: Robert Fitzsimons <robfitz@273k.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Unoptimize info/refs creation.Junio C Hamano2005-09-15
| | | | | | | | The code did not catch the case where you removed an existing ref without changing anything else. We are not talking about hundreds of refs anyway, so remove that optimization. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Retire info/rev-cacheJunio C Hamano2005-09-15
| | | | | | | It was one of those things that were well intentioned but did not turn out to be useful in practice. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Revert "Replace zero-length array decls with []."Junio C Hamano2005-08-29
| | | | | | | | | | | | | This reverts 6c5f9baa3bc0d63e141e0afc23110205379905a4 commit, whose change breaks gcc-2.95. Not that I ignore portability to compilers that are properly C99, but keeping compilation with GCC working is more important, at least for now. We would probably end up declaring with "name[1]" and teach the allocator to subtract one if we really aimed for portability, but that is left for later rounds. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Replace zero-length array decls with [].Jason Riedy2005-08-23
| | | | | | C99 denotes variable-sized members with [], not [0]. Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
* [PATCH] Fix sparse warningsLinus Torvalds2005-08-01
| | | | | | | | | | A few sparse warnings have crept in again since I checked last time: undeclared variables with global scope. Fix them by marking the private variables properly "static". Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* server-info: do not complain if a tag points at a non-commit.Junio C Hamano2005-07-29
| | | | | | Linux 2.6 tree has one of those tree tags. Signed-off-by: Junio C Hamano <junkio@cox.net>
* [PATCH] Add update-server-info.Junio C Hamano2005-07-23
The git-update-server-info command prepares informational files to help clients discover the contents of a repository, and pull from it via a dumb transport protocols. Currently, the following files are produced. - The $repo/info/refs file lists the name of heads and tags available in the $repo/refs/ directory, along with their SHA1. This can be used by git-ls-remote command running on the client side. - The $repo/info/rev-cache file describes the commit ancestry reachable from references in the $repo/refs/ directory. This file is in an append-only binary format to make the server side friendly to rsync mirroring scheme, and can be read by git-show-rev-cache command. - The $repo/objects/info/pack file lists the name of the packs available, the interdependencies among them, and the head commits and tags contained in them. Along with the other two files, this is designed to help clients to make smart pull decisions. The git-receive-pack command is changed to invoke it at the end, so just after a push to a public repository finishes via "git push", the server info is automatically updated. In addition, building of the rev-cache file can be done by a standalone git-build-rev-cache command separately. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>