Re: RFC: Renaming grabbers

Ian Campbell <[email protected]> Wed, 28 Feb 2018 09:53:43 +0000
Newsgroups gmane.comp.tv.xmltv.devel
Message-ID <[email protected]>
On Tue, 2018-02-27 at 18:23 +0000, Gary Buhrmaster wrote:
> On Tue, Feb 27, 2018 at 5:44 PM, Robert Eden <[email protected]>
> wrote:
> 
> > I'm pretty sure git can move a file/folder w/o losing the history
> > (that's a
> > benefit of git)
> 
> Git tries to be smart about such things, but for those
> that do not want to remember the three commands
> to do it (mv; git-rm; git-add), there is always git-mv
> (a convenience function).

Even with `git mv` renames are not something which is explicitly stored
in the repo/metadata, it is just a presentation (`git log`, `git show`)
layer thing which notices that an add and delete match within some
percentage  (default 50%, controlled with the -M flag). The same is
true for copy detection (-C flag).

Tools like `git log` also need an explicit `--follow` to make them
follow renames and this only works when showing the log for a single
file, so not a directory.

For the purposes of looking at an old grabber (or really any file), if
you know it was removed in v1.(X+1) and present in v1.X then `git show
v1.X:path/to/it` will show the named file as of that tag (or replace
v1.X with any commit sha1).

If you remember the path then `git log -- path/to/it` will also work
even if `path/to/it` doesn't exist in the current tree (the `--` is
there to force `git` to interpret it as a path and not as commit or
branch reference which would come before the `--`, normally `git` uses
existence of the file as an heuristic to figure out which one you
meant)

While git certainly has its quirks and sharp corners I don't think the
basics of this particular aspect of it is any different to most VCSs. Personally I don't buy the notion of keeping Attic directories around because it's too hard to find things in the VCS history, but I'm not a maintainer so who cares what I think ;-)

Ian.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot