1
0
mirror of https://github.com/git/git.git synced 2024-10-03 19:51:31 +02:00
Commit Graph

558 Commits

Author SHA1 Message Date
Dennis Stosberg
de86e131b5 Makefile fix for Solaris
Solaris' /bin/sh does not support $( )-style command substitution

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-02 17:14:43 -07:00
Dennis Stosberg
c2eeb4dcfe "test" in Solaris' /bin/sh does not support -e
Running "make clean" currently fails:
  [ ! -e perl/Makefile ] || make -C perl/ clean
  /bin/sh: test: argument expected
  make: *** [clean] Error 1

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-02 17:14:42 -07:00
Junio C Hamano
f6276fe159 Git.pm: tentative fix to test the freshly built Git.pm
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-02 17:14:42 -07:00
Petr Baudis
d595a473ee Git.pm: assorted build related fixes.
- We passed our own *.a archives as LIBS to the submake that runs
   in perl/; separate LIBS and EXTLIBS and pass the latter which
   tells what the system libraries are used.

 - The quoting of preprocesor symbol definitions passed down to
   perl/ submake was loose and we lost double quotes around
   include directives.  Use *_SQ to quote them properly.

 - The installation location of perl/ submake is not
   architecture neutral anymore, so use SITEARCH instead of
   SITELIB.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-02 17:14:42 -07:00
Junio C Hamano
523bbaa458 perl: fix make clean
When perl/Makefile is stale with respect to perl/Makefile.PL, it
prevents "make clean" from completing which is quite irritating.
Fix it by calling subdirectory make clean twice as needed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-02 17:14:42 -07:00
Junio C Hamano
f6af75d29c Perl interface: add build-time configuration to allow building with -fPIC
On x86-64 it seems that Git.xs does not link without compiling
the main git objects with -fPIC.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-02 17:14:41 -07:00
Petr Baudis
63df97ae7b Git.pm: Implement Git::version()
Git::version() returns the Git version string.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-02 17:14:40 -07:00
Petr Baudis
b1edc53d06 Introduce Git.pm (v4)
This patch introduces a very basic and barebone Git.pm module
with a sketch of how the generic interface would look like;
most functions are missing, but this should give some good base.
I will continue expanding it.

Most desirable now is more careful error reporting, generic_in() for feeding
input to Git commands and the repository() constructor doing some poking
with git-rev-parse to get the git directory and subdirectory prefix.
Those three are basically the prerequisities for converting git-mv.
I will send them as follow-ups to this patch.

Currently Git.pm just wraps up exec()s of Git commands, but even that
is not trivial to get right and various Git perl scripts do it in
various inconsistent ways. In addition to Git.pm, there is now also
Git.xs which provides barebone Git.xs for directly interfacing with
libgit.a, and as an example providing the hash_object() function using
libgit.

This adds the Git module, integrates it to the build system and as
an example converts the git-fmt-merge-msg.perl script to it (the result
is not very impressive since its advantage is not quite apparent in this
one, but I just picked up the simplest Git user around).

Compared to v3, only very minor things were fixed in this patch (some
whitespaces, a missing export, tiny bug in git-fmt-merge-msg.perl);
at first I wanted to post them as a separate patch but since this
is still only in pu, I decided that it will be cleaner to just resend
the patch.

My current working state is available all the time at

	http://pasky.or.cz/~xpasky/git-perl/Git.pm

and an irregularily updated API documentation is at

	http://pasky.or.cz/~xpasky/git-perl/Git.html

Many thanks to Jakub Narebski, Junio and others for their feedback.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-02 17:14:40 -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
Junio C Hamano
1f33026937 Makefile: do not recompile main programs when libraries have changed.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-22 16:20:54 -07:00
Junio C Hamano
5ab2c0a475 Merge branch 'js/lsfix'
* js/lsfix:
  Initialize lock_file struct to all zero.
  Make git-update-ref a builtin
  Make git-update-index a builtin
  Make git-stripspace a builtin
  Make git-mailinfo a builtin
  Make git-mailsplit a builtin
  Make git-write-tree a builtin
2006-06-22 10:35:13 -07:00
Junio C Hamano
16bf4e1f1e Merge branch 'jc/upload-corrupt'
* jc/upload-corrupt:
  daemon: send stderr to /dev/null instead of closing.
  upload-pack/fetch-pack: support side-band communication
  Retire git-clone-pack
  upload-pack: prepare for sideband message support.
  upload-pack: avoid sending an incomplete pack upon failure
2006-06-22 10:25:51 -07:00
Junio C Hamano
bbc932c845 Makefile: do not force unneeded recompilation upon GIT_VERSION changes
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-22 02:04:27 -07:00
Yakov Lerner
c1f8064b14 Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
Before this patch, -DDEFAULT_GIT_TEMPLATE_DIR was passed on compilation
command line to all and every .c file compiled. In fact the macro
is used by only one .c file, and unused by all other .c files.
Remove -DDEFAULT_GIT_TEMPLATE_DIR where unused. Follow the example of
exec_cmd.o. Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.

Signed-off-by: Yakov Lerner <iler.ml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-22 00:11:23 -07:00
Junio C Hamano
efc7fa5355 Retire git-clone-pack
The program is not used by git-clone since git-fetch-pack was extended
to allow its caller do what git-clone-pack alone did, and git-clone was
updated to use it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-21 02:34:14 -07:00
Linus Torvalds
855419f764 Add specialized object allocator
This creates a simple specialized object allocator for basic
objects.

This avoids wasting space with malloc overhead (metadata and
extra alignment), since the specialized allocator knows the
alignment, and that objects, once allocated, are never freed.

It also allows us to track some basic statistics about object
allocations. For example, for the mozilla import, it shows
object usage as follows:

     blobs:   627629 (14710 kB)
     trees:  1119035 (34969 kB)
   commits:   196423  (8440 kB)
      tags:     1336    (46 kB)

and the simpler allocator shaves off about 2.5% off the memory
footprint off a "git-rev-list --all --objects", and is a bit
faster too.

[ Side note: this concludes the series of "save memory in object storage".
  The thing is, there simply isn't much more to be saved on the objects.

  Doing "git-rev-list --all --objects" on the mozilla archive has a final
  total RSS of 131498 pages for me: that's about 513MB. Of that, the
  object overhead is now just 56MB, the rest is going somewhere else (put
  another way: the fact that this patch shaves off 2.5% of the total
  memory overhead, considering that objects are now not much more than 10%
  of the total shows how big the wasted space really was: this makes
  object allocations much more memory- and time-efficient).

  I haven't looked at where the rest is, but I suspect the bulk of it is
  just the pack-file loading. It may be that we should pack the tree
  objects separately from the blob objects: for git-rev-list --objects, we
  don't actually ever need to even look at the blobs, but since trees and
  blobs are interspersed in the pack-file, we end up not being dense in
  the tree accesses, so we end up looking at more pages than we strictly
  need to.

  So with a 535MB pack-file, it's entirely possible - even likely - that
  most of the remaining RSS is just the mmap of the pack-file itself. We
  don't need to map in _all_ of it, but we do end up mapping a fair
  amount. ]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-19 18:42:21 -07:00
Lukas Sandström
854b4629f9 Make git-update-ref a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 22:12:20 -07:00
Lukas Sandström
fefe81c996 Make git-update-index a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 22:12:19 -07:00
Lukas Sandström
7499c99615 Make git-stripspace a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 22:12:16 -07:00
Lukas Sandström
34488e3c37 Make git-mailinfo a builtin
[jc: with a bit of constness tightening]

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 22:10:28 -07:00
Lukas Sandström
e690e84315 Make git-mailsplit a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 21:58:20 -07:00
Lukas Sandström
8ed05fb5e9 Make git-write-tree a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 21:58:19 -07:00
Junio C Hamano
64e86c5786 Merge branch 'yl/build'
* yl/build:
  auto-detect changed prefix and/or changed build flags
2006-06-18 21:18:49 -07:00
Linus Torvalds
3e4339e6f9 Remove "refs" field from "struct object"
This shrinks "struct object" to the absolutely minimal size possible.
It now contains /only/ the object flags and the SHA1 hash name of the
object.

The "refs" field, which is really needed only for fsck, is maintained in
a separate hashed lookup-table, allowing all normal users to totally
ignore it.

This helps memory usage, although not as much as I hoped: it looks like
the allocation overhead of malloc (and the alignment constraints in
particular) means that while the structure size shrinks, the actual
allocation overhead mostly does not.

