Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git issue import can fetch issues from origin with no arguments #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FrazerClews
Copy link
Contributor

@FrazerClews FrazerClews commented Jul 22, 2020

#81

@FrazerClews FrazerClews changed the title WIP: git issue import can fetch issues from origin automatically WIP: git issue import can fetch issues from origin with no arguments Jul 22, 2020

get_provider()
{
provider=$(echo "$1" | grep -oP "(?<=@).*?(?=\.)")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function and the ones' below can simply be echo | grep (No need for assignment and second echo). Even better, use expr match or sed, rather than grep whose use for this purpose isn't common.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify:

get_provider()
{
  echo "$1" | grep -oP "(?<=@).*?(?=\.)"
}

or better

get_provider()
{
  expr match "$1" 'suitable RE here'
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Using expr match gives the warning https://github.com/koalaman/shellcheck/wiki/SC2003 . Will sed or another command like cut do?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. It seems that using : will not trigger the warning. Using sed is also fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some changes using sed and even got it working with https URLs. Do you prefer the sed styling on line 905, or line 910 and 915? Had trouble with getting the provider sed working with the extended regex styling

@dspinellis
Copy link
Owner

Thanks for the heads-up. I made a couple of improvement suggestions.

@FrazerClews FrazerClews force-pushed the frazer/importIssueSimplify branch 7 times, most recently from 5e96621 to ca7fb82 Compare August 3, 2020 23:24
@FrazerClews FrazerClews changed the title WIP: git issue import can fetch issues from origin with no arguments git issue import can fetch issues from origin with no arguments Aug 4, 2020
@FrazerClews FrazerClews changed the title git issue import can fetch issues from origin with no arguments WIP: git issue import can fetch issues from origin with no arguments Aug 17, 2020
@FrazerClews FrazerClews force-pushed the frazer/importIssueSimplify branch 2 times, most recently from bb14620 to 02a6cbf Compare August 18, 2020 01:38
@FrazerClews FrazerClews force-pushed the frazer/importIssueSimplify branch 3 times, most recently from bbc33f1 to 016fbb9 Compare August 28, 2020 15:09
@FrazerClews
Copy link
Contributor Author

Think this PR is ready for review and potential merge if you're happy with it? I looked into incorporating the testing, but since the test suite import stage imports from a separate repo, the new functionality will just import issues from this issue tracker and not work.

@FrazerClews FrazerClews changed the title WIP: git issue import can fetch issues from origin with no arguments git issue import can fetch issues from origin with no arguments Aug 28, 2020
Allow git issue import to work without arguments by fetching the information
from $(git remote get-url ${remote}).
But also allow just the remote to be defined if 1 arguement is present while
preserving the previous functionality, for repos that may have separate issue
trackers in forked repos.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants