Date: Fri, 11 Feb 2022 09:38:24 -0500 From: Drew Gallatin <gallatin@netflix.com> To: Kristof Provost <kp@freebsd.org> Cc: 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: <CADLQ3sKdAvci47RxK=Vqg4JA0Wff2z9dcuDrByWNdendQu=M%2Bw@mail.gmail.com> In-Reply-To: <4FC1EDC4-9F20-4271-B468-715A1727AC8A@FreeBSD.org> References: <202201170935.20H9ZM3T069547@gitrepo.freebsd.org> <72061959-88f8-d2ee-b4e9-f09ca084411e@cs.duke.edu> <4FC1EDC4-9F20-4271-B468-715A1727AC8A@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000009f70e405d7bf0547 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Feb 11, 2022 at 4:38 AM Kristof Provost <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=3Db1f= 7154cb12517162a51d19ae19ec3f2dee88e11__;!!OToaGQ!4Lozvj8S2Opxre6qHuywX_aNhw= m1heXl1CyQyb0N5f_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 =E2=80=98git clean -n -x=E2=80=99 work for you? > > -x > Don=E2=80=99t use the standard ignore rules (see gitignore(5)), bu= t still use > the ignore rules given with -e options from the command line. This > allows removing all untracked files, including build products. Thi= s > 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 > > =E2=80=A2 Patterns read from $GIT_DIR/info/exclude. > > =E2=80=A2 Patterns read from the file specified by the configuration= variable > core.excludesFile. > > So I=E2=80=99d think you can overrule things you don=E2=80=99t like from = the repo > gitignore file in $GIT_DIR/info/exclude or in your global git > configuration, especially combined with this: > > =E2=80=A2 An optional prefix "!" which negates the pattern; any matc= hing file > excluded by a previous pattern will become included again. It is n= ot > possible to re-include a file if a parent directory of that file i= s > excluded. Git doesn=E2=80=99t list excluded directories for perfor= mance > reasons, so any patterns on contained files have no effect, no mat= ter > where they are defined. Put a backslash ("\") in front of the firs= t > "!" 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. Drew --0000000000009f70e405d7bf0547 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Fri, Feb 11, 2022 at 4:38 AM Krist= of Provost <<a href=3D"mailto:kp@freebsd.org">kp@freebsd.org</a>> wro= te:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px = 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u> <div><div style=3D"font-family:sans-serif"><div style=3D"white-space:normal= "> <p dir=3D"auto">On 11 Feb 2022, at 2:25, Andrew Gallatin wrote:</p> </div><div style=3D"white-space:normal"><blockquote style=3D"margin:0px 0px= 5px;padding-left:5px;border-left:2px solid rgb(19,107,206);color:rgb(19,10= 7,206)"><p dir=3D"auto">On 1/17/22 04:35, Alexander V. Chernikov wrote:</p> <blockquote style=3D"margin:0px 0px 5px;padding-left:5px;border-left:2px so= lid rgb(75,137,207);color:rgb(75,137,207)"><p dir=3D"auto">The branch main = has been updated by melifaro:</p> <p dir=3D"auto">URL: <a href=3D"https://urldefense.com/v3/__https://cgit.Fr= eeBSD.org/src/commit/?id=3Db1f7154cb12517162a51d19ae19ec3f2dee88e11__;!!OTo= aGQ!4Lozvj8S2Opxre6qHuywX_aNhwm1heXl1CyQyb0N5f_fiBJEkTQGhLzE7KlqqP9C7A$" ta= rget=3D"_blank">https://urldefense.com/v3/__https://cgit.FreeBSD.org/src/co= mmit/?id=3Db1f7154cb12517162a51d19ae19ec3f2dee88e11__;!!OToaGQ!4Lozvj8S2Opx= re6qHuywX_aNhwm1heXl1CyQyb0N5f_fiBJEkTQGhLzE7KlqqP9C7A$</a></p> <p dir=3D"auto">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</p> <p dir=3D"auto"> gitignore: ignore vim swap files & .rej/.orig <br> Reviewed by: cem, avg <br> MFC after: 2 weeks</p> </blockquote><p dir=3D"auto">Hi,</p> <p dir=3D"auto">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?</p> <p dir=3D"auto">I'm asking because this makes life painful for my workf= low.</p> <p dir=3D"auto">Having git clean be able to handle .orig and .rej is incred= ibly <br> handy when applying large patch sets. It makes finding a rejected <br> patch as simple as 'git clean -n | grep rej'.</p> <br></blockquote></div> <div style=3D"white-space:normal"> <p dir=3D"auto">Would =E2=80=98git clean -n -x=E2=80=99 work for you?</p> <pre style=3D"margin-left:15px;margin-right:15px;padding:5px;border:thin so= lid gray;overflow-x:auto;max-width:90vw;background-color:rgb(228,228,228)">= <code> -x Don=E2=80=99t 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. </code></pre> <p dir=3D"auto"></p></div></div></div></blockquote><div><br></div><div>Yes,= except it would delete our .obj directories, which I don't want.=C2=A0= The -x is how I figured out the .gitignore had been changed.<br></div><div= >=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px = 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div st= yle=3D"font-family:sans-serif"><div style=3D"white-space:normal"><p dir=3D"= auto">Alternatively, the gitignore(5) man page also mentions that patterns = can be listed in</p> <pre style=3D"margin-left:15px;margin-right:15px;padding:5px;border:thin so= lid gray;overflow-x:auto;max-width:90vw;background-color:rgb(228,228,228)">= <code> =E2=80=A2 Patterns read from $GIT_DIR/info/exclude. =E2=80=A2 Patterns read from the file specified by the configuration v= ariable core.excludesFile. </code></pre> <p dir=3D"auto">So I=E2=80=99d think you can overrule things you don=E2=80= =99t like from the repo gitignore file in $GIT_DIR/info/exclude or in your = global git configuration, especially combined with this:</p> <pre style=3D"margin-left:15px;margin-right:15px;padding:5px;border:thin so= lid gray;overflow-x:auto;max-width:90vw;background-color:rgb(228,228,228)">= <code> =E2=80=A2 An optional prefix "!" which negates the pat= tern; 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=E2=80=99t list excluded directories for performa= nce reasons, so any patterns on contained files have no effect, no matte= r where they are defined. Put a backslash ("\") in front of = the first "!" for patterns that begin with a literal "!", = for example, "\!important!.txt". </code></pre> <p dir=3D"auto">Kristof</p></div></div></div></blockquote><div><br></div><d= iv>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 giti= gnore rule in the repo.=C2=A0 Eg:</div><div><br></div><div><span style=3D"f= ont-family:monospace"><9:32am>beast/gallatin:work1>kdump | grep NA= MI | egrep exclude\|gitignore | head<br>=C2=A042947 git =C2=A0 =C2=A0 =C2= =A0NAMI =C2=A0"/home/gallatin/.gitignore"<br>=C2=A042947 git =C2= =A0 =C2=A0 =C2=A0NAMI =C2=A0"/home/gallatin/.gitignore"<br>=C2=A0= 42947 git =C2=A0 =C2=A0 =C2=A0NAMI =C2=A0"/data/ocafirmware/.git/info/= exclude"<br>=C2=A042947 git =C2=A0 =C2=A0 =C2=A0NAMI =C2=A0"/data= /ocafirmware/.git/info/exclude"<br>=C2=A042947 git =C2=A0 =C2=A0 =C2= =A0NAMI =C2=A0".gitignore"<br>=C2=A042947 git =C2=A0 =C2=A0 =C2= =A0NAMI =C2=A0"FreeBSD/.gitignore"</span></div><div><span style= =3D"font-family:monospace"><br></span></div><div><span style=3D"font-family= :monospace">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>Wo= uld remove FreeBSD/sys/dev/mlx5/mlx5_en/en_hw_tls.h.rej</span><br></div><di= v><br></div><div>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.</div><div><br></div><div>= Drew<br></div><div>=C2=A0</div></div></div> --0000000000009f70e405d7bf0547--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADLQ3sKdAvci47RxK=Vqg4JA0Wff2z9dcuDrByWNdendQu=M%2Bw>