Skip to main content

Rendering

Enum Rendering 

Source
pub enum Rendering {
    Global,
    PerPattern {
        fold_case: bool,
    },
}
Expand description

Spells a pattern so it matches either case of every ASCII letter.

The other half of open decision 13, settled on 2026-08-05, and it is not optional: [crate::rules::declaration::MATCHING] folds ASCII case unconditionally, so a rendered line that did not would be narrower than the filter — and the narrow direction is the one measured eating 34 CR bytes out of a 2 MB ciphertext and losing the file at checkout. Emitting the fold rather than leaning on core.ignorecase is what makes the two agree on every machine: measured on git 2.55, **/secrets/** answers unspecified for SEcrets/db.txt where the setting is false, while **/[sS][eE][cC][rR][eE][tT][sS]/** answers unset whatever it is set to.

Four things in a pattern are not plain letters, and each is left meaning what it meant:

  • a glob escape. \s is the literal s, so it becomes [sS] — the backslash was doing nothing a character class does not. \* and every other escaped metacharacter is passed through with its backslash.
  • a character class. [a-z] cannot become [[aA]-[zZ]]; the counterpart is added inside the brackets instead, giving [a-zA-Z]. A negated class gets it too, which is right: folding [!a] must stop it matching A.
  • a POSIX class, [[:alpha:]], whose members are named rather than spelled, so there is nothing to rewrite and it is copied whole — except the two classes that are a case: [:upper:] and [:lower:] each gain their counterpart, because the selection side folds them too. Measured: gix-glob under Case::Fold lowercases the candidate first, so [[:upper:]]dir/ selects xdir/a.env — and a verbatim copy answers unspecified for it at core.ignorecase=false, the narrower-than-the- filter direction that costs the file.
  • anything outside ASCII, which is copied byte for byte. That is the documented boundary — see [crate::rules::declaration::MATCHING].

Quoting is not this function’s business. It runs before [spell], which puts the quotes back around a pattern that needs them, and [, ] and - are ordinary characters to git’s C-unquoting. It runs after [guard] for the opposite reason: guard recognises a literal [attr] opening, and folding first would turn it into [attrATTR] and hide it. How the managed section spells what it protects.

Two shapes, and the choice is a trade this project measured rather than guessed.

PerPattern writes a line per declared pattern, each naming the filter, the -text that protects the ciphertext and the diff driver — the shape git-crypt users will recognise. It is what sync writes when nothing asks otherwise, and it confines the diff driver to declared paths.

Global is one line covering the whole repository. init writes it, so a repository works correctly before sync has ever run and nothing can go stale; sync --global puts it back. Its cost is the diff driver on every file.

The cost that decides between them is the diff driver, and it is a process per blob — git has no long-running protocol for textconv the way it has one for filters. Measured on git 2.55, 2026-08-06, against the same repository with the driver unregistered:

files in the diffglobalper pattern
572 ms21 ms
20201 ms22 ms
100899 ms25 ms
10008461 ms23 ms

So an everyday diff pays nothing anyone notices, and a thousand-file review pays eight seconds. init writes Global so a fresh repository is correct with no second command; sync writes PerPattern, which is what a repository settles into once anyone runs it.

The other half of Global is -text on every path, which stops git normalising line endings anywhere in the repository. That is the price of needing no sync: the same attribute is what keeps git’s CRLF conversion off the ciphertext, and one line cannot say it for some paths only.

Variants§

§

Global

One line, covering everything. Correct with no sync in the flow.

§

PerPattern

One line per declared pattern, with ASCII case folded when asked.

Fields

§fold_case: bool

Trait Implementations§

Source§

impl Clone for Rendering

Source§

fn clone(&self) -> Rendering

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Rendering

Source§

impl Debug for Rendering

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Rendering

Source§

impl PartialEq for Rendering

Source§

fn eq(&self, other: &Rendering) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Rendering

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.