Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 381277

Summary: Unknown file extensions result in link to Git Log in Navigator
Product: [ECD] Orion Reporter: Ken Walker <ken_walker>
Component: ClientAssignee: Malgorzata Janczarska <malgorzata.tomczyk>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: susan, Szymon.Brandys
Version: 0.4   
Target Milestone: 0.5 RC1   
Hardware: All   
OS: All   
Whiteboard:

Description Ken Walker CLA 2012-05-31 16:29:38 EDT
I was going to edit a file I created in Orion a few weeks ago.  It's an unknown extension so it used to open in the editor anyway.

Now the link provided when you click on the filename attempts to open a git log on the item even if that file is not in a Git repository.

To replicate, create a new file named "bob.adsfadsfsadf" then when you click on that new file you'll see it opens a git log.

The options for that file if you select it are Open With -> Git Log or Git Remote.
Comment 1 Ken Walker CLA 2012-05-31 16:48:30 EDT
Tried the M2 build on orionhub and it seems ok, file opens in editor.
Comment 2 Susan McCourt CLA 2012-05-31 16:56:13 EDT
There are open with commands for those files for "Git Log" and "Git Remote."
I don't see any "open with" commands in the git plugin.
But suspiciously I see two "related links" commands for log and remote that have no other properties than the id. 

So my theory is that those contributions are triggering a bug in the extension/open with processing???
Comment 3 Ken Walker CLA 2012-05-31 17:40:55 EDT
Loading various tags found the commit for NLSing plugins

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=ac0521fcf6b9c44b690ec7e48096d2c774a08356
Comment 4 Susan McCourt CLA 2012-05-31 18:04:57 EDT
so looking at those changes my best guess is that the info being accessed in the loop is not right.  around extensionCommands line 353 is

	require(['i18n!'+info.nls], function(commandMessages){

If this is an asynch call, then I think the solution is to hitch the info to the function and then refer to this.editor, etc. rather than info itself.  Not sure.
Comment 5 Malgorzata Janczarska CLA 2012-06-01 12:03:45 EDT
Susan was right, this was the problem with the changed reference in the loop. I also resulted in putting all plugged in commands in "Show In" menu. 
I passed the reference in dojo.hitch function and everything went back to normal.
Comment 6 Susan McCourt CLA 2012-06-01 12:13:02 EDT
(In reply to comment #5)
> Susan was right, this was the problem with the changed reference in the loop. I
> also resulted in putting all plugged in commands in "Show In" menu. 
> I passed the reference in dojo.hitch function and everything went back to
> normal.

There should be some famous name for the "referencing variable in a loop asynch gives you the last one" pattern.  (I've looked before and never found one, though there are tons of stackoverflow, etc. references to the symptom).  This is the most common bug I encounter in my own code.