git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Jagan Teki <jteki@openedev.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: Git patch shows tab but files doesn't
Date: Fri, 12 Feb 2016 13:32:38 -0500	[thread overview]
Message-ID: <20160212183238.GB19973@sigill.intra.peff.net> (raw)
In-Reply-To: <CAD6G_RTJuNsR6qawgco1H+ocKPThk1HsQLvhQigmzUb_c7UdaQ@mail.gmail.com>

On Fri, Feb 12, 2016 at 09:32:32PM +0530, Jagan Teki wrote:

> Hi,
> 
> I edited a file as one space between #define and macro and tab space
> between macro and BIT value, similar as below.
> 
> #define USE_FSR           BIT(6)
> #define SNOR_WR         BIT(7)
> 
> Once I created the patch looks different as tab space between #define
> and macro and 2 tab spaces between macro and BIT value looks like it's
> added tab spaces while creating a patch as below.
> 
> +#define        USE_FSR                              BIT(6)
> +#define        SNOR_WR                            BIT(7)
> 
> Any help how to fix this, was it an issues with vim or do we have any
> git-config fixes for this?

It's hard to tell from your output, but you can often get tab
realignment on your terminal when viewing a patch, because the tabs are
shifted in by one character (the leading "+"). So if your terminal
is showing (as most do) a tab as "skip to the next tabstop", then:

  1. The size of particular tabs may look quite different if they move
     from an exact tabstop to the next character (or vice versa).

     If the space between your "#define" and the macro name is actually
     a tab, then I'd expect it to exhibit this behavior with a tabstop
     of 8 (because #define is 7 chars).

  2. Spaces don't exhibit this, so two lines which _are_ aligned in the
     source for a specific tabstop may not be in the patch.

Piping the diff (and your file) through "cat -A" can often show more
clearly what's going on.

-Peff

      reply	other threads:[~2016-02-12 18:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12 16:02 Git patch shows tab but files doesn't Jagan Teki
2016-02-12 18:32 ` 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20160212183238.GB19973@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jteki@openedev.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).