archive mirror
 help / color / mirror / Atom feed
From: Jeff King <>
To: James Hughes <>
Cc: "" <>
Subject: Re: Fw: Tabs vs Spaces - Handle like CLRF?
Date: Wed, 19 May 2021 12:28:56 -0400	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Wed, May 19, 2021 at 03:55:46PM +0000, James Hughes wrote:

> We have the ability to automagically handle CLRF issues when we commit
> and check-out to handle different dev environments.
> A lot of us will also hold religious beliefs as to which is the
> correct way to indent, tabs or spaces.
> Since it's simple a whitespacing issue, is there any reason we
> couldn't handle this in a similar way to CLRF? Give devs the choice to
> commit with tabs/spaces as per their organisations requirements and
> then convert to their preference on checkout?

You can. See clean/smudge filters in the gitattributes(5) manpage. You'd
declare one of them the canonical in-repo format (let's say tabs). Then
your "clean" filter would convert spaces-to-tabs, perhaps with something
like "perl -pe 's/ {8}/\t/g'". And your "smudge" filter would convert
tabs back to spaces.

And then you just mark the files you want converted with an attribute in
.gitattributes, and wire up that attribute to the filters in your


      reply	other threads:[~2021-05-19 16:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2021-05-19 15:55 ` James Hughes
2021-05-19 16:28   ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \
    --subject='Re: Fw: Tabs vs Spaces - Handle like CLRF?' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).