NicoHood / GPGit

A shell script that automates the process of signing Git sources via GPG
MIT License
89 stars 10 forks source link

Project name detection incorrect in the case of origin without a .git #15

Closed wolph closed 6 years ago

wolph commented 6 years ago

The project currently uses this command to get the project name:

PROJECT="${PROJECT:-"$(git config --local remote.origin.url | sed -n 's#.*/\([^.]*\)\.git#\1#p')"}"

But that doesn't return anything when a origin doesn't have the trailing .git (for this repo, the url https://github.com/NicoHood/gpgit is valid too)

Perhaps this should be added as well:

PROJECT="${PROJECT:-"git config --local remote.origin.url | sed -n 's#.*/##p'"}"
NicoHood commented 6 years ago

Do you know how to combine those, so they work with and without git?

echo "https://github.com/NicoHood/gpgit.git" | sed -n 's#.*/##p'
gpgit.git
wolph commented 6 years ago

Adding the line I suggested takes care of it. I could combine the regexes but that wouldn't help with readability

NicoHood commented 6 years ago

https://github.com/NicoHood/gpgit/commit/121df8a1f45ab37dcf7b785f669885788eedc8b0