Skip to content

Commit 292e53f

Browse files
committed
Merge branch 've/userdiff-bash'
The userdiff pattern learned to identify the function definition in POSIX shells and bash. * ve/userdiff-bash: userdiff: support Bash
2 parents 305fcf4 + 2ff6c34 commit 292e53f

18 files changed

+91
-0
lines changed

Documentation/gitattributes.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,9 @@ patterns are available:
802802

803803
- `ada` suitable for source code in the Ada language.
804804

805+
- `bash` suitable for source code in the Bourne-Again SHell language.
806+
Covers a superset of POSIX shell function definitions.
807+
805808
- `bibtex` suitable for files with BibTeX coded references.
806809

807810
- `cpp` suitable for source code in the C and C++ languages.

t/t4018-diff-funcname.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ test_expect_success 'setup' '
2727

2828
diffpatterns="
2929
ada
30+
bash
3031
bibtex
3132
cpp
3233
csharp

t/t4018/bash-arithmetic-function

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
RIGHT() ((
2+
3+
ChangeMe = "$x" + "$y"
4+
))

t/t4018/bash-bashism-style-compact

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function RIGHT {
2+
function InvalidSyntax{
3+
:
4+
echo 'ChangeMe'
5+
}
6+
}

t/t4018/bash-bashism-style-function

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function RIGHT {
2+
:
3+
echo 'ChangeMe'
4+
}

t/t4018/bash-bashism-style-whitespace

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function RIGHT ( ) {
2+
3+
ChangeMe
4+
}

t/t4018/bash-conditional-function

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
RIGHT() [[ \
2+
3+
"$a" > "$ChangeMe"
4+
]]

t/t4018/bash-missing-parentheses

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function RIGHT {
2+
functionInvalidSyntax {
3+
:
4+
echo 'ChangeMe'
5+
}
6+
}

t/t4018/bash-mixed-style-compact

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function RIGHT(){
2+
:
3+
echo 'ChangeMe'
4+
}

t/t4018/bash-mixed-style-function

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function RIGHT() {
2+
3+
ChangeMe
4+
}

0 commit comments

Comments
 (0)