git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Extending "extended SHA1" syntax to traverse through gitlinks?

From
Josh Triplett <josh@joshtriplett.org>
Date
Aug 20, 2016, 22:50 UTC
Message-ID
<20160820225013.l7ynru7hzcmrzff7@x>

Currently, if you have a branch "somebranch" that contains a gitlink "somecommit", you can write "somebranch:somecommit" to refer to the commit, just like a tree or blob. ("man git-rev-parse" defines this syntax in the "SPECIFYING REVISIONS" section.) You can use this anywhere you can use a committish, including "git show somebranch:somecommit", "git log somebranch:somecommit..anotherbranch", or even "git format-patch -1 somebranch:somecommit".

However, you cannot traverse *through* the gitlink to look at files inside its own tree, or to look at other commits relative to that commit. For instance, "somebranch:somecommit:somefile" and "somebranch:somecommit~3" do not work.

I'd love to have a syntax that allows traversing through the gitlink to other files or commits. Ideally, I'd suggest the syntax above, as a natural extension of the existing extended syntax.

(That syntax would potentially introduce ambiguity if you had a file named "somecommit:somefile" or "somecommit~3". That doesn't seem like a problem, though; the existing syntax already doesn't support accessing a file named "x..y" or "x...y", so scripts already can't expect to access arbitrary filenames with that syntax without some kind of quoting, wich we also don't have.)

Does this seem reasonable? Would a patch introducing such syntax (including documentation and tests) be acceptable?

- Josh Triplett
Next: Jakub Narębski
Message 1 of 13 in “Extending "extended SHA1" syntax to traverse through gitlinks?”
  1. Josh TriplettAug 20, 2016
  2. Jakub NarębskiAug 21, 2016
  3. Josh TriplettAug 21, 2016
  4. Jakub NarębskiAug 22, 2016
  5. Josh TriplettAug 23, 2016
  6. Jakub NarębskiAug 23, 2016
  7. Junio C HamanoAug 24, 2016
  8. Jakub NarębskiAug 24, 2016
  9. Josh TriplettAug 24, 2016
  10. Stefan BellerAug 24, 2016
  11. Jakub NarębskiAug 24, 2016
  12. Josh TriplettAug 24, 2016
  13. Junio C HamanoAug 23, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.