From 7225e9b7e6d8e74e3edc347bde03d4c631e4c73b Mon Sep 17 00:00:00 2001 From: Peter Cottle Date: Wed, 16 Oct 2013 19:41:59 -0700 Subject: [PATCH] Change fetch arguments up a bit, start migrating --- src/js/git/commands.js | 16 ++++++++++++++-- src/js/git/index.js | 1 + todo.txt | 4 ---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/js/git/commands.js b/src/js/git/commands.js index 05ab031f..9212fb64 100644 --- a/src/js/git/commands.js +++ b/src/js/git/commands.js @@ -265,8 +265,20 @@ var commandConfig = { command.twoArgsImpliedOrigin(generalArgs); assertOriginSpecified(generalArgs); - if (generalArgs[1]) { - var tracking = assertBranchIsRemoteTracking(engine, generalArgs[1]); + var firstArg = generalArgs[1]; + if (firstArg && isColonRefspec(firstArg)) { + var refspecParts = firstArg.split(':'); + options.source = refspecParts[0]; + options.destination = refspecParts[1]; + + // destination will be created by fetch, but check source + assertIsRef(engine.origin, options.source); + } else if (firstArg) { + // here is the deal -- its JUST like git push. the first arg + // is used as both the destination and the source, so we need + // to make sure it exists as the source on REMOTE and then + // the destination will be created locally + var tracking = assertBranchIsRemoteTracking(engine, firstArg); options.branches = [engine.refs[tracking]]; } diff --git a/src/js/git/index.js b/src/js/git/index.js index a91925c9..6c31f130 100644 --- a/src/js/git/index.js +++ b/src/js/git/index.js @@ -1051,6 +1051,7 @@ GitEngine.prototype.fetch = function(options) { ) )); }, this); + if (!commitsToMake.length && !options.dontThrowOnNoFetch) { throw new GitError({ msg: intl.str('git-error-origin-fetch-uptodate') diff --git a/todo.txt b/todo.txt index b5641934..7e34abad 100644 --- a/todo.txt +++ b/todo.txt @@ -19,10 +19,6 @@ Argument things: aka fetch + merge, just like expected. ill probably still update o/master just for sanity. master is the source on the remote and HEAD is the source on local (place to merge). o/master gets updated regardless -so "git push origin branchNotOnLocal" fails but "git push origin someBranch" will make the someBranch on remote. - -3) HOWEVER if I'm git push-ing on banana and I say "git push origin master" then it pretends Im checked out on master. aka master is both source and destination, as expected. this is really 3 - Cases to handle / things to edit =======================