Re: [Funky] "git -p cmd" inside a bare repository

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Dec 14, 2007 8:29 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> If you have a bare repository and try this there:
>
>         $ PAGER=head git show HEAD:gcc/ChangeLog
>
> it works as expected, but if you explicitly ask for pagination, like
> this:
>
>         $ PAGER=head git -p show HEAD:gcc/ChangeLog
>
> you would get a very funky error message:
>
>         fatal: ambiguous argument 'HEAD:gcc/ChangeLog': unknown revision or path not in the working tree.
>         Use '--' to separate paths from revisions
>
> as if we are working with a repository with working tree.
>
> I originally noticed this with ls-tree.  The symptom is a bit different:
>
>         $ git -p ls-tree HEAD
>         fatal: Not a valid object name HEAD
>
>
>
> I _think_ what is happening is that setup_pager() tries to run
> git_config(), which runs setup(), and then RUN_SETUP set for "ls-tree"
> (or "show") internal command runs setup again.  HEAD is given to
> resolve_ref() and git_path("%s", ref) makes it to ".git/HEAD", even
> though in a bare repository git_dir should be set to ".", and of course
> we cannot find such a path in the git directory.

You meant setup_git_directory() or setup_git_env()? If find that
setup_git_env() is called too soon so it caches wrong git_dir and
friends if you setup_pager().

Another option (BTW I think your patch is fine) is to call
setup_git_env one more time to refresh its cache.
-- 
Duy
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux