fix/forbidden (#58) #60

Merged
张泊明518370910136 merged 7 commits from fix/forbidden into master 2024-10-18 14:41:10 +08:00
Showing only changes of commit 44e3feb5c6 - Show all commits

View File

@ -16,7 +16,12 @@ func getForbiddens(root string) ([]string, error) {
var matches []string
// Create a gitignore instance from the .gitignore file
ignore, err := gitignore.NewFromFile(filepath.Join(root, ".gitignore"))
ignore := gitignore.NewRepositoryWithCache(root, ".gitignore", gitignore.NewCache(), func(e gitignore.Error) bool {
bomingzh marked this conversation as resolved Outdated
  1. Check the existence of the root .gitignore file
  2. The .gitignore file may appear in sub-dirs, you also need to check them
1. Check the existence of the root `.gitignore` file 2. The `.gitignore` file may appear in sub-dirs, you also need to check them

So what's the default pattern if no gitignore? Warn student add a gitignore or set root as default value?

So what's the default pattern if no gitignore? Warn student add a gitignore or set root as default value?

what if the gitignore is nonsense? Not every course provide unchangeable gitignore

what if the gitignore is nonsense? Not every course provide unchangeable gitignore

Change to locallist and make it work as a gitignore file?

what if the gitignore is nonsense? Not every course provide unchangeable gitignore

Change to locallist and make it work as a gitignore file? > what if the gitignore is nonsense? Not every course provide unchangeable gitignore

with JOJ3 they must have an immutable gitignore or the server will quickly become a massive mess... caught a student who wanted to see what happened if he pushd a movie... repo was 2.8GB :/

with JOJ3 they **must** have an immutable gitignore or the server will quickly become a massive mess... caught a student who wanted to see what happened if he pushd a movie... repo was 2.8GB :/

If the forbidden check is enabled, then just throw error for no root gitignore or wrong root gitignore.

If the forbidden check is enabled, then just throw error for no root gitignore or wrong root gitignore.
return false
})
var err error
if err != nil {
return nil, err
}