Coder Social home page Coder Social logo

gitlabhq / grit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mojombo/grit

59.0 59.0 56.0 6.31 MB

Grit gives you object oriented read/write access to Git repositories via Ruby. Patched for GitLab

Home Page: gitlab.org

License: MIT License

Ruby 85.51% Shell 14.49%

grit's Introduction

GitLab

Canonical source

The canonical source of GitLab where all development takes place is hosted on GitLab.com.

If you wish to clone a copy of GitLab without proprietary code, you can use the read-only mirror of GitLab located at https://gitlab.com/gitlab-org/gitlab-foss/. However, please do not submit any issues and/or merge requests to that project.

Free trial

You can request a free trial of GitLab Ultimate on our website.

Open source software to collaborate on code

To see how GitLab looks please see the features page on our website.

  • Manage Git repositories with fine grained access controls that keep your code secure
  • Perform code reviews and enhance collaboration with merge requests
  • Complete continuous integration (CI) and continuous deployment/delivery (CD) pipelines to build, test, and deploy your applications
  • Each project can also have an issue tracker, issue board, and a wiki
  • Used by more than 100,000 organizations, GitLab is the most popular solution to manage Git repositories on-premises
  • Completely free and open source (MIT Expat license)

Editions

There are three editions of GitLab:

  • GitLab Community Edition (CE) is available freely under the MIT Expat license.
  • GitLab Enterprise Edition (EE) includes extra features that are more useful for organizations with more than 100 users. To use EE and get official support please become a subscriber.
  • JiHu Edition (JH) tailored specifically for the Chinese market.

Licensing

See the LICENSE file for licensing information as it pertains to files in this repository.

Hiring

We are hiring developers, support people, and production engineers all the time, please see our jobs page.

Website

On about.gitlab.com you can find more information about:

Requirements

Please see the requirements documentation for system requirements and more information about the supported operating systems.

Installation

The recommended way to install GitLab is with the Omnibus packages on our package server. Compared to an installation from source, this is faster and less error prone. Just select your operating system, download the respective package (Debian or RPM) and install it using the system's package manager.

There are various other options to install GitLab, please refer to the installation page on the GitLab website for more information.

Contributing

GitLab is an open source project and we are very happy to accept community contributions. Please refer to Contributing to GitLab page for more details.

Install a development environment

To work on GitLab itself, we recommend setting up your development environment with the GitLab Development Kit. If you do not use the GitLab Development Kit you need to install and configure all the dependencies yourself, this is a lot of work and error prone. One small thing you also have to do when installing it yourself is to copy the example development Puma configuration file:

cp config/puma.example.development.rb config/puma.rb

Instructions on how to start GitLab and how to run the tests can be found in the getting started section of the GitLab Development Kit.

Software stack

GitLab is a Ruby on Rails application that runs on the following software:

  • Ubuntu/Debian/CentOS/RHEL/OpenSUSE
  • Ruby (MRI) 3.1.4
  • Git 2.33+
  • Redis 6.0+
  • PostgreSQL 14.9+

For more information please see the architecture and requirements documentation.

UX design

Please adhere to the UX Guide when creating designs and implementing code.

Third-party applications

There are a lot of third-party applications integrating with GitLab. These include GUI Git clients, mobile applications and API wrappers for various languages.

GitLab release cycle

For more information about the release process see the release documentation.

Upgrading

For upgrading information please see our update page.

Documentation

All documentation can be found on https://docs.gitlab.com.

Getting help

Please see Getting help for GitLab on our website for the many options to get help.

Why should I use GitLab?

Read why our customers choose GitLab.

grit's People

Contributors

chapados avatar cristibalan avatar davetron5000 avatar defunkt avatar dzaporozhets avatar fdiary avatar halorgium avatar hans avatar jacargentina avatar jacobvosmaer avatar js avatar maxlazio avatar mojombo avatar nathanvda avatar pda avatar peff avatar pjhyett avatar ranmocy avatar rsanheim avatar rtomayko avatar rymai avatar sbryant avatar schacon avatar shepmaster avatar technoweenie avatar therealadam avatar tmm1 avatar vmg avatar voker57 avatar xdissent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grit's Issues

Grit no longer handles binary files

b25f745 completely screwed up extraction of binary files -- I've got JPEGs that are completely mangled by this desire to "Ensure that the same encoding is returned in all cases". How is that even a good thing? My recommendation would be to completely revert that commit, it makes no sense whatsoever unless you only intend on supporting UTF-8 text (in which case, it would be best to raise an exception if you get binary data, rather than just blindly mangle it).

You are forgetting to push tags

I noticed that rubygems.org lists versions 2.6.1, 2.6.0 and 2.5.2, but the tags only go up to 2.5.1. You might consider automating the release process using bundler's rake tasks to ensure the version is tagged and pushed.

UTF-8 support

Grit currently doesn't support UTF-8:

irb(main):003:0> repo.commits.first.tree.blobs.first.name
=> "\xC4\x85"
irb(main):004:0> repo.commits.first.tree / "\xC4\x85"
=> nil

There is a patch for that in piotreq/grit.

Update mime-types to 2.4.3

Hello,

for Rails support (>=4.2.0) it would be nice if mime-types could be upgraded to version 2.4.3. It works like a charm except one minor issue with binary encoding?!

Bundler could not find compatible versions for gem "mime-types":
  In Gemfile:
    gollum_rails (~> 1.6.5) ruby depends on
      gollum-lib (~> 4.0.1) ruby depends on
        gollum-grit_adapter (>= 0.1.1, ~> 0.1) ruby depends on
          gitlab-grit (>= 2.7.1, ~> 2.7) ruby depends on
            mime-types (~> 1.15) ruby

    rails (= 4.2.0) ruby depends on
      actionmailer (= 4.2.0) ruby depends on
        mail (>= 2.5.4, ~> 2.5) ruby depends on
          mime-types (2.4.3)

Test fails at:

[ 49/215] TestEncoding#test_binary_message = 0.00 s
  1) Failure:
TestEncoding#test_binary_message [/home/fkasper/files/grit/test/test_encoding.rb:15]:
<"ASCII-8BIT"> expected but was
<"UTF-8">.

Global git color configuration breaks Grit::Repo.log()

If you have the following in your ~/.gitconfig, Grit::Repo.log() will break.

[color]
  ui = always

To reproduce:

require_relative "lib/grit.rb"

Grit.debug = true
repo = Grit::Repo.new("test/dot_git", :is_bare => true)

repo.log("master", nil, :max_count => 1)

repo.log

Which outputs/throws the following error (screenshot to show colored output):

image

Right now I've only seen it specifically happening with the log method, as it was causing Gollum to crash immediately after I started using it.

Might be wise to add --color=never to all git commands, but I'm not even sure the flag is supported by all commands.

Double backslashes when comes to ascii incompatible string.

Hi guys, when Grit tries to get diffs, and name of files in diffs contains ascii incompatible string like CJK, it would give some unexpected string, like what I did in this test .

Basically a_path/b_path will looks like "\\344\\270\\255\\346\\226\\207.txt", rather than "\344\270\255\346\226\207.txt", single backslash is convertible, double backslashes is not, Ruby consider double backslashes as escaped.

I am thinking of

$SAFE = 4
eval %Q{"#{a_path}"}

like code with safe protecting to eval this string, but I don't think it's the best solution, I don't even think this is a way of solving double backslashes, do you guys have any good ideas? Please check the test to reproduce this problem. Thanks.

GPG-signed commits throws NoMethodError

This is a recreation of issue mojombo#141.

Long story short, when signing commits with GPG grit has trouble parsing around the GPG signature in the commit and throws NoMethodError. On gitlab 5.0 this means that repos that have GPG signed commits cannot be viewed.

User alexdo wrote a patch to resolve the issue by stripping out the GPG signature from the commit.

Here's the relevant section of the traceback:

undefined method `match' for nil:NilClass
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/grit-2.5.0/lib/grit/commit.rb:286:in `actor'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/grit-2.5.0/lib/grit/commit.rb:158:in `list_from_string'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/grit-2.5.0/lib/grit/commit.rb:125:in `find_all'
/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/grit-2.5.0/lib/grit/repo.rb:381:in `commits'

Not able to support all of the git object

The commit id d9bb4be · git/git warn "unknown header ''" when I use this gem on git/git.

It is the unexpected implementation of Grit::GitRuby::Commit::from_raw in grit/lib/grit/git-ruby/git_object.rb .

require "grit"

GIT_REPO = '../git'

repo_grit   = Grit::Repo.new(GIT_REPO)
repo_grit.commit('d9bb4be53bc5185244b4be986')

output:

header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb
unknown header '' in commit d9bb4be53bc5185244b4be9860562a012803bacb

dump all_headers

[["tree", "399705cdf254f291b50418c2b1fd46586edcb145"],
 ["parent", "79fcbf7e703ca5805ebd46b2c7e09d0703f1c1ff"],
 ["parent", "1b2c79e63e5afa3cecb3ab4a40cb414dbe6511ce"],
 ["author", "Junio C Hamano <[email protected]> 1390338977 -0800"],
 ["committer", "Junio C Hamano <[email protected]> 1390338977 -0800"],
 ["mergetag", "object 1b2c79e63e5afa3cecb3ab4a40cb414dbe6511ce"],
 ["", "type commit"],
 ["", "tag gitgui-0.19.0"],
 ["", "tagger Pat Thoyts <[email protected]> 1390066238 +0000"],
 ["", ""],
 ["", "git-gui 0.19.0"],
 ["", "-----BEGIN PGP SIGNATURE-----"],
 ["", "Version: GnuPG v1.4.14 (GNU/Linux)"],
 ["", ""],
 ["", "iQCVAwUAUtq6P2B90JXwhOSJAQK3zQP/T+cOevbKCwFl9mif3EtgPgCoFS9Yd/93"],
 ["", "FYgoKxZh3t9i0Smo9EUggyEkx22v7vONwglGP1wCmCmniQRoaoTW4WBxJFJlEegt"],
 ["", "Li/7OilkwTrSgu1RFZTtpW7zYpg08YrkehFTo6Ntye5gyxZeHsmgFv56f6Ef9Egj"],
 ["", "qEf8xXLyjX4="],
 ["", "=IBoS"],
 ["", "-----END PGP SIGNATURE-----"]]

