From: "Jakub Narębski" <jnareb@gmail.com>
To: Josh Triplett <josh@joshtriplett.org>, git@vger.kernel.org
Subject: Re: Extending "extended SHA1" syntax to traverse through gitlinks?
Date: Sun, 21 Aug 2016 15:46:36 +0200 [thread overview]
Message-ID: <9bad3d13-3257-2077-a734-f985c375b8d3@gmail.com> (raw)
In-Reply-To: <20160820225013.l7ynru7hzcmrzff7@x>
W dniu 21.08.2016 o 00:50, Josh Triplett pisze:
> 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.
Note that there is the same problem traversing through trees:
while 'git cat-file -p HEAD:subdir/file' works, the 'HEAD:subdir:file'
doesn't:
$ git cat-file -p HEAD:subdir:file
fatal: Not a valid object name HEAD:subdir:file
Though you can do resolve step manually
$ git cat-file -p $(git rev-parse HEAD:subdir):file
This works.
>
> 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.
And with the above manual resolving, you can see the problem with
implementing it: the git-cat-file (in submodule) and git-rev-parse
(in supermodule) are across repository boundary.
Also the problem with proposed syntax is that is not very visible.
But perhaps it is all right. Maybe :/ as separator would be better,
or using parentheses or braces?
> (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, which
> we also don't have.)
Errr... what?
$ echo A..B >A..B
$ git add A..B
$ git commit -m 'A..B added'
[master 2d69af9] A..B added
1 file changed, 1 insertion(+), 1 deletion(-)
create mode 100644 A..B
$ git show HEAD:A..B
A..B
>
> Does this seem reasonable? Would a patch introducing such syntax
> (including documentation and tests) be acceptable?
--
Jakub Narębski
next prev parent reply other threads:[~2016-08-21 13:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-20 22:50 Extending "extended SHA1" syntax to traverse through gitlinks? Josh Triplett
2016-08-21 13:46 ` Jakub Narębski [this message]
2016-08-21 14:26 ` Josh Triplett
2016-08-22 18:39 ` Jakub Narębski
2016-08-23 6:53 ` Josh Triplett
2016-08-23 20:24 ` Jakub Narębski
2016-08-24 5:36 ` Junio C Hamano
2016-08-24 13:16 ` Jakub Narębski
2016-08-24 14:20 ` Josh Triplett
2016-08-24 16:26 ` Stefan Beller
2016-08-24 17:05 ` Jakub Narębski
2016-08-24 20:21 ` Josh Triplett
2016-08-23 16:39 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9bad3d13-3257-2077-a734-f985c375b8d3@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=josh@joshtriplett.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).