[flang-dev] Rewriting f18's history for inclusion in llvm monorepo

Peter Waller via flang-dev flang-dev at lists.llvm.org
Fri Dec 6 07:49:58 PST 2019


On 06/12/2019 14:36, Peter Waller via flang-dev wrote:
> Another known deficiency is that we don't currently handle merges from
> mainline back into feature branches cleanly. There are a few of those
> and they look pretty weird. I haven't yet thought about this in great
> detail. I'll see if I can fix this issue.

Ah. Here is an example problematic case. 690b6f0d1 moves lots of files 
around the directory hierarchy. When git does a rebase of 02e8c4c86 
(Initial work on the representation of types.) onto 34fc2397a (Merge 
pull request #4), the rebased 02e8c4c86 ends up undoing the rename.

Currently, in flatten.sh, this results in the merge commit 2b3b07f10 
existing in the new flattened history (with one parent), which has the 
effect of redoing this rename.

In time-going forward order, here's what's happened:

* Mainline does a bunch of renames {foo.h => blah/foo.h}
* Branch modifies foo.h
* Branch merges mainline, and the recursive merge strategy "does the 
right thing with rename detection"

Result: modified blah/foo.h.

What do you get when you rebase the merge onto mainline? You end up with 
a new `foo.h` living along side `blah/foo.h`. I even tried `git rebase 
--merge -Xfind-renames`, to no avail. What do I expect to get? Ideally, 
I'd get just the modification to blah/foo.h.

I wasn't yet able to figure out how to provoke git-rebase to deal with 
this case. The simplest thing might just be to leave these "single 
parent merge" commits in place, since they have the effect of correcting 
the work-tree contents to what they should be. Unfortunately it means 
the "modified foo.h" commits are wrong, since they're modifying the 
wrong files. The other obvious solution might be to detect this case and 
throw it into the "hard" bucket.

Here is the git log --graph --oneline for the problematic merge:

*   7f2bbe3f4 Merge pull request #3 from tskeith/type
|\
| * 9d06c385d Adapt to new directory for idioms.cc, idioms.h.
| *   2b3b07f10 Merge remote-tracking branch 'upstream/master' into type
| |\
| |/
|/|
* |   34fc2397a Merge pull request #4 from ThePortlandGroup/directories
|\ \
| * | e10e43b69 Tweaked .clang-format, then ran it.
| * | 690b6f0d1 Impose a directory structure.  Move files around. 
Introduce an intermediate "parser" namespace.
|/ /
| * ecdffa374 Address some of the review comments.
| * 02e8c4c86 Initial work on the representation of types.
|/
* f40b5e40d Markdown improvements.



More information about the flang-dev mailing list