Skip to content

Commit

Permalink
Merge pull request #473 from kellyselden/remove_resolve-conflicts
Browse files Browse the repository at this point in the history
remove --resolve-conflicts
  • Loading branch information
kellyselden committed Oct 30, 2023
2 parents 446f567 + fbc545b commit 9a532f3
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 86 deletions.
17 changes: 1 addition & 16 deletions bin/git-diff-apply.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ const { argv } = require('yargs')
'end-tag': {
type: 'string'
},
'resolve-conflicts': {
type: 'boolean'
},
'ignored-files': {
type: 'array'
},
Expand All @@ -38,22 +35,10 @@ const { argv } = require('yargs')
});

(async() => {
let returnObject;
try {
returnObject = await gitDiffApply(argv);
await gitDiffApply(argv);
} catch (err) {
console.log(err);
return;
}

let ps = returnObject.resolveConflictsProcess;
if (ps) {
process.stdin.pipe(ps.stdin);
ps.stdout.pipe(process.stdout);
ps.stderr.pipe(process.stderr);

// since we are piping, not inheriting, the child process
// doesn't have the power to close its parent
ps.on('exit', process.exit);
}
})();
58 changes: 14 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prefer-let": "^3.0.1",
"fixturify-project": "^4.0.0",
"git-fixtures": "^4.0.0",
"git-fixtures": "^4.2.2",
"mocha": "^9.2.1",
"mocha-helpers": "^6.2.1",
"renovate-config-standard": "2.1.2",
Expand Down
11 changes: 3 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const gitStatus = require('./git-status');
const commit = require('./commit');
const checkOutTag = require('./check-out-tag');
const convertToObj = require('./convert-to-obj');
const resolveConflicts = require('./resolve-conflicts');
const commitAndTag = require('./commit-and-tag');
const gitRemoveAll = require('./git-remove-all');
const createCustomRemote = require('./create-custom-remote');
Expand All @@ -36,7 +35,6 @@ module.exports = async function gitDiffApply({
remoteUrl,
startTag,
endTag,
resolveConflicts: _resolveConflicts,
ignoredFiles = [],
reset,
init,
Expand All @@ -47,7 +45,6 @@ module.exports = async function gitDiffApply({
let _tmpDir;
let tmpWorkingDir;

let hasConflicts;
let returnObject;

let isCodeUntracked;
Expand Down Expand Up @@ -204,7 +201,9 @@ module.exports = async function gitDiffApply({
try {
await spawn('git', ['cherry-pick', '--no-commit', sha.trim()], { cwd });
} catch (err) {
hasConflicts = true;
if (!err.message.includes('error: could not apply')) {
throw err;
}
}

await spawn('git', ['remote', 'remove', tempBranchName], { cwd });
Expand Down Expand Up @@ -286,10 +285,6 @@ module.exports = async function gitDiffApply({
throw err;
}

if (hasConflicts && _resolveConflicts) {
returnObject.resolveConflictsProcess = resolveConflicts({ cwd });
}

return returnObject;
};

Expand Down
11 changes: 0 additions & 11 deletions src/resolve-conflicts.js

This file was deleted.

12 changes: 6 additions & 6 deletions test/acceptance/git-diff-apply-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ describe(function() {
'--start-tag',
defaultStartTag,
'--end-tag',
defaultEndTag,
'--resolve-conflicts'
defaultEndTag
],
cwd: localDir,
commitMessage: 'local',
Expand Down Expand Up @@ -72,9 +71,10 @@ describe(function() {

expect(status).to.equal(`A added-changed.txt
A added-unchanged.txt
M present-added-changed.txt
M present-changed.txt
D removed-changed.txt
DU missing-changed.txt
AA present-added-changed.txt
UU present-changed.txt
UD removed-changed.txt
D removed-unchanged.txt
`);
});
Expand All @@ -91,7 +91,7 @@ D removed-unchanged.txt
mergeFixtures: 'test/fixtures/merge/git'
});

expect(status).to.equal(`M .gitignore
expect(status).to.equal(`UU .gitignore
`);
});
});
1 change: 1 addition & 0 deletions test/fixtures/merge/conflict/missing-changed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
missing-v3
4 changes: 4 additions & 0 deletions test/fixtures/merge/conflict/present-added-changed.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<<<<<<< HEAD
present-added-local
=======
present-added-v3
>>>>>>> fffffff (v1...v3)
4 changes: 4 additions & 0 deletions test/fixtures/merge/conflict/present-changed.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<<<<<<< HEAD
present-local
=======
present-v3
>>>>>>> fffffff (v1...v3)
1 change: 1 addition & 0 deletions test/fixtures/merge/conflict/removed-changed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
removed-local
3 changes: 3 additions & 0 deletions test/fixtures/merge/git/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<<<<<<< HEAD
=======
v3
>>>>>>> fffffff (v1...v3)

0 comments on commit 9a532f3

Please sign in to comment.