Date: Fri, 11 Feb 2022 10:02:05 -0500 From: Drew Gallatin <gallatin@netflix.com> To: Renato Botelho <garga@freebsd.org> Cc: Kristof Provost <kp@freebsd.org>, Andrew Gallatin <gallatin@cs.duke.edu>, "Alexander V. Chernikov" <melifaro@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Conrad Meyer <cem@freebsd.org>, Andriy Gapon <avg@freebsd.org> Subject: Re: git: b1f7154cb125 - main - gitignore: ignore vim swap files & .rej/.orig Message-ID: <CADLQ3sJhbyCa2KmEKkhfUTPrzCv2nWcjA8CyLdGd-U2wr2ZB%2BQ@mail.gmail.com> In-Reply-To: <4f4f6a83-3def-4938-6e40-5460486cc415@FreeBSD.org> References: <202201170935.20H9ZM3T069547@gitrepo.freebsd.org> <72061959-88f8-d2ee-b4e9-f09ca084411e@cs.duke.edu> <4FC1EDC4-9F20-4271-B468-715A1727AC8A@FreeBSD.org> <CADLQ3sKdAvci47RxK=Vqg4JA0Wff2z9dcuDrByWNdendQu=M%2Bw@mail.gmail.com> <4f4f6a83-3def-4938-6e40-5460486cc415@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] I think that has the same problem. Either that, or I'm doing the escaping wrong. Using tcsh: <10:01am>beast/gallatin:work1>git clean -ne '\!\*.orig' Would remove ktrace.out <10:01am>beast/gallatin:work1>git clean -xn | grep rej Would remove FreeBSD/sys/dev/mlx5/mlx5_en/en_hw_tls.h.rej On Fri, Feb 11, 2022 at 9:58 AM Renato Botelho <garga@freebsd.org> wrote: > On 11/02/22 11:38, Drew Gallatin wrote: > > > > > > On Fri, Feb 11, 2022 at 4:38 AM Kristof Provost <kp@freebsd.org > > <mailto:kp@freebsd.org>> wrote: > > > > __ > > > > 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$ > > < > 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. | > > > > > > Yes, except it would delete our .obj directories, which I don't want. > > The -x is how I figured out the .gitignore had been changed. > > > > 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 > > > > > > The problem seems to be that all of these solutions are processed > > *FIRST*, before a .gitignore in the repo, so they cannot be used to > > negate a gitignore rule in the repo. Eg: > > > > <9:32am>beast/gallatin:work1>kdump | grep NAMI | egrep > > exclude\|gitignore | head > > 42947 git NAMI "/home/gallatin/.gitignore" > > 42947 git NAMI "/home/gallatin/.gitignore" > > 42947 git NAMI "/data/ocafirmware/.git/info/exclude" > > 42947 git NAMI "/data/ocafirmware/.git/info/exclude" > > 42947 git NAMI ".gitignore" > > 42947 git NAMI "FreeBSD/.gitignore" > > > > 9:34am>beast/gallatin:work1>cat ~/.gitignore > > !*.orig > > !*.rej > > > > <9:35am>beast/gallatin:work1>git clean -n | grep rej > > <9:35am>beast/gallatin:work1>git clean -xn | grep rej > > Would remove FreeBSD/sys/dev/mlx5/mlx5_en/en_hw_tls.h.rej > > > > This makes a stronger case that those who want to ignore .orig and .rej > > files can add them to *their* local .gitignore, and we should back them > > out of the .gitignore for the project. > > What about -e parameter? Something like: > > git clean -x -e '*.obj' > > -- > Renato Botelho > [-- Attachment #2 --] <div dir="ltr"><div>I think that has the same problem. Either that, or I'm doing the escaping wrong. Using tcsh:</div><div><br></div><div><span style="font-family:monospace"><10:01am>beast/gallatin:work1>git clean -ne '\!\*.orig'<br>Would remove ktrace.out<br><10:01am>beast/gallatin:work1>git clean -xn | grep rej<br>Would remove FreeBSD/sys/dev/mlx5/mlx5_en/en_hw_tls.h.rej</span><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 11, 2022 at 9:58 AM Renato Botelho <<a href="mailto:garga@freebsd.org">garga@freebsd.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 11/02/22 11:38, Drew Gallatin wrote:<br> > <br> > <br> > On Fri, Feb 11, 2022 at 4:38 AM Kristof Provost <<a href="mailto:kp@freebsd.org" target="_blank">kp@freebsd.org</a> <br> > <mailto:<a href="mailto:kp@freebsd.org" target="_blank">kp@freebsd.org</a>>> wrote:<br> > <br> > __<br> > <br> > On 11 Feb 2022, at 2:25, Andrew Gallatin wrote:<br> > <br> > On 1/17/22 04:35, Alexander V. Chernikov wrote:<br> > <br> > The branch main has been updated by melifaro:<br> > <br> > URL:<br> > <a href="https://urldefense.com/v3/__https://cgit.FreeBSD.org/src/commit/?id=b1f7154cb12517162a51d19ae19ec3f2dee88e11__;!!OToaGQ!4Lozvj8S2Opxre6qHuywX_aNhwm1heXl1CyQyb0N5f_fiBJEkTQGhLzE7KlqqP9C7A$" rel="noreferrer" target="_blank">https://urldefense.com/v3/__https://cgit.FreeBSD.org/src/commit/?id=b1f7154cb12517162a51d19ae19ec3f2dee88e11__;!!OToaGQ!4Lozvj8S2Opxre6qHuywX_aNhwm1heXl1CyQyb0N5f_fiBJEkTQGhLzE7KlqqP9C7A$</a><br> > <<a href="https://urldefense.com/v3/__https://cgit.FreeBSD.org/src/commit/?id=b1f7154cb12517162a51d19ae19ec3f2dee88e11__;!!OToaGQ!4Lozvj8S2Opxre6qHuywX_aNhwm1heXl1CyQyb0N5f_fiBJEkTQGhLzE7KlqqP9C7A$" rel="noreferrer" target="_blank">https://urldefense.com/v3/__https://cgit.FreeBSD.org/src/commit/?id=b1f7154cb12517162a51d19ae19ec3f2dee88e11__;!!OToaGQ!4Lozvj8S2Opxre6qHuywX_aNhwm1heXl1CyQyb0N5f_fiBJEkTQGhLzE7KlqqP9C7A$</a>><br> > <br> > commit b1f7154cb12517162a51d19ae19ec3f2dee88e11<br> > Author: Alexander V. Chernikov <melifaro@FreeBSD.org><br> > AuthorDate: 2022-01-08 16:14:47 +0000<br> > Commit: Alexander V. Chernikov <melifaro@FreeBSD.org><br> > CommitDate: 2022-01-17 09:35:15 +0000<br> > <br> > gitignore: ignore vim swap files & .rej/.orig<br> > Reviewed by: cem, avg<br> > MFC after: 2 weeks<br> > <br> > Hi,<br> > <br> > I was wondering if you might consider reverting this change?<br> > Alternatively, can you teach me how to override this file<br> > locally without carrying a diff?<br> > <br> > I'm asking because this makes life painful for my workflow.<br> > <br> > Having git clean be able to handle .orig and .rej is incredibly<br> > handy when applying large patch sets. It makes finding a rejected<br> > patch as simple as 'git clean -n | grep rej'.<br> > <br> > <br> > Would ‘git clean -n -x’ work for you?<br> > <br> > |-x Don’t use the standard ignore rules (see gitignore(5)), but<br> > still use the ignore rules given with -e options from the command<br> > line. This allows removing all untracked files, including build<br> > products. This can be used (possibly in conjunction with git restore<br> > or git reset) to create a pristine working directory to test a clean<br> > build. |<br> > <br> > <br> > Yes, except it would delete our .obj directories, which I don't want. <br> > The -x is how I figured out the .gitignore had been changed.<br> > <br> > Alternatively, the gitignore(5) man page also mentions that patterns<br> > can be listed in<br> > <br> > |• Patterns read from $GIT_DIR/info/exclude. • Patterns read from<br> > the file specified by the configuration variable core.excludesFile. |<br> > <br> > So I’d think you can overrule things you don’t like from the repo<br> > gitignore file in $GIT_DIR/info/exclude or in your global git<br> > configuration, especially combined with this:<br> > <br> > |• An optional prefix "!" which negates the pattern; any matching<br> > file excluded by a previous pattern will become included again. It<br> > is not possible to re-include a file if a parent directory of that<br> > file is excluded. Git doesn’t list excluded directories for<br> > performance reasons, so any patterns on contained files have no<br> > effect, no matter where they are defined. Put a backslash ("\") in<br> > front of the first "!" for patterns that begin with a literal "!",<br> > for example, "\!important!.txt". |<br> > <br> > Kristof<br> > <br> > <br> > The problem seems to be that all of these solutions are processed <br> > *FIRST*, before a .gitignore in the repo, so they cannot be used to <br> > negate a gitignore rule in the repo. Eg:<br> > <br> > <9:32am>beast/gallatin:work1>kdump | grep NAMI | egrep <br> > exclude\|gitignore | head<br> > 42947 git NAMI "/home/gallatin/.gitignore"<br> > 42947 git NAMI "/home/gallatin/.gitignore"<br> > 42947 git NAMI "/data/ocafirmware/.git/info/exclude"<br> > 42947 git NAMI "/data/ocafirmware/.git/info/exclude"<br> > 42947 git NAMI ".gitignore"<br> > 42947 git NAMI "FreeBSD/.gitignore"<br> > <br> > 9:34am>beast/gallatin:work1>cat ~/.gitignore<br> > !*.orig<br> > !*.rej<br> > <br> > <9:35am>beast/gallatin:work1>git clean -n | grep rej<br> > <9:35am>beast/gallatin:work1>git clean -xn | grep rej<br> > Would remove FreeBSD/sys/dev/mlx5/mlx5_en/en_hw_tls.h.rej<br> > <br> > This makes a stronger case that those who want to ignore .orig and .rej <br> > files can add them to *their* local .gitignore, and we should back them <br> > out of the .gitignore for the project.<br> <br> What about -e parameter? Something like:<br> <br> git clean -x -e '*.obj'<br> <br> -- <br> Renato Botelho<br> </blockquote></div>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADLQ3sJhbyCa2KmEKkhfUTPrzCv2nWcjA8CyLdGd-U2wr2ZB%2BQ>
