git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Git patch shows tab but files doesn't
@ 2016-02-12 16:02 Jagan Teki
  2016-02-12 18:32 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Jagan Teki @ 2016-02-12 16:02 UTC (permalink / raw)
  To: Git List

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?

-- 
Jagan.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Git patch shows tab but files doesn't
  2016-02-12 16:02 Git patch shows tab but files doesn't Jagan Teki
@ 2016-02-12 18:32 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2016-02-12 18:32 UTC (permalink / raw)
  To: Jagan Teki; +Cc: Git List

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-12 18:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-12 16:02 Git patch shows tab but files doesn't Jagan Teki
2016-02-12 18:32 ` Jeff King

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).