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

Support per-repo config properly #256

Merged
merged 1 commit into from
Apr 6, 2024
Merged

Conversation

draftcode
Copy link
Contributor

Previously, it finds a config in some config dirs or in
.git/config.$EXT. This changes the config loading code to do the
followings:

  • Change the repository config path from $GIT_DIR/config.yaml to
    $GIT_COMMON_DIR/av/config.yaml. $GIT_COMMON_DIR is always (e.g.
    .git dir). $GIT_DIR can point to something else under certain
    situations.

  • Loads both global configs (~/.config/av/config.yaml) and repository
    config (.git/av/config.yaml). The repository config overrides the
    global config.

Copy link
Contributor

aviator-app bot commented Apr 6, 2024

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR was merged using Aviator.


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

Copy link
Contributor

aviator-app bot commented Apr 6, 2024

FlexReview Summary

Based on the code complexity and the author's expertise score, these are the suggested reviewers:

  • @jainankit (current review load: 4)

See the list of alternate reviewers in the detailed breakdown below.

Detailed Breakdown Author’s expertise score for the modified files:
  • cmd/av/main.go (1.00)
  • internal/config/config.go (1.00)
Files Reviewers
cmd/av/main.go †,
internal/config/config.go
@jainankit (score: 0.84, current review load: 4),
@doratzeng (score: 0.13, current review load: 3)

† Indicates that the file doesn't need an expert review. (?)

See full breakdown of the reviewers on the Aviator webapp.

@aviator-app aviator-app bot requested a review from jainankit April 6, 2024 20:04
// viper.SupportedExts.
//
// Note that Viper will find only one file in these directories, so if there are multiple,
// only one is read.
Copy link
Contributor

Choose a reason for hiding this comment

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

can you describe in comments which order does it detect config files in?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

logrus.WithError(err).Warning("failed to determine $GIT_COMMON_DIR")
} else {
logrus.WithField("git_common_dir", gitCommonDir).Debug("loaded Git repo")
repoConfigDir = filepath.Join(gitCommonDir, "av")
Copy link
Contributor

Choose a reason for hiding this comment

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

oh so we were not joining av before anywhere for repo level config?

I understand that this is a breaking change, but i guess no one would be setting .git/config.yaml for av CLI. This is what we have in our public docs:
https://docs.aviator.co/aviator-cli/configuration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. So, I guess nobody could use per-repo config, unless they read the code.

Previously, it finds a config in some config dirs or in
`.git/config.$EXT`. This changes the config loading code to do the
followings:

* Change the repository config path from `$GIT_DIR/config.yaml` to
  `$GIT_COMMON_DIR/av/config.yaml`. `$GIT_COMMON_DIR` is always (e.g.
  `.git` dir). `$GIT_DIR` can point to something else under certain
  situations.

* Loads both global configs (`~/.config/av/config.yaml`) and repository
  config (`.git/av/config.yaml`). The repository config overrides the
  global config.
@draftcode draftcode force-pushed the support_recursive_config branch from 242bdc2 to 2319d18 Compare April 6, 2024 20:51
@aviator-app aviator-app bot merged commit e772868 into master Apr 6, 2024
4 checks passed
@aviator-app aviator-app bot deleted the support_recursive_config branch April 6, 2024 20:58
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.

2 participants