Skip to content

diff.submodule config breaks submodule test cases when set to log  #204

@jawshooah

Description

@jawshooah

The test cases in spec/overcommit/hook_context/pre_commit_spec.rb for staged submodule changes break when the diff.submodule config setting is set to log rather than the default short. This is because those test cases rely on git diff --cached reporting submodule changes in the short format:

$ git config diff.submodule short
$ git diff --cached
diff --git a/subrepo b/subrepo
index a4955cd..6d692c2 160000
--- a/subrepo
+++ b/subrepo
@@ -1 +1 @@
-Subproject commit a4955cdcd4b6c5bc70a667384feb35340a244929
+Subproject commit 6d692c2e228b0f33104409610353f3e6d3f1a5d2

rather than the log format:

$ git config diff.submodule log
$ git diff --cached
Submodule subrepo a4955cd..6d692c2:
  > Another commit
  > Submodule commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions