@@ -547,13 +547,6 @@ static const char *anonymize_refname(const char *refname)
const char *full_refname = refname;
int i;
- /*
- * We also leave "master" as a special case, since it does not reveal
- * anything interesting.
- */
- if (!strcmp(refname, "refs/heads/master"))
- return refname;
-
strbuf_reset(&anon);
for (i = 0; i < ARRAY_SIZE(prefixes); i++) {
if (skip_prefix(refname, prefixes[i], &refname)) {
@@ -26,11 +26,8 @@ test_expect_success 'stream omits path names' '
! grep xyzzy stream
'
-test_expect_success 'stream allows master as refname' '
- grep master stream
-'
-
-test_expect_success 'stream omits other refnames' '
+test_expect_success 'stream omits refnames' '
+ ! grep master stream &&
! grep other stream &&
! grep mytag stream
'
@@ -52,9 +49,7 @@ test_expect_success 'refname mapping can be dumped' '
# we make no guarantees of the exact anonymized names,
# so just check that we have the right number and
# that a sample line looks sane.
- # Note that master is not anonymized, and so not included
- # in the mapping.
- test_line_count = 6 refs.out &&
+ test_line_count = 7 refs.out &&
grep "^refs/heads/other refs/heads/" refs.out
'
@@ -69,15 +64,16 @@ test_expect_success 'import stream to new repository' '
test_expect_success 'result has two branches' '
git for-each-ref --format="%(refname)" refs/heads >branches &&
test_line_count = 2 branches &&
- other_branch=$(grep -v refs/heads/master branches)
+ main_branch=$(sed -ne "s,refs/heads/master ,,p" ../refs.out) &&
+ other_branch=$(sed -ne "s,refs/heads/other ,,p" ../refs.out)
'
test_expect_success 'repo has original shape and timestamps' '
shape () {
git log --format="%m %ct" --left-right --boundary "$@"
} &&
(cd .. && shape master...other) >expect &&
- shape master...$other_branch >actual &&
+ shape $main_branch...$other_branch >actual &&
test_cmp expect actual
'
Running "fast-export --anonymize" will leave "refs/heads/master" untouched in the output, for two reasons: - it helped to have some known reference point between the original and anonymized repository - since it's historically the default branch name, it doesn't leak any information Now that we can ask fast-export to dump the anonymized ref mapping, we have a much better tool for the first one (because it works for _any_ ref, not just master). For the second, the notion of "default branch name" is likely to become configurable soon, at which point the name _does_ leak information. Let's drop this special case in preparation. Note that we have to adjust the test a bit, since it relied on using the name "master" in the anonymized repos. But this gives us a good opportunity to further test the new dumping feature. Signed-off-by: Jeff King <peff@peff.net> --- builtin/fast-export.c | 7 ------- t/t9351-fast-export-anonymize.sh | 16 ++++++---------- 2 files changed, 6 insertions(+), 17 deletions(-)