commands, test: change to blocklist
This commit is contained in:
parent
5da95608c9
commit
81e525cd86
@ -17,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
blacklistedPrefixes = []string{
|
||||
prefixBlocklist = []string{
|
||||
".git", ".lfs",
|
||||
}
|
||||
|
||||
@ -94,15 +94,15 @@ ArgsLoop:
|
||||
}
|
||||
now := time.Now()
|
||||
|
||||
var blacklisted bool
|
||||
var matchedBlocklist bool
|
||||
for _, f := range gittracked {
|
||||
if forbidden := blacklistItem(f); forbidden != "" {
|
||||
if forbidden := blocklistItem(f); forbidden != "" {
|
||||
Print("Pattern %s matches forbidden file %s. If you would like to track %s, modify .gitattributes manually.", pattern, f, f)
|
||||
blacklisted = true
|
||||
matchedBlocklist = true
|
||||
}
|
||||
|
||||
}
|
||||
if blacklisted {
|
||||
if matchedBlocklist {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -202,12 +202,12 @@ func needsTrailingLinebreak(filename string) bool {
|
||||
return !strings.HasSuffix(string(buf[0:bytesRead]), "\n")
|
||||
}
|
||||
|
||||
// blacklistItem returns the name of the blacklist item preventing the given
|
||||
// blocklistItem returns the name of the blocklist item preventing the given
|
||||
// file-name from being tracked, or an empty string, if there is none.
|
||||
func blacklistItem(name string) string {
|
||||
func blocklistItem(name string) string {
|
||||
base := filepath.Base(name)
|
||||
|
||||
for _, p := range blacklistedPrefixes {
|
||||
for _, p := range prefixBlocklist {
|
||||
if strings.HasPrefix(base, p) {
|
||||
return p
|
||||
}
|
||||
|
@ -221,11 +221,11 @@ begin_test "track in symlinked dir"
|
||||
)
|
||||
end_test
|
||||
|
||||
begin_test "track blacklisted files by name"
|
||||
begin_test "track blocklisted files by name"
|
||||
(
|
||||
set -e
|
||||
|
||||
repo="track_blacklisted_by_name"
|
||||
repo="track_blocklisted_by_name"
|
||||
mkdir "$repo"
|
||||
cd "$repo"
|
||||
git init
|
||||
@ -238,11 +238,11 @@ begin_test "track blacklisted files by name"
|
||||
)
|
||||
end_test
|
||||
|
||||
begin_test "track blacklisted files with glob"
|
||||
begin_test "track blocklisted files with glob"
|
||||
(
|
||||
set -e
|
||||
|
||||
repo="track_blacklisted_glob"
|
||||
repo="track_blocklisted_glob"
|
||||
mkdir "$repo"
|
||||
cd "$repo"
|
||||
git init
|
||||
|
Loading…
Reference in New Issue
Block a user