summaryrefslogtreecommitdiff
path: root/update-cache.c
AgeCommit message (Collapse)AuthorFilesLines
2005-05-01Implement git-update-cache --force-remove <path>Libravatar Junio C Hamano1-0/+9
This new flag tells git-update-cache to remove the named path even when the work tree still happens to have the file. It is used to update git-merge-one-file-script not to smudge the work tree. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-01Add git-write-blob.Libravatar Junio C Hamano1-51/+0
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>
2005-05-01[PATCH] Make git-update-cache --refresh fail if update/merge needed.Libravatar Junio C Hamano1-5/+10
Scripts may find it useful if they do not have to parse the output from the command but just can rely on its exit status. Earlier both Linus and myself thought this would be necessary to make git-prune-script safer but it turns out that the issue was somewhere else and not related to what this patch addresses. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-01[PATCH] Allow removing files in a subdirectory.Libravatar Junio C Hamano1-1/+1
I found this during a conflict merge testing. The original did not have either DF (a file) or DF/DF (a file DF/DF under a directory DF). One side created DF, the other created DF/DF. I first resolved DF as a new file by taking what the first side did. After that, the entry DF/DF cannot be resolved by running git-update-cache --remove although it does not exist on the filesystem. $ /bin/ls -F AN DF MN NM NN SS Z/ $ git-ls-files --stage | grep DF 100644 71420ab81e254145d26d6fc0cddee64c1acd4787 0 DF 100644 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 2 DF/DF $ git-update-cache --remove DF/DF fatal: Unable to add DF/DF to database It turns out that the errno from open() in this case was not ENOENT but ENOTDIR, which the code did not check. Here is a fix. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-26[PATCH] introduce xmalloc and xreallocLibravatar Christopher Li1-5/+5
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>
2005-04-26update-cache: remove index lock file on SIGINTLibravatar Linus Torvalds1-0/+7
This makes it a lot more pleasant to use when you interrupt a long-running operation.
2005-04-24[PATCH] update-cache: add "--ignore-missing" optionLibravatar James Bottomley1-6/+27
This adds an --ignore-missing option to update-cache, which makes it ignore missing files. Together with the "-n" option to checkout-cache, it allows me to do checkout-cache -n -f -a && update-cache --ignore-missing --refresh which only updates and refreshes the files I already have checked out. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-21Add support for a "GIT_INDEX_FILE" environment variable.Libravatar Linus Torvalds1-8/+11
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.
2005-04-20The recent hash/compression switch-over missed the blob creation.Libravatar Linus Torvalds1-5/+9
Happily, convert-cache just magically fixes all errors.
2005-04-18[PATCH] Fix confusing behaviour of update-cache --refresh on unmerged paths.Libravatar Junio C Hamano1-2/+11
The "update-cache --refresh" command attempts refresh_entry() on unmerged path, which results in as many "needs update" messages as there are unmerged stages for that path. This does not do any harm to the working directory, but it is confusing. Here is a fix. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-17[PATCH] Remove unused arguments from index_fd()Libravatar Junio C Hamano1-9/+6
The function index_fd() in update-cache.c takes 5 arguments, but two is not necessary and one that is a pointer to a structure really needs to be a pointer to one member of that structure. This patch cleans it up. Also it removes printf() apparently left after initial debugging. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16Be much more liberal about the file mode bits.Libravatar Linus Torvalds1-2/+2
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.
2005-04-15Encode a few extra flags per index entry.Libravatar Linus Torvalds1-2/+2
This will allow us to have the same name in different "states" in the index at the same time. Which in turn seems to be a very simple way to merge.
2005-04-15Add "--cacheinfo" option to update-cache.Libravatar Linus Torvalds1-0/+35
This allows scripts to manually add entries to the cache explicitly. Need to do some way to remove them too, even if the path exists.
2005-04-15Convert the index file reading/writing to use network byte order.Libravatar Linus Torvalds1-14/+11
This allows using a git tree over NFS with different byte order, and makes it possible to just copy a fully populated repository and have the end result immediately usable (needing just a refresh to update the stat information).
2005-04-13[PATCH] nsec portabilityLibravatar Petr Baudis1-0/+4
It seems like the nsec portability is limited; in particular, older glibcs (<=2.2.4 at least) don't seem to like it. So access the nsec fields in struct stat only when -DNSEC. Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13[PATCH] Whitespace FixesLibravatar Ingo Molnar1-1/+1
Trivial whitespace fixes. From: Ingo Molnar <mingo@elte.hu> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13[PATCH] Consolidate the error handlingLibravatar Petr Baudis1-5/+5
Now there is error() for "library" errors and die() for fatal "application" errors. usage() is now used strictly only for usage errors. Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-11Allow zero-sized files to be checked in.Libravatar Linus Torvalds1-4/+8
The kernel may not want it, but others probably do. Noted (again) by Junio Hamano.
2005-04-11Rename ".dircache" directory to ".git"Libravatar Linus Torvalds1-4/+4
I started out calling the tool "dircache". That's clearly moronic.
2005-04-11Fix stale index.lock file removal using "atexit()".Libravatar Linus Torvalds1-17/+24
Problem noted by Randy Dunlap.
2005-04-11Fix "update-cache" not fixing up the size field as appropriate.Libravatar Linus Torvalds1-5/+6
The size field isn't in the tree information, so we need to update it if the sha1 matches.
2005-04-11Make "update-cache --refresh" do what it really should do: justLibravatar Linus Torvalds1-19/+99
refresh the "stat" information. We need this after having done a "read-tree", for example, when the stat information does not match the checked-out tree, and we want to start getting efficient cache matching against the parts of the tree that are already up-to-date.
2005-04-10Make "update-cache" a bit friendlier to use (and harder to mis-use).Libravatar Linus Torvalds1-3/+57
It now requires the "--add" flag before you add any new files, and a "--remove" file if you want to mark files for removal. And giving it the "--refresh" flag makes it just update all the files that it already knows about.
2005-04-09Make "write_cache()" and friends available as generic routines.Libravatar Linus Torvalds1-69/+0
This is needed for the change to make "read-tree" just read into the cache (and then you do a "checkout-cache" to update your current dir contents).
2005-04-09Make "cache_name_pos()" available to others.Libravatar Linus Torvalds1-36/+0
It finds the cache entry position for a given name, and is generally useful. Sure, everybody can just scan the active cache array, but since it's sorted, you actually want to search it with a binary search, so let's not duplicate that logic all over the place.
2005-04-08Use "-Wall -O2" for the compiler to get more warnings.Libravatar Linus Torvalds1-0/+2
And fix up the warnings that it pointed out. Let's keep the tree clean from early on. Not that the code is very beautiful anyway ;)
2005-04-07Add copyright notices.Libravatar Linus Torvalds1-0/+5
The tool interface sucks (especially "committing" information, which is just me doing everything by hand from the command line), but I think this is in theory actually a viable way of describing the world. So copyright it.
2005-04-07Initial revision of "git", the information manager from hellLibravatar Linus Torvalds1-0/+248