Page MenuHomePhabricator

tighten remote URI error handling with idiosyncratic remote names
ClosedPublic

Authored by cburroughs on Dec 28 2016, 10:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 26, 8:39 AM
Unknown Object (File)
Oct 23 2024, 7:56 AM
Unknown Object (File)
Oct 15 2024, 12:54 AM
Unknown Object (File)
Oct 14 2024, 6:21 PM
Unknown Object (File)
Oct 1 2024, 7:23 PM
Unknown Object (File)
Aug 28 2024, 12:19 AM
Unknown Object (File)
Aug 26 2024, 8:07 PM
Unknown Object (File)
Aug 26 2024, 8:07 PM
Tokens
"100" token, awarded by cburroughs.

Details

Summary

git ls-remote has an unusual way to indicate a URL was not
found: echoing back user input

$ git ls-remote --get-url does_not_exist
does_not_exist
$ echo $?
0

getRemoteURI handles checking for remotes other than 'origin', but
the error handling always matched against the string 'origin'
regardless of remote name.

Test Plan

With a git config along the lines of:

[remote "my_special_name"]
        url = ssh://secure@secure.phabricator.com/diffusion/ARC/arcanist.git
        fetch = +refs/heads/*:refs/remotes/my_special_name/*
[branch "master"]
        remote = github
        merge = refs/heads/master
[remote "github"]
         # url = git@github.com:phacility/arcanist.git
         fetch = +refs/heads/*:refs/remotes/github/*

and running in a branch tracking master (github). arc which would
(without this diff) show:

The remote URI for this working copy is "github".

With this diff, arc which correctly shows:

Unable to determine the remote URI for this repository.

When diffing against a tracking branch with a propertly configured
remote (the happy path), arc which still correctly identifies the
remote URI:

The remote URI for this working copy is
"ssh://secure@secure.phabricator.com/diffusion/ARC/arcanist.git".

Diff Detail

Repository
rARC Arcanist
Branch
ls_remote (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 15036
Build 19729: Run Core Tests
Build 19728: arc lint + arc unit

Event Timeline

It looks like git remote get-url <remote-name> has sane error behavior. Did you happen to dig up any version information on that while figuring this out?

epriestley added a reviewer: epriestley.

Hrrm, it looks like get-url is fairly recent (September 2015, not sure what release it made it into):

https://github.com/git/git/commit/96f78d39989d1fcf393d7bc42357467dd8cf0f15

Maybe leave a note about it in a comment for the next time someone ends up here (along the lines of "In recent versions of git 'git remote get-url' is available.").

This revision is now accepted and ready to land.Dec 28 2016, 10:33 PM

GitHub's tag list in that URL points towards 2.7.0 in January of 2016.

u need a real avatar before landing codez

  • breadcrumbs for future explorers
This revision was automatically updated to reflect the committed changes.