codestream icon indicating copy to clipboard operation
codestream copied to clipboard

CodeStream can't deal with git submodules

Open gabrielshanahan opened this issue 4 years ago • 0 comments

Description I have a git repo initialized, with a git submodule at ./a/b/myRepo. PhpStorm is set up so that the global repo is the project root, but all my work is done in ./a/b/myRepo (the global repo is needed for code completion etc.). When I attempt to add a CodeMark to ./a/b/myRepo/myCustomDir/myFile.php, I get an error. Upon inspection, the logs contain the following:

/usr/bin/git -c core.quotepath=false -c color.ui=false show <revision_id>:./a/b/myRepo/myCustomDir/myFile.php --
fatal: bad revision '<revision_id>:./a/b/myRepo/myCustomDir/myFile.php'

When I run that same command myself, I get Path ./a/b/myRepo/myCustomDir/myFile.php does not exist in <revision_id>, however if I run the same command with <revision_id>:./myCustomDir/myFile.php, it works.

What seems to be happening is that CodeStream is using the path relative to the project root, while it should be using the path relative to the submodule.

If this is the case, a possible solution could be along the following lines:

  • look for a match between the list of submodules (obtainable by git config --file .gitmodules --get-regexp path | awk '{ print $2 }') and the prefix of the file path
  • if a match is found, remove the prefix

System Info (please complete the following information):

  • Version of the CodeStream extension: 7.2.0+48
  • OS + version: macOS Catalina 10.15.3 (19D76)
  • IDE + version:
Build #PS-201.7223.96, built on April 30, 2020
Licensed to PhpStorm Evaluator
Expiration date: June 6, 2020
Runtime version: 11.0.6+8-b765.40 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.3
GC: ParNew, ConcurrentMarkSweep
Memory: 1981M
Cores: 8
Registry: run.processes.with.pty=TRUE, ide.balloon.shadow.size=0
Non-Bundled Plugins: Key Promoter X, com.chrisrm.idea.MaterialThemeUI, com.codestream.jetbrains-codestream, com.mallowigi, izhangzhihao.rainbow.brackets```

gabrielshanahan avatar May 07 '20 14:05 gabrielshanahan