Skip to content

Review and update .gitattributes to support cross-platform development #36

@MariusStorhaug

Description

Context and Request

A developer cloning a PSModule repository on any platform — Windows, macOS, or Linux — expects consistent behavior: correct line endings, proper diff handling, and no silent corruption of files. The principle "Build for all developers" (added to Principles) establishes that repository configuration must reflect cross-platform support.

Currently, .gitattributes files across the PSModule organization are either missing or inconsistent. Without proper configuration, line-ending normalization depends entirely on individual developer settings (core.autocrlf), which leads to inconsistent commits, noisy diffs, and potential issues in shell scripts or CI environments.

This issue covers an organization-wide review and alignment of .gitattributes files to ensure all repositories support cross-platform development consistently.

Acceptance criteria

  • All repositories in the PSModule organization have been audited for .gitattributes presence and content.
  • A standard .gitattributes template is defined for the organization.
  • Text files are normalized to LF on commit (* text=auto eol=lf or equivalent).
  • Binary files (images, fonts) are marked as binary to prevent corruption.
  • Shell scripts (.sh) and PowerShell scripts (.ps1, .psm1, .psd1) have explicit line-ending rules.
  • All repositories are updated to use the standard template (or a justified variation).
  • The configuration is consistent across all PSModule repositories.

Technical Decisions

Line-ending strategy: Normalize all text to LF in the repository. LF is the universal standard across tooling and CI runners. Windows editors and Git handle LF natively. This aligns with the "Build for all developers" principle.

Scope: Organization-wide. All repositories under PSModule are reviewed. A standard template is established and applied consistently. Repository-specific variations are permitted only with documented justification.

Template location: The standard .gitattributes template should be documented or stored in a central location (e.g., the .github repository or this docs site) so new repositories can adopt it automatically.


Implementation Plan

  • Audit all PSModule repositories for existing .gitattributes files — catalog which have one, which don't, and what rules they define.
  • Define a standard .gitattributes template covering: text normalization, markdown, PowerShell, YAML, JSON, shell scripts, images, and other binary assets.
  • Document the template in a central location for reuse.
  • Apply the template to repositories that are missing .gitattributes.
  • Update repositories with divergent .gitattributes to align with the standard.
  • Run git add --renormalize . in each updated repository to apply the new rules to existing files.
  • Verify no unintended changes in test branches before merging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions