≡

wincent.dev

  • Products
  • Blog
  • Wiki
  • Issues
You are viewing an historical archive of past issues. Please report new issues to the appropriate project issue tracker on GitHub.
Home » Issues » Feature request #1697

Feature request #1697: Add tree-browsing to repo browser

Kind feature request
Product wincent.dev
When Created 2010-09-19T15:30:33Z, updated 2010-09-20T18:42:32Z
Status open
Reporter Greg Hurrell
Tags no tags

Description

See ticket #1135 for the original ticket on the repo-browsing functionality.

Comments

  1. Greg Hurrell 2010-09-19T15:51:51Z

    For both trees (this ticket) and blobs (ticket #1698) need to think about URL design.

    While the objects in question are identified by their SHA-1 hashes, for human users it would be nice to display the actual path names in the URL somehow.

    Likewise, it is useful to be able to link directly to specific blobs/trees as they appear in a particular branch or tag; eg:

    • /repos/command-t/blobs/023cc318952347fa689f082d44020ae4ba3949bc (not very human-friendly)

    versus:

    • /repos/command-t/branches/master/blobs/README.txt

    or:

    • /repos/command-t/blobs/branches/master/README.txt

    etc. This would be straightforward if it weren't for the fact that Git is extremely liberal about what characters it allows in branch names. That is, branch names like foo/bar are not only allowed but are actually quite common in some projects (like git.git itself), so we can't just separate the URL on forward slashes.

    GitHub does it like this (no idea if it blows up with branch names that contain slashes):

    • http://github.com/wincent/Command-T/blob/master/README.txt

    I'm kind of leaning towards using a colon as a separator here too, provided I can get confirmation somewhere that a colon is not a legal character in either a branch or tag name.

    Note that it is probably not necessary to directly support displaying blob contents via their hash IDs, as humans interacting with the repo only ever access blobs by a combination of commit and path name.

    This would give us URLs like the following for blobs:

    • /repos/command-t/blobs/master:README.txt

    And the same idea for trees:

    • /repos/command-t/trees/master (no path would just show the top-level tree)
    • /repos/command-t/trees/master:ruby (ruby subdirectory)

    Presumably we can get the contents of the blobs via a simple git cat-file blob ref:path, obviously after checking that ref refers to a reachable commit.

    Should also have no problems handling SHA-1 hashes or ref names with slashes in them:

    • /repos/command-t/trees/195dedcca4726a5d61289e617447ccb415587f6a:ruby
    • /repos/command-t/trees/HEAD:ruby
    • /repos/command-t/trees/foo/bar/branch:ruby
  2. Greg Hurrell 2010-09-19T15:58:26Z

    Found this on legal branch names. Not sure how it was derived yet, but going to make a Legal Git branch names page on the wiki in any case.

  3. Greg Hurrell 2010-09-20T18:42:32Z

    Note that it is probably not necessary to directly support displaying blob contents via their hash IDs, as humans interacting with the repo only ever access blobs by a combination of commit and path name.

    Not only that, but we don't want to provide arbitrary access to blobs that might only be referenced by unreachable commits. So, must only allow access via a commit-ish.

Add a comment

Comments are now closed for this issue.

  • contact
  • legal

Menu

  • Blog
  • Wiki
  • Issues
  • Snippets