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

Specify a subpath to build the changelog #11

Closed
pgmillon opened this issue Sep 7, 2021 · 6 comments
Closed

Specify a subpath to build the changelog #11

pgmillon opened this issue Sep 7, 2021 · 6 comments
Assignees
Labels
feature/request New feature or request

Comments

@pgmillon
Copy link

pgmillon commented Sep 7, 2021

Hi,
In the context of a mono-repo, is it possible to specify the repository subpath to build the changelog from ?

Something like git cliff -- subpath/

Thanks.

@pgmillon pgmillon added the feature/request New feature or request label Sep 7, 2021
@orhun
Copy link
Owner

orhun commented Sep 7, 2021

Hello,

You can do git cliff --repository subpath/ and it will use the git repository in subpath/.

If that's not what you mean, please elaborate.

@pgmillon
Copy link
Author

pgmillon commented Sep 8, 2021

Hi,
Thanks for the quick answer.
So, I have multiple projects in a mono-repo and I'd like to get the changelog of only one of these projects:

git-repo-root
├── project1
│  └── CHANGELOG.md
└── project2
    └── CHANGELOG.md

For now, I usually do conventional-changelog --commit-path=project1 -t releases/project1/v -o project1/CHANGELOG.md
I think something similar in git-cliff is required to be useful in monorepos :)

Regards,

@orhun
Copy link
Owner

orhun commented Sep 8, 2021

So, I have multiple projects in a mono-repo and I'd like to get the changelog of only one of these projects:

git-repo-root
├── project1
│  └── CHANGELOG.md
└── project2
    └── CHANGELOG.md

I see. Have you tried --repository option? (e.g. git cliff --repository project1)

@pgmillon
Copy link
Author

pgmillon commented Sep 8, 2021

Yes, but I have an error:

$ git cliff --repository project1
 ERROR git_cliff > Git error: `could not find repository from 'project1'; class=Repository (6); code=NotFound (-3)`

@orhun
Copy link
Owner

orhun commented Sep 8, 2021

I think I finally get it 😃

0bb7c91 -> adds --commit-path <PATH> argument for generating a changelog scoped to a specific directory

e.g.

git cliff --commit-path git-cliff-core/ -o git-cliff-core/CHANGELOG.md

This argument will be available with the next release. In the meantime feel free to test it out and report bugs if any 🐻

@orhun
Copy link
Owner

orhun commented Sep 11, 2021

v0.3.0 is released.

@orhun orhun closed this as completed Sep 11, 2021
kondanta added a commit to kondanta/git-cliff that referenced this issue Sep 19, 2021
Previously, cliff was sorting the commits by oldest first.
Like:

```
 - Support parsing the missing scopes with `default_scope` (orhun#8)
 - Support generating a changelog scoped to a directory (orhun#11)
```

As the PR numbers indicate, the first bullet point is definitely
older than the latter.

With this update, it will look like this:
```
 - Support generating a changelog scoped to a directory (orhun#11)
 - Support parsing the missing scopes with `default_scope` (orhun#8)
```

Signed-off-by: Taylan Dogan <[email protected]>
orhun added a commit that referenced this issue Sep 28, 2021
* refactor(changelog): sort commits by newest in CHANGELOG

Previously, cliff was sorting the commits by oldest first.
Like:

```
 - Support parsing the missing scopes with `default_scope` (#8)
 - Support generating a changelog scoped to a directory (#11)
```

As the PR numbers indicate, the first bullet point is definitely
older than the latter.

With this update, it will look like this:
```
 - Support generating a changelog scoped to a directory (#11)
 - Support parsing the missing scopes with `default_scope` (#8)
```

Signed-off-by: Taylan Dogan <[email protected]>

* refactor: add sorting flag

I don't expect any other sorting types will be added
so the logic consist of checking whether it is
`newest` or not.

One could argue with why wouldn't I make this a boolean.
My answer would be, in my opinion, it lose its meaning
because this is not something we want to enable or disable
but something that we want to decide which pattern
we want to use. So it is more like a semantic choice.

Signed-off-by: Taylan Dogan <[email protected]>

* docs(readme): move the explanation of sort flag to README.md

Co-authored-by: orhun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants