diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-25T23·06+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-25T23·06+0100 |
commit | 93ba78d6f4632ef1c5228965e3edc8c0faf88c1e (patch) | |
tree | 85730c182a9f5f492ade8e8ccdb1c2356f9900bd /third_party/git/Documentation/git-merge-base.txt | |
parent | 6f8fbf4aa4b1654ab27d4829e114538761817de0 (diff) |
revert(3p/git): Revert merge of git upstream at v2.26.2 r/852
This causes cgit to serve error pages, which is undesirable. This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing changes made to f2b211131f2347342dde63975b09cf603149f1a3.
Diffstat (limited to 'third_party/git/Documentation/git-merge-base.txt')
-rw-r--r-- | third_party/git/Documentation/git-merge-base.txt | 98 |
1 files changed, 41 insertions, 57 deletions
diff --git a/third_party/git/Documentation/git-merge-base.txt b/third_party/git/Documentation/git-merge-base.txt index 2d944e0851f6..261d5c116454 100644 --- a/third_party/git/Documentation/git-merge-base.txt +++ b/third_party/git/Documentation/git-merge-base.txt @@ -80,11 +80,9 @@ which is reachable from both 'A' and 'B' through the parent relationship. For example, with this topology: -.... - o---o---o---B - / ----o---1---o---o---o---A -.... + o---o---o---B + / + ---o---1---o---o---o---A the merge base between 'A' and 'B' is '1'. @@ -92,25 +90,21 @@ Given three commits 'A', 'B' and 'C', `git merge-base A B C` will compute the merge base between 'A' and a hypothetical commit 'M', which is a merge between 'B' and 'C'. For example, with this topology: -.... - o---o---o---o---C - / - / o---o---o---B - / / ----2---1---o---o---o---A -.... + o---o---o---o---C + / + / o---o---o---B + / / + ---2---1---o---o---o---A the result of `git merge-base A B C` is '1'. This is because the equivalent topology with a merge commit 'M' between 'B' and 'C' is: -.... - o---o---o---o---o - / \ - / o---o---o---o---M - / / ----2---1---o---o---o---A -.... + o---o---o---o---o + / \ + / o---o---o---o---M + / / + ---2---1---o---o---o---A and the result of `git merge-base A M` is '1'. Commit '2' is also a common ancestor between 'A' and 'M', but '1' is a better common ancestor, @@ -122,13 +116,11 @@ the best common ancestor of all commits. When the history involves criss-cross merges, there can be more than one 'best' common ancestor for two commits. For example, with this topology: -.... ----1---o---A - \ / - X - / \ ----2---o---o---B -.... + ---1---o---A + \ / + X + / \ + ---2---o---o---B both '1' and '2' are merge-bases of A and B. Neither one is better than the other (both are 'best' merge bases). When the `--all` option is not given, @@ -139,22 +131,18 @@ and B is (or at least used to be) to compute the merge base between A and B, and check if it is the same as A, in which case, A is an ancestor of B. You will see this idiom used often in older scripts. -.... -A=$(git rev-parse --verify A) -if test "$A" = "$(git merge-base A B)" -then - ... A is an ancestor of B ... -fi -.... + A=$(git rev-parse --verify A) + if test "$A" = "$(git merge-base A B)" + then + ... A is an ancestor of B ... + fi In modern git, you can say this in a more direct way: -.... -if git merge-base --is-ancestor A B -then - ... A is an ancestor of B ... -fi -.... + if git merge-base --is-ancestor A B + then + ... A is an ancestor of B ... + fi instead. @@ -166,15 +154,13 @@ topic origin/master`, the history of remote-tracking branch `origin/master` may have been rewound and rebuilt, leading to a history of this shape: -.... - o---B2 - / ----o---o---B1--o---o---o---B (origin/master) - \ - B0 - \ - D0---D1---D (topic) -.... + o---B2 + / + ---o---o---B1--o---o---o---B (origin/master) + \ + B0 + \ + D0---D1---D (topic) where `origin/master` used to point at commits B0, B1, B2 and now it points at B, and your `topic` branch was started on top of it back @@ -207,15 +193,13 @@ will find B0, and will replay D0, D1 and D on top of B to create a new history of this shape: -.... - o---B2 - / ----o---o---B1--o---o---o---B (origin/master) - \ \ - B0 D0'--D1'--D' (topic - updated) - \ - D0---D1---D (topic - old) -.... + o---B2 + / + ---o---o---B1--o---o---o---B (origin/master) + \ \ + B0 D0'--D1'--D' (topic - updated) + \ + D0---D1---D (topic - old) A caveat is that older reflog entries in your repository may be expired by `git gc`. If B0 no longer appears in the reflog of the |