On April 19, 2021 3:15 PM, Jacob Keller wrote: > On Fri, Apr 16, 2021 at 4:38 PM Emily Shaffer <emilyshaffer@xxxxxxxxxx> > wrote: > > > > Hi folks, > > > > As hinted by a couple recent patches, I'm planning on some pretty big > > submodule work over the next 6 months or so - and Ævar pointed out to > > me in https://lore.kernel.org/git/87v98p17im.fsf@xxxxxxxxxxxxxxxxxxx > > that I probably should share some of those plans ahead of time. :) So > > attached is a lightly modified version of the doc that we've been > > working on internally at Google, focusing on what we think would be an ideal > submodule workflow. > > > > I'm hoping that folks will get a chance to read some or all of it and > > let us know what sounds cool (or sounds extremely broken). The best > > spot to start is probably the "Overview" section, which describes what > > the "main path" would look like for a user working on a project with > > submodules. Most of the work that we're planning on doing is under the > "What doesn't already work" headings. > > > > Thanks in advance for any time you spend reading/discussing :) > > > > - Emily > > > > Background > > ========== > > > > It's worth mentioning that the main goal that's funding this work is > > to provide an alternative for users whose projects use repo > > (https://source.android.com/setup/develop#repo) today. That means that > > the main focus is to try and reach feature parity to repo for an > > easier transition for those who want to switch. As a result, some of > > the direction below is aimed towards learning from what has worked > > well with repo (but hopefully more flexible for users who want to do more, or > differently). > > > > There are also a few things mentioned that are specifically targeted > > to ease use with Gerrit, which is in wide use here at Google (and > > therefore also a consideration we need to make to keep getting paid ;) ). > > > > Overview > > ======= > > > > One thing that I think I didn't see covered when I scanned this, that is > something I find difficult or annoying to resolve is using "blame" > with submodules. I use blame a lot to do code history analysis to understand > how something got to the way it is. (Often this helps resolve issues or bugs by > using new context to understand why an old change was broken). > > It has bothered me in the past when I try to do "git blame > <path/to/submodule>" and I get nothing. Obviously there are ways around this: > you can for example just log the path and get the commit that changed it most > recently, or try to search for when the submodule was set to a given commit. > > A sort of dream I had was a flow where I could do something from the parent > like "git blame <path/to/submodule>/submodule/file" and have it present a > blame of that files contents keyed on the *parent* commit that changed the > submodule to have that line, as opposed to being forced to go into the > submodule and figure out what commit introduced it and then go back to the > parent and find out what commit changed the submodule to include that > submodule commit. Not going to disagree, but are you looking for the blame on the submodule ref file itself or files in the submodule? It's hard to teach git to do a blame on a one-line file. Otherwise, and I think this is what you really are going for, teaching it to do a blame based on "git blame <path/to/submodule>/submodule/file" would be very nice and abstracts out the need for the user (or more importantly to me = scripts) to understand that a submodule is involved; however, it is opening up a very large door: "should/could we teach git to abstract submodules out of every command". This would potentially replace a significant part of the use cases for the "git submodule foreach" sub-command. In your ask, the current paradigm "cd <path/to/submodule>/submodule && git blame file" or pretty much every other command does work, but it requires the user/script to know you have a submodule in the path. So my question is: is this worth the effort? I don't have a good answer to that question. Half of my brain would like this very much/the other half is scared of the impact to the code. Just my musings. Randall