Skip site navigation (1)Skip section navigation (2)
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
--00000000000048f23105d7bf5a33
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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=3Db1f=
7154cb12517162a51d19ae19ec3f2dee88e11__;!!OToaGQ!4Lozvj8S2Opxre6qHuywX_aNhw=
m1heXl1CyQyb0N5f_fiBJEkTQGhLzE7KlqqP9C7A$
> >             <
> 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 reject=
ed
> >         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)),=
 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 restor=
e
> >     or git reset) to create a pristine working directory to test a clea=
n
> >     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 pattern=
s
> >     can be listed in
> >
> >     |=E2=80=A2 Patterns read from $GIT_DIR/info/exclude. =E2=80=A2 Patt=
erns 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 ma=
tching
> >     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
> >     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
>

--00000000000048f23105d7bf5a33
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I think that has the same problem.=C2=A0 Either that,=
 or I&#39;m doing the escaping wrong.=C2=A0 Using tcsh:</div><div><br></div=
><div><span style=3D"font-family:monospace">&lt;10:01am&gt;beast/gallatin:w=
ork1&gt;git clean -ne &#39;\!\*.orig&#39;<br>Would remove ktrace.out<br>&lt=
;10:01am&gt;beast/gallatin:work1&gt;git clean -xn | grep rej<br>Would remov=
e FreeBSD/sys/dev/mlx5/mlx5_en/en_hw_tls.h.rej</span><br></div></div><br><d=
iv class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Feb =
11, 2022 at 9:58 AM Renato Botelho &lt;<a href=3D"mailto:garga@freebsd.org"=
>garga@freebsd.org</a>&gt; wrote:<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">On 11/02/22 11:38, Drew Gallatin wrote:<br>
&gt; <br>
&gt; <br>
&gt; On Fri, Feb 11, 2022 at 4:38 AM Kristof Provost &lt;<a href=3D"mailto:=
kp@freebsd.org" target=3D"_blank">kp@freebsd.org</a> <br>
&gt; &lt;mailto:<a href=3D"mailto:kp@freebsd.org" target=3D"_blank">kp@free=
bsd.org</a>&gt;&gt; wrote:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0__<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0On 11 Feb 2022, at 2:25, Andrew Gallatin wrote:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0On 1/17/22 04:35, Alexander V. Cherni=
kov wrote:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0The branch main has bee=
n updated by melifaro:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0URL:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<a href=3D"https://urld=
efense.com/v3/__https://cgit.FreeBSD.org/src/commit/?id=3Db1f7154cb12517162=
a51d19ae19ec3f2dee88e11__;!!OToaGQ!4Lozvj8S2Opxre6qHuywX_aNhwm1heXl1CyQyb0N=
5f_fiBJEkTQGhLzE7KlqqP9C7A$" rel=3D"noreferrer" target=3D"_blank">https://u=
rldefense.com/v3/__https://cgit.FreeBSD.org/src/commit/?id=3Db1f7154cb12517=
162a51d19ae19ec3f2dee88e11__;!!OToaGQ!4Lozvj8S2Opxre6qHuywX_aNhwm1heXl1CyQy=
b0N5f_fiBJEkTQGhLzE7KlqqP9C7A$</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://=
urldefense.com/v3/__https://cgit.FreeBSD.org/src/commit/?id=3Db1f7154cb1251=
7162a51d19ae19ec3f2dee88e11__;!!OToaGQ!4Lozvj8S2Opxre6qHuywX_aNhwm1heXl1CyQ=
yb0N5f_fiBJEkTQGhLzE7KlqqP9C7A$" rel=3D"noreferrer" target=3D"_blank">https=
://urldefense.com/v3/__https://cgit.FreeBSD.org/src/commit/?id=3Db1f7154cb1=
2517162a51d19ae19ec3f2dee88e11__;!!OToaGQ!4Lozvj8S2Opxre6qHuywX_aNhwm1heXl1=
CyQyb0N5f_fiBJEkTQGhLzE7KlqqP9C7A$</a>&gt;<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0commit b1f7154cb1251716=
2a51d19ae19ec3f2dee88e11<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Author: Alexander V. Ch=
ernikov &lt;melifaro@FreeBSD.org&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0AuthorDate: 2022-01-08 =
16:14:47 +0000<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Commit: Alexander V. Ch=
ernikov &lt;melifaro@FreeBSD.org&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CommitDate: 2022-01-17 =
09:35:15 +0000<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0gitignore: ignore vim s=
wap files &amp; .rej/.orig<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Reviewed by: cem, avg<b=
r>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MFC after: 2 weeks<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Hi,<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0I was wondering if you might consider=
 reverting this change?<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Alternatively, can you teach me how t=
o override this file<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0locally without carrying a diff?<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0I&#39;m asking because this makes lif=
e painful for my workflow.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Having git clean be able to handle .o=
rig and .rej is incredibly<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0handy when applying large patch sets.=
 It makes finding a rejected<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0patch as simple as &#39;git clean -n =
