Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH 3/3] completion: make: fix whitespaces



On Thu, Aug 4, 2022 at 3:55 AM Jun T <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
>
> As this patch shows, _make has some indentation problems
> (and also lots of other scripts have them).
>
> > 2022/07/30 10:03, Felipe Contreras <felipe.contreras@xxxxxxxxx> write:
> >
> > diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
>
> > @@ -12,35 +12,35 @@ _make-expandVars() {
> >
> >     case $rest[2] in
> >       ($)         # '$$'. may not appear in target and variable's value
> > -     front=$front\$\$
> > -     rest=${rest[3,-1]}
> > -     continue
> > -     ;;
> > +        front=$front\$\$
> > +        rest=${rest[3,-1]}
> (snip)
>
> # I didn't know that indent_style for scripts has changed from
> # tab to space.
>
> I have a vague memory of argument that it's not good to fix indent of
> lines not related with the real fix because it makes 'git blame'
> rather useless, and then someone wrote that 'git blame -w' can be used
> in that case.

Even if -w didn't exist, `git blame` can find previous modifications,
it's not just a tool to find the last one, so it wouldn't be
"useless".

You can tell it to start from the previous commit that made modifications:

    git blame 6ab65fae7a~ -L12,35 Completion/Unix/Command/_make

And you can of course list *all* the previous modifications to those lines:

    git log -L12,35:Completion/Unix/Command/_make

> So, in general, is it better (or not) to apply this type of patch?

I've sent many patches like this one to the git project itself, so
presumably git has no trouble with them.

Ultimately it's up to you (the developers). Do you want to have
inconsistent whitespaces forever (or at least until somebody modifies
those lines, which seems to happen every 5 years)? Or would you rather
have it clean now?

Personally, sometimes I use ts=2 in shell scripts, so it's very
annoying to see those badly indented lines, but your mileage may vary.

Cheers.

-- 
Felipe Contreras




Messages sorted by: Reverse Date, Date, Thread, Author