Skip to documentation

MergerInterface

Interface

Defines the contract for merging .gitignore entries.

Description

This service SHALL combine canonical and project-specific .gitignore definitions into an ordered result. Canonical defaults MUST precede consumer rules. The merger MUST preserve pattern whitespace and repeated rules because Git resolves conflicts using the last matching pattern.

Table of Contents

Methods

merge()

Merges two GitIgnore instances without changing consumer rule precedence.

 : GitIgnoreInterface
Methods

merge()

Public

Merges two GitIgnore instances without changing consumer rule precedence.

public merge(GitIgnoreInterface  $canonical, GitIgnoreInterface  $project) : GitIgnoreInterface

Description

An already present canonical prefix MUST NOT be added again. The path from $project is used in the returned instance.

Parameters
$canonical : GitIgnoreInterface

Description

the canonical .gitignore from dev-tools

$project : GitIgnoreInterface

Description

the project-specific .gitignore

Return values

Description

a new GitIgnore instance with merged entries

Search results