git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Trying to use xfuncname without success.

From
JZJack Adrian Zappa <adrianh.bsc@gmail.com>
Date
Feb 7, 2017, 19:21 UTC
Message-ID
<CAKepmajNz7TP_Z6p_Wj17tOpiMOpKkvQOBvVthBkEiKabAppjg@mail.gmail.com>

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. :(
Next: René Scharfe
Message 1 of 14 in “Trying to use xfuncname without success.”
  1. Jack Adrian ZappaFeb 7, 2017
  2. René ScharfeFeb 7, 2017
  3. Jack Adrian ZappaFeb 8, 2017
  4. René ScharfeFeb 8, 2017
  5. Samuel LijinFeb 8, 2017
  6. Jack Adrian ZappaFeb 8, 2017
  7. Samuel LijinFeb 8, 2017
  8. Jack Adrian ZappaFeb 8, 2017
  9. Jack Adrian ZappaFeb 8, 2017
  10. Jack Adrian ZappaFeb 8, 2017
  11. Jack Adrian ZappaFeb 9, 2017
  12. Jack Adrian ZappaFeb 9, 2017
  13. Jack Adrian ZappaFeb 9, 2017
  14. René ScharfeFeb 10, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.