summaryrefslogtreecommitdiff
path: root/diff.h
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-04 08:45:24 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-05-04 08:45:24 (GMT)
commitb46f0b6dfd09629645efc59cda76e7e4fad7ca39 (patch)
tree74a490c6a742801a5318f8c5a8be153a99d74e4b /diff.h
parent6fa28064b0c9da9c2c8696b4eac28ee5beaee469 (diff)
downloadgit-b46f0b6dfd09629645efc59cda76e7e4fad7ca39.zip
git-b46f0b6dfd09629645efc59cda76e7e4fad7ca39.tar.gz
git-b46f0b6dfd09629645efc59cda76e7e4fad7ca39.tar.bz2
Optimize diff-cache -p --cached
This patch optimizes "diff-cache -p --cached" by avoiding to inflate blobs into temporary files when the blob recorded in the cache matches the corresponding file in the work tree. The file in the work tree is passed as the comparison source in such a case instead. This optimization kicks in only when we have already read the cache this optimization and this is deliberate. Especially, diff-tree does not use this code, because changes are contained in small number of files relative to the project size most of the time, and reading cache is so expensive for a large project that the cost of reading it outweighs the savings by not inflating blobs. Also this patch cleans up the structure passed from diff clients by removing one unused structure member. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff.h')
-rw-r--r--diff.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/diff.h b/diff.h
index 8f269b2..0b76cc4 100644
--- a/diff.h
+++ b/diff.h
@@ -20,15 +20,12 @@ extern void diff_unmerge(const char *path);
/* These are for diff-tree-helper */
struct diff_spec {
- union {
- const char *name; /* path on the filesystem */
- unsigned char sha1[20]; /* blob object ID */
- } u;
+ unsigned char blob_sha1[20];
unsigned short mode; /* file mode */
- unsigned sha1_valid : 1; /* if true, use u.sha1 and trust mode.
- * (however with a NULL SHA1, read them
- * from the file!).
- * if false, use u.name and read mode from
+ unsigned sha1_valid : 1; /* if true, use blob_sha1 and trust mode;
+ * however with a NULL SHA1, read them
+ * from the file system.
+ * if false, use the name and read mode from
* the filesystem.
*/
unsigned file_valid : 1; /* if false the file does not even exist */