[PATCH v2 00/44] Ruby support

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

 



This is a different patch series that tries a different approach.

First, this series allows external scripts to also access libgit through Ruby
bindings:

  git ruby <<EOF
  for_each_ref() do |name, sha1, flags|
    puts "%s: %s" % [name, sha1_to_hex(sha1)]
  end
  EOF

This way third party script writers can write Ruby code that resembles Git's
internal C code, but in a much simpler way.

Since the importance of the contrib area is fading, and it's important to move
all Git commands to C, it's helpful to have tools that allows third parties to
rewrite scripts that are easier to rewrite to C.

In addition, this would help Git developers to create quick prototypes and test
new code.

Finally, and perhaps most importantly, Ruby scripts can be intermediaries
between perl/shell scripts, and the final desired C code.

I already argued this, but here is a clear demonstration.

I took git-request-pull.sh, converted it to Ruby and incrementally moodified it
until the resulting code was essentially what the code would look like in C,
and then, finally, the rewrite to C, which follows the exact same logic of the
Ruby script.

In the progress of doing this, it was clear the shell script was buggy, so it
was fixed, and the C code needed fixes as well.

If we are serious about converting *all scripts* to C, clearly a powerful tool
is needed, and Ruby bindings fit the bill.

Ruby scripts could be provided alongside the perl/shell alternatives, so people
that build with NO_RUBY=y don't loose any functionality. And eventually the
Ruby scripts (and originals) get removed once the conversion to C is completed.

Even if Ruby is not used as an intermediary tool, and no official Git scripts are
converted to C this way, the bindings would still be useful to third parties.

Who wouldn't benefit from adding this support?

Felipe Contreras (44):
  Add support for ruby commands
  ruby: add support for internal ruby programs
  request-pull: fix annotated tag check
  request-pull: fix for specific branch
  request-pull: use appropriate ref
  request-pull: fix exact match checking
  request-pull: trivial simplification
  request-pull: t: trivial whitespace style fixes
  request-pull: t: add missing cat
  ruby: rewrite 'request-pull'
  ruby: request-pull: rewrite perl script
  ruby: request-pull: trivial simplifications
  ruby: bind setup_git_directory()
  ruby: bind dwim_ref()
  ruby: request-pull: use native dwim_ref()
  ruby: bind git_config()
  ruby: request-pull: use native git_config()
  ruby: bind read_ref()/peel_ref()
  ruby: bind get_sha1()
  ruby: request-pull: simplify tag fetching
  ruby: request-pull: use get_sha1()
  ruby: add Commit class
  ruby: bind get_merge_bases()
  ruby: request-pull: use get_merge_bases()
  ruby: request-pull: trivial cleanups
  ruby: bind remote and transport stuff
  ruby: request-pull: use native remote and transport
  ruby: bind find_unique_abbrev()
  ruby: request-pull: use native commit info
  ruby: bind read_sha1_file()
  ruby: request-pull: use read_sha1_file()
  revision: add missing include
  shortlog: add missing declaration
  shortlog: split builtin from common code
  ruby: add RevInfo and DiffOptions
  ruby: bind shortlog()
  ruby: request-pull: use shortlog()
  ruby: bind diff_tree_sha1()
  ruby: bind log_tree_diff_flush()
  ruby: request-pull: use native diff_tree stuff
  ruby: request-pull: remove rescue block
  ruby: remove GIT_PAGER from environment
  ruby: add simpler option parser
  request-pull: rewrite to C

 .gitignore              |   1 +
 Makefile                |  31 ++-
 builtin.h               |   1 +
 builtin/request-pull.c  | 275 +++++++++++++++++++++++
 builtin/shortlog.c      | 184 +--------------
 git-rb-setup.rb         | 109 +++++++++
 git-request-pull.sh     | 162 --------------
 git.c                   |   1 +
 revision.h              |   1 +
 ruby.c                  | 584 ++++++++++++++++++++++++++++++++++++++++++++++++
 shortlog.c              | 181 +++++++++++++++
 shortlog.h              |   8 +
 t/t10000-ruby.sh        | 233 +++++++++++++++++++
 t/t5150-request-pull.sh |  81 +++++--
 14 files changed, 1492 insertions(+), 360 deletions(-)
 create mode 100644 builtin/request-pull.c
 create mode 100644 git-rb-setup.rb
 delete mode 100755 git-request-pull.sh
 create mode 100644 ruby.c
 create mode 100644 shortlog.c
 create mode 100755 t/t10000-ruby.sh

-- 
1.8.4-fc

--
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]