macgitver / MacGitverModules

DEPRECATED: Modules for MacGitver
5 stars 1 forks source link

migrate refitem to use RM::Ref #98

Closed antis81 closed 9 years ago

antis81 commented 9 years ago

The member RefBranch->mRef was a Git::Reference before. This is replaced now completely with a simple pointer to the valid RM::Ref. To avoid confusion I renamed the member to mRefInfo.

Known Bugs, that should be fixed, before the this PR is merged:

Here's a visual example, of how that currently looks: mgv-migrate-refitem

scunz commented 9 years ago

Did I make wrong naming decisions when I wrote the reference name analyser or did you confuse the concept of namespaces with scopes? Or maybe both? Will check that :)

antis81 commented 9 years ago

I remember we had once a really big discussion about this ... :). In general the names "namespace" and "scope" are historical. At the time I wrote the RefItem code, I didn't know about the namespacing mechanism in Git - the world was simple :).

In the MGV-Module RefsViews we currently have two classes relevant to this topic:

  1. RefScope
  2. RefNamespace

As Git::RefName uses similar names, these names became ambiguous and cannot be translated 1:1.

Another problem: Both classes are technically 100% identical. They just serve different appearance purposes (display roles). I'll leave this fact aside and go straight forward to get the names clear once and for all.

Let's rename the classes to their meaning:

Now it is more clear: Both classes have nothing in common with a "scope" or "namespace" from Git::RefName! Actually a FolderItem can contain one of both.

Let's further simplify it: The HeaderItem has a static name and groups references of the same type. So, for this topic, we don't need that and only talk about the FolderItem, which is built out of the reference shorthand path.

Here I had two problems: When I understand Git::RefName::scopes() right, this list should be the separated shorthand path without the reference name. Seems like this is not implemented though and Git::RefName::scopes() is always empty. @scunz Could you check that, please?

Now why did I do the Git::RefName::namespaces() thing? Simple, because Git::RefName::shorthand() gives me an empty list, if Git::RefName::isNamespaced() == true.

Hope this "explanation" helps. Actually I plan to at least rename the RefItem classes here to remove the ubiquitous confusion with those names.

scunz commented 9 years ago

Let me have my try with this code. I've actually refactored a lot already.

antis81 commented 9 years ago

I'll close this PR, as the implementation in #99 has quite some advantages compared to this. The idea is pretty much the same and I don't want to produce just work :).