Re: git: b1f7154cb125 - main - gitignore: ignore vim swap files & .rej/.orig

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Fri, 11 Feb 2022 09:38:16 UTC
On 11 Feb 2022, at 2:25, Andrew Gallatin wrote:
> On 1/17/22 04:35, Alexander V. Chernikov wrote:
>> The branch main has been updated by melifaro:
>>
>> URL: 
>> https://urldefense.com/v3/__https://cgit.FreeBSD.org/src/commit/?id=b1f7154cb12517162a51d19ae19ec3f2dee88e11__;!!OToaGQ!4Lozvj8S2Opxre6qHuywX_aNhwm1heXl1CyQyb0N5f_fiBJEkTQGhLzE7KlqqP9C7A$
>>
>> commit b1f7154cb12517162a51d19ae19ec3f2dee88e11
>> Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
>> AuthorDate: 2022-01-08 16:14:47 +0000
>> Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
>> CommitDate: 2022-01-17 09:35:15 +0000
>>
>>      gitignore: ignore vim swap files & .rej/.orig
>>          Reviewed by:    cem, avg
>>      MFC after:      2 weeks
>
>
> Hi,
>
> I was wondering if you might consider reverting this change?
> Alternatively, can you teach me how to override this file
> locally without carrying a diff?
>
> I'm asking because this makes life painful for my workflow.
>
> Having git clean be able to handle .orig and .rej is incredibly
> handy when applying large patch sets.  It makes finding a rejected
> patch as simple as 'git clean -n | grep rej'.
>
Would ‘git clean -n -x’ work for you?

        -x
            Don’t use the standard ignore rules (see gitignore(5)), 
but still use
            the ignore rules given with -e options from the command 
line. This
            allows removing all untracked files, including build 
products. This
            can be used (possibly in conjunction with git restore or git 
reset)
            to create a pristine working directory to test a clean 
build.

Alternatively, the gitignore(5) man page also mentions that patterns can 
be listed in

        •   Patterns read from $GIT_DIR/info/exclude.

        •   Patterns read from the file specified by the configuration 
variable
            core.excludesFile.

So I’d think you can overrule things you don’t like from the repo 
gitignore file in $GIT_DIR/info/exclude or in your global git 
configuration, especially combined with this:

        •   An optional prefix "!" which negates the pattern; any 
matching file
            excluded by a previous pattern will become included again. 
It is not
            possible to re-include a file if a parent directory of that 
file is
            excluded. Git doesn’t list excluded directories for 
performance
            reasons, so any patterns on contained files have no effect, 
no matter
            where they are defined. Put a backslash ("\") in front of 
the first
            "!" for patterns that begin with a literal "!", for example,
            "\!important!.txt".


Kristof