Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot_input
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
Container Registry
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CbmSoft
cbmroot_input
Merge requests
!16
Add checks for proper rebase and linear history
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add checks for proper rebase and linear history
f.uhlig/cbmroot_input:test_file_type
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Florian Uhlig
requested to merge
f.uhlig/cbmroot_input:test_file_type
into
master
4 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Viewing commit
0b272ede
Show latest version
1 file
+
61
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
0b272ede
Add checks for proper rebase and linear history
· 0b272ede
Administrator
authored
4 years ago
.gitlab-ci.yml
+
61
−
0
Options
stages
:
-
checkRepository
-
checkFormat
RebaseCheck
:
stage
:
checkRepository
image
:
alpine
tags
:
-
docker
only
:
refs
:
-
merge_requests
variables
:
-
$CI_MERGE_REQUEST_PROJECT_PATH == "CbmSoft/cbmroot_input" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
script
:
# Get the upstream repository manually. I did not find any other way to have it for
# comparison
# Check if a rebase is needed
# If a rebase is needed stop immediately
-
apk update && apk add git bash
-
.scripts/connect_upstream_repo.sh $CI_MERGE_REQUEST_PROJECT_URL
-
git fetch upstream
-
hash1=$(git show-ref upstream/master | cut -f1 -d' ')
-
hash2=$(git merge-base upstream/master origin/$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME)
-
echo "${hash1}"
-
echo "${hash2}"
-
if [ "${hash1}" = "${hash2}" ]; then
-
echo "No rebase required"
-
exit
0
-
else
-
echo "The Merge Request is not up-to-date"
-
echo "Rebase is required"
-
exit
1
-
fi
LinearHistCheck
:
stage
:
checkRepository
image
:
alpine
tags
:
-
docker
only
:
refs
:
-
merge_requests
variables
:
-
$CI_MERGE_REQUEST_PROJECT_PATH == "CbmSoft/cbmroot_input" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
script
:
# Get the upstream repository manually. I did not find any other way to have it for
# comparison
# Check if the history introduced by the MR is linear (no branch loop in fork)
# If not linear stop immediately
-
apk update && apk add git bash
-
.scripts/connect_upstream_repo.sh $CI_MERGE_REQUEST_PROJECT_URL
-
git fetch upstream
-
count=$(git rev-list --min-parents=2 --count upstream/master..HEAD)
-
echo "${count}"
-
if [ 0 = "${count}" ]; then
-
echo "History introduced in fork is linear"
-
exit
0
-
else
-
echo "History introduced in fork is not linear"
-
echo "${count} merge commits must be removed or the other new commits have to be replayed in a new branch"
-
exit
1
-
fi
FileFormatCheck
:
stage
:
checkFormat
image
:
alpine
Loading