[ That said: memory usage is actually down, but not as much as it should
  be: I suspect just one of the object types actually ended up shrinking
  its effective allocation size.

  To get to the next level, we probably need specialized allocators that
  don't pad the allocation more than necessary. ]

The separation makes for some code cleanup, though, and makes the ref
tracking that fsck wants a clearly separate thing.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 13:51:27 -07:00
Rene Scharfe
9cd625b79b Make release tarballs friendlier to older tar versions
git-tar-tree adds an extended pax header to archives if its first
parameter points to a commit.  It confuses older tars and isn't
very useful in the case of git anyway, so stop doing it.

Idea: Junio, implementation: Junio.  I just wrote it up. :-)

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 11:29:36 -07:00
Yakov Lerner
ca3bcabf11 auto-detect changed prefix and/or changed build flags
Detect changed prefix and/or changed build flags in the middle
of the build (or between 'make' and 'make install'), and if change
is detected, make sure all objects are compiled with same build
flags and same prefix, thus avoiding inconsistent/broken build.

[jc: removed otherwise unnecessary Makefile target to test the
 change this patch introduces. ]

Signed-off-by: Yakov Lerner <iler.ml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-17 19:17:34 -07:00
Rene Scharfe
52ba03cbb1 Built-in git-get-tar-commit-id
By being an internal command git-get-commit-id can make use of
struct ustar_header and other stuff and stops wasting precious
disk space.

Note: I recycled one of the two "tar-tree" entries instead of
splitting that cleanup into a separate patch.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-10 11:14:00 -07:00
Junio C Hamano
9dc2164ab3 make clean: remove dist-doc targets.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-07 12:37:46 -07:00
Junio C Hamano
021b6e4549 Make index file locking code reusable to others.
The framework to create lockfiles that are removed at exit is
first used to reliably write the index file, but it is
applicable to other things, so stop calling it "cache_file".

This also rewords a few remaining error message that called the
index file "cache file".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-06 14:30:58 -07:00
Junio C Hamano
dd8239f997 HTTP cleanup
This ifdef's out more functions that are not used while !USE_MULTI
in http code.  Also the dependency of http related objects on http.h
header file was missing in the Makefile.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-06 14:26:57 -07:00
Christian Couder
895f10c3b5 Builtin git-rev-parse.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-03 23:45:30 -07:00
Junio C Hamano
3f69d405d7 Merge branch 'jc/cache-tree'
* jc/cache-tree: (26 commits)
  builtin-rm: squelch compiler warnings.
  git-write-tree writes garbage on sparc64
  Fix crash when reading the empty tree
  fsck-objects: do not segfault on missing tree in cache-tree
  cache-tree: a bit more debugging support.
  read-tree: invalidate cache-tree entry when a new index entry is added.
  Fix test-dump-cache-tree in one-tree disappeared case.
  fsck-objects: mark objects reachable from cache-tree
  cache-tree: replace a sscanf() by two strtol() calls
  cache-tree.c: typefix
  test-dump-cache-tree: validate the cached data as well.
  cache_tree_update: give an option to update cache-tree only.
  read-tree: teach 1-way merege and plain read to prime cache-tree.
  read-tree: teach 1 and 2 way merges about cache-tree.
  update-index: when --unresolve, smudge the relevant cache-tree entries.
  test-dump-cache-tree: report number of subtrees.
  cache-tree: sort the subtree entries.
  Teach fsck-objects about cache-tree.
  index: make the index file format extensible.
  cache-tree: protect against "git prune".
  ...

Conflicts:

	Makefile, builtin.h, git.c: resolved the same way as in next.
2006-05-28 22:57:47 -07:00
Jim Meyering
fc36f6a6c9 Don't write directly to a make target ($@).
Otherwise, if make is suspended, or killed with prejudice, or if the
system crashes, you could be left with an up-to-date, yet corrupt,
generated file.

