1- import $exec .plugins
1+ import $file .plugins
22import $ivy .`com.lihaoyi::mill-contrib-docker:$MILL_VERSION`
33import com .goyeau .mill .git .GitTaggedDockerModule
44import mill ._
@@ -14,6 +14,8 @@ object project extends JavaModule with GitTaggedDockerModule {
1414
1515// Uncommitted changes
1616def setupUncommittedChanges = T .input {
17+ remove.all(pwd / " .git" )
18+
1719 proc(" git" , " init" ).call()
1820}
1921def uncommittedChanges () = T .command {
@@ -23,12 +25,12 @@ def uncommittedChanges() = T.command {
2325 assert(tags.size == 2 )
2426 assert(""" project:[\da-f]{7}""" .r.findFirstIn(tags(0 )).isDefined)
2527 assert(tags(1 ) == " project:latest" )
26-
27- remove.all(pwd / " .git" )
2828}
2929
3030// Commit without tag
3131def setupCommitWithoutTag = T .input {
32+ remove.all(pwd / " .git" )
33+
3234 proc(" git" , " init" ).call()
3335 proc(" git" , " add" , " --all" ).call()
3436 proc(" git" , " commit" , " -m" , " Some commit" ).call()
@@ -41,12 +43,13 @@ def commitWithoutTag() = T.command {
4143 assert(tags.size == 2 )
4244 assert(tags(0 ) == s " project: $hash" )
4345 assert(tags(1 ) == " project:latest" )
44-
45- remove.all(pwd / " .git" )
4646}
4747
4848// Uncommitted changes after commit without tag
4949def setupUncommittedChangesAfterCommitWithoutTag = T .input {
50+ remove.all(pwd / " .git" )
51+ remove(pwd / " some-file" )
52+
5053 proc(" git" , " init" ).call()
5154 proc(" git" , " add" , " --all" ).call()
5255 proc(" git" , " commit" , " -m" , " Some commit" ).call()
@@ -61,13 +64,12 @@ def uncommittedChangesAfterCommitWithoutTag() = T.command {
6164 val hash = proc(" git" , " rev-parse" , " HEAD" ).call().out.trim().take(7 )
6265 assert(! tags(0 ).contains(hash))
6366 assert(tags(1 ) == " project:latest" )
64-
65- remove.all(pwd / " .git" )
66- remove(pwd / " some-file" )
6767}
6868
6969// Head tagged
7070def setupHeadTagged = T .input {
71+ remove.all(pwd / " .git" )
72+
7173 proc(" git" , " init" ).call()
7274 proc(" git" , " add" , " --all" ).call()
7375 proc(" git" , " commit" , " -m" , " Some commit" ).call()
@@ -80,12 +82,13 @@ def headTagged() = T.command {
8082 assert(tags.size == 2 )
8183 assert(tags(0 ) == s " project:1.0.0 " )
8284 assert(tags(1 ) == " project:latest" )
83-
84- remove.all(pwd / " .git" )
8585}
8686
8787// Uncommitted changes after tag
8888def setupUncommittedChangesAfterTag = T .input {
89+ remove.all(pwd / " .git" )
90+ remove(pwd / " some-file" )
91+
8992 proc(" git" , " init" ).call()
9093 proc(" git" , " add" , " --all" ).call()
9194 proc(" git" , " commit" , " -m" , " Some commit" ).call()
@@ -101,13 +104,13 @@ def uncommittedChangesAfterTag() = T.command {
101104 val hash = proc(" git" , " rev-parse" , " HEAD" ).call().out.trim().take(7 )
102105 assert(! tags(0 ).contains(hash))
103106 assert(tags(1 ) == " project:latest" )
104-
105- remove.all(pwd / " .git" )
106- remove(pwd / " some-file" )
107107}
108108
109109// Commit after tag
110110def setupCommitAfterTag = T .input {
111+ remove.all(pwd / " .git" )
112+ remove(pwd / " some-file" )
113+
111114 proc(" git" , " init" ).call()
112115 proc(" git" , " add" , " --all" ).call()
113116 proc(" git" , " commit" , " -m" , " Some commit" ).call()
@@ -124,13 +127,13 @@ def commitAfterTag() = T.command {
124127 val hash = proc(" git" , " rev-parse" , " HEAD" ).call().out.trim().take(7 )
125128 assert(tags(0 ) == s " project:1.0.0-1- $hash" )
126129 assert(tags(1 ) == " project:latest" )
127-
128- remove.all(pwd / " .git" )
129- remove(pwd / " some-file" )
130130}
131131
132132// Uncommitted changes after tag and after commit
133133def setupUncommittedChangesAfterTagAndCommit = T .input {
134+ remove.all(pwd / " .git" )
135+ remove(pwd / " some-file" )
136+
134137 proc(" git" , " init" ).call()
135138 proc(" git" , " add" , " --all" ).call()
136139 proc(" git" , " commit" , " -m" , " Some commit" ).call()
@@ -149,7 +152,4 @@ def uncommittedChangesAfterTagAndCommit() = T.command {
149152 val hash = proc(" git" , " rev-parse" , " HEAD" ).call().out.trim().take(7 )
150153 assert(! tags(0 ).contains(hash))
151154 assert(tags(1 ) == " project:latest" )
152-
153- remove.all(pwd / " .git" )
154- remove(pwd / " some-file" )
155155}
0 commit comments