Felipe Contreras wrote:
> +test_expect_success 'argument passing' '
> +       cat > script <<-"EOF" &&
> +       p($0)
> +       p(ARGV)
> +       EOF
> +       git ruby script foo bar > actual &&
> +       cat > expected <<-EOF &&
> +       "script"
> +       ["foo", "bar"]
> +       EOF
> +       test_cmp expected actual
> +'

So, git-ruby is a new builtin that's just like a ruby interpreter,
except that it has certain git-related functions defined: you pass it
source code on stdin, and it returns the result on stdout. I wonder
what the purpose of passing arguments to it is though.

> +test_expect_success 'test for_each_ref()' '
> +       test_commit foo &&
> +       git ruby > actual <<-EOF &&
> +       for_each_ref() do |name, sha1, flags|
> +               puts "%s: %s" % [name, sha1_to_hex(sha1)]
> +       end
> +       EOF
> +       git for-each-ref --format="%(refname): %(objectname)" > expected &&
> +       test_cmp expected actual
> +'

I find it interesting that you chose to implement for-each-ref in the
initial version. It currently takes no arguments, but we can always
extend it to do ref-hierarchy filtering like f-e-r in the future.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to