Skip to content

Commit 1af543f

Browse files
committed
wip
1 parent dba05ca commit 1af543f

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

packages/mcl/src/src/mcl/commands/dev_commit.d

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,15 @@ bool inGitIgnore(string file)
3535
{
3636
foreach (string line; gitIgnore)
3737
{
38-
writeln("Comparing: " ~ file ~ " with " ~ line);
39-
if (line.startsWith("#") || line == "")
40-
continue;
41-
else if (globMatch(file, line))
38+
if (file.strip == ".direnv")
39+
writeln("file: ", file, " line: ", line);
40+
if (file.strip == line.strip)
4241
return true;
43-
else if (file.startsWith(line.strip ~ "/"))
42+
else if (file.strip == (line.strip ~ "/"))
43+
return true;
44+
else if (globMatch(file.strip, line.strip))
45+
return true;
46+
else if (globMatch(file.strip, line.strip ~ "/**"))
4447
return true;
4548
}
4649
return false;
@@ -51,11 +54,9 @@ void initGitDiff()
5154
// auto status = execute("git diff --name-only -- cached", false).split("\n");
5255
auto status = dirEntries("", SpanMode.depth).map!(a => a.name.strip).array
5356
.filter!(a =>
57+
!inGitIgnore(a) &&
5458
!a.startsWith("node_modules") &&
55-
!a.startsWith(".direnv") &&
5659
!a.startsWith("vendor") &&
57-
!a.startsWith("result") &&
58-
!a.startsWith(".result") &&
5960
!a.startsWith("dist") &&
6061
!a.startsWith(".yarn/") &&
6162
!a.startsWith(".git/") &&
@@ -70,8 +71,7 @@ void initGitDiff()
7071
!(a =="libs") &&
7172
!(a =="modules") &&
7273
!(a =="services")&&
73-
!(a ==".git") &&
74-
!inGitIgnore(a)
74+
!(a ==".git")
7575
).array;
7676
if (status.length)
7777
{
@@ -132,9 +132,8 @@ string[] getAuthors()
132132

133133
export void dev_commit()
134134
{
135-
writeln("It's Supercalifragilisticexpialidocious! Even though the sound of it is something quite atrocious! If you say it loud enough, you'll always sound precocious! Supercalifragilisticexpialidocious!");
135+
gitIgnore = readText(rootDir() ~ "/.gitignore").split("\n").filter!(a => !(a.strip.startsWith("#") || a.strip == "")).array;
136136
initGitDiff();
137-
gitIgnore = readText(rootDir() ~ "/.gitignore").split("\n");
138137
writeln(guessScope().join("\n"));
139138
return;
140139

0 commit comments

Comments
 (0)