Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Poulpe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
octobus
Poulpe
Commits
f53460bb
Commit
f53460bb
authored
5 years ago
by
Raphaël Gomès
Browse files
Options
Downloads
Patches
Plain Diff
Make generation more robust
parent
d9e0dd2d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
repo-scripts/generate_unknown_files
+6
-1
6 additions, 1 deletion
repo-scripts/generate_unknown_files
with
6 additions
and
1 deletion
repo-scripts/generate_unknown_files
+
6
−
1
View file @
f53460bb
...
...
@@ -27,6 +27,7 @@
=> [
"
path/to/repo/hoggrnie
"
]
"""
cleaner_regex
=
re
.
compile
(
'
[\W_]+
'
,
flags
=
re
.
UNICODE
)
all_numbers_regex
=
re
.
compile
(
'
\d+
'
)
new_paths
=
[]
for
path
in
tracked_paths
:
...
...
@@ -36,5 +37,5 @@
# That way we don't easily create problematic filenames (on Linux...)
filename
=
cleaner_regex
.
sub
(
""
,
filename
)
if
len
(
filename
)
<
3
:
if
len
(
filename
)
<
5
or
all_numbers_regex
.
match
(
filename
)
:
# skip files that are too small to prevent easy conflict
...
...
@@ -40,7 +41,8 @@
# skip files that are too small to prevent easy conflict
# or purely made up of numbers.
continue
l
=
list
(
filename
)
random
.
shuffle
(
l
)
new_name
=
''
.
join
(
l
)
+
ext
...
...
@@ -41,9 +43,12 @@
continue
l
=
list
(
filename
)
random
.
shuffle
(
l
)
new_name
=
''
.
join
(
l
)
+
ext
if
new_name
==
basename
:
# we generated the same name
continue
new_paths
.
append
(
path
[
0
:
-
len
(
basename
)]
+
new_name
)
return
new_paths
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment