This involves adding submodule support to what-the-diff
Hm, what did we mean by this, exactly? Currently this gets parsed as a regular text file and shows in the unstaged changes correctly:
~/src/node-cmark on master! $ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: README.md
modified: cmark (new commits)
modified: package.json
no changes added to commit (use "git add" and/or "git commit -a")
~/src/node-cmark on master! $ git diff -- cmark
diff --git a/cmark b/cmark
index bb8ada5..4e9fad6 160000
--- a/cmark
+++ b/cmark
@@ -1 +1 @@
-Subproject commit bb8ada50e5ca66aa5356d692c7bafa444f8460a5
+Subproject commit 4e9fad6a7183c7a1fe1fd631f2e36547631fafbc
👇

Maybe we should support showing changes down in a submodule eventually? But for now I think the above is fine to staff ship with, unless there's some edge case I'm missing.
From the linked issue in what-the-diff, it looks like it used to throw a stacktrace in the parser.
Also, does it break if git config --global diff.submodule log is set?
When my project folder is a submodule, I can view the diff, but I cannot stage or unstage hunks or files; is this a known issue?
I have the following git structure:
ghost (primary git repo)
|-- core/client (submodule)
|-- content/themes/casper (submodule)
I mostly work in the client by running cd core/client then atom .. All the git operations performed via terminal in that directory treat the submodule as if it is a separate repository which is what I want as it _is_ a completely separate project to the main repo.
However I've just tried the Atom Beta by running atom-beta . in the core/client directory and it's only picking up the top-level Ghost repository which isn't of any use because all the commits, PRs etc are on the submodule's repository.
Is this the same problem that this issue is referring to?
it's only picking up the top-level
Ghostrepository
Okay, @kuychaco and I just tracked this down (and learned something new about Git in the process. happens a lot on this project 😅)
So submodule working directories do contain a .git entry, but it's a file, not a folder, and the file contains some text that points to the actual repository directory, which lives in the containing repository's .git/modules directory. This is problematic for two reasons:
WorkdirCache#walkToRoot walks up the folder hierarchy trying to find a .git folder, and it fails if it finds one but it's not a file. This needs to be adjusted to account for the pseudo-symlink nature of the .git file in submodule working dirs.Repository and friends and GitShellOutStrategy) that the .git folder is a subdirectory of the working directory (to read things like MERGE_HEAD, etc.) We should implement a smarter getGitDirectoryPath and use it everywhere instead.I can't say for sure how long it'll be before we have full submodule support in Atom, but in the meantime we are trying to take care of some of the more egregious errors and problems (e.g. #828). I'll open some issues to track specific tasks. Thanks for your help tracking this all down! ✨
Can we change or unset the milestone?
Necroposting with an investigation note: submodule mount points appear in git diffs with a special filemode of 160000 (which just happens to be IF_DIR & IF_LNK). So we can detect 'em at least.
Any update here? We use in our project multiple Submodules and the Atom Github package isn't still useful for us. Our structure looks like this:
Open a file (or use Ctrl PgUp to navigate to a file) being tracked by the _root_ project, and open the submodule directory as an additional project directory (Ctrl Shift A) when presented the following prompt within Atom's Git _pop-out_...
:closed_book:
Create Repository
Initialize a new project directory with a Git repository
Git diffs and other things should then show-up for both the root level project and any modules added as additional project folders.
I thought I broke something within my local Git because Ctrl Shift 9 started prompting with the above. And at first I didn't recognize that it was only whenever looking at files within a submodule... _knee jerk_ reaction was to re-clone and all that that entails :facepunch:
One workaround I found was opening the submodule with the _Add Project Folder..._ under the _File_ menu; keyboard shortcut Ctrl Shift A, in which case :tada: the _Git_ _pop-out_ does show diffs, allows for commits and pushes, and really all the Git things.
After opening submodule sub-directories as additional project folders it's possible to have Atom re-open the project along with the additional submodule directories; Ctrl f, _Reopen Project_, and selecting the <project name>,<sub-dir> instead of the option that only shows a file path.
This functions for simple projects that use one or two Git submodule, but more seems to result in a very cluttered _pop-out_ with Atom's _Project_/_file browser_, so projects like what @TheCherry describes may not be the best fit for the above workarounds.
Above may be updated as time and interest in finding a better resolution permits/persists.
Most helpful comment
Any update here? We use in our project multiple Submodules and the Atom Github package isn't still useful for us. Our structure looks like this: