git-meta icon indicating copy to clipboard operation
git-meta copied to clipboard

git meta push pushes current not committed submodules

Open novalis opened this issue 8 years ago • 9 comments
trafficstars

If I make a commit in submodule A, and then make a meta commit, and then make another commit in submodule A, git meta push will push the second submodule A commit -- not the one that is in the meta commit being pushed.

novalis avatar Jul 26 '17 18:07 novalis

And if you close the submodule, it doesn't push at all.

abliss avatar Jul 28 '17 11:07 abliss

The way it works right now is... expedient. I'm not sure that it's tractable to figure out what the exact right set of submodule commits to push is. To do so, you'd first need to determine what meta-repo commits haven't been pushed -- which is always going to be a guess, and which could range between mildly and extremely expensive (e.g., of the user has removed all remote branches you might deduce that all of history is being pushed).

I think a better algorithm than what I currently have (that would address @novalis 's issue) would be to push, for each open submodule, the commit referenced at the tip of the meta-repo commit being pushed. Final validation will have to happen on the back-end as we really have no idea of what's there, unless we want to teach git-meta how to participate in the negotiation process.

bpeabody avatar Jul 28 '17 12:07 bpeabody

Under the assumption that you only push one commit at a time, it would seem simple to examine the tip of the outgoing branch, and push to a synthetic meta ref every submodule changed in that commit.

abliss avatar Nov 09 '17 19:11 abliss

Why would we assume that users push only one commit at a time?

bpeabody avatar Nov 09 '17 19:11 bpeabody

I know it's not philosophically pure, but neither is the currently-implemented solution, and approximately 100% of real-world usage of git meta to date has been one commit at a time. :)

abliss avatar Nov 09 '17 22:11 abliss

I think it's OK to use that point as an optimization, but I don't think the tool should be broken if someone has more than one commit.

bpeabody avatar Nov 09 '17 22:11 bpeabody

Agreed. But the tool is currently broken if you (a) have a different commit checked out than the one you're pushing or (b) have closed some changed submodules since git-adding them. It doesn't seem obvious to me that "pushing multiple meta commits" is a more common operaton than that (even in a future when we support "assembling" them).

abliss avatar Nov 09 '17 23:11 abliss

How about we push (a) open submodules and (b) any submodules changed in the commit being pushed (opening them if necessary)?

bpeabody avatar Nov 09 '17 23:11 bpeabody

sounds good to me!

abliss avatar Nov 10 '17 02:11 abliss