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: {
|
||||
// Git remote.
|
||||
// Example: `"https://github.com/dagger/dagger"`
|
||||
remote: string @dagger(input)
|
||||
remote: string & dagger.#Input
|
||||
|
||||
// Git ref: can be a commit, tag or branch.
|
||||
// Example: "main"
|
||||
ref: string @dagger(input)
|
||||
ref: string & dagger.#Input
|
||||
|
||||
// (optional) Subdirectory
|
||||
subdir: string | *null @dagger(input)
|
||||
subdir: *null | string & dagger.#Input
|
||||
|
||||
// (optional) Keep .git directory
|
||||
keepGitDir: *false | bool
|
||||
|
||||
#up: [
|
||||
op.#FetchGit & {
|
||||
"remote": remote
|
||||
"ref": ref
|
||||
if (keepGitDir) {
|
||||
keepGitDir: true
|
||||
}
|
||||
},
|
||||
if subdir != null {
|
||||
op.#Subdir & {
|
||||
|
@ -6,18 +6,19 @@ import (
|
||||
"alpha.dagger.io/git"
|
||||
"alpha.dagger.io/alpine"
|
||||
"alpha.dagger.io/os"
|
||||
"alpha.dagger.io/dagger/op"
|
||||
)
|
||||
|
||||
repo: git.#Repository & {
|
||||
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
||||
ref: "master"
|
||||
remote: "https://github.com/blocklayerhq/acme-clothing.git"
|
||||
ref: "master"
|
||||
keepGitDir: true
|
||||
}
|
||||
|
||||
#up: [
|
||||
op.#FetchGit & {
|
||||
keepGitDir: true
|
||||
},
|
||||
]
|
||||
repoSubDir: git.#Repository & {
|
||||
remote: "https://github.com/dagger/examples.git"
|
||||
ref: "main"
|
||||
subdir: "todoapp"
|
||||
keepGitDir: true
|
||||
}
|
||||
|
||||
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 & {
|
||||
image: alpine.#Image & {
|
||||
package: bash: "=5.1.0-r0"
|
||||
|
Reference in New Issue
Block a user