Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Add support for locations starting with https://github.com/ #47

Merged
merged 4 commits into from
Apr 26, 2023

Conversation

mikelik
Copy link
Member

@mikelik mikelik commented Apr 24, 2023

Additionally get rid of gh error if not installed.
Fix an update of the existing dependency: previously update was ignored (because executing emplace on unordered_map is ignored if key already exists).
When it comes to supporting https://github.com: now dependencies are still stored as shorthands (i.e. org/project), so I'm normalizing the location before validating / adding location to the dependency.

@mikelik mikelik self-assigned this Apr 24, 2023
@mikelik mikelik linked an issue Apr 24, 2023 that may be closed by this pull request
src/location.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@ScottBailey ScottBailey left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me. I added a couple things to look at.

@@ -86,6 +86,7 @@ namespace antler::system {
for (const auto& arg : args) {
cmd += " " + arg;
}
cmd += " 2>&1";
Copy link
Contributor

Choose a reason for hiding this comment

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

what does it affect? if there will be error you return nullopt and if not you'll unlikely to have error output at all. And even if you do, parsing of output will likely break.

Copy link
Member Author

Choose a reason for hiding this comment

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

It resolves issue: sh: 1: gh: not found in the original issue.

I believe Bucky's intention was to run command line gh --version quietly (the function name is execute_quiet).
While stdout was silenced, the stderr was still printing error (which was ignored anyway).

Copy link
Contributor

Choose a reason for hiding this comment

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

got you. in that case cmd += "2> /dev/null" sounds to me like more self-descriptive

Copy link
Member Author

Choose a reason for hiding this comment

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

In current usages of execute_quiet both 2>&1 and 2> /dev/null are fine.
If someone would like to read the stderr if the return code is 0 (there are such cases) with the existing solution he will have such chance. In yours we are losing stderr output. So I will leave the current solution.

Copy link
Contributor

@dimas1185 dimas1185 Apr 25, 2023

Choose a reason for hiding this comment

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

I doubt that could be a case. if we will have non-critical error output on zero return code that may corrupt parsing of a valid data. Ideally that should be similar to subprocess.run in python. i.e. stdout and stderr piping is customizable. but I would leave it to next issue if that will be really needed. If you believe your case is more likely to happen than mine, just leave comment like pipe error output from console to stdout so caller can parse error string and I'll approve

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, done

src/location.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@dimas1185 dimas1185 left a comment

Choose a reason for hiding this comment

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

see my comments

@mikelik mikelik merged commit 286ab12 into main Apr 26, 2023
@mikelik mikelik deleted the mikelik/github_url branch April 26, 2023 08:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Incorrect processing of adding of dependency.
4 participants