Skip to content

.import files with no options have a trailing newline at the end, which conflicts with pre-commit hooks #105456

@Calinou

Description

@Calinou

Tested versions

  • Reproducible in: 4.4.1.stable, 4.5.dev 215acd5

System information

Godot v4.5.dev (215acd5) - Fedora Linux 41 (KDE Plasma) on X11 - X11 display driver, Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4090 (nvidia; 570.133.07) - 13th Gen Intel(R) Core(TM) i9-13900K (32 threads)

Issue description

.import files with no options have a trailing newline at the end, which conflicts with pre-commit hooks.

See godotengine/godot-demo-projects#1193, where I removed trailing whitespace from all files using a pre-commit hook. If I open all projects and run them, I get this diff (these are the only changed files sacross all demos):

diff --git a/compute/post_shader/post_process_grayscale.glsl.import b/compute/post_shader/post_process_grayscale.glsl.import
index f46e950c..653ea822 100644
--- a/compute/post_shader/post_process_grayscale.glsl.import
+++ b/compute/post_shader/post_process_grayscale.glsl.import
@@ -11,3 +11,4 @@ source_file="res://post_process_grayscale.glsl"
 dest_files=["res://.godot/imported/post_process_grayscale.glsl-74f080e1b01e56b39260b8709956a520.res"]
 
 [params]
+
diff --git a/compute/texture/water_plane/water_compute.glsl.import b/compute/texture/water_plane/water_compute.glsl.import
index ebf872a7..8ef651fc 100644
--- a/compute/texture/water_plane/water_compute.glsl.import
+++ b/compute/texture/water_plane/water_compute.glsl.import
@@ -11,3 +11,4 @@ source_file="res://water_plane/water_compute.glsl"
 dest_files=["res://.godot/imported/water_compute.glsl-c7fe8f11197ba28412c4cdf6f7a9a21b.res"]
 
 [params]
+
diff --git a/misc/compute_shader_heightmap/compute_shader.glsl.import b/misc/compute_shader_heightmap/compute_shader.glsl.import
index 92d45486..64e0cfba 100644
--- a/misc/compute_shader_heightmap/compute_shader.glsl.import
+++ b/misc/compute_shader_heightmap/compute_shader.glsl.import
@@ -11,3 +11,4 @@ source_file="res://compute_shader.glsl"
 dest_files=["res://.godot/imported/compute_shader.glsl-0816de56a4f9dce0934d88a29a0758cf.res"]
 
 [params]
+

Only GLSL files seem affected by this, most likely because they have no import options to specify.

Steps to reproduce

  • Trim trailing whitespace from all files in a project using a pre-commit hook or text editor. Files should only have one blank line at the end (not several).

Minimal reproduction project (MRP)

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions