Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions l10n/bundle.l10n.zh.json

This file was deleted.

4 changes: 2 additions & 2 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 @@ -3,7 +3,7 @@
"displayName": "Git Commit Generator",
"description": "%extension.description%",
"icon": "icon.png",
"version": "1.0.1",
"version": "1.0.2",
"publisher": "eoasmxd",
"repository": {
"type": "git",
Expand Down
15 changes: 9 additions & 6 deletions src/git/diffService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,24 @@ export async function getGitDiff(cwd: string): Promise<string> {

async function getStagedDiff(cwd: string): Promise<string> {
try {
const { stdout } = await execAsync("git --no-pager diff --staged --diff-filter=d", { cwd })
return stdout
const { stdout: nonDeleted } = await execAsync("git --no-pager diff --staged --diff-filter=d", { cwd })
const { stdout: deletedStat } = await execAsync("git --no-pager diff --staged --diff-filter=D --stat", { cwd })
return [nonDeleted.trim(), deletedStat.trim()].filter(Boolean).join("\n\n")
} catch {
return ""
}
}

async function getWorkingTreeDiff(cwd: string): Promise<string> {
try {
const { stdout } = await execAsync("git --no-pager diff HEAD --diff-filter=d", { cwd })
return stdout
const { stdout: nonDeleted } = await execAsync("git --no-pager diff HEAD --diff-filter=d", { cwd })
const { stdout: deletedStat } = await execAsync("git --no-pager diff HEAD --diff-filter=D --stat", { cwd })
return [nonDeleted.trim(), deletedStat.trim()].filter(Boolean).join("\n\n")
} catch {
try {
const { stdout } = await execAsync("git --no-pager diff --diff-filter=d", { cwd })
return stdout
const { stdout: nonDeleted } = await execAsync("git --no-pager diff --diff-filter=d", { cwd })
const { stdout: deletedStat } = await execAsync("git --no-pager diff --diff-filter=D --stat", { cwd })
return [nonDeleted.trim(), deletedStat.trim()].filter(Boolean).join("\n\n")
} catch {
return ""
}
Expand Down
Loading