1
0
mirror of https://github.com/git/git.git synced 2024-10-06 23:51:24 +02:00
Commit Graph

110 Commits

Author SHA1 Message Date
Junio C Hamano
ff27adf3da Support +<src>:<dst> format in push as well.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-24 16:50:53 -07:00
Junio C Hamano
f1d090e13a Fix __attribute__ changes.
It cannot be checked with #ifndef, if you really think about what it
does which cannot be done only with the preprocessor.  My thinko.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-19 02:06:52 -07:00
Jason Riedy
75ea6911d6 [PATCH] Spell __attribute__ correctly in cache.h.
Sun's cc doesn't know __attribute__.

Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-18 21:55:46 -07:00
Linus Torvalds
828cc617c1 [PATCH] Export relative path handling "prefix_path()" function
Not all programs necessarily have a pathspec array of pathnames, some of
them (like git-update-cache) want to do things one file at a time.  So
export the single-path interface too.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-17 14:53:39 -07:00
Linus Torvalds
d288a70030 [PATCH] Make "git diff" work inside relative subdirectories
We always show the diff as an absolute path, but pathnames to diff are
taken relative to the current working directory (and if no pathnames are
given, the default ends up being all of the current working directory).

Note that "../xyz" also works, so you can do

	cd linux/drivers/char
	git diff ../block

and it will generate a diff of the linux/drivers/block changes.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-16 18:47:22 -07:00
Daniel Barkalow
c508df5edf [PATCH] Add function to read an index file from an arbitrary filename.
Note that the pack file has to be in the usual location if it gets
installed later.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-16 12:09:33 -07:00
Junio C Hamano
d5a63b9983 Alternate object pool mechanism updates.
It was a mistake to use GIT_ALTERNATE_OBJECT_DIRECTORIES
environment variable to specify what alternate object pools to
look for missing objects when working with an object database.
It is not a property of the process running the git commands,
but a property of the object database that is partial and needs
other object pools to complete the set of objects it lacks.

This patch allows you to have $GIT_OBJECT_DIRECTORY/info/alternates
whose contents is in exactly the same format as the environment
variable, to let an object database name alternate object pools
it depends on.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-15 03:00:20 -07:00
Timo Sirainen
4ec99bf080 [PATCH] -Werror fixes
GCC's format __attribute__ is good for checking errors, especially
with -Wformat=2 parameter. This fixes most of the reported problems
against 2005-08-09 snapshot.
2005-08-09 22:28:19 -07:00
Junio C Hamano
d3af621b14 Redo the templates generation and installation.
Per discussion with people interested in binary packaging,
change the default template location from /etc/git-core to
/usr/share/git-core hierarchy.  If a user wants to run git
before installing for whatever reason, in addition to adding
$src to the PATH environment variable, git-init-db can be run
with --template=$src/templates/blt/ parameter.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-06 13:49:26 -07:00
Holger Eitzenberger
f2db68eda8 [PATCH] git: add git_mkstemp()
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-05 23:06:58 -07:00
Junio C Hamano
f88395ac23 Renaming push.
This allows git-send-pack to push local refs to a destination
repository under different names.

Here is the name mapping rules for refs.

* If there is no ref mapping on the command line:

 - if '--all' is specified, it is equivalent to specifying
   <local> ":" <local> for all the existing local refs on the
   command line
 - otherwise, it is equivalent to specifying <ref> ":" <ref> for
   all the refs that exist on both sides.

* <name> is just a shorthand for <name> ":" <name>

* <src> ":" <dst>

  push ref that matches <src> to ref that matches <dst>.

  - It is an error if <src> does not match exactly one of local
    refs.

  - It is an error if <dst> matches more than one remote refs.

  - If <dst> does not match any remote refs, either

    - it has to start with "refs/"; <dst> is used as the
      destination literally in this case.

    - <src> == <dst> and the ref that matched the <src> must not
      exist in the set of remote refs; the ref matched <src>
      locally is used as the name of the destination.

For example,

  - "git-send-pack --all <remote>" works exactly as before;

  - "git-send-pack <remote> master:upstream" pushes local master
    to remote ref that matches "upstream".  If there is no such
    ref, it is an error.

  - "git-send-pack <remote> master:refs/heads/upstream" pushes
    local master to remote refs/heads/upstream, even when
    refs/heads/upstream does not exist.

  - "git-send-pack <remote> master" into an empty remote
    repository pushes the local ref/heads/master to the remote
    ref/heads/master.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-03 17:16:29 -07:00
Junio C Hamano
8d5afef0f9 Install sample hooks
A template mechanism to populate newly initialized repository
with default set of files is introduced.  Use it to ship example
hooks that can be used for update and post update checks, as
Josef Weidendorfer suggests.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-03 16:27:38 -07:00
barkalow@iabervon.org
70b9829ea7 [PATCH] Parallelize pulling by ssh
This causes ssh-pull to request objects in prefetch() and read then in
fetch(), such that it reduces the unpipelined round-trip time.

This also makes sha1_write_from_fd() support having a buffer of data
which it accidentally read from the fd after the object; this was
formerly not a problem, because it would always get a short read at
the end of an object, because the next object had not been
requested. This is no longer true.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-02 22:53:11 -07:00
barkalow@iabervon.org
bf592c5057 [PATCH] Functions for managing the set of packs the library is using (whitespace fixed)
This adds support for reading an uninstalled index, and installing a
pack file that was added while the program was running, as well as
functions for determining where to put the file.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-31 23:30:59 -07:00
Junio C Hamano
5da5c8f4cf Teach parse_commit_buffer about grafting.
Introduce a new file $GIT_DIR/info/grafts (or $GIT_GRAFT_FILE)
which is a list of "fake commit parent records".  Each line of
this file is a commit ID, followed by parent commit IDs, all
40-byte hex SHA1 separated by a single SP in between.  The
records override the parent information we would normally read
from the commit objects, allowing both adding "fake" parents
(i.e. grafting), and pretending as if a commit is not a child of
some of its real parents (i.e. cauterizing).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-31 11:58:49 -07:00
Junio C Hamano
8f3f9b09dc [PATCH] Add update-server-info.
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>
2005-07-23 18:28:19 -07:00
Linus Torvalds
d1c133f5d4 Merge three separate "fetch refs" functions
It really just boils down to one "get_remote_heads()" function, and a
common "struct ref" structure definition.
2005-07-16 13:55:50 -07:00
Eric W. Biederman
d289d13625 [PATCH] Move git_author_info and git_commiter_info to ident.c
Moving these functions allows all of the logic for figuring out what
these values are to be shared between programs.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-15 10:00:35 -07:00
Linus Torvalds
c0fd1f517e Make "ce_match_path()" a generic helper function
... and make git-diff-files use it too.  This all _should_ make the
diffcore-pathspec.c phase unnecessary, since the diff'ers now all do the
path matching early interally.
2005-07-14 16:55:06 -07:00
Linus Torvalds
3e58763542 Fix up read_tree() pathspec matching to use "const char **"
The same way the other pathspecs work.  Also fix missing success return
from the matching - not that anything actually uses this yet ;)
2005-07-14 11:39:27 -07:00
Linus Torvalds
0ca14a57f1 Start adding interfaces to read in partial trees
The same way "git-diff-tree" can limit its output to just a set of matches,
we can read in just a partial tree for comparison purposes.
2005-07-14 11:26:31 -07:00
Linus Torvalds
2386d65822 Add first cut at "git protocol" connect logic.
Useful for pulling stuff off a dedicated server.  Instead of connecting
with ssh or just starting a local pipeline, we connect over TCP to the
other side and try to see if there's a git server listening.

Of course, since I haven't written the git server yet, that will never
happen.  But the server really just needs to listen on a port, and
execute a "git-upload-pack" when somebody connects.

(It should read one packet-line, which should be of the format

	"git-upload-pack directoryname\n"

and eventually we migth have other commands the server might accept).
2005-07-13 18:46:20 -07:00
Linus Torvalds
6aa33f4035 Abstract out the "name <email> date" handling of commit-tree.c
We'll want to use it for the tagging too.
2005-07-12 11:49:27 -07:00
Linus Torvalds
26a2d8ae89 parse_date(): allow const date string
This is part of breaking up the tag ID patch by Eric Biederman.
2005-07-12 10:33:06 -07:00
Daniel Barkalow
d5f1befca8 [PATCH] Remove map_sha1_file
Remove map_sha1_file(), now unused.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-10 15:39:08 -07:00
Daniel Barkalow
a5eda52bfe [PATCH] write_sha1_to_fd()
Add write_sha1_to_fd(), which writes an object to a file descriptor. This
includes support for unpacking it and recompressing it.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-10 15:39:08 -07:00
Bryan Larsen
7672db20c2 [PATCH] Expose object ID computation functions.
This patch makes the first half of write_sha1_file() and
index_fd() externally visible, to allow callers to compute the
object ID without actually storing it in the object database.

[JC demangled the whitespaces himself because he liked the patch
 so much, and reworked the interface to index_fd() slightly,
 taking suggestion from Linus and of his own.]

Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-08 17:07:37 -07:00
Linus Torvalds
26c8a533af Add "mkpath()" helper function
I'm bored with doing it by hand all the time.
2005-07-08 16:20:59 -07:00
Junio C Hamano
b2cb94254b [PATCH] clone-pack.c:write_one_ref() - Create leading directories.
The function write_one_ref() is passed the list of refs received
from the other end, which was obtained by directory traversal
under $GIT_DIR/refs; this can contain paths other than what
git-init-db prepares and would fail to clone when there is
such.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-06 10:39:58 -07:00
Linus Torvalds
41cb7488b9 Move "get_ack()" to common git_connect functions
git-clone-pack will want it too. Soon.
2005-07-05 15:44:09 -07:00
Linus Torvalds
723c31fea2 Add "git_path()" and "head_ref()" helper functions.
"git_path()" returns a static pathname pointer into the git directory
using a printf-like format specifier.

"head_ref()" works like "for_each_ref()", except for just the HEAD.
2005-07-05 11:31:32 -07:00
Linus Torvalds
013e7c7ff4 Move ref path matching to connect.c library
It's a generic thing for matching refs from the other side.
2005-07-04 13:24:30 -07:00
Linus Torvalds
f71925983d Factor out the ssh connection stuff from send-pack.c
I want to use it for git-fetch-pack too.
2005-07-04 11:57:58 -07:00
Linus Torvalds
dade09c226 Add "has_sha1_pack()" function to query whether the object is available in a pack
We'll want this for incremental packing.
2005-07-03 13:06:36 -07:00
Junio C Hamano
ad8c80a58f [PATCH] Show more details of packfile with verify-pack -v.
This implements show_pack_info() function used in verify-pack
command when -v flag is used to obtain something like
unpack-objects used to give when it was first written.

It shows the following for each non-deltified object found in
the pack:

    SHA1 type size offset

For deltified objects, it shows this instead:

    SHA1 type size offset depth base_sha1

In order to get the output in the order that appear in the pack
file for debugging purposes, you can do this:

 $ git-verify-pack -v packfile | sort -n -k 4,4

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-30 22:33:47 -07:00
Junio C Hamano
f3bf922409 [PATCH] verify-pack updates.
Nico pointed out that having verify_pack.c and verify-pack.c was
confusing.  Rename verify_pack.c to pack-check.c as suggested,
and enhances the verification done quite a bit.

 - Built-in sha1_file unpacking knows that a base object of a
   deltified object _must_ be in the same pack, and takes
   advantage of that fact.

 - Earlier verify-pack command only checked the SHA1 sum for the
   entire pack file and did not look into its contents.  It now
   checks everything idx file claims to have unpacks correctly.

 - It now has a hook to give more detailed information for
   objects contained in the pack under -v flag.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-30 22:33:47 -07:00
Linus Torvalds
575f497456 Add first cut at "git-receive-pack"
It's not working yet, but it's at the point where I want to be able to
track my changes.  The theory of operation is that this is the "remote"
side of a "git push".  It can tell us what references the remote side
has, receives out reference update commands and a pack-file, and can
execute the unpacking command.
2005-06-29 17:52:11 -07:00
Junio C Hamano
f9253394a2 [PATCH] Add git-verify-pack command.
Given a list of <pack>.idx files, this command validates the
index file and the corresponding .pack file for consistency.

This patch also uses the same validation mechanism in fsck-cache
when the --full flag is used.

During normal operation, sha1_file.c verifies that a given .idx
file matches the .pack file by comparing the SHA1 checksum
stored in .idx file and .pack file as a minimum sanity check.
We may further want to check the pack signature and version when
we map the pack, but that would be a separate patch.

Earlier, errors to map a pack file was not flagged fatal but led
to a random fatal error later.  This version explicitly die()s
when such an error is detected.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-29 09:11:39 -07:00
Junio C Hamano
9a217f2a72 [PATCH] Expose packed_git and alt_odb.
The commands git-fsck-cache and probably git-*-pull needs to have a way
to enumerate objects contained in packed GIT archives and alternate
object pools.  This commit exposes the data structure used to keep track
of them from sha1_file.c, and adds a couple of accessor interface
functions for use by the enhanced git-fsck-cache command.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-28 15:16:25 -07:00
Junio C Hamano
36e4d74a21 [PATCH] Enhance sha1_file_size() into sha1_object_info()
This lets us eliminate one use of map_sha1_file() outside
sha1_file.c, to bring us one step closer to the packed GIT.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-27 15:27:51 -07:00
Junio C Hamano
c4584ae3fd [PATCH] Remove "delta" object representation.
Packed delta files created by git-pack-objects seems to be the
way to go, and existing "delta" object handling code has exposed
the object representation details to too many places.  Remove it
while we refactor code to come up with a proper interface in
sha1_file.c.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-27 15:27:51 -07:00
Junio C Hamano
b155725dae [PATCH] Fix oversimplified optimization for add_cache_entry().
An earlier change to optimize directory-file conflict check
broke what "read-tree --emu23" expects.  This is fixed by this
commit.

(1) Introduces an explicit flag to tell add_cache_entry() not to
    check for conflicts and use it when reading an existing tree
    into an empty stage --- by definition this case can never
    introduce such conflicts.

(2) Makes read-cache.c:has_file_name() and read-cache.c:has_dir_name()
    aware of the cache stages, and flag conflict only with paths
    in the same stage.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 16:52:16 -07:00
Jason McMullan
5d6ccf5ce7 [PATCH] Anal retentive 'const unsigned char *sha1'
Make 'sha1' parameters const where possible

Signed-off-by: Jason McMullan <jason.mcmullan@timesys.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-08 13:04:53 -07:00
Daniel Barkalow
95fc75129a [PATCH] Operations on refs
This patch adds code to read a hash out of a specified file under
{GIT_DIR}/refs/, and to write such files atomically and optionally with an
compare and lock.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-06 17:09:45 -07:00
Linus Torvalds
90334cf780 Add "__noreturn__" attribute to die() and usage()
Only with gcc. It fixes some warnings for certain versions
of gcc, but not apparently all.
2005-06-06 10:12:31 -07:00
Linus Torvalds
220a0b527b More work on merging with git-read-tree..
Add a "-u" flag to update the tree as a result of a merge.

Right now this code is way too anal about things, and fails merges it
shouldn't, but let me fix up the different cases and this will allow for
much smoother merging even in the presense of dirty data in the working
tree.
2005-06-05 22:07:31 -07:00
Linus Torvalds
12dccc1654 Make fiel checkout function available to the git library
The merge stuff will want it soon, and we don't want to
duplicate all the work..
2005-06-05 21:59:54 -07:00
Junio C Hamano
65c2e0c349 [PATCH] Find size of SHA1 object without inflating everything.
This adds sha1_file_size() helper function and uses it in the
rename/copy similarity estimator.  The helper function handles
deltified object as well.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-02 15:48:33 -07:00
Junio C Hamano
4a62b61939 [PATCH] Handle deltified object correctly in git-*-pull family.
When a remote repository is deltified, we need to get the
objects that a deltified object we want to obtain is based upon.
The initial parts of each retrieved SHA1 file is inflated and
inspected to see if it is deltified, and its base object is
asked from the remote side when it is.  Since this partial
inflation and inspection has a small performance hit, it can
optionally be skipped by giving -d flag to git-*-pull commands.
This flag should be used only when the remote repository is
known to have no deltified objects.

Rsync transport does not have this problem since it fetches
everything the remote side has.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-02 15:48:33 -07:00
Linus Torvalds
5180cacc20 Split up unpack_sha1_file() some more
Make a separate helper for parsing the header of an object file
(really carefully) and for unpacking the rest. This means that
anybody who uses the "unpack_sha1_header()" interface can easily
look at the header and decide to unpack the rest too, without
doing any extra work.
2005-06-02 07:57:25 -07:00