• Stars
    star
    291
  • Rank 137,866 (Top 3 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 9 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

git commit dependency analysis tool

Code Climate

git-deps

git-deps is a tool for performing automatic analysis of dependencies between commits in a git repository. Here's a screencast demonstration:

YouTube screencast

I have blogged about git-deps and related tools, and also publically spoken about the tool several times:

Contents

Background theory

It is fairly clear that two git commits within a single repo can be considered "independent" from each other in a certain sense, if they do not change the same files, or if they do not change overlapping parts of the same file(s).

In contrast, when a commit changes a line, it is "dependent" on not only the commit which last changed that line, but also any commits which were responsible for providing the surrounding lines of context, because without those previous versions of the line and its context, the commit's diff might not cleanly apply (depending on how it's being applied, of course). So all dependencies of a commit can be programmatically inferred by running git-blame on the lines the commit changes, plus however many lines of context make sense for the use case of this particular dependency analysis.

Therefore the dependency calculation is impacted by a "fuzz" factor parameter (c.f. patch(1)), i.e. the number of lines of context which are considered necessary for the commit's diff to cleanly apply.

As with many dependency relationships, these dependencies form edges in a DAG (directed acyclic graph) whose nodes correspond to commits. Note that a node can only depend on a subset of its ancestors.

Caveat

It is important to be aware that any dependency graph inferred by git-deps may be semantically incomplete; for example it would not auto-detect dependencies between a commit A which changes code and another commit B which changes documentation or tests to reflect the code changes in commit A. Therefore git-deps should not be used with blind faith. For more details, see the section on Textual vs. semantic (in)dependence below.

Motivation

Sometimes it is useful to understand the nature of parts of this dependency graph, as its nature will impact the success or failure of operations including merge, rebase, cherry-pick etc. Please see the USE-CASES.md file for more details.

Installation

Please see the INSTALL.md file.

Usage

Please see the USAGE.md file.

Textual vs. semantic (in)dependence

Astute readers will note that textual independence as detected by git-deps is not the same as semantic / logical independence. Textual independence means that the changes can be applied in any order without incurring conflicts, but this is not a reliable indicator of logical independence.

For example a change to a function and corresponding changes to the tests and/or documentation for that function would typically exist in different files. So if those changes were in separate commits within a branch, running git-deps on the commits would not detect any dependency between them even though they are logically related, because changes in different files (or even in different areas of the same files) are textually independent.

So in this case, git-deps would not behave exactly how we might want. And for as long as AI is an unsolved problem, it is very unlikely that it will ever develop totally reliable behaviour. So does that mean git-deps is useless? Absolutely not!

Firstly, when best practices for commit structuring are adhered to, changes which are strongly logically related should be placed within the same commit anyway. So in the example above, a change to a function and corresponding changes to the tests and/or documentation for that function should all be within a single commit. (Although this is not the only valid approach; for a more advanced meta-history grouping mechanism, see git-dendrify.)

Secondly, whilst textual independence does not imply logical independence, the converse is expected to be more commonly true: logical independence often implies textual independence (or stated another way, textual dependence often implies logical dependence). So while it might not be too uncommon for git-deps to fail to detect the dependency between logically-related changes, it should be rarer that it incorrectly infers a dependency between logically unrelated changes. In other words, its false negatives are generally expected to be more common than its false positives. As a result it is likely to be more useful in determining a lower bound on dependencies than an upper bound. Having said that, more research is needed on this.

Thirdly, it is often unhelpful to allow the quest for the perfect become the enemy of the good - a tool does not have to be perfect to be useful; it only has to be better than performing the same task without the tool.

Further discussion on some of these points can be found in an old thread from the git mailing list.

Ultimately though, "the proof is in the pudding", so try it out and see!

Development / support / feedback

Please see the CONTRIBUTING.md file.

History

Please see the HISTORY.md file.

Credits

Special thanks to SUSE for partially sponsoring the development of this software. Thanks also to everyone who has contributed code, bug reports, and other feedback.

License

Released under GPL version 2 in order to be consistent with git's license, but I'm open to the idea of dual-licensing if there's a convincing reason.

More Repositories

1

stow

GNU Stow - mirror of savannah git repository occasionally with more bleeding-edge branches
Perl
429
star
2

