Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • Nektar Nektar
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 90
    • Issues 90
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 60
    • Merge requests 60
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Nektar
  • NektarNektar
  • Issues
  • #295
Closed
Open
Created Jul 18, 2022 by Thibault Lestang@tlestangMaintainer

How to fix conflicts due to the clang-format reformatting of the Nektar++ codebase

MR !1359 (merged) modifies the way source code is formatted. In practice, it modifies allm the Nektar++ source code files to apply the new standard code layout.

If your Merge Request is based on changes made before commit , theses changes will conflict with the reformatting on the master branch. To fix these conflicts, you can follow the procedure below. If your changes are based on commit or child commit, you can ignore this issue.

First things first, you'll need clang-format version 11.

  • Ubuntu/Debian
sudo apt update && sudo apt install clang-format-11
  • Fedora/OpenSUSE
dnf install clang-format-11
  • MacPorts
port install llvm-11 # use `clang-format-11`
  • Homebrew
brew install clang-format@11

Now, conflicts due to formatting can be fixed with:

  1. Make sure you are not currently running any merge operation
git merge --abort
  1. Fetch the latest changes on the upstream master branch
git fetch origin master
  1. If you have local changes (staged or unstaged), commit them or stash them. git status should print something close to
nothing added to commit [but untracked files present (use "git add" to track)]
  1. Merge the last commit before the reformatting branch was merged in the master branch. If you haven't updated your local branch in a while, it is likely that you will have to fix conflicts.
git merge fedf53148fd4f0f5387b40f34fd8de6401446bde
  1. Apply clang-format-11 to files modified since branching off from master
git diff $(git merge-base origin/master HEAD) --name-only -- "*.cpp" "*.h" ".hpp" ".hxx" | xargs clang-format-11 -i

where origin refers to the git@gitlab.nektar.info:nektar/nektar.git remote. You may have named it in a different way, .e.g upstream.

Important: Use clang-format version 11. On some platforms the name of the executable may differ; for example MacPorts installations should use the command clang-format-mp-11.

  1. Stage and commit the changes
git commit -am "[formatting] Apply clang-format-11"
  1. Merge the reformat commit into your branch, marking your version as the correct one in case of conflicting changes
git merge 6a3e03cf6 -s recursive -Xours

You branch is now up to date with the state of the master branch right after the reformatting was introduced. If your branch is still conflicting with the master branch, it is because your local changes conflict with changes made on the master branch after the reformatting was introduced. In other words these are normal conflicts, unrelated to the reformatting of the code base.

Edited Jul 29, 2022 by Thibault Lestang
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking