We are using Gerrit for code review.
Gerrit stores reviewed code in non-standard reference path - refs/changes.
So, reference to commit looks like refs/changes/95/295/2 .
I want to add project from Gerrit to my superproject as a submodule.
I can do it in two steps:
- add my project as a submodule to commit-hash currently pointed by master
- perform git fetch origin refs/changes/95/295/2 && git checkout FETCH_HEADand commit the change.
But when I try to checkout my superproject and do git update --init git reports failure. Git can't find hash in submodule, because git didn't see references in refs/changes by default, and don't download objects from them.
Ok, I can fix it with executing git config --add remote.origin.fetch '+refs/changes/*:refs/remotes/origin/changes/*' in my gerrit repo, then retry submodule update, and that will be ok.
Question is, can I perform "add" and "init/update" submodule in one step as in usuial workflow? Basically, I need feature to set refspec before "clone"/"pull"/"submodule add"/"sumbodule update" execution start.
 
    