microsoft/rushstack

rush: "unable to hash" when using git submodules

Closed this issue · 4 comments

I've a few npm packages currently in one git repository per npm package. For testing I created a new git repository and added the existing projects using git submodules.
When I run "rush rebuild" I get the following error:

> Starting task [@40three/ng-data]
fatal: Unable to hash ng-base

Where "ng-base" is the folder of a project added as git submodule.
Running "rush rebuild --verbose" reports:

Unable to calculate incremental build state. Instead running full rebuild. Error: Command failed: git hash-object .gitignore README.md common/config/rush/npm-shrinkwrap.json ng-base ng-data rush.json

(Submodules: ng-base and ng-data folder.)

I guess it's getPackageDeps.ts where it seems that all modified files as returned by git should be hashed but git status returns these two directories too because they're submodules.

This definitely looks like an issue with package-deps-hash. It does appear that Git is returning a different format than we expect when using submodules. For this fix, we probably need to make the parsing of git ls-tree powerful enough to not throw an exception.

Git return the commit number that we are currently on for a submodule, which will work OK with incremental, although you will lose out in some cases (when you have 2 different commit hashes that actually have the same files). The git status -s -u . command should also still work so I don't think we will need to make substantial changes for this bug. Most likely just change this code into a Regex.

@cluetjen - this should be supported now. Closing the issue. Feel free to re-open if you continue to encounter problems. Thanks!

It's happening again

fatal: Unable to hash <somesubmodule>
Error calculating the state of the repo. (inner error: Error: Command failed: git hash-object <somesubmodule>
fatal: Unable to hash azure-js-dev-tools
). Continuing without diffing files.

But seems like it's another issue about submodule?

Could you open a new GitHub issue and provide repro steps?