| grep rej&#39;.<br>
&gt; <br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Would =E2=80=98git clean -n -x=E2=80=99 work for yo=
u?<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0|-x Don=E2=80=99t use the standard ignore rules (se=
e gitignore(5)), but<br>
&gt;=C2=A0 =C2=A0 =C2=A0still use the ignore rules given with -e options fr=
om the command<br>
&gt;=C2=A0 =C2=A0 =C2=A0line. This allows removing all untracked files, inc=
luding build<br>
&gt;=C2=A0 =C2=A0 =C2=A0products. This can be used (possibly in conjunction=
 with git restore<br>
&gt;=C2=A0 =C2=A0 =C2=A0or git reset) to create a pristine working director=
y to test a clean<br>
&gt;=C2=A0 =C2=A0 =C2=A0build. |<br>
&gt; <br>
&gt; <br>
&gt; Yes, except it would delete our .obj directories, which I don&#39;t wa=
nt.=C2=A0 <br>
&gt; The -x is how I figured out the .gitignore had been changed.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Alternatively, the gitignore(5) man page also menti=
ons that patterns<br>
&gt;=C2=A0 =C2=A0 =C2=A0can be listed in<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0|=E2=80=A2 Patterns read from $GIT_DIR/info/exclude=
. =E2=80=A2 Patterns read from<br>
&gt;=C2=A0 =C2=A0 =C2=A0the file specified by the configuration variable co=
re.excludesFile. |<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0So I=E2=80=99d think you can overrule things you do=
n=E2=80=99t like from the repo<br>
&gt;=C2=A0 =C2=A0 =C2=A0gitignore file in $GIT_DIR/info/exclude or in your =
global git<br>
&gt;=C2=A0 =C2=A0 =C2=A0configuration, especially combined with this:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0|=E2=80=A2 An optional prefix &quot;!&quot; which n=
egates the pattern; any matching<br>
&gt;=C2=A0 =C2=A0 =C2=A0file excluded by a previous pattern will become inc=
luded again. It<br>
&gt;=C2=A0 =C2=A0 =C2=A0is not possible to re-include a file if a parent di=
rectory of that<br>
&gt;=C2=A0 =C2=A0 =C2=A0file is excluded. Git doesn=E2=80=99t list excluded=
 directories for<br>
&gt;=C2=A0 =C2=A0 =C2=A0performance reasons, so any patterns on contained f=
iles have no<br>
&gt;=C2=A0 =C2=A0 =C2=A0effect, no matter where they are defined. Put a bac=
kslash (&quot;\&quot;) in<br>
&gt;=C2=A0 =C2=A0 =C2=A0front of the first &quot;!&quot; for patterns that =
begin with a literal &quot;!&quot;,<br>
&gt;=C2=A0 =C2=A0 =C2=A0for example, &quot;\!important!.txt&quot;. |<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Kristof<br>
&gt; <br>
&gt; <br>
&gt; The problem seems to be that all of these solutions are processed <br>
&gt; *FIRST*, before a .gitignore in the repo, so they cannot be used to <b=
r>
&gt; negate a gitignore rule in the repo.=C2=A0 Eg:<br>
&gt; <br>
&gt; &lt;9:32am&gt;beast/gallatin:work1&gt;kdump | grep NAMI | egrep <br>
&gt; exclude\|gitignore | head<br>
&gt;=C2=A0 =C2=A042947 git =C2=A0 =C2=A0 =C2=A0NAMI =C2=A0&quot;/home/galla=
tin/.gitignore&quot;<br>
&gt;=C2=A0 =C2=A042947 git =C2=A0 =C2=A0 =C2=A0NAMI =C2=A0&quot;/home/galla=
tin/.gitignore&quot;<br>
&gt;=C2=A0 =C2=A042947 git =C2=A0 =C2=A0 =C2=A0NAMI =C2=A0&quot;/data/ocafi=
rmware/.git/info/exclude&quot;<br>
&gt;=C2=A0 =C2=A042947 git =C2=A0 =C2=A0 =C2=A0NAMI =C2=A0&quot;/data/ocafi=
rmware/.git/info/exclude&quot;<br>
&gt;=C2=A0 =C2=A042947 git =C2=A0 =C2=A0 =C2=A0NAMI =C2=A0&quot;.gitignore&=
quot;<br>
&gt;=C2=A0 =C2=A042947 git =C2=A0 =C2=A0 =C2=A0NAMI =C2=A0&quot;FreeBSD/.gi=
tignore&quot;<br>
&gt; <br>
&gt; 9:34am&gt;beast/gallatin:work1&gt;cat ~/.gitignore<br>
&gt; !*.orig<br>
&gt; !*.rej<br>
&gt; <br>
&gt; &lt;9:35am&gt;beast/gallatin:work1&gt;git clean -n | grep rej<br>
&gt; &lt;9:35am&gt;beast/gallatin:work1&gt;git clean -xn | grep rej<br>
&gt; Would remove FreeBSD/sys/dev/mlx5/mlx5_en/en_hw_tls.h.rej<br>
&gt; <br>
&gt; This makes a stronger case that those who want to ignore .orig and .re=
j <br>
&gt; files can add them to *their* local .gitignore, and we should back the=
m <br>
&gt; out of the .gitignore for the project.<br>
<br>
What about -e parameter?=C2=A0 Something like:<br>
<br>
git clean -x -e &#39;*.obj&#39;<br>
<br>
-- <br>
Renato Botelho<br>
</blockquote></div>

--00000000000048f23105d7bf5a33--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADLQ3sJhbyCa2KmEKkhfUTPrzCv2nWcjA8CyLdGd-U2wr2ZB%2BQ>