Re: [PATCH v2 2/4] run_builtin(): save "-h" detection result for later use

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

 



Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx> writes:

> When run_builtin() sees "-h" as the first argument, it assumes:
>
>  - this is the call for help usage
>  - the real git command will only print help usage then exit
>
> So it skips all setup in this case.  Unfortunately, some commands do
> other things before calling parse_options(), which is often where the
> help usage is printed.  Some of those things may try to access the
> repository unnecessarily. If a repository is broken, the command may
> die() before it prints help usage, not really helpful.

What does die() message say in that case?  If it says "your repository is
broken", that may be more useful than giving a help message.  I dunno.

> Demonstrating "git foo -h" fails depends on individual commands and
> is generally difficult to do. Instead GIT_TRACE is used to check
> if a command does set repo. If it does, it is supposed to fail if
> repo setup code chokes.

Hmm, I am not sure I understand this one.  If you are interested in
changing the behaviour of these commands when run with "-h" in a corrupt
repository, perhaps you can deliberately corrupt the test repository in
the trash directory you start with, and run these commands there, no?
For a good measure, you could use CEILING_DIRECTORIES to make sure the
tests do not climb up to the project repository.
--
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]