geometry-zsh / geometry

geometry is a minimal, fully customizable and composable zsh prompt theme
ISC License
921 stars 94 forks source link

Fix git conflict counting with multiple files #294

Closed gluxon closed 3 years ago

gluxon commented 4 years ago

When the $conflicts shell variable contains newlines, the $_grep command attempts to read the entire output as a single file. This results in "No such file or directory" errors.

The fix here uses xargs to pass each file name individually.

I was seeing this on macoS 10.15.4 with zsh 5.8 (x86_64-apple-darwin19.3.0).

Screen Shot 2020-04-19 at 3 50 16 PM
gluxon commented 3 years ago

@alxbl Thanks for the review. @jedahan Any chance this can get a look? Thanks!

jedahan commented 3 years ago

This looks good, though I wonder if we can use zsh's env substitution to achieve the same thing. Something like

conflict_list=$($_grep -cH '^=======$' ${conflicts/\n/\0/})

gluxon commented 3 years ago

I think that should work as well and is indeed much simpler. Let me make sure later tonight and update this PR if there's no issues. Thanks!

gluxon commented 3 years ago

Looks like we're going with #299, which has a more intuitive solution. 🙂 Closing this PR for now.