summaryrefslogtreecommitdiff
path: root/t/t3205-branch-color.sh
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <johannes.schindelin@gmx.de>2019-09-06 21:09:35 +0200
committerLibravatar Johannes Schindelin <johannes.schindelin@gmx.de>2019-12-05 15:36:51 +0100
commit3a85dc7d534fc2d410ddc0c771c963b20d1b4857 (patch)
tree11481a90ba78f64d09320514b0232c4ac2980885 /t/t3205-branch-color.sh
parentpath: also guard `.gitmodules` against NTFS Alternate Data Streams (diff)
downloadtgif-3a85dc7d534fc2d410ddc0c771c963b20d1b4857.tar.xz
is_ntfs_dotgit(): speed it up
Previously, this function was written without focusing on speed, intending to make reviewing the code as easy as possible, to avoid any bugs in this critical code. Turns out: we can do much better on both accounts. With this patch, we make it as fast as this developer can make it go: - We avoid the call to `is_dir_sep()` and make all the character comparisons explicit. - We avoid the cost of calling `strncasecmp()` and unroll the test for `.git` and `git~1`, not even using `tolower()` because it is faster to compare against two constant values. - We look for `.git` and `.git~1` first thing, and return early if not found. - We also avoid calling a separate function for detecting chains of spaces and periods. Each of these improvements has a noticeable impact on the speed of `is_ntfs_dotgit()`. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Diffstat (limited to 't/t3205-branch-color.sh')
0 files changed, 0 insertions, 0 deletions