# rev-parse doesn't take pwd into consideration

11 messages from 2008-05-26 to 2008-05-27. Participants: Luciano Rocha, Junio C Hamano, Teemu Likonen, しらいしななこ, Johannes Schindelin.
Thread: https://gitlist.dev/t/13676

## Luciano Rocha, 2008-05-26 19:58

Subject: rev-parse doesn't take pwd into consideration
Message-ID: <20080526195812.GA23396@bit.office.eurotux.com>
URL: https://gitlist.dev/e/20080526195812.GA23396%40bit.office.eurotux.com

```

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/>

```

## Junio C Hamano, 2008-05-26 20:15

Subject: Re: rev-parse doesn't take pwd into consideration
Message-ID: <7vhcckddov.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vhcckddov.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20080526195812.GA23396@bit.office.eurotux.com>

```
This was discussed to death.  Check the list archive.

```

## Teemu Likonen, 2008-05-26 20:18

Subject: Re: rev-parse doesn't take pwd into consideration
Message-ID: <20080526201842.GA8194@mithlond.arda.local>
URL: https://gitlist.dev/e/20080526201842.GA8194%40mithlond.arda.local
In-Reply-To: <20080526195812.GA23396@bit.office.eurotux.com>

```
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, 2008-05-26 20:52

Subject: Re: rev-parse doesn't take pwd into consideration
Message-ID: <20080526205248.GB23396@bit.office.eurotux.com>
URL: https://gitlist.dev/e/20080526205248.GB23396%40bit.office.eurotux.com
In-Reply-To: <20080526201842.GA8194@mithlond.arda.local>

```
On Mon, May 26, 2008 at 11:18:42PM +0300, Teemu Likonen wrote:
> 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/>

```

## しらいしななこ, 2008-05-26 21:35

Subject: Re: rev-parse doesn't take pwd into consideration
Message-ID: <200805262135.m4QLZtpq023003@mi0.bluebottle.com>
URL: https://gitlist.dev/e/200805262135.m4QLZtpq023003%40mi0.bluebottle.com
In-Reply-To: <7vhcckddov.fsf@gitster.siamese.dyndns.org>

```
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, 2008-05-26 21:42

Subject: Re: rev-parse doesn't take pwd into consideration
Message-ID: <alpine.DEB.1.00.0805262239060.30431@racer>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0805262239060.30431%40racer
In-Reply-To: <7vhcckddov.fsf@gitster.siamese.dyndns.org>

```
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

```

## Johannes Schindelin, 2008-05-26 21:44

Subject: Re: rev-parse doesn't take pwd into consideration
Message-ID: <alpine.DEB.1.00.0805262243061.30431@racer>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0805262243061.30431%40racer
In-Reply-To: <200805262135.m4QLZtpq023003@mi0.bluebottle.com>

```
Hi,

On Tue, 27 May 2008, しらいしななこ wrote:

> 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, 2008-05-26 21:48

Subject: Re: rev-parse doesn't take pwd into consideration
Message-ID: <7vprr84tzc.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vprr84tzc.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <200805262135.m4QLZtpq023003@mi0.bluebottle.com>

```
しらいしななこ  <nanako3@bluebottle.com> writes:

> 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.

```

## Luciano Rocha, 2008-05-26 22:14

Subject: Re: rev-parse doesn't take pwd into consideration
Message-ID: <20080526221425.GA29854@bit.office.eurotux.com>
URL: https://gitlist.dev/e/20080526221425.GA29854%40bit.office.eurotux.com
In-Reply-To: <200805262135.m4QLZtpq023003@mi0.bluebottle.com>

```
On Tue, May 27, 2008 at 06:35:10AM +0900, しらいしななこ wrote:
> 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, 2008-05-26 23:14

Subject: Re: rev-parse doesn't take pwd into consideration
Message-ID: <20080526231441.GA2508@bit.office.eurotux.com>
URL: https://gitlist.dev/e/20080526231441.GA2508%40bit.office.eurotux.com
In-Reply-To: <200805262135.m4QLZtpq023003@mi0.bluebottle.com>

```
On Tue, May 27, 2008 at 06:35:10AM +0900, しらいしななこ wrote:
> 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/>

```

## しらいしななこ, 2008-05-27 10:53

Subject: Re: rev-parse doesn't take pwd into consideration
Message-ID: <200805271054.m4RAs3NE004265@mi0.bluebottle.com>
URL: https://gitlist.dev/e/200805271054.m4RAs3NE004265%40mi0.bluebottle.com
In-Reply-To: <7vprr84tzc.fsf@gitster.siamese.dyndns.org>

```
Quoting Junio C Hamano <gitster@pobox.com>:

> 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.

> 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

```
