aboutsummaryrefslogtreecommitdiff
path: root/cache.h
Commit message (Collapse)AuthorAge
...
* Add "__noreturn__" attribute to die() and usage()Linus Torvalds2005-06-06
| | | | | 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-05
| | | | | | | | | 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-05
| | | | | 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-02
| | | | | | | | | 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-02
| | | | | | | | | | | | | | | | | | 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-02
| | | | | | | | 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-01
| | | | | | | | | | | 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-22
| | | | | | | 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-20
| | | | | | 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-19
| | | | | | | | | | 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-18
| | | | | | | | | - 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-15
| | | | | 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-15
| | | | | | | | 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-15
| | | | | Signed-off-by: Brad Roberts <braddr@puremagic.com> Signed-off-by: Petr Baudis <pasky@ucw.cz>
* Cleanup the x-allocation functionsBrad Roberts2005-05-15
| | | | | | | | 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-13
| | | | | | | | | | 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-11
|\
| * Introduce GIT_DIR environment variable.Junio C Hamano2005-05-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-07
| | | | | | | | | | | | | | | | | | | | | | | | 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-07
| | | | | | | | | | | | | | | | | | | | 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-11
|/ | | | | | 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-06
| | | | | | | 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-06
| | | | | | | | | | 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-06
| | | | Kind of like ctime(), but not as broken.
* Fix symlink handlingLinus Torvalds2005-05-05
| | | | | 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-05
| | | | | | | | | | 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-03
| | | | | | | | | | | 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-01
| | | | | | | | | | | | | | 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-01
| | | | | | | | | | | | 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-30
| | | | | Not everybody has "d_type".
* [PATCH] compat: support pre-1.2 zlibEdgar Toernig2005-04-30
| | | | | Older zlib's don't have deflateBound()
* [PATCH] Do date parsing by hand...Edgar Toernig2005-04-30
| | | | | | | | | | | | | | ...since everything out there is either strange (libc mktime has issues with timezones) or introduces unnecessary dependencies for people (libcurl). This goes back to the old date parsing, but moves it out into a file of its own, and does the "struct tm" to "seconds since epoch" handling by hand. I grepped through the tz-database and it seems there's one "country" left that has non-60-minute DST: Lord Howe Island. All others dropped that before 1970.
* [PATCH] Rename and extend read_tree_with_tree_or_commit_sha1Junio C Hamano2005-04-28
| | | | | | | | | | | | | | | This patch renames read_tree_with_tree_or_commit_sha1() to read_object_with_reference() and extends it to automatically dereference not just "commit" objects but "tag" objects. With this patch, you can say e.g.: ls-tree $tag read-tree -m $(merge-base $tag $HEAD) $tag $HEAD diff-cache $tag diff-tree $tag $HEAD Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] introduce xmalloc and xreallocChristopher Li2005-04-26
| | | | | | | | Introduce xmalloc and xrealloc to die gracefully with a descriptive message when out of memory, rather than taking a SIGSEGV. Signed-off-by: Christopher Li<chrislgit@chrisli.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Fix up the types in write_sha1_fileLinus Torvalds2005-04-25
| | | | Use "unsigned long" for the size, like we do everywhere else.
* Simplify "write_sha1_file()" interfacesLinus Torvalds2005-04-25
| | | | | The write function now adds the header to the file by itself, so there is no reason to duplicate it among all the users any more.
* [PATCH] Additional functions for the objects databaseDaniel Barkalow2005-04-23
| | | | | | | | | This adds two functions: one to check if an object is present in the local database, and one to add an object to the local database by reading it from a file descriptor and checking its hash. Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* New "diff-cache" implementation.Linus Torvalds2005-04-22
| | | | | | | | | | This one is about a million times simpler, and much more likely to be correct too. Instead of trying to match up a tree object against the index, we just read in the tree object side-by-side into the index, and just walk the resulting index file. This was what all the read-tree cleanups were all getting to.
* Move "read_tree()" to "tree.c" to be used as a generic helper function.Linus Torvalds2005-04-22
| | | | Next step: make "diff-cache" use it.
* Add support for alternate SHA1 library implementations.Linus Torvalds2005-04-21
| | | | | | | | | | This one includes the Mozilla SHA1 implementation sent in by Edgar Toernig. It's dual-licenced under MPL-1.1 or GPL, so in the context of git, we obviously use the GPL version. Side note: the Mozilla SHA1 implementation is about twice as fast as the default openssl one on my G5, but the default openssl one has optimized x86 assembly language on x86. So choose wisely.
* Add support for a "GIT_INDEX_FILE" environment variable.Linus Torvalds2005-04-21
| | | | | | | | | We use that to specify alternative index files, which can be useful if you want to (for example) generate a temporary index file to do some specific operation that you don't want to mess with your main one with. It defaults to the regular ".git/index" if it hasn't been specified.
* [PATCH] Accept commit in some places when tree is needed.Junio C Hamano2005-04-20
| | | | | | | | | | | | | | | This patch implements read_tree_with_tree_or_commit_sha1(), which can be used when you are interested in reading an unpacked raw tree data but you do not know nor care if the SHA1 you obtained your user is a tree ID or a commit ID. Before this function's introduction, you would have called read_sha1_file(), examined its type, parsed it to call read_sha1_file() again if it is a commit, and verified that the resulting object is a tree. Instead, this function does that for you. It returns NULL if the given SHA1 is not either a tree or a commit. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Improve build: add <unistd.h> and use -O2 instead of -O3Linus Torvalds2005-04-20
| | | | (Nobody should use -O3. It just makes bad inlining decisions).
* Make the sha1 of the index file go at the very end of the file.Linus Torvalds2005-04-20
| | | | This allows us to both calculate it and verify it faster.
* Do SHA1 hash _before_ compression.Linus Torvalds2005-04-20
| | | | | And add a "convert-cache" program to convert from old-style to new-style.
* Be much more liberal about the file mode bits.Linus Torvalds2005-04-16
| | | | | | We only really care about the difference between a file being executable or not (by its owner). Everything else we leave for the user umask to decide.
* [PATCH] Add --stage to show-files for new stage dircache.Junio C Hamano2005-04-16
| | | | | | | | | This adds --stage option to show-files command. It shows file-mode, SHA1, stage and pathname. Record separator follows the usual convention of -z option as before. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] Byteorder fix for read-tree, new -m semantics version.Junio C Hamano2005-04-16
| | | | | | | | | | | | The ce_namelen field has been renamed to ce_flags and split into the top 2-bit unused, next 2-bit stage number and the lowest 12-bit name-length, stored in the network byte order. A new macro create_ce_flags() is defined to synthesize this value from length and stage, but it forgets to turn the value into the network byte order. Here is a fix. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Make cache entry comparison take the new "state" flag into account.Linus Torvalds2005-04-15
| | | | | This is what allows us to have multiple states of the same file in the index, and what makes it always sort correctly.