Skip to content

Native gitignore Support - Open for Discussion #1079

Description

@steadytao

Requested previously in:

--filter=':- .gitignore' does not work. This reads .gitignore files as rsync per-directory merge filters. It does not implement Git ignore semantics and diverges on negation, anchoring, directory-only patterns, escaping and nested precedence.

git ls-files can provide an external solution when Git is installed and the source is a Git worktree. It does not provide native support for remote sources or ordinary directory trees containing .gitignore files.

I am not opposed to adding explicit native support. Before implementation, we should agree on the behaviour.

A possible interface would be an opt-in option such as --gitignore. It would interpret gitignore files on the sending side without silently changing the meaning of existing transfers.

The design needs to define:

  • Whether nested gitignore files are supported and how their precedence is applied
  • What anchored patterns are relative to when multiple source arguments are provided
  • Whether only gitignore files are read or whether .git/info/exclude and core.excludesFile are also in scope
  • How Git exclusions interact with existing rsync filter rules
  • Whether ignored files are protected from receiver-side deletion, consistent with ordinary rsync exclusions
  • Behaviour for remote sources and directories that are not Git worktrees
  • Whether Git-compatible parsing is implemented internally or delegated to Git

Thoughts? Open to discussion and implementations.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions