# [PATCH] Remove tab character from conflicted files list part of the merge message

6 messages from 2007-03-13 to 2007-03-14. Participants: Andy Parkins, Johannes Schindelin, Junio C Hamano.
Thread: https://gitlist.dev/t/7229

## Andy Parkins, 2007-03-13 13:09

Subject: [PATCH] Remove tab character from conflicted files list part of the merge message
Message-ID: <200703131309.43767.andyparkins@gmail.com>
URL: https://gitlist.dev/e/200703131309.43767.andyparkins%40gmail.com

```
Merge can generate sections like this:
 Conflicts:
   file1
   file2
   file3
The filenames were moved forward by embedding a tab.  Tabs are variable
width, so there is no guarantee that the appearance would be the same on
different systems.  In this case the tabs are being used for formatting,
for formatting, spaces are better.

This patch simply swaps the tab for four spaces in the "Conflicts:"
section.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
The reason this makes a difference (to me), is that I often edit the
conflict section to say what the resolution of the conflict was,  I
happen to have expandtabs set for git log messages (to guarantee they
look the same regardless of the viewer's settings), and hadn't noticed
that git was putting tabs into the log message for me.

So what I thought I was formatting as (for example)

Conflicts:
    file.c
     * Chose upstream version over mine, but integrated my small typo fix.

Was appearing in the log display as

Conflicts:
        file.c
     * Chose upstream version over mine, but integrated my small typo fix.

Which isn't how I'd intended at all.

The fix is of course - no tabs.  Tabs for formatting is always going to cause
trouble, so this patch swaps the tab for spaces.

I don't think the actual number of spaces is important (I chose 4), as long
as there are no tab-surprises in the log message (unless the user put them
there themselves of course - but that's their own fault).


 git-merge.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-merge.sh b/git-merge.sh
index 6ce62c8..a03d22b 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -482,7 +482,7 @@ else
 Conflicts:
 '
 		git ls-files --unmerged |
-		sed -e 's/^[^	]*	/	/' |
+		sed -e 's/^[^	]*	/    /' |
 		uniq
 	} >>"$GIT_DIR/MERGE_MSG"
 	if test -d "$GIT_DIR/rr-cache"
-- 
1.5.0.2.205.g74e20

```

## Johannes Schindelin, 2007-03-13 14:42

Subject: Re: [PATCH] Remove tab character from conflicted files list part of the merge message
Message-ID: <Pine.LNX.4.63.0703131539430.22628@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0703131539430.22628%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <200703131309.43767.andyparkins@gmail.com>

```
Hi,

On Tue, 13 Mar 2007, Andy Parkins wrote:

> So what I thought I was formatting as (for example)
> 
> Conflicts:
>     file.c
>      * Chose upstream version over mine, but integrated my small typo fix.
> 
> Was appearing in the log display as
> 
> Conflicts:
>         file.c
>      * Chose upstream version over mine, but integrated my small typo fix.
> 
> Which isn't how I'd intended at all.
> 
> The fix is of course - no tabs.  Tabs for formatting is always going to 
> cause trouble, so this patch swaps the tab for spaces.

And of course the next guy will have the reverse problem, because he typed 
<TAB><SPACE> instead of <SPACE>*5. What do you tell _him_ after "fixing" 
this issue? "Do as _I_ do"?

Ciao,
Dscho

```

## Andy Parkins, 2007-03-13 15:18

Subject: Re: [PATCH] Remove tab character from conflicted files list part of the merge message
Message-ID: <200703131518.54076.andyparkins@gmail.com>
URL: https://gitlist.dev/e/200703131518.54076.andyparkins%40gmail.com
In-Reply-To: <Pine.LNX.4.63.0703131539430.22628@wbgn013.biozentrum.uni-wuerzburg.de>

