在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:aspiers/git-deps开源软件地址:https://github.com/aspiers/git-deps开源编程语言:Python 49.3%开源软件介绍:git-deps
I have blogged about
Contents
Background theoryIt 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. CaveatIt is important to be aware that any dependency graph inferred by
MotivationSometimes 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
InstallationPlease see the UsagePlease see the Textual vs. semantic (in)dependenceAstute readers will note that textual independence as detected by
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 So in this case, 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
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 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 / feedbackPlease see the HistoryPlease see the CreditsSpecial thanks to SUSE for partially sponsoring the development of this software. Thanks also to everyone who has contributed code, bug reports, and other feedback. LicenseReleased under GPL version 2 in order to be consistent with
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论