]> source.dussan.org Git - gitea.git/commitdiff
Disable core.protectNTFS (#17300)
authorzeripath <art27@cantab.net>
Wed, 13 Oct 2021 18:20:11 +0000 (19:20 +0100)
committerGitHub <noreply@github.com>
Wed, 13 Oct 2021 18:20:11 +0000 (14:20 -0400)
core.protectNTFS protects NTFS from files which may be difficult to remove or interact
with using the win32 api, however, it also appears to prevent such files from
being entered into the git indexes - fundamentally causing breakages with PRs that
affect these files. However, deliberately setting this to false may cause security
issues due to the remain sparse checkout of files in the merge pipeline.

The only sensible option therefore is to provide an optional setting which admins
could set which would forcibly switch this off if they are affected by this issue.

Fix #17092

Signed-off-by: Andrew Thornton <art27@cantab.net>
custom/conf/app.example.ini
docs/content/doc/advanced/config-cheat-sheet.en-us.md
modules/git/git.go
modules/setting/git.go

index 0a25e7e5cd540c3f4f7da2534615a47e5fb684cc..07ca9f84099869e3d6d5ab8c08610e866c35dcc3 100644 (file)
@@ -580,6 +580,8 @@ PATH =
 ;;
 ;; (Go-Git only) Don't cache objects greater than this in memory. (Set to 0 to disable.)
 ;LARGE_OBJECT_THRESHOLD = 1048576
+;; Set to true to forcibly set core.protectNTFS=false
+;DISABLE_CORE_PROTECT_NTFS=false
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
index d224533e964c32e7d20487eeeadf65d33052a122..f02d8cbc3775946ae97dd67e6914b475728b5ac4 100644 (file)
@@ -842,6 +842,7 @@ NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take ef
 - `VERBOSE_PUSH`: **true**: Print status information about pushes as they are being processed.
 - `VERBOSE_PUSH_DELAY`: **5s**: Only print verbose information if push takes longer than this delay.
 - `LARGE_OBJECT_THRESHOLD`: **1048576**: (Go-Git only), don't cache objects greater than this in memory. (Set to 0 to disable.)
+- `DISABLE_CORE_PROTECT_NTFS`: **false** Set to true to forcibly set `core.protectNTFS` to false.
 ## Git - Timeout settings (`git.timeout`)
 - `DEFAUlT`: **360**: Git operations default timeout seconds.
 - `MIGRATE`: **600**: Migrate external repositories timeout seconds.
index 7ab11736e8eb37437046c3c72630fd1515141309..e6c34979e862b016ff71cb9199b5857d8e53a51e 100644 (file)
@@ -204,6 +204,12 @@ func Init(ctx context.Context) error {
                        return err
                }
        }
+       if setting.Git.DisableCoreProtectNTFS {
+               if err := checkAndSetConfig("core.protectntfs", "false", true); err != nil {
+                       return err
+               }
+               GlobalCommandArgs = append(GlobalCommandArgs, "-c", "core.protectntfs=false")
+       }
        return nil
 }
 
index aa838a8d641a766b2e3ae93b7e8ebb47a7f1e9ad..aaa65ed81c7fe083ec45ee01c39477fb6e1bb22e 100644 (file)
@@ -26,6 +26,7 @@ var (
                EnableAutoGitWireProtocol bool
                PullRequestPushMessage    bool
                LargeObjectThreshold      int64
+               DisableCoreProtectNTFS    bool
                Timeout                   struct {
                        Default int
                        Migrate int