Merge pull request #18981 from rhatdan/quadlet

Trim whitespace from unit files while parsing
This commit is contained in:
OpenShift Merge Robot
2023-06-26 22:29:42 +02:00
committed by GitHub
4 changed files with 5 additions and 4 deletions

View File

@ -12,7 +12,7 @@ repos:
- id: end-of-file-fixer
exclude: test/buildah-bud/buildah-tests.diff
- id: trailing-whitespace
exclude: test/buildah-bud/buildah-tests.diff
exclude: test/buildah-bud/buildah-tests.diff|test/e2e/quadlet/remap-keep-id2.container
- id: mixed-line-ending
- id: check-byte-order-marker
- id: check-executables-have-shebangs

View File

@ -253,7 +253,7 @@ help: ## (Default) Print listing of key targets with their descriptions
.PHONY: .gitvalidation
.gitvalidation:
@echo "Validating vs commit '$(call err_if_empty,EPOCH_TEST_COMMIT)'"
GIT_CHECK_EXCLUDE="./vendor:./test/tools/vendor:docs/make.bat:test/buildah-bud/buildah-tests.diff" ./test/tools/build/git-validation -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..$(HEAD)
GIT_CHECK_EXCLUDE="./vendor:./test/tools/vendor:docs/make.bat:test/buildah-bud/buildah-tests.diff:test/e2e/quadlet/remap-keep-id2.container" ./test/tools/build/git-validation -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..$(HEAD)
.PHONY: lint
lint: golangci-lint

View File

@ -373,7 +373,7 @@ func (p *UnitFileParser) flushPendingComments(toComment bool) {
func nextLine(data string, afterPos int) (string, string) {
rest := data[afterPos:]
if i := strings.Index(rest, "\n"); i >= 0 {
return data[:i+afterPos], data[i+afterPos+1:]
return strings.TrimSpace(data[:i+afterPos]), data[i+afterPos+1:]
}
return data, ""
}

View File

@ -2,6 +2,7 @@
[Container]
Image=localhost/imagename
RemapUsers=keep-id
# The added three spaces to keep-id are necessary for test of trimwhitespace
RemapUsers=keep-id
RemapUid=200
RemapGid=210