Grit::GitRuby::Internal::PackFormatError (has discontinuous index 1)

I recently started getting this error:

Started GET "/vesseltracker/vtr_weather" for 127.0.0.1 at 2013-03-17 13:53:09 +0100
Processing by ProjectsController#show as HTML
Parameters: {"id"=>"vesseltracker/vtr_weather"}
Completed 500 Internal Server Error in 26ms
Grit::GitRuby::Internal::PackFormatError (pack /home/git/repositories/vesseltracker/vtr_weather.git/objects/pack/pack-0f0743045e023e6d59ef55b70fca377494498cca.pack has discontinuous index 1):
app/models/commit.rb:22:in `find_or_first'
app/models/repository.rb:38:in `commit'
app/models/repository.rb:101:in `has_commits?'
app/models/repository.rb:107:in `empty?'
app/controllers/projects_controller.rb:60:in `block (2 levels) in show'
app/controllers/projects_controller.rb:58:in `show'

On the upstream they are having the same issue but it seems like someone solved it: mojombo#117

undefined method `>>' for "x":String

gem "grit", git: "https://github.com/gitlabhq/grit.git", ref: '7f35cb98ff17d534a07e3ce6ec3d580f67402837'

undefined method >>' for "x":String /var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/git-ruby/internal/loose.rb:108:inunpack_object_header_gently'
/var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/git-ruby/internal/loose.rb:56:in get_raw_object' /var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/git-ruby/internal/loose.rb:32:in[]'
/var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/git-ruby/repository.rb:84:in block in get_raw_object_by_sha1' /var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/git-ruby/repository.rb:83:ineach'
/var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/git-ruby/repository.rb:83:in get_raw_object_by_sha1' /var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/git-ruby/repository.rb:334:inwalk_log'
/var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/git-ruby/repository.rb:287:in log' /var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/git-ruby/repository.rb:306:inrev_list'
/var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/git-ruby.rb:70:in block in rev_list' /var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/git-ruby.rb:211:inblock in try_run'
/var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/git-ruby.rb:210:in try_run' /var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/git-ruby.rb:70:inrev_list'
/var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/commit.rb:120:in find_all' /var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/bundler/gems/grit-7f35cb98ff17/lib/grit/repo.rb:394:incommits'
/var/www/gitlab/online_20130225/app/models/commit.rb:22:in find_or_first' /var/www/gitlab/online_20130225/app/models/repository.rb:36:incommit'
/var/www/gitlab/online_20130225/app/models/repository.rb:118:in has_commits?' /var/www/gitlab/online_20130225/app/models/repository.rb:124:inempty?'
/var/www/gitlab/online_20130225/app/models/project.rb:443:in empty_repo?' /var/www/gitlab/online_20130225/lib/tasks/gitlab/check.rake:830:inblock in check_repos_post_receive_hooks_is_link'
/var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/relation/batches.rb:21:in block (2 levels) in find_each' /var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/relation/batches.rb:21:ineach'
/var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/relation/batches.rb:21:in block in find_each' /var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/relation/batches.rb:72:infind_in_batches'
/var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/relation/batches.rb:20:in find_each' /var/www/gitlab/online_20130225/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/querying.rb:8:infind_each'
/var/www/gitlab/online_20130225/lib/tasks/gitlab/check.rake:827:in check_repos_post_receive_hooks_is_link' /var/www/gitlab/online_20130225/lib/tasks/gitlab/check.rake:410:inblock (3 levels) in <top (required)>'

Grit::Repo.grep returns separated list if --\n is in file context

The search of gitlab (and almost every other thing depending on grit) could be improved,
when in lib/grit/repo.rb line 724 would be changed from

722       binary = false
723       file = ''
724        matches = filematch.split("--\n")
725        matches.each_with_index do |match, i|
726          content = []

to use a regexp instead of a string as split parameter

722       binary = false
723       file = ''
724        matches = filematch.split(/^--\n/)
725        matches.each_with_index do |match, i|
726          content = []

Error requiring grit with version 1.6.1

The latest version 1.6.1 of gitlab-grit on RubyGems.org gives the following error on require 'grit':

`read': No such file or directory - VERSION (Errno::ENOENT)

1.6.0 is working fine. Please see gollum/gollum#757 for an example with full backtrace.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.