Commit 484203d

Anton Medvedev <anton@medv.io>
2025-12-07 14:52:48
Remove `NO_OUTPUT_DIR_CHECK` and check
1 parent c34b92e
docs/how-to-self-host-a-git-repository.md
@@ -38,7 +38,7 @@ Create a [post‑receive](https://git-scm.com/docs/git-receive-pack#_post_receiv
 
 ```sh
 #!/bin/sh
-NO_OUTPUT_DIR_CHECK=1 /path-to/gitmal --output /home/git/public/repo/
+exec gitmal --output /home/git/public/repo/
 ```
 
 Make the hook executable:
main.go
@@ -56,7 +56,6 @@ func main() {
 
 	_, noFiles := os.LookupEnv("NO_FILES")
 	_, noCommitsList := os.LookupEnv("NO_COMMITS_LIST")
-	_, noOutputDirCheck := os.LookupEnv("NO_OUTPUT_DIR_CHECK")
 
 	flag.StringVar(&flagOwner, "owner", "", "Project owner")
 	flag.StringVar(&flagName, "name", "", "Project name")
@@ -89,16 +88,6 @@ func main() {
 		panic(err)
 	}
 
-	if !noOutputDirCheck {
-		if fi, err := os.Stat(outputDir); err == nil && fi.IsDir() {
-			if entries, err := os.ReadDir(outputDir); err == nil && len(entries) > 0 {
-				echo(fmt.Sprintf("Output directory %q is not empty.", outputDir))
-				echo("Please remove its contents or choose a different --output directory.")
-				os.Exit(1)
-			}
-		}
-	}
-
 	absInput, err := filepath.Abs(input)
 	if err != nil {
 		panic(err)