Trying to use xfuncname without success.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to specify a hunk header using xfuncname, and it just
doesn't want to work.

The full question is on SO here:

http://stackoverflow.com/questions/42078376/why-isnt-my-xfuncname-working-in-my-gitconfig-file

But the basic gist is that no matter what regex I specify, git will
not recognise the hunk header.  Am I doing something wrong or is this
a bug?

For those who don't want to jump to the SO site, I've copied the text below:

-----8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<---

I'm trying to setup a hunk header for .natvis files. For some reason,
it doesn't seem to be working. I'm following their instructions from
here, which doesn't say much in terms of restrictions of the regex,
such as, is the matched item considered the hunk header or do I need a
group? I have tried both with no success. This is what I have:

[diff "natvis"]
    xfuncname = "^[\\\t ]*<Type[\\\t ]+Name=\"([^\"])\".*$"

I've also added to my .gitattributes file (even though I'm not
positive that it is necessary):

*.natvis diff=natvis

I've tried \t instead of \\\t as well as replacing the entire regex
with just <Type.* with no luck. I'm using git version 2.7.0.windows.1
on Windows 8.1. EDIT: I upgraded to git version 2.11.1.windows.1 on
Windows 8.1 and even tried git version 2.8.3 on cygwin64 on Windows
8.1 with the same results.

As a test file, I have the following test.natvis file:

<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer
xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010";>

  <Type Name="test">
    <Expand>
      <Item Name="var">var</Item>













      <!-- Non-blank line -->
      <Item Name="added var">added_var</Item>


      <Item Name="var2">var2</Item>
    </Expand>
  </Type>
</AutoVisualizer>

with the <Item Name="added var">added_var</Item> being the new line added.

I'm really not sure why this is so difficult.

EDIT:

Here is a sample output of what I am getting:

$ git diff --word-diff
diff --git a/test.natvis b/test.natvis
index 73c06bc..bc0f549 100644
--- a/test.natvis
+++ b/test.natvis
@@ -18,6 +18,7 @@


      <!-- Non-blank line -->
      {+<Item Name="added var">added_var</Item>+}


      <Item Name="var2">var2</Item>
warning: LF will be replaced by CRLF in test.natvis.
The file will have its original line endings in your working directory.

Even using xfuncname = "^.*$" I would have expected that <!--
Non-blank line --> would have shown up as my hunk header, but I get
nothing. :(

EDIT:

I've tried the solution proposed by torek, but to no avail. It's like
it doesn't know what to do with the xfuncname entry. :(



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]