ly2video

generating videos from LilyPond projects
Python
130
star
3

mysqldiff

tool and CPAN suite backend for comparing MySQL database schemas
Perl
125
star
4

shell-env

Adam's shell environment (bash/zsh) including a bunch of handy home-made utilities
Shell
117
star
5

smooth-scrolling

Emacs smooth scrolling package
Emacs Lisp
107
star
6

git-config

Adam's git shortcuts and environment. Designed to be stowed to ~ using GNU Stow.
Shell
88
star
7

opensuse-spotify-installer

Automate installation of Spotify on openSUSE
Shell
78
star
8

etrace

Emacs Lisp Latency Tracing for the Chromium Catapult Trace Event Format
Emacs Lisp
67
star
9

git-explode

Explode linear sequence of git commits into topic branches
Python
46
star
10

ansible-viz

Graph relationships between Ansible playbooks / roles / tasks / vars etc. via static analysis
Ruby
40
star
11

book-indices

Indices for music books
24
star
12

mr-config

Adam's mr config
Shell
21
star
13

zkp-eddsa-point-doubler

Zero Knowledge proof for point doubling on baby JubJub elliptic curve, using Zokrates
Shell
12
star
14

orgmode

personal repository for patches to orgmode upstream
Emacs Lisp
11
star
15

lilypond

Friendly fork of GNU Lilypond
C++
11
star
16

emacs

Adam's emacs config
Emacs Lisp
10
star
17

lnav-formats

Extra log file format descriptions for the lnav log file reader
9
star
18

worg

Adam's personal mirror of Worg - user documentation of orgmode for emacs
Emacs Lisp
7
star
19

SUSE-dist

SUSE-specific utilities and miscellany
Perl
7
star
20

desktop-config

Set up Adam's Xorg desktop the way he likes it
Shell
7
star
21

mutt

a set of generic configuration files for mutt
Perl
7
star
22

migrationpaths

implementation of VM migration path-finding algorithm
Python
7
star
23

vc-osc

osc backend for emacs vc mode
Emacs Lisp
6
star
24

ssh-config

Adam's openssh public config and helper scripts
Shell
6
star
25

screenrc

Adam's config for GNU Screen and tmux
Shell
5
star
26

guard-sclang

Guard plugin for automatic testing of SuperCollider code
Ruby
5
star
27

linear-analysis

Analysis of linear.app issues
TypeScript
3
star
28

shell-vars-to-ruby

solution to http://stackoverflow.com/questions/11956850/read-all-shell-variables-in-ruby
Ruby
3
star
29

PDFexploder

Tools for exploding PDFs into fragments based on an index
Ruby
3
star
30

ruby-harmony

Music harmony theory, in Ruby!
Ruby
2
star
31

list-utils

Utilities relating to mailing lists, NNTP, groups etc.
Python
2
star
32

mutt.pub

Configuration files for mutt specifically written for use by me (Adam), but shared publically for interest.
Shell
2
star
33

Finance-Bank-LloydsTSB

CPAN module suite providing a rudimentary interface to the LloydsTSB online banking system at https://online.lloydstsb.co.uk/
Perl
2
star
34

Discord-custom-nicks-userscript

Browser userscript for assigning custom nicknames to users client-side
JavaScript
2
star
35

rpm

tools related to rpm
Shell
1
star
36

rolod0x

TypeScript
1
star
37

cfgctl

Utility for managing config repositories
Perl
1
star
38

zmk-config

1
star
39

openstack-day-israel-2017-compute-ha

Presentation on upstream compute HA for OpenStack Day Israel 2017
CSS
1
star
40

github-notifications

Utility for marking github notifications as read via mail clients
Ruby
1
star
41

ET-reporting

Ruby
1
star
42

mscore-groove

Groove plugin for MuseScore
Jupyter Notebook
1
star
43

ANTIFOLD

ugly hack to prevent GNU Stow from folding certain directories under $HOME
Shell
1
star
44

compute-ha-presentation

Presentation on compute HA for OpenStack
CSS
1
star
45

obs-service-tar_scm.historic

Python
1
star
46

etheriopia

Browser userscript to fix two bugs with Twitter
JavaScript
1
star