Re: [WIP PATCH 01/18] rev-parse: add --internal-cwd and --internal-git-dir for tests

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

 



2010/10/24 Jonathan Nieder <jrnieder@xxxxxxxxx>:
> Nguyán ThÃi Ngác Duy wrote:
>
>> --internal-cwd is obvious, no way else to expose it for testing.
>>
>> --internal-git-dir is introduced because --git-dir prepares its output
>> suitable for scripting. For tests, it must be exactly what git stores.
>
> Hmm. ÂForget this is used in tests, would it make sense to do this
> with trace_printf, at the end of setup, as in your earlier patch?

trace_printf surely does. But "the end of setup" is unclear. As of
now, setup ends when setup_* function _and_ setup_git_env() are
called. There are cases that setup_* finishes without calling
setup_git_env(), or setup_git_env() is called way before setup_* is
finished.

> I think it might: just like the exec: lines provide context about what
> command is being traced, such trace: cwd: lines would make it clearer
> what paths that are being output might be referring to.

Also prefix them all with "setup:", something like

setup: git_dir: ../.git
setup: work_tree: /my/git/worktree
setup: cwd: /my/git/worktree
setup: prefix: sub/

would be easy to be grepped from GIT_TRACE, to read and to test_cmp.

> Returning to the topic of tests, is it possible to get at these
> variables using an external command that is run by git? Âpre-commit
> hook, maybe. ÂTesting of other symptoms is also possible, as in
> FrÃdÃric's example.

Why do hooks need these? git_dir, prefix are already accessible via
--git-dir, --show-prefix, --show-toplevel. Current cwd can be
determined with --is-inside-work-tree: if it returns true, current cwd
is worktree root, otherwise it is original cwd.
-- 
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]