git package - add keepGitDir option
Signed-off-by: Guillaume de Rouville <guillaume.derouville@gmail.com>
This commit is contained in:
parent
f8531fdb0b
commit
cbcb198dce
@ -11,19 +11,25 @@ import (
|
|||||||
#Repository: {
|
#Repository: {
|
||||||
// Git remote.
|
// Git remote.
|
||||||
// Example: `"https://github.com/dagger/dagger"`
|
// Example: `"https://github.com/dagger/dagger"`
|
||||||
remote: string @dagger(input)
|
remote: string & dagger.#Input
|
||||||
|
|
||||||
// Git ref: can be a commit, tag or branch.
|
// Git ref: can be a commit, tag or branch.
|
||||||
// Example: "main"
|
// Example: "main"
|
||||||
ref: string @dagger(input)
|
ref: string & dagger.#Input
|
||||||
|
|
||||||
// (optional) Subdirectory
|
// (optional) Subdirectory
|
||||||
subdir: string | *null @dagger(input)
|
subdir: *null | string & dagger.#Input
|
||||||
|
|
||||||
|
// (optional) Keep .git directory
|
||||||
|
keepGitDir: *false | bool
|
||||||
|
|
||||||
#up: [
|
#up: [
|
||||||
op.#FetchGit & {
|
op.#FetchGit & {
|
||||||
"remote": remote
|
"remote": remote
|
||||||
"ref": ref
|
"ref": ref
|
||||||
|
if (keepGitDir) {
|
||||||
|
keepGitDir: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
if subdir != null {
|
if subdir != null {
|
||||||
op.#Subdir & {
|
op.#Subdir & {
|
||||||
|
@ -6,18 +6,19 @@ import (
|
|||||||
"alpha.dagger.io/git"
|
"alpha.dagger.io/git"
|
||||||
"alpha.dagger.io/alpine"
|
"alpha.dagger.io/alpine"
|
||||||
"alpha.dagger.io/os"
|
"alpha.dagger.io/os"
|
||||||
"alpha.dagger.io/dagger/op"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
repo: git.#Repository & {
|
repo: git.#Repository & {
|
||||||
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
||||||
ref: "master"
|
ref: "master"
|
||||||
|
|
||||||
#up: [
|
|
||||||
op.#FetchGit & {
|
|
||||||
keepGitDir: true
|
keepGitDir: true
|
||||||
},
|
}
|
||||||
]
|
|
||||||
|
repoSubDir: git.#Repository & {
|
||||||
|
remote: "https://github.com/dagger/examples.git"
|
||||||
|
ref: "main"
|
||||||
|
subdir: "todoapp"
|
||||||
|
keepGitDir: true
|
||||||
}
|
}
|
||||||
|
|
||||||
branch: git.#CurrentBranch & {
|
branch: git.#CurrentBranch & {
|
||||||
@ -40,6 +41,18 @@ TestRepository: os.#Container & {
|
|||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TestSubRepository: os.#Container & {
|
||||||
|
image: alpine.#Image & {
|
||||||
|
package: bash: "=5.1.0-r0"
|
||||||
|
package: git: true
|
||||||
|
}
|
||||||
|
mount: "/repo1": from: repoSubDir
|
||||||
|
dir: "/repo1"
|
||||||
|
command: """
|
||||||
|
[ -d src ]
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
|
||||||
TestCurrentBranch: os.#Container & {
|
TestCurrentBranch: os.#Container & {
|
||||||
image: alpine.#Image & {
|
image: alpine.#Image & {
|
||||||
package: bash: "=5.1.0-r0"
|
package: bash: "=5.1.0-r0"
|
||||||
|
Reference in New Issue
Block a user