Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

New options for readBlobsFromGitRepo #212

Merged
merged 3 commits into from
Jul 31, 2019
Merged

New options for readBlobsFromGitRepo #212

merged 3 commits into from
Jul 31, 2019

Conversation

tclem
Copy link
Member

@tclem tclem commented Jul 31, 2019

Allows specifying only the paths you want to parse when reading from a git repo. This is the inverse of the existing args --exclude and --exclude-stdin.

tclem added 2 commits July 30, 2019 17:34
Allows specifying only the paths you want to parse in the repo
<|> ExcludeFromHandle <$> flag' stdin (long "exclude-stdin" <> help "Exclude paths given to stdin"))
<|> ExcludeFromHandle <$> flag' stdin (long "exclude-stdin" <> help "Exclude paths given to stdin")
<|> OnlyPaths <$> many (option str (long "only" <> help "Only include the specified paths"))
<|> OnlyPathsFromHandle <$> flag' stdin (long "only-stdin" <> help "Include only the paths given to stdin"))
Copy link
Contributor

Choose a reason for hiding this comment

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

The symmetry centre of my brain suggests: perhaps IncludePaths and IncludeFromHandle or IncludePathsFromHandle to mirror the exclude ones? I’m not super fussed, tho.

Copy link
Member Author

Choose a reason for hiding this comment

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

I like that. I'm going to leave the command line switches because I think --only is a better description of the behavior, but I can rename the type constructors.

@@ -50,6 +50,7 @@ readBlobsFromGitRepo path oid excludePaths = liftIO . fmap catMaybes $
, lang `elem` codeNavLanguages
, not (pathIsMinified path)
, path `notElem` excludePaths
, null includePaths || path `elem` includePaths
Copy link
Contributor

Choose a reason for hiding this comment

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

I have some mild discomfort around “what does it mean if we have the same path in both excludePaths and includePaths, and will this be surprising?” but since the CLI doesn’t allow you to specify both I think that’s ok 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah yeah, if you call this function directly and pass the same path in both the excludes and includes list then excludes always win out. I think this might actually be fine/expected behavior.

@robrix robrix merged commit ff9e140 into master Jul 31, 2019
@robrix robrix deleted the from-paths branch July 31, 2019 18:40
@tclem tclem mentioned this pull request Aug 1, 2019
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.

2 participants