summaryrefslogtreecommitdiff
path: root/cache.h
Commit message (Collapse)AuthorAgeFilesLines
* [PATCH] Expose object ID computation functions.Bryan Larsen2005-07-081-1/+7
| | | | | | | | | | | | | | 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>
* Add "mkpath()" helper functionLinus Torvalds2005-07-081-0/+1
| | | | I'm bored with doing it by hand all the time.
* [PATCH] clone-pack.c:write_one_ref() - Create leading directories.Junio C Hamano2005-07-061-0/+2
| | | | | | | | | | | 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>
* Move "get_ack()" to common git_connect functionsLinus Torvalds2005-07-051-0/+1
| | | | git-clone-pack will want it too. Soon.
* Add "git_path()" and "head_ref()" helper functions.Linus Torvalds2005-07-051-0/+1
| | | | | | | "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.
* Move ref path matching to connect.c libraryLinus Torvalds2005-07-041-0/+1
| | | | It's a generic thing for matching refs from the other side.
* Factor out the ssh connection stuff from send-pack.cLinus Torvalds2005-07-041-0/+3
| | | | I want to use it for git-fetch-pack too.
* Add "has_sha1_pack()" function to query whether the object is available in a ↵Linus Torvalds2005-07-031-0/+1
| | | | | | pack We'll want this for incremental packing.
* [PATCH] Show more details of packfile with verify-pack -v.Junio C Hamano2005-06-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | 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>
* [PATCH] verify-pack updates.Junio C Hamano2005-06-301-0/+9
| | | | | | | | | | | | | | | | | | | | 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>
* Add first cut at "git-receive-pack"Linus Torvalds2005-06-291-0/+2
| | | | | | | | 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.
* [PATCH] Add git-verify-pack command.Junio C Hamano2005-06-291-0/+4
| | | | | | | | | | | | | | | | | | | | | 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>
* [PATCH] Expose packed_git and alt_odb.Junio C Hamano2005-06-281-0/+19
| | | | | | | | | | | 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>
* [PATCH] Enhance sha1_file_size() into sha1_object_info()Junio C Hamano2005-06-271-1/+1
| | | | | | | | 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>
* [PATCH] Remove "delta" object representation.Junio C Hamano2005-06-271-1/+0
| | | | | | | | | | | 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>
* [PATCH] Fix oversimplified optimization for add_cache_entry().Junio C Hamano2005-06-251-0/+1
| | | | | | | | | | | | | | | | | | 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>
* [PATCH] Anal retentive 'const unsigned char *sha1'Jason McMullan2005-06-081-1/+1
| | | | | | | Make 'sha1' parameters const where possible Signed-off-by: Jason McMullan <jason.mcmullan@timesys.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] Operations on refsDaniel Barkalow2005-06-061-0/+1
| | | | | | | | | 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>
* Add "__noreturn__" attribute to die() and usage()Linus Torvalds2005-06-061-2/+8
| | | | | Only with gcc. It fixes some warnings for certain versions of gcc, but not apparently all.
* More work on merging with git-read-tree..Linus Torvalds2005-06-051-0/+1
| | | | | | | | | 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.
* Make fiel checkout function available to the git libraryLinus Torvalds2005-06-051-0/+11
| | | | | The merge stuff will want it soon, and we don't want to duplicate all the work..
* [PATCH] Find size of SHA1 object without inflating everything.Junio C Hamano2005-06-021-0/+1
| | | | | | | | | 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>
* [PATCH] Handle deltified object correctly in git-*-pull family.Junio C Hamano2005-06-021-0/+1
| | | | | | | | | | | | | | | | | | 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>
* Split up unpack_sha1_file() some moreLinus Torvalds2005-06-021-0/+1
| | | | | | | | 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.
* Add "unpack_sha1_header()" helper functionLinus Torvalds2005-06-011-0/+1
| | | | | | | | | | | It's for people who aren't necessarily interested in the whole unpacked file, but do want to know the header information (size, type, etc..) For example, the delta code can use this to figure out whether an object is already a delta object, and what it is a delta against, without actually bothering to unpack all of the actual data in the delta.
* Include file cleanups..Linus Torvalds2005-05-221-0/+1
| | | | | | | Add <limits.h> to the include files handled by "cache.h", and remove extraneous #include directives from various .c files. The rule is that "cache.h" gets all the basic stuff, so that we'll have as few system dependencies as possible.
* Introduce "base_name_compare()" helper functionLinus Torvalds2005-05-201-0/+1
| | | | | | This one compares two pathnames that may be partial basenames, not full paths. We need to get the path sorting right, since a directory name will sort as if it had the final '/' at the end.
* [PATCH] Implement git-checkout-cache -u to update stat information in the cache.Junio C Hamano2005-05-191-0/+9
| | | | | | | | | | With -u flag, git-checkout-cache picks up the stat information from newly created file and updates the cache. This removes the need to run git-update-cache --refresh immediately after running git-checkout-cache. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] Kill a bunch of pointer sign warnings for gcc4Brian Gerst2005-05-181-2/+2
| | | | | | | | | - Raw hashes should be unsigned char. - String functions want signed char. - Hash and compress functions want unsigned char. Signed-off By: Brian Gerst <bgerst@didntduck.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Remove obsolete note about native CPU byte formatPetr Baudis2005-05-151-4/+0
| | | | | Comment in entry.h said that the cache contents is in the native CPU byte format, which is really not true anymore for quite some time.
* Rename some more cache-related functionsBrad Roberts2005-05-151-2/+2
| | | | | | | | same_name -> ce_same_name() remove_entry_at() -> remove_cache_entry_at() Signed-off-by: Brad Roberts <braddr@puremagic.com> Signed-off-by: Petr Baudis <pasky@ucw.cz>
* Rename cache_match_stat() to ce_match_stat()Brad Roberts2005-05-151-1/+1
| | | | | Signed-off-by: Brad Roberts <braddr@puremagic.com> Signed-off-by: Petr Baudis <pasky@ucw.cz>
* Cleanup the x-allocation functionsBrad Roberts2005-05-151-2/+10
| | | | | | | | xmalloc() and xrealloc() now take their sizes as size_t-type arguments. Introduced complementary xcalloc(). Signed-off-by: Brad Roberts <braddr@puremagic.com> Signed-off-by: Petr Baudis <pasky@ucw.cz>
* [PATCH 2/3] Support symlinks in git-ls-files --others.Junio C Hamano2005-05-131-0/+1
| | | | | | | | | | It is kind of surprising that this was missed in the last round, but the work tree scanner in git-ls-files was still deliberately ignoring symlinks. This patch fixes it, so that --others will correctly report unregistered symlinks. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Petr Baudis <pasky@ucw.cz>
* Merge with http://members.cox.net/junkio/git-jc.gitPetr Baudis2005-05-111-8/+17
|\
| * Introduce GIT_DIR environment variable.Junio C Hamano2005-05-091-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the mailing list discussion on renaming GIT_ environment variables, people felt that having one environment that lets the user (or Porcelain) specify both SHA1_FILE_DIRECTORY (now GIT_OBJECT_DIRECTORY) and GIT_INDEX_FILE for the default layout would be handy. This change introduces GIT_DIR environment variable, from which the defaults for GIT_INDEX_FILE and GIT_OBJECT_DIRECTORY are derived. When GIT_DIR is not defined, it defaults to ".git". GIT_INDEX_FILE defaults to "$GIT_DIR/index" and GIT_OBJECT_DIRECTORY defaults to "$GIT_DIR/objects". Special thanks for ideas and discussions go to Petr Baudis and Daniel Barkalow. Bugs are mine ;-) Signed-off-by: Junio C Hamano <junkio@cox.net>
| * Rename environment variables.Junio C Hamano2005-05-091-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | H. Peter Anvin mentioned that using SHA1_whatever as an environment variable name is not nice and we should instead use names starting with "GIT_" prefix to avoid conflicts. Here is what this patch does: * Renames the following environment variables: New name Old Name GIT_AUTHOR_DATE AUTHOR_DATE GIT_AUTHOR_EMAIL AUTHOR_EMAIL GIT_AUTHOR_NAME AUTHOR_NAME GIT_COMMITTER_EMAIL COMMIT_AUTHOR_EMAIL GIT_COMMITTER_NAME COMMIT_AUTHOR_NAME GIT_ALTERNATE_OBJECT_DIRECTORIES SHA1_FILE_DIRECTORIES GIT_OBJECT_DIRECTORY SHA1_FILE_DIRECTORY * Introduces a compatibility macro, gitenv(), which does an getenv() and if it fails calls gitenv_bc(), which in turn picks up the value from old name while giving a warning about using an old name. * Changes all users of the environment variable to fetch environment variable with the new name using gitenv(). * Updates the documentation and scripts shipped with Linus GIT distribution. The transition plan is as follows: * We will keep the backward compatibility list used by gitenv() for now, so the current scripts and user environments continue to work as before. The users will get warnings when they have old name but not new name in their environment to the stderr. * The Porcelain layers should start using new names. However, just in case it ends up calling old Plumbing layer implementation, they should also export old names, taking values from the corresponding new names, during the transition period. * After a transition period, we would drop the compatibility support and drop gitenv(). Revert the callers to directly call getenv() but keep using the new names. The last part is probably optional and the transition duration needs to be set to a reasonable value. Signed-off-by: Junio C Hamano <junkio@cox.net>
| * Add git-update-cache --replace option.Junio C Hamano2005-05-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | When "path" exists as a file or a symlink in the index, an attempt to add "path/file" is refused because it results in file vs directory conflict. Similarly when "path/file1", "path/file2", etc. exist, an attempt to add "path" as a file or a symlink is refused. With git-update-cache --replace, these existing entries that conflict with the entry being added are automatically removed from the cache, with warning messages. Signed-off-by: Junio C Hamano <junkio@cox.net>
| * Introduce SHA1_FILE_DIRECTORIES to support multiple object databases.Junio C Hamano2005-05-071-0/+1
| | | | | | | | | | | | | | | | | | | | SHA1_FILE_DIRECTORIES environment variable is a colon separated paths used when looking for SHA1 files not found in the usual place for reading. Creating a new SHA1 file does not use this alternate object database location mechanism. This is useful to archive older, rarely used objects into separate directories. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Mark the variable declarations in .h files as externPetr Baudis2005-05-111-2/+2
|/ | | | | | This allows git to be built even with linkers which are not smart enough to join those symbols, and makes this correct C. Pointed out by several people.
* [PATCH] Remove unused sha1_file_directory variable.Junio C Hamano2005-05-061-1/+0
| | | | | | | Now all the users have gone. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Revert bogus optimization that avoids index file writesLinus Torvalds2005-05-061-1/+1
| | | | | | | | | | It didn't properly mark all cache updates as being dirty, and causes merge errors due to that. In particular, it didn't notice when a file was force-removed. Besides, it was ugly as hell. I've put in place a slightly cleaner version, but I've not enabled the optimization because I don't want to be burned again.
* date.c: add "show_date()" function.Linus Torvalds2005-05-061-0/+1
| | | | Kind of like ctime(), but not as broken.
* Fix symlink handlingLinus Torvalds2005-05-051-3/+1
| | | | | We really always want to have S_IFREG there for non-symlinks, otherwise we create corrupt index files.
* [PATCH] git and symlinks as tracked contentKay Sievers2005-05-051-1/+9
| | | | | | | | | | Allow to store and track symlink in the repository. A symlink is stored the same way as a regular file, only with the appropriate mode bits set. The symlink target is therefore stored in a blob object. This will hopefully make our udev repository fully functional. :) Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Improve sha1 object file writing.Linus Torvalds2005-05-031-3/+0
| | | | | | | | | | | Make it much safer: we write to a temporary file, and then link that temporary file to the final destination. This avoids all the nasty races if several people write the same object at the same time. It should also result in nicer on-disk layout, since it means that objects all get created in the same subdirectory. That makes a lot of block allocation algorithms happier, since the objects will now be allocated from the same zone.
* Add git-write-blob.Junio C Hamano2005-05-011-0/+1
| | | | | | | | | | | | | | A new command, git-write-blob, is introduced. This registers the contents of any file on the filesystem as a blob in the object database and reports its SHA1 to the standard output. To implement it, the patch promotes index_fd() from a static function in update-cache.c to extern and moves it to a library source, sha1_file.c. This command is used to update git-merge-one-file-script so that it does not smudge the work tree. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Add "get_sha1()" helper function.Linus Torvalds2005-05-011-0/+1
| | | | | | | | | | | | This allows the programs to use various simplified versions of the SHA1 names, eg just say "HEAD" for the SHA1 pointed to by the .git/HEAD file etc. For example, this commit has been done with git-commit-tree $(git-write-tree) -p HEAD instead of the traditional "$(cat .git/HEAD)" syntax.
* [PATCH] compat: missing dirent.d_type fieldEdgar Toernig2005-04-301-0/+9
| | | | | Not everybody has "d_type".
* [PATCH] compat: support pre-1.2 zlibEdgar Toernig2005-04-301-0/+4
| | | | | Older zlib's don't have deflateBound()