Coder Social home page Coder Social logo

git-related's Introduction

This tool finds people that might be interested in a patch series, by going back through the history of each single hunk modified, and finding authored the code the patch is modifying.

It does this by running git blame incrementally on each hunk, and finding the relevant commits. The relevant commits are counted for each person, and people are only displayed if they pass a minimum threshold of participation.

For example:

% git related master..topic
  Felipe Contreras <[email protected]> (25%)
  Sverre Rabbelier <[email protected]> (17%)
  Elijah Newren <[email protected]> (10%)
  Jeff King <[email protected]> (10%)
  Shawn O. Pearce <[email protected]> (5%)

Additionally, it’s able to parse commit trailers (e.g. Signed-off-by, Reviewed-by), and group the roles of each person.

For example:

% git related --roles master..topic
  Junio C Hamano <[email protected]> (signer: 90%, author: 5%)
  Felipe Contreras <[email protected]> (author: 25%, reviewer: 2%)
  Sverre Rabbelier <[email protected]> (author: 17%, acker: 2%, signer: 7%)
  Jeff King <[email protected]> (acker: 17%, author: 10%)
  Shawn O. Pearce <[email protected]> (author: 5%, signer: 2%, observer: 2%)
  Elijah Newren <[email protected]> (author: 10%)

Moreover, it has an option to output the list of commits, instead of the contributors, which allows you to easily find out the previous changes to the lines your patches modify.

% git related --commits master..topic
  99d9ec0 Merge branch 'fc/transport-helper-no-refspec'
  67c9c78 transport-helper: barf when user tries old:new
  0460ed2 documentation: trivial style cleanups
  126aac5 transport-helper: fix remote helper namespace regression
  21610d8 transport-helper: clarify pushing without refspecs
  a93b4a0 transport-helper: warn when refspec is not used
  664059f transport-helper: update remote helper namespace
  c4458ec fast-export: Allow pruned-references in mark file
  ...

Plus, when sending patches for review, you can configure git send-email to use git related to find relevant people that should be cc’ed:

% git send-email --cc-cmd='git related' *.patch

git-who

A very similar tool but it gathers all commits, not just the ones related to a branch.

You can specify a file, directory, or pathspec, just like with git log.

If nothing is specified, it lists all the people that have had a role in the whole tree.

% git who -- lib/

Installation

Install the parseopt gem:

% gem install parseopt

Then simply copy the script anywhere in your $PATH and make it executable, or run make install which will install it by default to your ~/bin/ directory (make sure it’s in your $PATH).

git-related's People

Contributors

felipec avatar m007 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

git-related's Issues

Syntax errors

Hi,

I just cloned and installed git-related and upon executing it, I always get

git related
/home/me/bin/git-related:258: syntax error, unexpected ']'
      $base_rev = revs[1][1..]
                             ^
/home/me/bin/git-related:326: syntax error, unexpected end-of-input, expecting keyword_end

My Ruby version is

ruby --version
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-gnu]

Any idea as to what the problem is?

UTF-8 issues with invalid byte sequences.

Some authors with umlaut letters in their names can get author details in git blame containing invalid UTF-8, specifically if they're on strange systems like windows.
By doing line.encode! :invalid=>:replace before trying to match strings in get_blame, I've personally managed to get around that issue, but that might not be a useful fix for everyone. Anyhow, just a heads up. :)

Syntax error on 1.9.3

Most OSes ship with older versions of ruby - it would be good to make this work out of the box for people without ruby 2.

$ git related master
/Users/danielheath/.bin/git-related:71: syntax error, unexpected tLABEL
def on(short = nil, long = nil, help: nil, &block)
^
/Users/danielheath/.bin/git-related:71: Can't assign to nil
def on(short = nil, long = nil, help: nil, &block)
^

Bug in range definition (maybe?)

I recently got an error out of git blame (I think)

fatal: no such path L in <arbitrary-commit-sha-out-of-the-defined-range>~

after executing

git related --roles <commit-sha-1>..<commit-sha-2>

What makes me think it is an issue with git blame is this line. But I do literally do have zero experience with ruby so I'm stuck in tracking the issue down to the real cause.

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.