ExternalProject rebasing fails for some legitimate update scenarios
Consider a simple ExternalProject use case with a git repo (pointing to a local git repo for this example, but it can be any valid git URL):
cmake_minimum_required(VERSION 3.7.0)
project(Foo)
include(ExternalProject)
ExternalProject_Add(gitTest
GIT_REPOSITORY file:///Users/craig/Projects/rebaseRepo
GIT_TAG myBranch
CONFIGURE_COMMAND ""
BUILD_COMMAND echo "Built"
INSTALL_COMMAND ""
TEST_COMMAND ""
)
If the user builds the above project, it will succeed the first time. Now let's suppose that the myBranch
branch is reset to a commit that came later on master and that the changes on master and the changes on the original myBranch
conflict. I would have expected to simply get the new location of myBranch
, effectively discarding the old branch, but the ExternalProject
implementation tries to use a rebase rather than a reset, which results in the conflicts causing the rebase to fail. In this scenario, no local changes are being made to the source directory, so it would seem reasonable for the user to expect that ExternalProject
would simply follow whatever the git tag/branch points to, including if it is moved, rebased, etc. and discard the local branch.
I can understand that there may be situations where a rebase to preserve local changes could be desirable, but failing the simpler (and more likely) case where no local changes are being made would seem to be a bug.