summaryrefslogtreecommitdiff
path: root/update-index.c
AgeCommit message (Collapse)Author
2005-10-07update-index: read --show-index-info output from standard input.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-07Show original and resulting blob object info in diff output.Junio C Hamano
This adds more cruft to diff --git header to record the blob SHA1 and the mode the patch/diff is intended to be applied against, to help the receiving end fall back on a three-way merge. The new header looks like this: diff --git a/apply.c b/apply.c index 7be5041..8366082 100644 --- a/apply.c +++ b/apply.c @@ -14,6 +14,7 @@ // files that are being modified, but doesn't apply the patch // --stat does just a diffstat, and doesn't actually apply +// --show-index-info shows the old and new index info for... ... Upon receiving such a patch, if the patch did not apply cleanly to the target tree, the recipient can try to find the matching old objects in her object database and create a temporary tree, apply the patch to that temporary tree, and attempt a 3-way merge between the patched temporary tree and the target tree using the original temporary tree as the common ancestor. The patch lifts the code to compute the hash for an on-filesystem object from update-index.c and makes it available to the diff output routine. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-02[PATCH] Re-instate index file write optimizationLinus Torvalds
This makes "git-update-index" avoid the new index file write if it didn't make any changes to the index. It still doesn't make things like "git status" be read-only operations in general, but if the index file doesn't need refreshing, it now will at least avoid making unnecessary changes. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-02[PATCH] Better error reporting for "git status"Linus Torvalds
Instead of "git status" ignoring (and hiding) potential errors from the "git-update-index" call, make it exit if it fails, and show the error. In order to do this, use the "-q" flag (to ignore not-up-to-date files) and add a new "--unmerged" flag that allows unmerged entries in the index without any errors. This also avoids marking the index "changed" if an entry isn't actually modified, and makes sure that we exit with an understandable error message if the index is corrupt or unreadable. "read_cache()" no longer returns an error for the caller to check. Finally, make die() and usage() exit with recognizable error codes, if we ever want to check the failure reason in scripts. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-27update-index: --stdin and -zJunio C Hamano
The new option --stdin reads list of paths to be updated from the standard input. As usual, -z means the paths are terminated with NUL characters, as opposed to LF without that option. This is useful to use git-diff-files -z and git-ls-files -z when the platform xargs does not support -0 option, and obviously saves one process even when xargs can take -0. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-25Diff clean-up.Junio C Hamano
This is a long overdue clean-up to the code for parsing and passing diff options. It also tightens some constness issues. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-20Show modified files in git-ls-filesJunio C Hamano
Add -m/--modified to show files that have been modified wrt. the index. [jc: The original came from Brian Gerst on Sep 1st but it only checked if the paths were cache dirty without actually checking the files were modified. I also added the usage string and a new test.] Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-20Fast-path 'update-index --refresh' a bit.Junio C Hamano
If the length in the stat information does not match what is recorded in the index, there is no point rehashing the contents to see if the index entry can be refreshed. We need to be a bit careful. Immediately after read-tree or checkout-index without -u, ce_size is set to zero and does not match the length of the blob that is recorded, and we need to actually look at the contents to see if it has been changed. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-18[PATCH] Improve git-update-index error reportingPetr Baudis
This makes git-update-index error reporting much less confusing. The user will know what went wrong with better precision, and will be given a hopefully less confusing advice. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-08Big tool rename.Junio C Hamano
As promised, this is the "big tool rename" patch. The primary differences since 0.99.6 are: (1) git-*-script are no more. The commands installed do not have any such suffix so users do not have to remember if something is implemented as a shell script or not. (2) Many command names with 'cache' in them are renamed with 'index' if that is what they mean. There are backward compatibility symblic links so that you and Porcelains can keep using the old names, but the backward compatibility support is expected to be removed in the near future. Signed-off-by: Junio C Hamano <junkio@cox.net>