```
On Tuesday 2007 March 13 14:42, Johannes Schindelin wrote:

> And of course the next guy will have the reverse problem, because he typed
> <TAB><SPACE> instead of <SPACE>*5. What do you tell _him_ after "fixing"
> this issue? "Do as _I_ do"?

That's basically what you're telling me by saying I can't have that change.  
But as it happens, no I wasn't doing this as a "do it my way" kind of thing.  
As it happens I /like/ tabs in my source code.  However, this isn't source 
code.

Let's forget my own problem - I was only offering it as backstory.  Consider a 
log message with no additional comments about the conflicts.  The current 
output looks like this:

Conflicts:
\tfile1.c
\tfile2.c

Now, view this message on the terminal with git-log, now view it in gitk, now 
view it in qgit, now view it in git-gui.  All of these could be set for 
different tab widths, and will hence display the log message differently.

git-merge has to pick one or the other - tabs or spaces - for me, I'd rather 
pick the one that means the message displays the same regardless of what the 
author of the viewer/terminal thought tabs should be set to that day.  I'd 
also prefer that when others view the log there is more chance that they'll 
see the same as I do.

Of course, there is nothing we can do if a log message author chooses to put 
tabs in - but at least if git uses spaces the choice isn't already made.



Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com

```

## Johannes Schindelin, 2007-03-13 15:44

Subject: Re: [PATCH] Remove tab character from conflicted files list part of the merge message
Message-ID: <Pine.LNX.4.63.0703131643590.22628@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0703131643590.22628%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <200703131518.54076.andyparkins@gmail.com>

```
Hi,

On Tue, 13 Mar 2007, Andy Parkins wrote:

> Of course, there is nothing we can do if a log message author chooses to 
> put tabs in - but at least if git uses spaces the choice isn't already 
> made.

Huh? s/isn't/is/, right?

Ciao,
Dscho

```

## Andy Parkins, 2007-03-13 16:22

Subject: Re: [PATCH] Remove tab character from conflicted files list part of the merge message
Message-ID: <200703131622.53559.andyparkins@gmail.com>
URL: https://gitlist.dev/e/200703131622.53559.andyparkins%40gmail.com
In-Reply-To: <Pine.LNX.4.63.0703131643590.22628@wbgn013.biozentrum.uni-wuerzburg.de>

```
On Tuesday 2007 March 13 15:44, Johannes Schindelin wrote:

> Huh? s/isn't/is/, right?

<sheepish grin>

Yes, it's impressive how I can render a point meaningless by not rereading 
before I send.



Andy

-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com

```

## Junio C Hamano, 2007-03-14 09:26

Subject: Re: [PATCH] Remove tab character from conflicted files list part of the merge message
Message-ID: <7vslc8ch1k.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vslc8ch1k.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <Pine.LNX.4.63.0703131539430.22628@wbgn013.biozentrum.uni-wuerzburg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> On Tue, 13 Mar 2007, Andy Parkins wrote:
> ...
>> Was appearing in the log display as
>> 
>> Conflicts:
>>         file.c
>>      * Chose upstream version over mine, but integrated my small typo fix.
>> 
>> Which isn't how I'd intended at all.
>> 
>> The fix is of course - no tabs.  Tabs for formatting is always going to 
>> cause trouble, so this patch swaps the tab for spaces.
>
> And of course the next guy will have the reverse problem, because he typed 
> <TAB><SPACE> instead of <SPACE>*5. What do you tell _him_ after "fixing" 
> this issue? "Do as _I_ do"?

Actually, tabs are for indent and everybody knows that.  In
Andy's example, I think the bug is in typing spaces before the
explanatory message "* Chose upstream...".  An obvious fix is to
type a tab instead.

Non-email pretty formats give 4-space margin at the left, and it
indeed is annoying if you drew ascii art in the commit message
and later discover you mistakenly used tab when you meant
spaces.

Having said that, I do not have a strong feeling either way.  If
I have to choose, I would probably replace the TAB with two
spaces, if only to match merge.summary output:

        Merge branch 'blah'

        * blah:
          third commit on blah topic
          second commit on blah topic
          first commit on blah topic

        Conflicts:

          blah.c
          xyzzy.h

```
