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

The global configuration file has the highest priority #51

Closed
hituzi-no-sippo opened this issue Jan 26, 2022 · 2 comments
Closed

The global configuration file has the highest priority #51

hituzi-no-sippo opened this issue Jan 26, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@hituzi-no-sippo
Copy link

Thank you for creating a great tool.
I'm sorry if the behavior this is a specification.

Describe the bug

The global configuration file has the highest priority.
Is this the expected behavior?
Load the global configuration file even if cliff.toml is in the current directory.

To Reproduce

  1. Create git repository.
  2. Create git-cliff three configuration files.
    • local (cliff.toml)
    • global (~/.config/git-cliff/cliff.toml)
    • The file specified by --config (config.toml)
  3. run git cliff
    Load global configuration file.
  4. run git cliff --config config.toml
    Load global configuration file.

Expected behavior

This is an environment with a global configuration file.

  • git cliff
    • cliff.toml exists in the current directory:: Load cliff.toml in the current directory.
    • cliff.toml does not exists in the current directory:: Load global configuration.
  • git cliff --config <PATH>
    • <PATH> exists:: Load <PATH>.
    • <PATH> does not exist:: Load embedded default configuration file into the binary.

Screenshots/Logs

Check the file exists & Check diff

$ ls
cliff.toml  config.toml
$ diff cliff.toml config.toml
6c6
< # local config
---
> # config option
27c27
< <!-- local config -->
---
> <!-- config option -->
$ diff cliff.toml ~/.config/git-cliff/cliff.toml
6c6
< # local config
---
> # global config
27c27
< <!-- local config -->
---
> <!-- global config -->

A global configuration file exists

$ git cliff
# global config
## [unreleased]

### Miscellaneous Tasks

- Add git-cliff toml

<!-- global config -->

$ git cliff --config config.toml
# global config
## [unreleased]

### Miscellaneous Tasks

- Add git-cliff toml

<!-- global config -->

A global configuration file does not exist

$ rm ~/.config/git-cliff/cliff.toml
$ git cliff
# local config
## [unreleased]

### Miscellaneous Tasks

- Add git-cliff toml

<!-- local config -->

$ git cliff --config config.toml
# config option
## [unreleased]

### Miscellaneous Tasks

- Add git-cliff toml

<!-- config option -->

System (please complete the following information):

Additional context

Current Behavior

This is an environment with a global configuration file.

  • git cliff
    • cliff.toml exists in the current directory:: Load global configuration file.
    • cliff.toml does not exists in the current directory:: Load global configuration file.
  • git cliff --config <PATH>
    • <PATH> exists:: Load global configuration file.
    • <PATH> does not exist:: Load global configuration file.

References

Thank you.

@orhun
Copy link
Owner

orhun commented Feb 3, 2022

Hey, good catch! ⚾

This should be fixed in 2595952, can you try it out?

@hituzi-no-sippo
Copy link
Author

Good job 👍

I've checked, it worked as expected.
Thank you 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants