Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computing
cbmroot
Merge requests
!211
Add file format test
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Add file format test
f.uhlig/cbmroot:add_file_format_test
into
master
Overview
0
Commits
1
Pipelines
3
Changes
2
Merged
Florian Uhlig
requested to merge
f.uhlig/cbmroot:add_file_format_test
into
master
4 years ago
Overview
0
Commits
1
Pipelines
3
Changes
2
0
0
Merge request reports
Compare
master
version 2
560735f8
4 years ago
version 1
f83be377
4 years ago
master (base)
and
latest version
latest version
32557215
1 commit,
4 years ago
version 2
560735f8
3 commits,
4 years ago
version 1
f83be377
2 commits,
4 years ago
2 files
+
54
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
scripts/check-file-format.sh
0 → 100755
+
38
−
0
View file @ 32557215
Edit in single-file editor
Open in Web IDE
#!/bin/bash
if
[[
$#
-eq
1
]]
;
then
UPSTREAM
=
$1
else
if
[
-z
$UPSTREAM
]
;
then
UPSTREAM
=
$(
git remote
-v
|
grep
git.cbm.gsi.de[:/]computing/cbmroot |
cut
-f1
|
uniq
)
if
[
-z
$UPSTREAM
]
;
then
echo
"Error: Name of upstream repository not provided and not found by automatic means"
echo
'Please provide if by checking your remotes with "git remote -v" and exporting UPSTREAM'
echo
"or passing as an argument"
exit
-1
fi
fi
fi
echo
"Upstream name is :"
$UPSTREAM
BASE_COMMIT
=
$UPSTREAM
/master
CHANGED_FILES
=
$(
git diff
--name-only
$BASE_COMMIT
)
for
file
in
$CHANGED_FILES
;
do
result
=
$(
file
$file
|
grep
CRLF
)
if
[[
"
$result
"
!=
""
]]
;
then
echo
""
echo
"File
$file
has wrong file format"
echo
"
$result
"
echo
""
okay
=
false
fi
done
if
[[
"
$okay
"
=
"false"
]]
;
then
echo
""
echo
"Not all files have the correct file format"
echo
"Test failed"
exit
1
else
exit
0
fi
Loading