Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Init repo list #24

Merged
merged 7 commits into from
Apr 9, 2019
Merged

Init repo list #24

merged 7 commits into from
Apr 9, 2019

Conversation

kittsville
Copy link
Contributor

Restricts git repos to a pre-defined selection, as per #12. Worth noting there's no tests for load_repos. Do we want to test this method and if so how?

This PR also:

  • Makes the git reference parameter optional (defaulting master)
  • Fixes a typo

Copy link
Contributor

@nathankleyn nathankleyn left a comment

Choose a reason for hiding this comment

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

Looking awesome! Just a couple of little things you can do to avoid some copying, and make some other copying you can't avoid a bit more obvious. 👍

Great work! 👏

handlers/src/lib.rs Outdated Show resolved Hide resolved
server/Cargo.toml Outdated Show resolved Hide resolved
server/src/main.rs Outdated Show resolved Hide resolved
server/src/main.rs Outdated Show resolved Hide resolved
server/src/main.rs Show resolved Hide resolved
reference,
})
.map(|x| {
x.0.map(Binary::from)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't mind if we fix in another PR — but would be inclined to use a struct here instead of a tuple, x.0 is kind of gross because it's hard to see from the code what it is that is being operated on.

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'm usually anti-tuple so happy to refactor now that you've called me out on it 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wait, got mixed up, was thinking of the tuple I used here. Though in this case it's necessary for building the map.

Repository::open(path).ok().and_then(|repo| Some((name, repo)))

Given the sprint ends tomorrow I'll pick this up in a future PR?

Copy link
Contributor

@nathankleyn nathankleyn left a comment

Choose a reason for hiding this comment

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

LGTM! 👏

Copy link
Contributor

@nathankleyn nathankleyn left a comment

Choose a reason for hiding this comment

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

Just noticed this failed some clippy lints:

https://travis-ci.org/intenthq/gitkv/jobs/517287394

@kittsville
Copy link
Contributor Author

Fixed

albertpastrana and others added 7 commits April 8, 2019 16:49
First it populates the list based on the repos found in the
repo_root directory specified as parameter.

Later, when calling the endpoint, the name of the repo is checked
against that repo list and it will only accept requests with a
valid repository as parameter.

This commit should fix the vulnerability mentioned in #12.

Still need to add some tests on the code and some other stuff
mentioned as TODOs.

Signed-off-by: Albert Pastrana <albert.pastrana@intenthq.com>
Makes `reference` parameter when requesting files optional, defaults to master
Replace mutable loop with functional code
Add handling for more failure cases
Silently discard repos that failed to load
Make error message more specific
Make dependency version more specific
Make cloning of data explicit
Copy link
Contributor

@nathankleyn nathankleyn left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@nathankleyn nathankleyn merged commit d247e15 into master Apr 9, 2019
@nathankleyn nathankleyn deleted the init-repo-list branch April 9, 2019 08:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants