diff options
| -rw-r--r-- | fsck.c | 5 | ||||
| -rwxr-xr-x | t/t1450-fsck.sh | 10 |
2 files changed, 11 insertions, 4 deletions
@@ -461,6 +461,11 @@ static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_optio generation += power * (name[--len] - '0'); if (power > 1 && len && name[len - 1] == '~') name_prefix_len = len - 1; + else { + /* Maybe a non-first parent, e.g. HEAD^2 */ + generation = 0; + name_prefix_len = len; + } } } diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 0c58cb349b..d3a3d2722b 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -658,13 +658,15 @@ test_expect_success 'fsck --name-objects' ' git init name-objects && ( cd name-objects && + git config core.logAllRefUpdates false && test_commit julius caesar.t && - test_commit augustus && - test_commit caesar && + test_commit augustus44 && + test_commit caesar && remove_object $(git rev-parse julius:caesar.t) && - test_must_fail git fsck --name-objects >out && tree=$(git rev-parse --verify julius:) && - test_i18ngrep "$tree (refs/tags/julius:" out + git tag -d julius && + test_must_fail git fsck --name-objects >out && + test_i18ngrep "$tree (refs/tags/augustus44\\^:" out ) ' |
