#where did my ".git folder" go?

1 messages · Page 1 of 1 (latest)

round raft
#

I have this piece of code in typescript:

    const cleanFolder = containerWithZsh.withMountedDirectory(justDotGitPath, justDotGitFolder)
        .withWorkdir(appRoot)
        .withRun("git checkout -f")
        .terminal()
        .directory(appRoot)

    console.log(await cleanFolder.entries())

when I am inside the terminal() and execute the ls -la command I see the .git folder and also all the folders from my git repo (which means the git checkout -f worked)
but when console.log(await cleanFolder.entries()) is executed, the .git folder is missing.

anyone has an idea about that ?

round raft
#

just to make things more readable:
same thing happens here

export function getRequiredInput(justDotGitFolder: Directory): Directory {


    return dag
        .container()
        .from("alpine:latest")
        .withRun("apk update")
        .withRun("apk add --no-cache zsh curl git bash")
        .withMountedDirectory(justDotGitPath, justDotGitFolder)
        .withWorkdir(appRoot)
        .withRun("git checkout -f")
        .terminal()
        .directory(appRoot)
        .terminal({
            insecureRootCapabilities: true,
            experimentalPrivilegedNesting: true
        })


}

--> the resulting directory should include the .git folder but does not... is it a bug or did I make a mistake somewhere ?

edgy flume
#

@round raft wait, you're changing the workdir after calling withMounteDirectory

#

so the directory you're returning at the end doesn't effectively contains the .git folder

#

additionally, when you export a directory which has another mounted directory inside of it, the mounted directory won't be exported

#

for that to work, you need to change the withMountedDirectory in your code to withDirectory