diff --git a/__tests__/remote.spec.js b/__tests__/remote.spec.js index 194d5a3a6..4f347975b 100644 --- a/__tests__/remote.spec.js +++ b/__tests__/remote.spec.js @@ -261,21 +261,21 @@ describe('Git Remotes', function() { it('will not fetch if ref does not exist on remote', function() { return expectTreeAsync( - 'git clone; git fakeTeamwork; git fetch foo:main', + 'git clone; git fakeTeamwork; git fetch origin foo:main', '{"branches":{"main":{"target":"C1","id":"main","remoteTrackingBranchID":"o/main"},"o/main":{"target":"C1","id":"o/main","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"}},"HEAD":{"target":"main","id":"HEAD"},"originTree":{"branches":{"main":{"target":"C2","id":"main","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"main","id":"HEAD"}}}' ); }); it('does not fetch if ref does not exist on remote with one arg', function() { return expectTreeAsync( - 'git clone; git fakeTeamwork; git fetch foo', + 'git clone; git fakeTeamwork; git fetch origin foo', '{"branches":{"main":{"target":"C1","id":"main","remoteTrackingBranchID":"o/main"},"o/main":{"target":"C1","id":"o/main","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"}},"HEAD":{"target":"main","id":"HEAD"},"originTree":{"branches":{"main":{"target":"C2","id":"main","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"main","id":"HEAD"}}}' ); }); it('validates branch names when fetching', function() { return expectTreeAsync( - 'git clone; git fakeTeamwork; git fetch main:HEAD; git fetch main:f<>', + 'git clone; git fakeTeamwork; git fetch origin main:f<>', '{"branches":{"main":{"target":"C1","id":"main","remoteTrackingBranchID":"o/main"},"o/main":{"target":"C1","id":"o/main","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"}},"HEAD":{"target":"main","id":"HEAD"},"originTree":{"branches":{"main":{"target":"C2","id":"main","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"main","id":"HEAD"}}}' ); }); @@ -311,7 +311,7 @@ describe('Git Remotes', function() { it('doesn\'t fetch if out of sync, but will update explicit dest if specified', function() { return expectTreeAsync( 'git clone; git fakeTeamwork; go HEAD~1; git fetch origin main:main;go main; gc; go HEAD~1; git fakeTeamwork;git fetch origin main:main', - '{"branches":{"main":{"target":"C3","id":"main","remoteTrackingBranchID":"o/main"},"o/main":{"target":"C1","id":"o/main","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C2"],"id":"C3"}},"HEAD":{"target":"C2","id":"HEAD"},"originTree":{"branches":{"main":{"target":"C4","id":"main","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C4":{"parents":["C2"],"id":"C4"}},"HEAD":{"target":"main","id":"HEAD"}}}' + '{"branches":{"main":{"target":"C3","id":"main","remoteTrackingBranchID":"o/main"},"o/main":{"target":"C2","id":"o/main","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C2"],"id":"C3"}},"HEAD":{"target":"C2","id":"HEAD"},"originTree":{"branches":{"main":{"target":"C4","id":"main","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C4":{"parents":["C2"],"id":"C4"}},"HEAD":{"target":"main","id":"HEAD"}}}' ); }); @@ -332,7 +332,7 @@ describe('Git Remotes', function() { it('correctly resolves source during git fetch with params', function() { return expectTreeAsync( - 'git clone; git push origin main:foo; git fakeTeamwork foo 2; git fetch origin foo^:blah', + 'git clone; git push origin main:foo; git fakeTeamwork foo 2; git fetch origin c2:blah', '{"branches":{"main":{"target":"C1","id":"main","remoteTrackingBranchID":"o/main"},"o/main":{"target":"C1","id":"o/main","remoteTrackingBranchID":null},"o/foo":{"target":"C1","id":"o/foo","remoteTrackingBranchID":null},"blah":{"target":"C2","id":"blah","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"main","id":"HEAD"},"originTree":{"branches":{"main":{"target":"C1","id":"main","remoteTrackingBranchID":null},"foo":{"target":"C3","id":"foo","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C2"],"id":"C3"}},"HEAD":{"target":"foo","id":"HEAD"}}}' ); }); @@ -346,14 +346,14 @@ describe('Git Remotes', function() { it('correctly resolves existing commits and updates', function() { return expectTreeAsync( - 'git clone; git push origin main:foo; git fakeTeamwork foo 2; git fetch origin foo^:blah;go C0; git fetch origin foo^:main', + 'git clone; git push origin main:foo; git fakeTeamwork foo 2; git fetch origin c2:blah;go C0; git fetch origin c2:main', '{"branches":{"main":{"target":"C2","id":"main","remoteTrackingBranchID":"o/main"},"o/main":{"target":"C1","id":"o/main","remoteTrackingBranchID":null},"o/foo":{"target":"C1","id":"o/foo","remoteTrackingBranchID":null},"blah":{"target":"C2","id":"blah","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"C0","id":"HEAD"},"originTree":{"branches":{"main":{"target":"C1","id":"main","remoteTrackingBranchID":null},"foo":{"target":"C3","id":"foo","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C2"],"id":"C3"}},"HEAD":{"target":"foo","id":"HEAD"}}}' ); }); it('doesn\'t let you fetch to main if you are checked out there', function() { return expectTreeAsync( - 'git clone; git push origin main:foo; git fakeTeamwork foo 2; git fetch origin foo^:blah; git fetch foo:main', + 'git clone; git push origin main:foo; git fakeTeamwork foo 2; git fetch origin c2:blah; git fetch origin foo:main', '{"branches":{"main":{"target":"C1","id":"main","remoteTrackingBranchID":"o/main"},"o/main":{"target":"C1","id":"o/main","remoteTrackingBranchID":null},"o/foo":{"target":"C1","id":"o/foo","remoteTrackingBranchID":null},"blah":{"target":"C2","id":"blah","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"main","id":"HEAD"},"originTree":{"branches":{"main":{"target":"C1","id":"main","remoteTrackingBranchID":null},"foo":{"target":"C3","id":"foo","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C2"],"id":"C3"}},"HEAD":{"target":"foo","id":"HEAD"}}}' ); }); @@ -368,7 +368,7 @@ describe('Git Remotes', function() { it('pulls to a new branch and then merges in that branch', function() { return expectTreeAsync( 'git clone; git fakeTeamwork; git commit; git pull origin main:bar', - '{"branches":{"main":{"target":"C4","id":"main","remoteTrackingBranchID":"o/main"},"o/main":{"target":"C1","id":"o/main","remoteTrackingBranchID":null},"bar":{"target":"C2","id":"bar","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C3":{"parents":["C1"],"id":"C3"},"C2":{"parents":["C1"],"id":"C2"},"C4":{"parents":["C2","C3"],"id":"C4"}},"HEAD":{"target":"main","id":"HEAD"},"originTree":{"branches":{"main":{"target":"C2","id":"main","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"main","id":"HEAD"}}}' + '{"branches":{"main":{"target":"C4","id":"main","remoteTrackingBranchID":"o/main"},"o/main":{"target":"C2","id":"o/main","remoteTrackingBranchID":null},"bar":{"target":"C2","id":"bar","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C3":{"parents":["C1"],"id":"C3"},"C2":{"parents":["C1"],"id":"C2"},"C4":{"parents":["C2","C3"],"id":"C4"}},"HEAD":{"target":"main","id":"HEAD"},"originTree":{"branches":{"main":{"target":"C2","id":"main","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"main","id":"HEAD"}}}' ); }); diff --git a/src/js/git/commands.js b/src/js/git/commands.js index 2e5c8dad4..0b6da0f31 100644 --- a/src/js/git/commands.js +++ b/src/js/git/commands.js @@ -22,6 +22,14 @@ var assertIsRef = function(engine, ref) { engine.resolveID(ref); // will throw git error if can't resolve }; +var assertRefNoModifiers = function(ref) { + if (/~|\^/.test(ref)) { + throw new GitError({ + msg: intl.str('git-error-exist', {ref: ref}) + }); + } +} + var validateBranchName = function(engine, name) { return engine.validateBranchName(name); }; @@ -255,6 +263,7 @@ var commandConfig = { if (firstArg && isColonRefspec(firstArg)) { var refspecParts = firstArg.split(':'); source = refspecParts[0]; + assertRefNoModifiers(source); destination = validateBranchNameIfNeeded( engine, crappyUnescape(refspecParts[1]) @@ -264,7 +273,6 @@ var commandConfig = { source = firstArg; assertIsBranch(engine.origin, source); // get o/main locally if main is specified - destination = engine.origin.resolveID(source).getPrefixedID(); } else { // can't be detached if (engine.getDetachedHead()) { @@ -277,8 +285,7 @@ var commandConfig = { var branch = engine.getOneBeforeCommit('HEAD'); var branchName = branch.get('id'); assertBranchIsRemoteTracking(engine, branchName); - destination = branch.getRemoteTrackingBranchID(); - source = destination.replace(ORIGIN_PREFIX, ''); + source = branch.getRemoteTrackingBranchID().replace(ORIGIN_PREFIX, ''); } engine.pull({ @@ -392,6 +399,7 @@ var commandConfig = { if (firstArg && isColonRefspec(firstArg)) { var refspecParts = firstArg.split(':'); source = refspecParts[0]; + assertRefNoModifiers(source); destination = validateBranchNameIfNeeded( engine, crappyUnescape(refspecParts[1]) @@ -405,7 +413,6 @@ var commandConfig = { source = firstArg; assertIsBranch(engine.origin, source); // get o/main locally if main is specified - destination = engine.origin.resolveID(source).getPrefixedID(); } if (source) { // empty string fails this check assertIsRef(engine.origin, source); diff --git a/src/js/git/index.js b/src/js/git/index.js index b8fbafea5..1e517c562 100644 --- a/src/js/git/index.js +++ b/src/js/git/index.js @@ -397,11 +397,8 @@ GitEngine.prototype.makeBranchIfNeeded = function(branchName) { if (this.doesRefExist(branchName)) { return; } - var where = this.findCommonAncestorForRemote( - this.getCommitFromRef('HEAD').get('id') - ); - return this.validateAndMakeBranch(branchName, this.getCommitFromRef(where)); + return this.validateAndMakeBranch(branchName, this.rootCommit); }; GitEngine.prototype.makeRemoteBranchForRemote = function(branchName) { @@ -1241,17 +1238,26 @@ GitEngine.prototype.fetch = function(options) { this.getCommitFromRef('HEAD') ); return; - } else if (options.destination && options.source) { + } else if (options.source) { + var sourceDestPairs = []; didMakeBranch = didMakeBranch || this.makeRemoteBranchIfNeeded(options.source); - didMakeBranch = didMakeBranch || this.makeBranchIfNeeded(options.destination); - options.didMakeBranch = didMakeBranch; - - return this.fetchCore([{ + var source = this.origin.resolveID(options.source); + if (source.get('type') == 'branch') { + sourceDestPairs.push({ + destination: this.origin.resolveID(options.source).getPrefixedID(), + source: options.source + }); + } + if (options.destination) { + didMakeBranch = didMakeBranch || this.makeBranchIfNeeded(options.destination); + sourceDestPairs.push({ destination: options.destination, source: options.source - }], - options - ); + }); + } + options.didMakeBranch = didMakeBranch; + options.dontThrowOnNoFetch = options.dontThrowOnNoFetch || didMakeBranch; + return this.fetchCore(sourceDestPairs, options); } // get all remote branches and specify the dest / source pairs var allBranchesOnRemote = this.origin.branchCollection.toArray(); @@ -1409,7 +1415,7 @@ GitEngine.prototype.pull = function(options) { return; } - var destBranch = this.resolveID(options.destination); + var destBranch = this.resolveID(options.destination || this.origin.resolveID(options.source).getPrefixedID()); // then either rebase or merge if (options.isRebase) { this.pullFinishWithRebase(pendingFetch, localBranch, destBranch); diff --git a/src/levels/remote/fetchArgs.js b/src/levels/remote/fetchArgs.js index 593e66275..03cf1070c 100644 --- a/src/levels/remote/fetchArgs.js +++ b/src/levels/remote/fetchArgs.js @@ -1,6 +1,6 @@ exports.level = { "goalTreeString": "{\"branches\":{\"main\":{\"target\":\"C6\",\"id\":\"main\",\"remoteTrackingBranchID\":\"o/main\"},\"foo\":{\"target\":\"C7\",\"id\":\"foo\",\"remoteTrackingBranchID\":\"o/foo\"},\"o/main\":{\"target\":\"C1\",\"id\":\"o/main\",\"remoteTrackingBranchID\":null},\"o/foo\":{\"target\":\"C1\",\"id\":\"o/foo\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"},\"C5\":{\"parents\":[\"C1\"],\"id\":\"C5\"},\"C6\":{\"parents\":[\"C5\"],\"id\":\"C6\"},\"C7\":{\"parents\":[\"C3\",\"C6\"],\"id\":\"C7\"}},\"HEAD\":{\"target\":\"foo\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"main\":{\"target\":\"C4\",\"id\":\"main\",\"remoteTrackingBranchID\":null},\"foo\":{\"target\":\"C6\",\"id\":\"foo\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C3\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C1\"],\"id\":\"C5\"},\"C6\":{\"parents\":[\"C5\"],\"id\":\"C6\"}},\"HEAD\":{\"target\":\"foo\",\"id\":\"HEAD\"}}}", - "solutionCommand": "git fetch origin main~1:foo;git fetch origin foo:main;git checkout foo;git merge main", + "solutionCommand": "git fetch origin c3:foo;git fetch origin c6:main;git checkout foo;git merge main", "startTree": "{\"branches\":{\"main\":{\"target\":\"C1\",\"id\":\"main\",\"remoteTrackingBranchID\":\"o/main\"},\"foo\":{\"target\":\"C1\",\"id\":\"foo\",\"remoteTrackingBranchID\":\"o/foo\"},\"o/main\":{\"target\":\"C1\",\"id\":\"o/main\",\"remoteTrackingBranchID\":null},\"o/foo\":{\"target\":\"C1\",\"id\":\"o/foo\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"}},\"HEAD\":{\"target\":\"C1\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"main\":{\"target\":\"C4\",\"id\":\"main\",\"remoteTrackingBranchID\":null},\"foo\":{\"target\":\"C6\",\"id\":\"foo\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C3\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C1\"],\"id\":\"C5\"},\"C6\":{\"parents\":[\"C5\"],\"id\":\"C6\"}},\"HEAD\":{\"target\":\"foo\",\"id\":\"HEAD\"}}}", "name": { "en_US": "Fetch arguments", @@ -118,7 +118,7 @@ exports.level = { "Let's see this craziness in action:" ], "afterMarkdowns": [ - "Wow! See, git resolved `C2` as a place on the origin and then downloaded those commits to `bar` (which was a local branch). Notice how `foo` and `o/foo` were not updated since we specified a destination." + "Wow! See, git resolved `C2` as a place on the origin and then downloaded those commits to `bar` (which was a local branch)." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -241,7 +241,7 @@ exports.level = { "Voyons ce phénomène en action :" ], "afterMarkdowns": [ - "Wow ! Vous voyez, Git a résolu `C2` comme un emplacement sur origin et a ensuite téléchargé les commits dans `bar` (qui était une branche locale). Remarquez aussi que `foo` et `o/foo` n'ont pas été mises à jour puisque nous avons spécifié une destination." + "Wow ! Vous voyez, Git a résolu `C2` comme un emplacement sur origin et a ensuite téléchargé les commits dans `bar` (qui était une branche locale)." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -364,7 +364,7 @@ exports.level = { "Veamos esta locura en acción:" ], "afterMarkdowns": [ - "¡Wow! Mirá: git resolvió `C2` como un lugar en el origin y bajó esos commits a `bar` (que era una rama local). Notá como `foo` y `o/foo` no fueron actualizados, dado que especificamos un destino." + "¡Wow! Mirá: git resolvió `C2` como un lugar en el origin y bajó esos commits a `bar` (que era una rama local)." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -487,7 +487,7 @@ exports.level = { "Veamos esta locura en acción:" ], "afterMarkdowns": [ - "¡Caramba! Mira: git resolvió `C2` como un lugar en el origin y bajó esos commits a `bar` (que era una rama local). Observa como `foo` y `o/foo` no fueron actualizados, dado que especificamos un destino." + "¡Caramba! Mira: git resolvió `C2` como un lugar en el origin y bajó esos commits a `bar` (que era una rama local)." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -610,7 +610,7 @@ exports.level = { "Vejamos essa loucura em ação:" ], "afterMarkdowns": [ - "Wow! Viu, o Git entendeu o `C2` como um lugar de origin e baixou os commits para o ramo local `bar`. Veja como `foo` e `o/foo` não foram atualizados, já que especificamos outro destino." + "Wow! Viu, o Git entendeu o `C2` como um lugar de origin e baixou os commits para o ramo local `bar`." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -733,7 +733,7 @@ exports.level = { "Vexamos esta locura en acción" ], "afterMarkdowns": [ - "¡Wow! Mira: git resolveu `C2` como un lugar no que a orixe descargou eses commits a `bar` (que era unha rama local). Nota como `foo` e `o/foo` non foron actualizados, xa que especificamos o destino." + "¡Wow! Mira: git resolveu `C2` como un lugar no que a orixe descargou eses commits a `bar` (que era unha rama local)." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -856,7 +856,7 @@ exports.level = { "讓我們來實際看一下這個瘋狂的事情:" ], "afterMarkdowns": [ - "哇!看到了吧,git 把 `C2` 解讀成一個在 origin 上的位置,而且把該位置上面的 commit 下載到 `bar`(這是一個 local branch)上面,注意,因為我們有指定目的地,因此 `foo` 跟 `o/foo` 並沒有被更新。" + "哇!看到了吧,git 把 `C2` 解讀成一個在 origin 上的位置,而且把該位置上面的 commit 下載到 `bar`(這是一個 local branch)上面。" ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -979,7 +979,7 @@ exports.level = { "来看个疯狂的例子:" ], "afterMarkdowns": [ - "哇! 看见了吧, Git 将 `C2` 解析成一个 origin 仓库的位置,然后将那些提交记录下载到了本地的 `bar` 分支(一个本地分支)上。注意由于我们指定了目标分支,`foo` 和 `o/foo` 都没有被更新。" + "哇! 看见了吧, Git 将 `C2` 解析成一个 origin 仓库的位置,然后将那些提交记录下载到了本地的 `bar` 分支(一个本地分支)上。" ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -1102,7 +1102,7 @@ exports.level = { "Schauen wir uns den Quatsch mal in Aktion an:" ], "afterMarkdowns": [ - "Wow! Siehst du, Git löst `C2` als Ort auf dem Server `origin` auf und lädt dessen Commits herunter in `bar` hinein. Beachte wie `foo` und `o/foo` *nicht* aktualisiert wurden, da wir ein Ziel angegeben haben." + "Wow! Siehst du, Git löst `C2` als Ort auf dem Server `origin` auf und lädt dessen Commits herunter in `bar` hinein." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -1236,9 +1236,7 @@ exports.level = { "このクレイジーさを実際に確認してみましょう。" ], "afterMarkdowns": [ - "うわぁ〜!gitは`C2`をorigin上の場所として解決し、そのコミットをローカルの`bar`ブランチに直接ダウンロードしました。", - "", - "保存先を指定したので`foo`と`o/foo`ブランチが更新されていないことに注目しましょう。" + "うわぁ〜!gitは`C2`をorigin上の場所として解決し、そのコミットをローカルの`bar`ブランチに直接ダウンロードしました。" ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -1363,7 +1361,7 @@ exports.level = { "Давайте взглянем на всё это в действии:" ], "afterMarkdowns": [ - "Ого! Видите, git распознал `C2` как место в origin и затем скачал эти коммиты в `bar`, которая является локальной веткой. Обратите внимание, что ветки `foo` и `o/foo` не изменились, так как в аргументах мы явно указали получателя." + "Ого! Видите, git распознал `C2` как место в origin и затем скачал эти коммиты в `bar`, которая является локальной веткой." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -1486,7 +1484,7 @@ exports.level = { "자 이 해괴한 작업을 직접 확인해봅시다:" ], "afterMarkdowns": [ - "이야! 보셨습니까, git이 `C2`을 origin의 place로 지정하고 커밋들을 내려받아 `bar`(로컬 브랜치)에 추가했습니다. `foo`와 `o/foo`는 갱신되지 않는게 확인되나요? destination을 지정해줬기 때문입니다." + "이야! 보셨습니까, git이 `C2`을 origin의 place로 지정하고 커밋들을 내려받아 `bar`(로컬 브랜치)에 추가했습니다." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -1609,7 +1607,7 @@ exports.level = { "Подивімось на це божевілля в дії:" ], "afterMarkdowns": [ - "Ого! Дивись, git прийняв `C2` за джерело, і звантажив коміти в `bar` (локальна гілка). Зауваж, що `foo` і `o/foo` не оновлювались, оскільки ми явно вказали звідки і куди передавати коміти." + "Ого! Дивись, git прийняв `C2` за джерело, і звантажив коміти в `bar` (локальна гілка)." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -1732,7 +1730,7 @@ exports.level = { "Lấy một ví dụ điên rồ..." ], "afterMarkdowns": [ - "Wao! Thấy chứ, Git diễn giải `C2` thành một vị trí trên kho chứa từ xa sau đó tải xuống các commit lên nhánh `bar` ở kho chứa cục bộ. Để ý rằng nhánh `foo` và `o/foo` không hề được cập nhật vì ta đã chỉ định đích đến." + "Wao! Thấy chứ, Git diễn giải `C2` thành một vị trí trên kho chứa từ xa sau đó tải xuống các commit lên nhánh `bar` ở kho chứa cục bộ." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -1855,7 +1853,7 @@ exports.level = { "Poglejmo si to zmešnjavo v praksi:" ], "afterMarkdowns": [ - "Wow! Vidiš, git je naredil `C2` kot mesto na originu in nato prenesel commite na `bar` (ki je bil lokalen branch). Opazi, kako `foo` in `o/foo` nista bila posodobljena, ker smo določili destinacijo." + "Wow! Vidiš, git je naredil `C2` kot mesto na originu in nato prenesel commite na `bar` (ki je bil lokalen branch)." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -1978,7 +1976,7 @@ exports.level = { "Zobaczmy, jak to szaleństwo działa:" ], "afterMarkdowns": [ - "Nieźle! Spójrz. Git zinterpretował `C2` jako miejsce na origin i pobrał z niego commity do `bar` (czyli lokalną gałąź). Zauważ, że ani `foo`, ani `o/foo` nie zostały zaktualizowane, ponieważ określiliśmy cel." + "Nieźle! Spójrz. Git zinterpretował `C2` jako miejsce na origin i pobrał z niego commity do `bar` (czyli lokalną gałąź)." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" @@ -2101,7 +2099,7 @@ exports.level = { "Vediamo questa pazzia sul campo:" ], "afterMarkdowns": [ - "Wow! Vediamo, git ha risolto `C2` come un luogo sul repository remoto e ha poi scaricato quei commit su `bar` (nostro ramo locale). Notiamo come `foo` e `o/foo` non sono stati aggiornati in quanto abbiamo specificato una destinazione." + "Wow! Vediamo, git ha risolto `C2` come un luogo sul repository remoto e ha poi scaricato quei commit su `bar` (nostro ramo locale)." ], "command": "git fetch origin C2:bar", "beforeCommand": "git branch foo; git clone; git branch bar; git fakeTeamwork foo 2" diff --git a/src/levels/remote/pullArgs.js b/src/levels/remote/pullArgs.js index 7f06efc34..883b22b79 100644 --- a/src/levels/remote/pullArgs.js +++ b/src/levels/remote/pullArgs.js @@ -1,6 +1,6 @@ exports.level = { "goalTreeString": "{\"branches\":{\"main\":{\"target\":\"C6\",\"id\":\"main\",\"remoteTrackingBranchID\":\"o/main\"},\"o/main\":{\"target\":\"C1\",\"id\":\"o/main\",\"remoteTrackingBranchID\":null},\"o/bar\":{\"target\":\"C1\",\"id\":\"o/bar\",\"remoteTrackingBranchID\":null},\"foo\":{\"target\":\"C3\",\"id\":\"foo\",\"remoteTrackingBranchID\":null},\"side\":{\"target\":\"C2\",\"id\":\"side\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C4\":{\"parents\":[\"C1\"],\"id\":\"C4\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"},\"C5\":{\"parents\":[\"C3\",\"C4\"],\"id\":\"C5\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C6\":{\"parents\":[\"C2\",\"C5\"],\"id\":\"C6\"}},\"HEAD\":{\"target\":\"main\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"main\":{\"target\":\"C2\",\"id\":\"main\",\"remoteTrackingBranchID\":null},\"bar\":{\"target\":\"C3\",\"id\":\"bar\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"}},\"HEAD\":{\"target\":\"bar\",\"id\":\"HEAD\"}}}", - "solutionCommand": "git pull origin bar:foo;git pull origin main:side", + "solutionCommand": "git pull origin c3:foo;git pull origin c2:side", "startTree": "{\"branches\":{\"main\":{\"target\":\"C4\",\"id\":\"main\",\"remoteTrackingBranchID\":\"o/main\"},\"o/main\":{\"target\":\"C1\",\"id\":\"o/main\",\"remoteTrackingBranchID\":null},\"o/bar\":{\"target\":\"C1\",\"id\":\"o/bar\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C4\":{\"parents\":[\"C1\"],\"id\":\"C4\"}},\"HEAD\":{\"target\":\"main\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"main\":{\"target\":\"C2\",\"id\":\"main\",\"remoteTrackingBranchID\":null},\"bar\":{\"target\":\"C3\",\"id\":\"bar\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"}},\"HEAD\":{\"target\":\"bar\",\"id\":\"HEAD\"}}}", "name": { "en_US": "Pull arguments", @@ -71,9 +71,9 @@ exports.level = { "", "And...", "", - "`git pull origin bar~1:bugFix` is equal to:", + "`git pull origin bar:bugFix` is equal to:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "See? git pull is really just shorthand for fetch + merge, and all git pull cares about is where the commits ended up (the `destination` argument that it figures out during fetch).", "", @@ -145,9 +145,9 @@ exports.level = { "", "Et :", "", - "`git pull origin bar~1:bugFix` est équivalent à :", + "`git pull origin bar:bugFix` est équivalent à :", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "Vous voyez ? git pull est au fond un simple un raccourci pour fetch + merge, et tout ce qui lui importe est la destination des commits (l'argument `destination` qu'il utilise durant le fetch).", "", @@ -219,9 +219,9 @@ exports.level = { "", "Y...", "", - "`git pull origin bar~1:bugFix` equivale a:", + "`git pull origin bar:bugFix` equivale a:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "¿Ves? git pull es simplemente un atajo para un fetch + merge, y todo lo que le importa a git pull es dónde terminaron esos commits (el parámetro `destino` que determina durante el fetch).", "", @@ -293,9 +293,9 @@ exports.level = { "", "Y...", "", - "`git pull origin bar~1:bugFix` equivale a:", + "`git pull origin bar:bugFix` equivale a:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "¿Ves? git pull es simplemente un atajo para un fetch + merge, y todo lo que le importa a git pull es dónde terminaron esos commits (el parámetro `destino` que determina durante el fetch).", "", @@ -367,9 +367,9 @@ exports.level = { "", "Y...", "", - "`git pull origin bar~1:bugFix` equivale a:", + "`git pull origin bar:bugFix` equivale a:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "¿Ves? git pull es simplemente un atajo para un fetch + merge, y todo lo que le importa a git pull es dónde terminaron esos commits (el parámetro `destino` que determina durante el fetch).", "", @@ -441,9 +441,9 @@ exports.level = { "", "E...", "", - "`git pull origin bar~1:bugFix` é igual a:", + "`git pull origin bar:bugFix` é igual a:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "Viu? O git pull é realmente um atalho para fetch + merge, e tudo com o que o git pull se importa é com onde os commits foram parar (o parâmetro de `destino` que ele descobre durante o fetch).", "", @@ -515,9 +515,9 @@ exports.level = { "", "E...", "", - "`git pull origin bar~1:bugFix` equivale a:", + "`git pull origin bar:bugFix` equivale a:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "¿Ves? git pull é sinxelamente un atallo para un fetch + merge, e todo o que lle importa a git pull é ónde terminaron eses commits (o parámetro `destino` que indícase durante o fetch).", "", @@ -589,9 +589,9 @@ exports.level = { "", "而且...", "", - "`git pull origin bar~1:bugFix` 相當於:", + "`git pull origin bar:bugFix` 相當於:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "看吧?`git pull` 真的就只是表示 fetch 跟 merge 的一個簡化後的指令,而且 `git pull` 所根據的是這些 commit 要放置的位置(在 fetch 的時候所指定的`destination`)。", "", @@ -663,9 +663,9 @@ exports.level = { "", "还有...", "", - "`git pull origin bar~1:bugFix` 相当于:", + "`git pull origin bar:bugFix` 相当于:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "看到了? git pull 实际上就是 fetch + merge 的缩写, git pull 唯一关注的是提交最终合并到哪里(也就是为 git fetch 所提供的 destination 参数)", "", @@ -737,9 +737,9 @@ exports.level = { "", "Und ...", "", - "`git pull origin bar~1:bugFix` ist dasselbe wie:", + "`git pull origin bar:bugFix` ist dasselbe wie:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "Siehst du? `git pull` ist wirklich nur eine Abkürzung von `fetch` + `merge` und es interessiert sich nur dafür, wo die Commits hin sollen (die \"Ziel\"-Option, die es beim `fetch` auswertet).", "", @@ -811,9 +811,9 @@ exports.level = { "", "他にも...", "", - "`git pull origin bar~1:bugFix` は次のコマンドと同じ働きをします。", + "`git pull origin bar:bugFix` は次のコマンドと同じ働きをします。", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "ご覧の通り、`git pull`は単なるfetch + mergeの略語であり、git pullが必要とするのはコミットがどこへ行くのか(fetchにおける``)だけなのです。", "", @@ -894,9 +894,9 @@ exports.level = { "", "И еще...", "", - "`git pull origin bar~1:bugFix` то же, что:", + "`git pull origin bar:bugFix` то же, что:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "Как видно, git pull используется, чтобы за одну команду выполнить fetch + merge.", "", @@ -968,9 +968,9 @@ exports.level = { "", "그리고...", "", - "`git pull origin bar~1:bugFix` 는 다음과 같습니다:", + "`git pull origin bar:bugFix` 는 다음과 같습니다:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "보이죠? git pull은 그저 fetch + merge의 축약형일 뿐이에요, 그리고 git pull은 커밋들이 도착하는곳을 신경씁니다(fetch를 하며 지정된 `destination`인자의 위치로 merge가 수행됩니다).", "", @@ -1042,9 +1042,9 @@ exports.level = { "", "А...", "", - "`git pull origin bar~1:bugFix` -- це аналог:", + "`git pull origin bar:bugFix` -- це аналог:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "Бачиш? git pull -- це просто зручне скорочення для fetch + merge. А все, про що дбає git pull -- це те, куди в результаті підуть коміти (а про це йому говорить аргумент `destination`).", "", @@ -1116,9 +1116,9 @@ exports.level = { "", "Và...", "", - "`git pull origin bar~1:bugFix` tương đương với:", + "`git pull origin bar:bugFix` tương đương với:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "Thấy chứ? git pull thực ra chỉ là lệnh tắt cho fetch + merge, và tất cả những gì git pull quan tâm là nơi mà các commit sẽ tới (tham số `đích` mà nó diễn giải được trong quá trình nạp).", "", @@ -1190,9 +1190,9 @@ exports.level = { "", "In ...", "", - "`git pull origin bar~1:bugFix` je enak:", + "`git pull origin bar:bugFix` je enak:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "Vidiš? Git pull je res bližnjica za fetch + merge. Vse kar zanima git pull je, kje bodo commiti končali (`ciljni` argument, ki ga ugotovi med fetchem).", "", @@ -1264,9 +1264,9 @@ exports.level = { "", "A...", "", - "`git pull origin bar~1:bugFix` daje taki sam efekt jak:", + "`git pull origin bar:bugFix` daje taki sam efekt jak:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "Widzisz? Polecenie `git pull` to naprawdę tylko skrót dla fetch + merge i jedyne, co się liczy dla `git pull`, to gdzie trafią commity (argument `celu`, który Git zinterpretuje sobie, wykonując fetch).", "", @@ -1338,9 +1338,9 @@ exports.level = { "", "E...", "", - "`git pull origin bar~1:bugFix` è equivalente a:", + "`git pull origin bar:bugFix` è equivalente a:", "", - "`git fetch origin bar~1:bugFix; git merge bugFix`", + "`git fetch origin bar:bugFix; git merge bugFix`", "", "Visto? git pull non è altro che una scorciatoia per fetch + merge, e l'unica cosa che interessa a quel comando è la posizione d'arrivo dei commit (il parametro `destination` specificato durante il fetch).", "",