From 174d832f157e3e9b73d78b8245e77d9d41a9158d Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Wed, 17 May 2017 16:49:52 +0200 Subject: [PATCH 1/2] Ignore dirty submodules in changed file list --- lib/git-shell-out-strategy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git-shell-out-strategy.js b/lib/git-shell-out-strategy.js index f3fe796603..44a93bdf45 100644 --- a/lib/git-shell-out-strategy.js +++ b/lib/git-shell-out-strategy.js @@ -317,7 +317,7 @@ export default class GitShellOutStrategy { * File Status and Diffs */ async getStatusesForChangedFiles() { - const output = await this.exec(['status', '--untracked-files=all', '-z']); + const output = await this.exec(['status', '--untracked-files=all', '--ignore-submodules=dirty', '-z']); const statusMap = { 'A': 'added', From 75e8fbe1f5f2f778a1e2503a74e5dcdf2840886b Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Wed, 17 May 2017 17:05:35 +0200 Subject: [PATCH 2/2] Assume submodules don't have merge markers This is a quick fix to allow users to stage submodules. `readFile` throws an EISDIR error when it tries to read the contents of the submodules folder. We might run into edge case issues when merging and there are actual conflicts, but for now we have minimal submodule support and we'll defer handling merge conflicts correctly until we implement more comprehensive support. --- lib/models/repository.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/models/repository.js b/lib/models/repository.js index cce7cd8866..7757287042 100644 --- a/lib/models/repository.js +++ b/lib/models/repository.js @@ -120,7 +120,8 @@ export default class Repository { const contents = await readFile(path.join(this.getWorkingDirectoryPath(), relativePath), 'utf8'); return MERGE_MARKER_REGEX.test(contents); } catch (e) { - if (e.code === 'ENOENT') { return false; } else { throw e; } + // EISDIR implies this is a submodule + if (e.code === 'ENOENT' || e.code === 'EISDIR') { return false; } else { throw e; } } }