Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2021-02-10 21:01:30 +0300
committerJunio C Hamano <gitster@pobox.com>2021-02-10 23:38:05 +0300
commite89f89361cd7b706858eb22a6cf3d59d31a00acf (patch)
treec858a9415a6819491113dac575ecd10562607f8c /t/t1450-fsck.sh
parent8c891eed3a89ff945b7957cdf62037b2e2b6eca7 (diff)
fsck --name-objects: be more careful parsing generation numbers
In 7b35efd734e (fsck_walk(): optionally name objects on the go, 2016-07-17), the `fsck` machinery learned to optionally name the objects, so that it is easier to see what part of the repository is in a bad shape, say, when objects are missing. To save on complexity, this machinery uses a parser to determine the name of a parent given a commit's name: any `~<n>` suffix is parsed and the parent's name is formed from the prefix together with `~<n+1>`. However, this parser has a bug: if it finds a suffix `<n>` that is _not_ `~<n>`, it will mistake the empty string for the prefix and `<n>` for the generation number. In other words, it will generate a name of the form `~<bogus-number>`. Let's fix this. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1450-fsck.sh')
-rwxr-xr-xt/t1450-fsck.sh10
1 files changed, 6 insertions, 4 deletions
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
)
'