Skip to content

Conversation

NathanBaulch
Copy link
Contributor

Refactor various string operations for efficiency and readability.

  • Use StringReader.ReadLine instead of manually searching for \n in a loop
  • Don't specify StringComparison.Ordinal when working with char (ordinal is the default)
  • Use string.Split(sep, 2) instead of IndexOf + Substring + Substring
  • Use AsSpan over Substring where possible

@love-linger love-linger self-assigned this Jul 7, 2025
@love-linger love-linger added the enhancement New feature or request label Jul 7, 2025
@love-linger love-linger merged commit 5c9d96f into sourcegit-scm:develop Jul 7, 2025
13 checks passed
love-linger added a commit that referenced this pull request Jul 7, 2025
- Fix the issue that `StringReader` traits all outputs of `git ls-tree -z` command as a single-line
- Remove unused namespace using

Signed-off-by: leo <longshuang@msn.cn>
@NathanBaulch NathanBaulch deleted the strings branch July 7, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants