mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 00:18:56 +02:00
[Origin] Fixed pull command throwing too early during no fetch case
This commit is contained in:
parent
63a88a6885
commit
92e2e303ed
6 changed files with 84 additions and 21 deletions
|
@ -7874,8 +7874,10 @@ GitEngine.prototype.getTargetGraphDifference = function(
|
|||
target,
|
||||
source,
|
||||
targetBranch,
|
||||
sourceBranch
|
||||
sourceBranch,
|
||||
options
|
||||
) {
|
||||
options = options || {};
|
||||
sourceBranch = source.resolveID(sourceBranch);
|
||||
|
||||
var targetSet = target.getUpstreamSet(targetBranch);
|
||||
|
@ -7885,10 +7887,15 @@ GitEngine.prototype.getTargetGraphDifference = function(
|
|||
var sourceStartCommitJSON = sourceTree.commits[sourceStartCommit.get('id')];
|
||||
|
||||
if (target.refs[sourceStartCommitJSON.id]) {
|
||||
// either we throw since theres no work to be done, or we return an empty array
|
||||
if (options.dontThrowOnNoFetch) {
|
||||
return [];
|
||||
} else {
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-origin-fetch-uptodate')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ok great, we have our starting point and our stopping set. lets go ahead
|
||||
// and traverse upwards and keep track of depth manually
|
||||
|
@ -8050,9 +8057,22 @@ GitEngine.prototype.fetch = function(options) {
|
|||
this,
|
||||
this.origin,
|
||||
localBranch,
|
||||
remoteBranch
|
||||
remoteBranch,
|
||||
options
|
||||
);
|
||||
|
||||
if (commitsToMake.length === 0) {
|
||||
this.command.addWarning(intl.str(
|
||||
'git-error-origin-fetch-uptodate'
|
||||
));
|
||||
// no fetch needed...
|
||||
var d = Q.defer();
|
||||
return {
|
||||
deferred: d,
|
||||
chain: d.promise
|
||||
};
|
||||
}
|
||||
|
||||
var makeCommit = _.bind(function(id, parentIDs) {
|
||||
// need to get the parents first. since we order by depth, we know
|
||||
// the dependencies are there already
|
||||
|
@ -8125,7 +8145,8 @@ GitEngine.prototype.pull = function() {
|
|||
|
||||
// no matter what fetch
|
||||
var pendingFetch = this.fetch({
|
||||
dontResolvePromise: true
|
||||
dontResolvePromise: true,
|
||||
dontThrowOnNoFetch: true
|
||||
});
|
||||
// then either rebase or merge
|
||||
if (this.commandOptions['--rebase']) {
|
||||
|
@ -24249,8 +24270,10 @@ GitEngine.prototype.getTargetGraphDifference = function(
|
|||
target,
|
||||
source,
|
||||
targetBranch,
|
||||
sourceBranch
|
||||
sourceBranch,
|
||||
options
|
||||
) {
|
||||
options = options || {};
|
||||
sourceBranch = source.resolveID(sourceBranch);
|
||||
|
||||
var targetSet = target.getUpstreamSet(targetBranch);
|
||||
|
@ -24260,10 +24283,15 @@ GitEngine.prototype.getTargetGraphDifference = function(
|
|||
var sourceStartCommitJSON = sourceTree.commits[sourceStartCommit.get('id')];
|
||||
|
||||
if (target.refs[sourceStartCommitJSON.id]) {
|
||||
// either we throw since theres no work to be done, or we return an empty array
|
||||
if (options.dontThrowOnNoFetch) {
|
||||
return [];
|
||||
} else {
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-origin-fetch-uptodate')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ok great, we have our starting point and our stopping set. lets go ahead
|
||||
// and traverse upwards and keep track of depth manually
|
||||
|
@ -24425,9 +24453,22 @@ GitEngine.prototype.fetch = function(options) {
|
|||
this,
|
||||
this.origin,
|
||||
localBranch,
|
||||
remoteBranch
|
||||
remoteBranch,
|
||||
options
|
||||
);
|
||||
|
||||
if (commitsToMake.length === 0) {
|
||||
this.command.addWarning(intl.str(
|
||||
'git-error-origin-fetch-uptodate'
|
||||
));
|
||||
// no fetch needed...
|
||||
var d = Q.defer();
|
||||
return {
|
||||
deferred: d,
|
||||
chain: d.promise
|
||||
};
|
||||
}
|
||||
|
||||
var makeCommit = _.bind(function(id, parentIDs) {
|
||||
// need to get the parents first. since we order by depth, we know
|
||||
// the dependencies are there already
|
||||
|
@ -24500,7 +24541,8 @@ GitEngine.prototype.pull = function() {
|
|||
|
||||
// no matter what fetch
|
||||
var pendingFetch = this.fetch({
|
||||
dontResolvePromise: true
|
||||
dontResolvePromise: true,
|
||||
dontThrowOnNoFetch: true
|
||||
});
|
||||
// then either rebase or merge
|
||||
if (this.commandOptions['--rebase']) {
|
||||
|
|
1
build/bundle.min.25da6a44.js
Normal file
1
build/bundle.min.25da6a44.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
build/bundle.min.js
vendored
2
build/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -434,7 +434,7 @@
|
|||
For a much easier time perusing the source, see the individual files at:
|
||||
https://github.com/pcottle/learnGitBranching
|
||||
-->
|
||||
<script src="build/bundle.min.b4338512.js"></script>
|
||||
<script src="build/bundle.min.25da6a44.js"></script>
|
||||
|
||||
<!-- The advantage of github pages: super-easy, simple, slick static hostic.
|
||||
The downside? No raw logs to parse for analytics, so I have to include
|
||||
|
|
|
@ -755,8 +755,10 @@ GitEngine.prototype.getTargetGraphDifference = function(
|
|||
target,
|
||||
source,
|
||||
targetBranch,
|
||||
sourceBranch
|
||||
sourceBranch,
|
||||
options
|
||||
) {
|
||||
options = options || {};
|
||||
sourceBranch = source.resolveID(sourceBranch);
|
||||
|
||||
var targetSet = target.getUpstreamSet(targetBranch);
|
||||
|
@ -766,10 +768,15 @@ GitEngine.prototype.getTargetGraphDifference = function(
|
|||
var sourceStartCommitJSON = sourceTree.commits[sourceStartCommit.get('id')];
|
||||
|
||||
if (target.refs[sourceStartCommitJSON.id]) {
|
||||
// either we throw since theres no work to be done, or we return an empty array
|
||||
if (options.dontThrowOnNoFetch) {
|
||||
return [];
|
||||
} else {
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-origin-fetch-uptodate')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ok great, we have our starting point and our stopping set. lets go ahead
|
||||
// and traverse upwards and keep track of depth manually
|
||||
|
@ -931,9 +938,22 @@ GitEngine.prototype.fetch = function(options) {
|
|||
this,
|
||||
this.origin,
|
||||
localBranch,
|
||||
remoteBranch
|
||||
remoteBranch,
|
||||
options
|
||||
);
|
||||
|
||||
if (commitsToMake.length === 0) {
|
||||
this.command.addWarning(intl.str(
|
||||
'git-error-origin-fetch-uptodate'
|
||||
));
|
||||
// no fetch needed...
|
||||
var d = Q.defer();
|
||||
return {
|
||||
deferred: d,
|
||||
chain: d.promise
|
||||
};
|
||||
}
|
||||
|
||||
var makeCommit = _.bind(function(id, parentIDs) {
|
||||
// need to get the parents first. since we order by depth, we know
|
||||
// the dependencies are there already
|
||||
|
@ -1006,7 +1026,8 @@ GitEngine.prototype.pull = function() {
|
|||
|
||||
// no matter what fetch
|
||||
var pendingFetch = this.fetch({
|
||||
dontResolvePromise: true
|
||||
dontResolvePromise: true,
|
||||
dontThrowOnNoFetch: true
|
||||
});
|
||||
// then either rebase or merge
|
||||
if (this.commandOptions['--rebase']) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue