mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 15:38:33 +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
|
@ -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,9 +768,14 @@ GitEngine.prototype.getTargetGraphDifference = function(
|
|||
var sourceStartCommitJSON = sourceTree.commits[sourceStartCommit.get('id')];
|
||||
|
||||
if (target.refs[sourceStartCommitJSON.id]) {
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-origin-fetch-uptodate')
|
||||
});
|
||||
// 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
|
||||
|
@ -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