: I have the following Swift function in my file Main/VProj/AppModel.swift ...">

What is the "regex function name" for git log -L: <funcname>: <file>

I have the following Swift function in my file Main/VProj/AppModel.swift

    func createItemAndSegment(image:UIImage, completionHandler:(Item?, NSError?)->Void) {
        \\[...]
    }

Documentation for git log -L :<funcname>:<file>approves

-L <start>, <end>: <file>

-L: <funcname>: <file>

Trace the evolution of the line range specified by "<start>, <end>" (or the name of the regex function <funcname>) in the <file> file.

But the teams

  • git log -L :createItemAndSegment:Main/VProj/AppModel.swift
  • git log -L :'createItemAndSegment':Main/VProj/AppModel.swift
  • git log -L :'/createItemAndSegment/':Main/VProj/AppModel.swift

everything crashes with an error starting at line 1: no match

When the documentation states what :<funcname>the "regular function name name" is, what does it look like?

+4
source share
2 answers

funcname , , , git log -L :createItemAndSegment:Main/VProj/AppModel.swift .

, , Git , . , , , , ( ), , -L :<funcname>:<file> , , .

. , , , , . . .gitattributes " hunk" , . -, .gitattributes , - :

*.swift diff=swift

.git/config ~/.gitconfig , . , , , - ( regex Python):

[diff "swift"]
    xfuncname = ^[ \t]*((class|func)[ \t].*)$
+6

, , JS git log -L. <start><end>:<file>. , <end> -, .

:

git log -L '/myFunction (params) {/','/^ }/':myClass.js

, :

git log -L '/int main/',/^}/:main.c

, :

$ git log -L '/myFunction (params) {/',/^  }/:myClass.js

fatal: Invalid object name '}/'.

() <end>: /^ }/ = > '/^ }/'.

, .

0

Source: https://habr.com/ru/post/1620600/


All Articles