Comments (12)
Is it relative to 47e9402?
CC @hyperupcall
It is weird as find . -mindepth 1 -maxdepth 1 -iregex '.*\(authors\|contributors\).*'
is expected to just look up the file in the current directory.
BTW, find . -mindepth 1 -maxdepth 1 -iregex '.*\(authors\|contributors\).*'
seems broken in Mac. It doesn't show up the AUTHORS
file:
~/git/git-extras(master ✗)14:47 find . -mindepth 1 -maxdepth 1 -iregex '.*\(authors\|contributors\).*' | head -n1
~/git/git-extras(master ✗)14:47 ls | grep -E 'authors|contributors' -i
AUTHORS
from git-extras.
@spacewander Yes, it does look up the file in the current directory, because that was the behavior previously before I changed it. Maybe it's worth changing it to look up the file relative to the Git worktree root.
I tested the command on Linux and it works, so maybe there is a difference
From find(1)
:
The regular expressions understood by find are by default Emacs Regular Expressions (except that `.' matches new‐line), but this can be changed with the -regextype option.
> find -regextype help
find: Unknown regular expression type ‘help’; valid types are ‘findutils-default’, ‘ed’, ‘emacs’, ‘gnu-awk’, ‘grep’, ‘posix-awk’, ‘awk’, ‘posix-basic’, ‘posix-egrep’, ‘egrep’, ‘posix-extended’, ‘posix-minimal-basic’, ‘sed’.
For example, it could be that the functionality for Emacs Regular Expressions is dynamically loaded, and the library is installed in most Linux distros, but not macOS, so on macOS maybe uses Extended Regular Expressions by default (which doesn't require escaping the end or close capture group syntax).
from git-extras.
Now that I think about it, I remember previously running into errors on macOS where Bash regular expressions behaved differently than compared to Linux. I don't know exactly which libraries or versions is used to interpret the regular expression (BRE, ERE).
from git-extras.
I wonder if changing the line to changelog="$(find . -mindepth 1 -maxdepth 1 -regextype posix-extended -iregex '.*(change|history).*' | head -n1)"
fixes things.
I didn't set -regextype
originally because I didn't want to set the regextype to one that isn't supported on platforms other than Linux.
from git-extras.
alright, it looks a history here and I think there is no more bad effect for the user work with git-extras
cause the git-authors
may a cold command for some repos and our ci runs on ubuntu only. Thanks your research and I will do a little bit digging. Thanks guys!
from git-extras.
I wonder if changing the line to
changelog="$(find . -mindepth 1 -maxdepth 1 -regextype posix-extended -iregex '.*(change|history).*' | head -n1)"
fixes things.I didn't set
-regextype
originally because I didn't want to set the regextype to one that isn't supported on platforms other than Linux.
It doesn't work with the BSD find, which is the find
in Mac:
~/git/git-extras(master ✗)16:56 find . -mindepth 1 -maxdepth 1 -regextype posix-extended -iregex '.*(change|history).*' | head -n1
find: -regextype: unknown primary or operator
from git-extras.
@hyperupcall
I tested the find . -iregex
today on Mac. It seems the regex engine in BSD find doesn't recognize the |
in the expression. Do you have any suggestions?
from git-extras.
There might be two alternatives:
BSD man page seems to indivate that -E
is supported to interpret regexes as ERE:
changelog="$(find -E . -mindepth 1 -maxdepth 1 -iregex '.*(change|history).*' | head -n1)"
I'm actually thinking... it would be better not to use regular expressions. The -o expression is specified by POSIX even:
find . -mindepth 1 -maxdepth 1 \( -iname '*change*' -o -iname '*history*' \)
from git-extras.
I have made #1094, which should fix this
from git-extras.
File
git-authors
has a weird behavior that invoke the command directly withoutAUTHORS
or target file and the result will be insert into thegit-authors
file, then open it via the default editor. Take a look here. I don't think it a good case to use the command.Testcases
- update the existed
AUTHORS
file with invoking directly.- insert the authors information in the target file when invoking it with a parameter.
- list all authors
- list all authors without the email
I recommand to transform the case 1 and 2 to below:
- move
git-authors
togit-authors --output authors.txt
to update theAUTHORS
file.
because the empty argument means update a file or output something to a file but the arguments else did not work with it. It does not make sense.
from git-extras.
File
git-authors
git-authors
has a weird behavior that invoke the command directly withoutAUTHORS
or target file and the result will be insert into thegit-authors
file, then open it via the default editor. Take a look here. I don't think it a good case to use the command.Testcases
- update the existed
AUTHORS
file with invoking directly.- insert the authors information in the target file when invoking it with a parameter.
- list all authors
- list all authors without the email
I recommand to transform the case 1 and 2 to below:
- move
git-authors
togit-authors --output authors.txt
to update theAUTHORS
file.because the empty argument means update a file or output something to a file but the arguments else did not work with it. It does not make sense.
Agree to provide an argument to specify the output manually is better. Also, we need to keep the compatibility with the old behavior.
from git-extras.
Agree to provide an argument to specify the output manually is better. Also, we need to keep the compatibility with the old behavior.
copy that. Finally, i can generate the usecases lol.
from git-extras.
Related Issues (20)
- Unable to update on Windows HOT 9
- Create destination folder during `git cp` if it doesn't exist HOT 1
- Allow override temp file location in `git cp` HOT 1
- `find` regex `-iregex '.*\(authors\|contributors\).*'` fails on BSDs
- Time to release 7.1.0 HOT 1
- Refactor(git-authors): support the option `--output` and controlled `--no-email` HOT 1
- Autocompletion after `brew install git-extras` HOT 7
- Discuss: add the python project attribute to git extras repository HOT 6
- git standup recursive search fails if -L missing HOT 1
- It's possible to set up autocompletion after brew install git-extras semi-automatically.
- New git-utimes is broken on Mac HOT 1
- Test(git-browse): unit tests
- Update account security
- Test(git-browse-ci): add unit tests
- Test(git-brv): add unit test
- `git delete-merged-branches` can delete default branch such as `master` HOT 10
- Add a flag to "git delete-squashed-branches" to not abort on first error HOT 3
- Time to release 7.2.0 HOT 3
- [question/feature request] verbose repo summary
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git-extras.