From: Junio C Hamano Date: Tue, 8 Jul 2008 20:05:06 +0000 (-0700) Subject: Merge branch 'qq/maint' into maint X-Git-Tag: v1.5.6.3~10 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/30161e73d17f309f9a7566459035b06ec748be7d?hp=8852f5d704edc20896a84ca9107978c478a2941b Merge branch 'qq/maint' into maint * qq/maint: run_command(): respect GIT_TRACE --- diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 59e95adf42..ba65bfa16b 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -301,9 +301,9 @@ It is the set of commits that are reachable from either one of `r1` or `r2` but not from both. Two other shorthands for naming a set that is formed by a commit -and its parent commits exists. `r1{caret}@` notation means all +and its parent commits exist. The `r1{caret}@` notation means all parents of `r1`. `r1{caret}!` includes commit `r1` but excludes -its all parents. +all of its parents. Here are a handful of examples: diff --git a/read-cache.c b/read-cache.c index 8e5fbb6192..f83de8c415 100644 --- a/read-cache.c +++ b/read-cache.c @@ -138,6 +138,16 @@ static int ce_modified_check_fs(struct cache_entry *ce, struct stat *st) return 0; } +static int is_empty_blob_sha1(const unsigned char *sha1) +{ + static const unsigned char empty_blob_sha1[20] = { + 0xe6,0x9d,0xe2,0x9b,0xb2,0xd1,0xd6,0x43,0x4b,0x8b, + 0x29,0xae,0x77,0x5a,0xd8,0xc2,0xe4,0x8c,0x53,0x91 + }; + + return !hashcmp(sha1, empty_blob_sha1); +} + static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st) { unsigned int changed = 0; @@ -193,6 +203,12 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st) if (ce->ce_size != (unsigned int) st->st_size) changed |= DATA_CHANGED; + /* Racily smudged entry? */ + if (!ce->ce_size) { + if (!is_empty_blob_sha1(ce->sha1)) + changed |= DATA_CHANGED; + } + return changed; }