Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/odnoletkov/github-ambiguous-url
Demo Github URLs ambiguity
https://github.com/odnoletkov/github-ambiguous-url
Last synced: 11 days ago
JSON representation
Demo Github URLs ambiguity
- Host: GitHub
- URL: https://github.com/odnoletkov/github-ambiguous-url
- Owner: odnoletkov
- Created: 2017-08-27T12:21:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-27T14:48:35.000Z (over 7 years ago)
- Last Synced: 2024-12-13T21:07:44.696Z (11 days ago)
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Github's URL structure for some git objects is
```
https://github.com/OWNER/REPOSITORY/[blob|tree]/TREE-ISH/PATH
```
But `/` (forward slash) is valid (and frequently used) character in git branch names. Therefore this structure is ambiguous.For example this repository have these two files in different branches:
| Branch | File |
| - | - |
| `some-branch` | `sub/file` |
| `e35b943c2a294e2f7ba2b0e0978e533c2f857897/sub` | `file` |Since `some-branch` points to `e35b943c2a294e2f7ba2b0e0978e533c2f857897`, the first file should also be accessible through `…/e35b943c2a294e2f7ba2b0e0978e533c2f857897/sub/file` URL. But this URL is also canonical URL for the second file, hence ambiguity. Currently Github resolves it to the second file:
[https://github.com/odnoletkov/github-ambiguous-url/blob/e35b943c2a294e2f7ba2b0e0978e533c2f857897/sub/file](https://github.com/odnoletkov/github-ambiguous-url/blob/e35b943c2a294e2f7ba2b0e0978e533c2f857897/sub/file)
There is a certain kind of ambiguity in the git's DSL itself, but with access to repository it can usually be easily resolved. Github URL structure adds another kind of ambiguity on top of that. It is especially inconvenient since I imagine Github URLs are often processed in contexts where you don't have/want access to the repository to resolve ambiguities.