I left off the `clean' addition, because I believe "make clean" should
not remove wildcard patterns like "*+", on the off-chance that someone
uses names like that for files they care about.  Besides, in practice,
those temporary files are left behind so rarely that they're not a bother,
and they're removed again as part of the next build.

[jc: sign-off?]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-25 22:57:06 -07:00
Martin Waitz
c53603249c Documentation/Makefile: remove extra /
As both DESTDIR and the prefix are supposed to be absolute pathnames
they can simply be concatenated without an extra / (like in the main Makefile).
The extra slash may even break installation on Windows.

[jc: adjusted an earlier workaround for this problem in the dist-doc
 target in the main Makefile as well. ]

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-25 22:48:45 -07:00
Timo Hirvonen
f81daefe56 Builtin git-cat-file
Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-24 13:35:35 -07:00
Junio C Hamano
73f0a1577b Merge branch 'js/fmt-patch'
This makes "git format-patch" a built-in.

* js/fmt-patch:
  git-rebase: use canonical A..B syntax to format-patch
  git-format-patch: now built-in.
  fmt-patch: Support --attach
  fmt-patch: understand old <his> notation
  Teach fmt-patch about --keep-subject
  Teach fmt-patch about --numbered
  fmt-patch: implement -o <dir>
  fmt-patch: output file names to stdout
  Teach fmt-patch to write individual files.
  Use RFC2822 dates from "git fmt-patch".
  git-fmt-patch: thinkofix to show [PATCH] properly.
  rename internal format-patch wip
  Minor tweak on subject line in --pretty=email
  Tentative built-in format-patch.
2006-05-24 12:19:47 -07:00
Junio C Hamano
f2054be4c4 Merge branch 'jc/builtin-n-tar-tree'
This pulls in "make many commands built-in" branches.

* jc/builtin-n-tar-tree:
  built-in tar-tree and remote tar-tree
  Builtin git-diff-files, git-diff-index, git-diff-stages, and git-diff-tree.
  Builtin git-show-branch.
  Builtin git-apply.
  Builtin git-commit-tree.
  Builtin git-read-tree.
  Builtin git-tar-tree.
  Builtin git-ls-tree.
  Builtin git-ls-files.
2006-05-24 11:24:50 -07:00
Junio C Hamano
376bb3a352 Merge branch 'lt/dirwalk'
This makes 'git add' and 'git rm' built-ins.

* lt/dirwalk:
  Add builtin "git rm" command
  Move pathspec matching from builtin-add.c into dir.c
  Prevent bogus paths from being added to the index.
  builtin-add: fix unmatched pathspec warnings.
  Remove old "git-add.sh" remnants
  builtin-add: warn on unmatched pathspecs
  Do "git add" as a builtin
  Clean up git-ls-file directory walking library interface
  libify git-ls-files directory traversal
2006-05-24 11:04:16 -07:00
Junio C Hamano
1af0d11283 Merge branch 'jc/tartree' into jc/builtin-n-tar-tree
* jc/tartree:
  built-in tar-tree and remote tar-tree
2006-05-23 14:44:31 -07:00
Peter Eriksen
e8cc9cd98e Builtin git-diff-files, git-diff-index, git-diff-stages, and git-diff-tree.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:13 -07:00
Peter Eriksen
51ce34b992 Builtin git-show-branch.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:13 -07:00
Peter Eriksen
ac6245e31a Builtin git-apply.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:13 -07:00
Peter Eriksen
6d96ac18e5 Builtin git-commit-tree.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:12 -07:00
Peter Eriksen
d147e501f3 Builtin git-read-tree.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:12 -07:00
Peter Eriksen
56d1398ad3 Builtin git-tar-tree.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:12 -07:00
Peter Eriksen
aae01bda7f Builtin git-ls-tree.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:12 -07:00
Peter Eriksen
0864f26421 Builtin git-ls-files.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:12 -07:00
Sean
7f7e6eacf9 Install git builtins into gitexecdir rather than bindir.
Moving "git-cmd" commands out of the path and into a special
git exec path, should include the builtins.

[jc: fixed the case where bindir == gitexecdir - ln -f fails
 with a complaint that src and dst are the same, likewise for
 the fallback cp.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-22 18:52:19 -07:00
Yakov Lerner
6ba68ab288 NO_INET_NTOP and compat/inet_ntop.c for some systems (e.g. old Cygwin).
For systems which lack inet_ntop(), this adds compat/inet_ntop.c,
and related build constant, NO_INET_NTOP. Older Cygwin(s) lack
inet_ntop().

Signed-off-by: Yakov Lerner <iler.ml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-21 16:44:36 -07:00
Junio C Hamano
685637381a git-format-patch: now built-in.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-21 02:48:21 -07:00