[idea] File history tracking hints
- Date: Mon, 11 Sep 2017 10:11:31 +0300
- From: Pavel Kretov <firegurafiku@xxxxxxxxx>
- Subject: [idea] File history tracking hints
Excuse me if the topic I'm going to raise here has been already discussed
on the mailing list, forums, or IRC, but I couldn't find anything related.
Git, being "a stupid content tracker", doesn't try to keep an eye on
operations which happens to individual files; things like file renames
aren't recorded during commit, but heuristically detected later.
Unfortunately, the heuristic can only deal with simple file renames with
no substantial content changes; it's helpless when you:
- rename file and change it's content significantly;
- split single file into several files;
- merge several files into another;
- copy entire file from another commit, and do other things like these.
However, if we're able to preserve this information, it's possible
not only to do more accurate 'git blame', but also merge revisions with
The idea is to let user give hints about what was changed during
the commit. For example, if user did a rename which wasn't automatically
detected, he would append something like the following to his commit
Tracking-hints: rename dev-vcs/git/git-1.0.ebuild ->
or (if full paths of affected files can be unambiguously omitted):
Tracking-hints: rename git-1.0.ebuild -> git-2.0.ebuild
There may be other hint types:
Tracking-hint: recreate LICENSE.txt
Tracking-hint: split main.c -> main.c cmdline.c
Tracking-hint: merge linalg.py <- vector.py matrix.py
or even something like this:
Tracking-hint: copy json.py <-
If file transformation cannot be described by a single tracking hint, it shall
be possible to specify a sequence of hints at once:
split Utils.java -> AppHelpers.java StringHelpers.java
Note that in the above example the order of operations really matters, so
both lines have to reside in one 'Tracking-hint' block.
* * *
How do you think, is this idea worth implementing?
Any other thoughts on this?
-- Pavel Kretov.