What is this add-on for?

Submodule Changes for Bitbucket helps visualize modified lines of code in commits and pull requests for repositories with submodules.

While working with Git submodules, there's a common problem with showing changes that are made to the submodule in the Diff tab. It displays two commit hashes instead of actually modified files and LOC. It's especially inconvenient when it comes to reviewing pull requests.

Submodule Changes for Bitbucket app helps watch changes committed to a submodule in a standard Bitbucket Diff view as if they're committed to the super-repository. It also gives an ability to watch Blame leave comments for more convenient pull requests review. 

Submodule Changes for Bitbucket also gives an ability to watch Blame, leave comments on the entire pull request, a particular file, or on specific lines of code in a file for more convenient pull requests review. 

There are several exceptions when the app doesn't show changes committed to a submodule:

Submodule Changes for Bitbucket includes a merge check Submodules fast-forward merge to ensure that all submodules can be merged to the default branch in fast-forward mode. If we didn't merge the submodule before merging the super-repository, we'd be able to do it afterward in fast-forward mode, and the link to the submodule will remain unchanged.

Merge-check must first be enabled in the project or repository settings.

Merge check restrictions:

How to install and configure the app?

To install Submodule Changes for Bitbucket, log into your Bitbucket Server as Administrator and install Submodule Changes for Bitbucket directly from Atlassian Marketplace or by file upload. 

The app doesn't require any configuration. Once installed, the changes apply to the Diff tab for commits and pull requests with updates to a submodule. 

How to turn off the app for a certain submodule?

In some cases, the number of changes in a pull request with a submodule can exceed the page.max.changes limit. For instance, when a dependency on some large project is used as a submodule. That resulted in an incomplete displaying of changes in the pull request diff view.

To disable the Submodule Changes for Bitbucket app for a specific submodule in a repository, you need to add a special property in the .gitmodules file using the following Git command:

git config --file .gitmodules submodule.<name>.ignoreChanges true

In this command, <name> is the submodule name specified in the [submodule "<name>"] section of the .gitmodules file. The changes will be applied after you commit and push them. 

Ex.: if you have a submodule named "library", the .gitmodules file will be the following:

[submodule "library"]
path = library
url = https://bitbucket.company.com/scm/sm/library.git

In this case, your command that will turn off the app for this submodule will be:

git config --file .gitmodules submodule.library.ignoreChanges true

As a result, the .gitmodules file will change like this:

[submodule "library"]
path = library
url = https://bitbucket.company.com/scm/sm/library.git
ignoreChanges = true