git-changelog-lib icon indicating copy to clipboard operation
git-changelog-lib copied to clipboard

Submodule support

Open nemui opened this issue 4 years ago • 8 comments

Hello, this is for #52

I'm not too sure how to correctly support submodules, to be honest, but this seems to be working for my use case: pushing tags on each build for the parent repository and its submodules, in other words, we rely on tags being the same across the repository.

What do you think?

I have also added a simple check for when toRef and fromRef are the same, #62 - in this case we return an empty list of tags.

nemui avatar Mar 03 '20 15:03 nemui

I'll put this on my todo-list.

tomasbjerre avatar Mar 03 '20 17:03 tomasbjerre

I have a better idea on how to handle submodules. Instead of relying on specified refs to exist in all submodules, how about simply returning the diff between the current and the previous submodule hashes?

E.g. in the parent repo, we have commits A, B, C And in a submodule we have commits D, E and F A -> D B -> D C -> F

When diffing between A and C, we will also show the diff between D and F for commit C

nemui avatar Mar 04 '20 11:03 nemui

Sounds good!

tomasbjerre avatar Mar 04 '20 11:03 tomasbjerre

Great, I'll update the pull request once I have it working.

nemui avatar Mar 04 '20 13:03 nemui

How does this look? I've opted out of having submodule changes per commit, as it makes the changelog too noisy, especially when mulitiple commits reference the same changes in submodules, e.g. via branch merges.

Instead, I diff submodules between the earliest and the latest commit mentioned in the parent repository for any given diffset.

nemui avatar Apr 10 '20 10:04 nemui

This is on my todo-list. Will have a look later.

tomasbjerre avatar Apr 13 '20 05:04 tomasbjerre

This might work, but I have very limited time right now so need to be more complete. Needs test cases. The stuff that is added to GitRepo can probably be refactored out of there with a describing name for it.

tomasbjerre avatar Apr 16 '20 15:04 tomasbjerre

Hi @tomasbjerre , I have added a couple of test cases.

The stuff that is added to GitRepo can probably be refactored out of there with a describing name for it.

Something like GitRepoWithSubmodules class that inherits from GitRepo? Or is there an easier way to get access to repository and revWalk class members from GitRepo, as submodule functionality makes use of those?

nemui avatar Sep 10 '20 14:09 nemui