Skip to content

Commit 48939c5

Browse files
committed
Merge branch 'tk/fast-export-anonymized-tag-fix' into maint
The output from "git fast-export", when its anonymization feature is in use, showed an annotated tag incorrectly. * tk/fast-export-anonymized-tag-fix: fast-export: fix anonymized tag using original length
2 parents f11b01b + 2f040a9 commit 48939c5

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

builtin/fast-export.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ static void handle_tag(const char *name, struct tag *tag)
821821
static struct hashmap tags;
822822
message = anonymize_str(&tags, anonymize_tag,
823823
message, message_size, NULL);
824+
message_size = strlen(message);
824825
}
825826
}
826827

t/t9351-fast-export-anonymize.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ test_expect_success 'setup simple repo' '
1818
git update-index --add --cacheinfo 160000,$fake_commit,link1 &&
1919
git update-index --add --cacheinfo 160000,$fake_commit,link2 &&
2020
git commit -m "add gitlink" &&
21-
git tag -m "annotated tag" mytag
21+
git tag -m "annotated tag" mytag &&
22+
git tag -m "annotated tag with long message" longtag
2223
'
2324

2425
test_expect_success 'export anonymized stream' '
@@ -55,7 +56,8 @@ test_expect_success 'stream retains other as refname' '
5556

5657
test_expect_success 'stream omits other refnames' '
5758
! grep main stream &&
58-
! grep mytag stream
59+
! grep mytag stream &&
60+
! grep longtag stream
5961
'
6062

6163
test_expect_success 'stream omits identities' '
@@ -118,9 +120,9 @@ test_expect_success 'identical gitlinks got identical oid' '
118120
test_line_count = 1 commits
119121
'
120122

121-
test_expect_success 'tag points to branch tip' '
123+
test_expect_success 'all tags point to branch tip' '
122124
git rev-parse $other_branch >expect &&
123-
git for-each-ref --format="%(*objectname)" | grep . >actual &&
125+
git for-each-ref --format="%(*objectname)" | grep . | uniq >actual &&
124126
test_cmp expect actual
125127
'
126128

0 commit comments

Comments
 (0)