File tree 2 files changed +18
-15
lines changed
2 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,8 @@ class GitMergeTooManyBases extends GitException {}
155
155
156
156
class GitMergeOnHashNotAllowed extends GitException {}
157
157
158
+ class GitMergeNoCommonAncestor extends GitException {}
159
+
158
160
class GitNotImplemented extends GitException {}
159
161
160
162
class GitRepoExists implements GitException {}
Original file line number Diff line number Diff line change @@ -36,25 +36,26 @@ extension Merge on GitRepository {
36
36
if (bases.length > 1 ) {
37
37
throw GitMergeTooManyBases ();
38
38
}
39
- if (bases.isNotEmpty) {
40
- var baseHash = bases.first.hash;
39
+ if (bases.isEmpty) {
40
+ throw GitMergeNoCommonAncestor ();
41
+ }
42
+ var baseHash = bases.first.hash;
41
43
42
- // up to date
43
- if (baseHash == commitB.hash) {
44
- return ;
45
- }
44
+ // up to date
45
+ if (baseHash == commitB.hash) {
46
+ return ;
47
+ }
46
48
47
- // fastforward
48
- if (baseHash == headCommit.hash) {
49
- var branchNameRef = headRef.target;
50
- assert (branchNameRef.isBranch ());
49
+ // fastforward
50
+ if (baseHash == headCommit.hash) {
51
+ var branchNameRef = headRef.target;
52
+ assert (branchNameRef.isBranch ());
51
53
52
- var newRef = HashReference (branchNameRef, commitB.hash);
53
- refStorage.saveRef (newRef);
54
+ var newRef = HashReference (branchNameRef, commitB.hash);
55
+ refStorage.saveRef (newRef);
54
56
55
- checkout ('.' );
56
- return ;
57
- }
57
+ checkout ('.' );
58
+ return ;
58
59
}
59
60
60
61
var baseTree = objStorage.readTree (bases.first.treeHash);
You can’t perform that action at this time.
0 commit comments