On Thu, Jun 6, 2013 at 12:37 AM, Aaron Schulz <aschulz4...@gmail.com> wrote:

> I agree it would be nice for our repos (or git-review setup steps) would
> have
> sane defaults instead of ones almost everyone will want to change to not be
> annoyed.


Setting defaultremote=origin in each repository's .gitreview file wouldn't
work well. We'd need to fix git-review further, first.

git-review expects the remote that is used for interacting with Gerrit to
be using SSH. This is a bug, but it's easy to see how it arose: if the
remote is named 'gerrit', it's not totally insane for git-review to assume
that it created it, and since it only creates SSH remotes, this one must
be, too, right?

So what happens if you set defaultremote to 'origin', then clone the
repository using https? Well, this:

~$ git clone https://gerrit.wikimedia.org/r/analytics/glass
Cloning into 'glass'...
~$ cd glass
~/glass$ git review -s
Problems encountered installing commit-msg hook
The following command failed with exit code 1
    "scp -P None gerrit.wikimedia.org:hooks/commit-msg
.git/hooks/commit-msg"
-----------------------
Bad port ' None'
-----------------------

I'm not sure what the correct behavior should be. It's tempting to tell
git-review to upgrade the remote to use SSH, but it's sneaky to change a
read-only remote to pushable one. If the 'origin' points at another site
altogether (like GitHub), it's even thornier. (If nothing else, though, the
error message should be better.)

So the current situation may in fact be optimal. By default, 'git-review'
will use 'gerrit' as a remote name, which is fine, since it's not likely to
exist. So newbies get the same experience as before: slightly odd, but not
broken. And if you're a power user and know to configure
~/.config/git-review/git-review.conf to specify defaultremote=origin, then
you just have to remember to clone Gerrit repositories using ssh://, which
you're probably doing anyway. Note that if you do that, there's no need to
migrate anything:

~$ git clone ssh://o...@gerrit.wikimedia.org:29418/analytics/glass.git
Cloning into 'glass'...
~$ cd glass
~/glass$ git review -s
(success; no output.)


Ori
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to