Skip to content

Commit 20a5340

Browse files
committed
fix: git-lfs bug
1 parent c7eb744 commit 20a5340

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "default",
3-
"version": "1.15.1",
3+
"version": "1.15.2",
44
"description": "Default plugin for Codify - provides 50+ declarative resources for managing development tools and system configuration across macOS and Linux",
55
"main": "dist/index.js",
66
"scripts": {

src/resources/git/lfs/git-lfs.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ export class GitLfsResource extends Resource<GitLfsConfig> {
7474
const gitLfsStatus = await $.spawn('git lfs env', { cwd: os.homedir(), interactive: true, disableWrapping: true });
7575
const lines = gitLfsStatus.data.split('\n');
7676

77-
// When git lfs exists but git lfs install hasn't been called then git lfs env returns:
78-
// git config filter.lfs.process = ""
79-
// git config filter.lfs.smudge = ""
80-
// git config filter.lfs.clean = ""
81-
const emptyLfsLines = lines.filter((l) => l.includes('git config filter.lfs'))
82-
.map((l) => l.split('=')[1].trim())
83-
.includes('""');
84-
85-
return !emptyLfsLines;
77+
// When git lfs exists but git lfs install hasn't been called (or has been undone by
78+
// `git lfs uninstall`, which removes the whole [filter "lfs"] section), `git lfs env` prints
79+
// either empty values (`git config filter.lfs.process = ""`) or no filter.lfs lines at all —
80+
// both mean "not initialized", not just the empty-string case.
81+
const filterLfsLines = lines.filter((l) => l.includes('git config filter.lfs'));
82+
const hasConfiguredFilter = filterLfsLines.length > 0
83+
&& filterLfsLines.every((l) => l.split('=')[1].trim() !== '""');
84+
85+
return hasConfiguredFilter;
8686
}
8787
}

0 commit comments

Comments
 (0)