From: Felipe Contreras <felipe.contreras@gmail.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH v2 02/44] ruby: add support for internal ruby programs
Date: Sat, 28 Sep 2013 23:56:18 -0500 [thread overview]
Message-ID: <CAMP44s28B+UX1ofQb_sZfaPG2htvQ=W_EvScVbFgmR9P4SnvPg@mail.gmail.com> (raw)
In-Reply-To: <CALkWK0=XSxiz+MoU2H7Zxo4gSRvs+C5fGpnD2ioBvrXzdLpmww@mail.gmail.com>
On Sat, Sep 28, 2013 at 11:40 PM, Ramkumar Ramachandra
<artagnon@gmail.com> wrote:
> Felipe Contreras wrote:
>> +$(RUBY_PROGRAMS): git-ruby$X
>> + $(QUIET_BUILT_IN)$(RM) $@ && \
>> + ln >lt; $@ 2>/dev/null || \
>> + ln -s >lt; $@ 2>/dev/null || \
>> + cp >lt; $@
>
> Why so many fallbacks? Will the hard-link (the first ln) ever fail?
Because that's what the code right on top of this is doing. I presume
it would fail in file-systems that don't have hard-links.
>> diff --git a/ruby.c b/ruby.c
>> index ee6a0e7..339e376 100644
>> --- a/ruby.c
>> +++ b/ruby.c
>> @@ -52,5 +52,22 @@ static int run_ruby_command(const char *cmd, int argc, const char **argv)
>>
>> int main(int argc, const char **argv)
>> {
>> - return run_ruby_command(argv[1], argc, argv);
>> + if (!strcmp(argv[0], "git-ruby")) {
>> + return run_ruby_command(argv[1], argc, argv);
>> + } else {
>> + const char *cmd = argv[0];
>> + static char buf[PATH_MAX + 1];
>> + const char *args[argc + 1];
>> + int i;
>> +
>> + snprintf(buf, PATH_MAX, "%s/%s.rb",
>> + git_exec_path(), basename((char *)cmd));
>> +
>> + args[0] = "git";
>> + args[1] = buf;
>> + for (i = 0; i < argc - 1; i++)
>> + args[i + 2] = (char *)argv[i + 1];
>> +
>> + return run_ruby_command(cmd, argc + 1, args);
>> + }
>> }
>
> Can you explain this in greater detail in your commit message? When I
> pass an argument,
>
> $ git ruby foo
> git-ruby: No such file or directory -- foo (LoadError)
>
> I get this as before. How exactly will new ruby scripts be executed?
> (I can only guess at this point)
If you do:
% git ruby foo
It's the same as
% ruby foo
You need the script right there, as a file named "foo".
However, this already works before this patch.
What this patch does is enable:
% git foo
But for this you need two things:
1) A binary named git-foo in your path, that is a link to git-ruby,
which is what the variable RUBY_PROGRAMS is for in the Makefile
2) A script named git-foo.rb in your exec-path.
So basically "git-foo" is the same as "git ruby $GIT_EXEC_PATH/git-foo.rb".
--
Felipe Contreras
next prev parent reply other threads:[~2013-09-29 4:56 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-28 22:03 [PATCH v2 00/44] Ruby support Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 01/44] Add support for ruby commands Felipe Contreras
2013-09-29 4:30 ` Ramkumar Ramachandra
2013-09-29 4:47 ` Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 02/44] ruby: add support for internal ruby programs Felipe Contreras
2013-09-29 4:40 ` Ramkumar Ramachandra
2013-09-29 4:56 ` Felipe Contreras [this message]
2013-09-29 5:07 ` Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 03/44] request-pull: fix annotated tag check Felipe Contreras
2013-09-29 4:41 ` Ramkumar Ramachandra
2013-09-28 22:03 ` [PATCH v2 04/44] request-pull: fix for specific branch Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 05/44] request-pull: use appropriate ref Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 06/44] request-pull: fix exact match checking Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 07/44] request-pull: trivial simplification Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 08/44] request-pull: t: trivial whitespace style fixes Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 09/44] request-pull: t: add missing cat Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 10/44] ruby: rewrite 'request-pull' Felipe Contreras
2013-09-29 4:59 ` Ramkumar Ramachandra
2013-09-28 22:03 ` [PATCH v2 11/44] ruby: request-pull: rewrite perl script Felipe Contreras
2013-09-29 5:04 ` Ramkumar Ramachandra
2013-09-28 22:03 ` [PATCH v2 12/44] ruby: request-pull: trivial simplifications Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 13/44] ruby: bind setup_git_directory() Felipe Contreras
2013-09-29 5:11 ` Ramkumar Ramachandra
2013-09-29 5:40 ` Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 14/44] ruby: bind dwim_ref() Felipe Contreras
2013-09-29 5:17 ` Ramkumar Ramachandra
2013-09-29 5:24 ` Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 15/44] ruby: request-pull: use native dwim_ref() Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 16/44] ruby: bind git_config() Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 17/44] ruby: request-pull: use native git_config() Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 18/44] ruby: bind read_ref()/peel_ref() Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 19/44] ruby: bind get_sha1() Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 20/44] ruby: request-pull: simplify tag fetching Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 21/44] ruby: request-pull: use get_sha1() Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 22/44] ruby: add Commit class Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 23/44] ruby: bind get_merge_bases() Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 24/44] ruby: request-pull: use get_merge_bases() Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 25/44] ruby: request-pull: trivial cleanups Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 26/44] ruby: bind remote and transport stuff Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 27/44] ruby: request-pull: use native remote and transport Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 28/44] ruby: bind find_unique_abbrev() Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 29/44] ruby: request-pull: use native commit info Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 30/44] ruby: bind read_sha1_file() Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 31/44] ruby: request-pull: use read_sha1_file() Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 32/44] revision: add missing include Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 33/44] shortlog: add missing declaration Felipe Contreras
2013-09-28 22:03 ` [PATCH v2 34/44] shortlog: split builtin from common code Felipe Contreras
2013-09-28 22:04 ` [PATCH v2 35/44] ruby: add RevInfo and DiffOptions Felipe Contreras
2013-09-28 22:04 ` [PATCH v2 36/44] ruby: bind shortlog() Felipe Contreras
2013-09-28 22:04 ` [PATCH v2 37/44] ruby: request-pull: use shortlog() Felipe Contreras
2013-09-28 22:04 ` [PATCH v2 38/44] ruby: bind diff_tree_sha1() Felipe Contreras
2013-09-28 22:04 ` [PATCH v2 39/44] ruby: bind log_tree_diff_flush() Felipe Contreras
2013-09-28 22:04 ` [PATCH v2 40/44] ruby: request-pull: use native diff_tree stuff Felipe Contreras
2013-09-28 22:04 ` [PATCH v2 41/44] ruby: request-pull: remove rescue block Felipe Contreras
2013-09-28 22:04 ` [PATCH v2 42/44] ruby: remove GIT_PAGER from environment Felipe Contreras
2013-09-28 23:27 ` Stefan Beller
2013-09-28 23:33 ` Felipe Contreras
2013-09-28 22:04 ` [PATCH v2 43/44] ruby: add simpler option parser Felipe Contreras
2013-09-28 22:04 ` [PATCH v2 44/44] request-pull: rewrite to C Felipe Contreras
2013-09-29 6:05 ` Ramkumar Ramachandra
2013-09-29 4:13 ` [PATCH v2 00/44] Ruby support Ramkumar Ramachandra
2013-09-29 4:20 ` Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMP44s28B+UX1ofQb_sZfaPG2htvQ=W_EvScVbFgmR9P4SnvPg@mail.gmail.com' \
--to=felipe.contreras@gmail.com \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).