threads / discuss / 13676

rev-parse doesn't take pwd into consideration

Subject: rev-parse doesn't take pwd into consideration

## tl;dr

11 messages between May 26, 2008 and May 27, 2008.

replies: 10people: 5as markdown or json

Luciano Rocha· May 26, 2008, 19:58 UTC · lore
Hello,

I was frustrated for some minutes trying to get the HEAD version of a file, as is in the documentation. Using git's source as an example: git/Documentation$ git show HEAD:docbook.xsl fatal: ambiguous argument 'HEAD:docbook.xsl': unknown revision or path not in the working tree. Use '--' to separate paths from revisions

<hmmm>

$ git show HEAD -- docbook.xsl <nil> $

Seeing in the documentation that the parsing was made by git-rev-parse, I tried running git-rev-parse directly, ending with the same error.

I tried with the full path, just in case, but it didn't work also ($PWD/docbook.xsl).

Until finally I tried the absolute path as git is concerned, and it worked.

It works anywhere: git$ git show HEAD:Documentation/docbook.xsl <contents> git/Documentation$ git show HEAD:Documentation/docbook.xsl <contents> ...

Is it difficult to make rev-parse accept relative path specifications?
-- 
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>
しらいしななこ· May 26, 2008, 21:35 UTC · re: Junio C Hamano · lore

Re: rev-parse doesn't take pwd into consideration

Quoting Junio C Hamano <gitster@pobox.com> writes:
> This was discussed to death.  Check the list archive.
Junio, sometimes I think you are being very mean.  I am reasonably sure you meant this one, but why didn't you give a pointer for him?
http://thread.gmane.org/gmane.comp.version-control.git/68786/focus=68852
-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

----------------------------------------------------------------------
Get a free email address with REAL anti-spam protection.
http://www.bluebottle.com/tag/1
Johannes Schindelin· May 26, 2008, 21:44 UTC · re: しらいしななこ · lore

Re: rev-parse doesn't take pwd into consideration

Hi,
On Tue, 27 May 2008, しらいしななこ wrote:
Show 8 quoted lines
> Quoting Junio C Hamano <gitster@pobox.com> writes:
> 
> > This was discussed to death.  Check the list archive.
> 
> Junio, sometimes I think you are being very mean.  I am reasonably sure 
> you meant this one, but why didn't you give a pointer for him?
> 
> http://thread.gmane.org/gmane.comp.version-control.git/68786/focus=68852

Note that it takes a little bit of time for every such request to find the pointer. A little bit of time times a many times makes quite some time.

I think it is _not_ asking too much to expect people to do _basic_ research.

And yes, searching the mailing list (if a simple Google search is not enough) _does_ qualify for "basic research".

Ciao, Dscho

Junio C Hamano· May 26, 2008, 21:48 UTC · re: しらいしななこ · lore

Re: rev-parse doesn't take pwd into consideration

しらいしななこ  <nanako3@bluebottle.com> writes:
Show 5 quoted lines
> Quoting Junio C Hamano <gitster@pobox.com> writes:
>
>> This was discussed to death.  Check the list archive.
>
> Junio, sometimes I think you are being very mean.  I am reasonably sure you meant this one, but why didn't you give a pointer for him?

Well, because my response roughly translates to "Your lack of research before posting would have wasted other's time, don't do it", I _could_ have spent some time researching before posting to keep Luciano from spending his time on going back to the list archive. Setting a good example, so to speak.

In that sense, perhaps you may have a point.

But I do not think I (or we collectively as the project) can afford to keep doing that in the longer term. A minute lost for me is a minute lost for the project to review and integrate changes that others spent dozens of minutes, perhaps hours, to come up with. So I should not be constantly doing the archive research for other people.

My response might have been mean, and I instead could have ignored it and allow the thread to waste time of others responding to it, but that would have been a worse alternative than nipping it off in the bud. I am not sure what better alternatives there were, other than having a dedicated secretary/librarian to do the archive research for the community.

> http://thread.gmane.org/gmane.comp.version-control.git/68786/focus=68852

Yeah, that's the one I had in mind. I like quoting the threaded interface from gmane --- it makes the context of old discussion very clear.

Thanks.
しらいしななこ· May 27, 2008, 10:53 UTC · re: Junio C Hamano · lore

Re: rev-parse doesn't take pwd into consideration

Quoting Junio C Hamano <gitster@pobox.com>:
Show 5 quoted lines
> But I do not think I (or we collectively as the project) can afford to
> keep doing that in the longer term.  A minute lost for me is a minute lost
> for the project to review and integrate changes that others spent dozens
> of minutes, perhaps hours, to come up with.  So I should not be constantly
> doing the archive research for other people.
I agree that your time is more valuable.
Show 10 quoted lines
> My response might have been mean, and I instead could have ignored it and
> allow the thread to waste time of others responding to it, but that would
> have been a worse alternative than nipping it off in the bud.  I am not
> sure what better alternatives there were, other than having a dedicated
> secretary/librarian to do the archive research for the community.
>
>> http://thread.gmane.org/gmane.comp.version-control.git/68786/focus=68852
>
> Yeah, that's the one I had in mind.  I like quoting the threaded interface
> from gmane --- it makes the context of old discussion very clear.
I remembered that you were not so happy when I pointed at marc.info the last time.  I can learn (^_^).
And it was very easy to find the discussion in gmane (I asked "relative cwd path blob" and the discussion was the first in the list).
> Thanks.
You are wellcome (^_^).
-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

----------------------------------------------------------------------
Free pop3 email with a spam filter.
http://www.bluebottle.com/tag/5
Luciano Rocha· May 26, 2008, 22:14 UTC · re: しらいしななこ · lore

Re: rev-parse doesn't take pwd into consideration

On Tue, May 27, 2008 at 06:35:10AM +0900, しらいしななこ wrote:
Show 7 quoted lines
> Quoting Junio C Hamano <gitster@pobox.com> writes:
> 
> > This was discussed to death.  Check the list archive.
> 
> Junio, sometimes I think you are being very mean.  I am reasonably sure you meant this one, but why didn't you give a pointer for him?
> 
> http://thread.gmane.org/gmane.comp.version-control.git/68786/focus=68852
Thanks for the pointer.

Regards, Luciano Rocha

-- 
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>
Luciano Rocha· May 26, 2008, 23:14 UTC · re: しらいしななこ · lore

Re: rev-parse doesn't take pwd into consideration

On Tue, May 27, 2008 at 06:35:10AM +0900, しらいしななこ wrote:
Show 7 quoted lines
> Quoting Junio C Hamano <gitster@pobox.com> writes:
> 
> > This was discussed to death.  Check the list archive.
> 
> Junio, sometimes I think you are being very mean.  I am reasonably sure you meant this one, but why didn't you give a pointer for him?
> 
> http://thread.gmane.org/gmane.comp.version-control.git/68786/focus=68852
Well, that clears things up. Thanks again.

I've thought of changing only the git-show command, but I've since realized that it will imply changing critical code used by every command.

So I'll be content with git-showrel. :)

Best regards, Luciano Rocha

-- 
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>
Johannes Schindelin· May 26, 2008, 21:42 UTC · re: Junio C Hamano · lore

Re: rev-parse doesn't take pwd into consideration

Hi,
On Mon, 26 May 2008, Junio C Hamano wrote:
> This was discussed to death.  Check the list archive.
FWIW I have a patch in my personal fork that allows "git show HEAD:./bla":
http://repo.or.cz/w/git/dscho.git?a=commitdiff;h=3007b5c53d9b571f992f3e2d801248ff0bd15c76

If you like the patch, you are free to push for inclusion; I do not need it myself, and wasted enough time in writing it, so I will not waste any more time with it.

Ciao, Dscho

Teemu Likonen· May 26, 2008, 20:18 UTC · re: Luciano Rocha · lore

Re: rev-parse doesn't take pwd into consideration

Luciano Rocha wrote (2008-05-26 20:58 +0100):
> Is it difficult to make rev-parse accept relative path specifications?

I don't know but let's consider this: The revision user is asking for with "git show <commit>:<path>" may not even contain the directory user is currently in. Also, there may not be any working directory at all, or user may be completely outside the repository and using "git --git-dir=/somewhere/else". I guess the system is much simpler as the "<commit>:" always refers to repository's root.

If you are using Git's bash completions it's easy to complete paths with "git show <commit>:". For example, try

  $ git show HEAD~10:Docum<tab>
and the path is completed.
Luciano Rocha· May 26, 2008, 20:52 UTC · re: Teemu Likonen · lore

Re: rev-parse doesn't take pwd into consideration

On Mon, May 26, 2008 at 11:18:42PM +0300, Teemu Likonen wrote:
Show 10 quoted lines
> Luciano Rocha wrote (2008-05-26 20:58 +0100):
> 
> > Is it difficult to make rev-parse accept relative path specifications?
> 
> I don't know but let's consider this: The revision user is asking for
> with "git show <commit>:<path>" may not even contain the directory user
> is currently in. Also, there may not be any working directory at all, or
> user may be completely outside the repository and using "git
> --git-dir=/somewhere/else". I guess the system is much simpler as the
> "<commit>:" always refers to repository's root.

If <commit>:<path> is valid assuming the repository's root, then use it. If it isn't, try <commit>:<path_to_git_root>/<path>.

> If you are using Git's bash completions it's easy to complete paths with
> "git show <commit>:". For example, try
I find bash-completion more an hassle than useful, thanks anyway.
>   $ git show HEAD~10:Docum<tab>
> 
> and the path is completed.

But a user usually thinks relative to the current directory, not to the project's root.

But I should check the archives before any further discussion, as Junio C Hamano observed.

Thanks for your input.
-- 
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>

← back to recent threads