Remove redundant function isBareGitRepo
This commit is contained in:
1 parent
4b0c8b3d59
commit
66894bc0c5
2 files changed
-11
No files matched your search
@@ -64,15 +64,6 @@ func validBuildpackURL(buildpack string) (string, error) {
|
|||||||
return buildpack, fmt.Errorf("Invalid buildpack specified: %v", buildpack)
|
return buildpack, fmt.Errorf("Invalid buildpack specified: %v", buildpack)
|
||||||
}
|
}
|
||||||
|
|
||||||
func isBareGitRepo(directory string) bool {
|
|
||||||
headFile := filepath.Join(directory, "HEAD")
|
|
||||||
objectsDir := filepath.Join(directory, "objects")
|
|
||||||
if common.FileExists(headFile) && common.DirectoryExists(objectsDir) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkoutBareGitRepo(sourceWorkDir string) (string, error) {
|
func checkoutBareGitRepo(sourceWorkDir string) (string, error) {
|
||||||
tmpdir, err := os.MkdirTemp("", "bare-git-checkout")
|
tmpdir, err := os.MkdirTemp("", "bare-git-checkout")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ func CommandDetect(appName string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
workDir := common.AppRoot(appName)
|
workDir := common.AppRoot(appName)
|
||||||
if isBareGitRepo(workDir) {
|
|
||||||
checkedOutDir, err := checkoutBareGitRepo(workDir)
|
checkedOutDir, err := checkoutBareGitRepo(workDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -49,7 +48,6 @@ func CommandDetect(appName string) error {
|
|||||||
common.LogWarn(fmt.Sprintf("Failed to remove temporary directory %s: %v", checkedOutDir, err))
|
common.LogWarn(fmt.Sprintf("Failed to remove temporary directory %s: %v", checkedOutDir, err))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
|
||||||
|
|
||||||
dockerArgs := []string{
|
dockerArgs := []string{
|
||||||
"run", "--rm",
|
"run", "--rm",
|
||||||
|
|||||||
Reference in new issue
Block a user