This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 248594 - Absolute path of project when doing git blame makes the annotations not work
Summary: Absolute path of project when doing git blame makes the annotations not work
Status: RESOLVED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Git (show other bugs)
Version: 8.0.1
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Ondrej Vrabec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-12 10:01 UTC by SoboLAN
Modified: 2014-11-14 03:57 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SoboLAN 2014-11-12 10:01:32 UTC
Product Version: NetBeans IDE 8.0.1 (Build 201408251540)
Java: 1.7.0_17; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02
System: Windows 7 version 6.1 running on amd64

I have a project in D:\projectname that is tracked by git. I use Git 1.9.2.
Let's take for example the file D:\projectname\folder1\folder2\file.txt .

If I open it and go to Team -> Show Annotations, the left side of the editor flickers a bit and then nothing happens.

I looked at the Output window, and there it says:

==[IDE]== Nov 12, 2014 11:34:28 AM Annotating...
git blame -l -f D:\projectname\folder1\folder2\file.txt
==[IDE]== Nov 12, 2014 11:34:28 AM Annotating... finished.

I went to the command line and navigated to D:\projectname. There, I copy-pasted the "git blame" command from above. What I got was this:

fatal: 'D:\projectname\folder1\folder2\file.txt' is outside repository

Now, I tried the exact same command again, but this time with a relative path, a.k.a. like this:

git blame -l -f "folder1\folder2\file.txt"

This time it worked (annotations are shown on command line).

However, I had to put the path within quotes, because otherwise I get:

fatal: cannot stat path 'folder1\folder2\file.txt': No such file or directory

-----------------------

My guess is that, if Netbeans would use the relative path, it would work to show the annotations.

Am I doing something wrong or is this really Netbeans's fault for using absolute paths ?

If there's any more information I can provide, please let me know :) .
Comment 1 Ondrej Vrabec 2014-11-12 10:18:32 UTC
We are not using CLI but a Java implementation called JGit. The absolute path in the log is irrelevant because in fact before calling a blame we translate it to a relative one. It's most likely because of line-ending or a bug in JGit related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=374382.

Does it happen for every file? Is it reproducible on a Linux machine (if you have some in the team)? Check your core.autocrlf setting if it's correctly set to true.
Comment 2 Ondrej Vrabec 2014-11-12 10:33:30 UTC
Attempting to bypass any line-ending problem in JGit. Hope that helps.

fix: http://hg.netbeans.org/core-main/rev/2746ce3fcf95
Comment 3 SoboLAN 2014-11-12 10:42:19 UTC
You're right, apparently it's dependent on the autocrlf Git option. I opened a different repository where all the files have LF as line ending and autocrlf is set to false. In that case, it works perfectly.
Comment 4 Quality Engineering 2014-11-13 03:49:02 UTC
Integrated into 'main-silver', will be available in build *201411130002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/2746ce3fcf95
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: #248594 - Absolute path of project when doing git blame makes the annotations not work
Fetch blame information for HEAD revision, local modifications are taken into account in the after-processing anyway.
Comment 5 Quality Engineering 2014-11-14 03:57:17 UTC
Integrated into 'main-silver', will be available in build *201411140002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/2746ce3fcf95
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: #248594 - Absolute path of project when doing git blame makes the annotations not work
Fetch blame information for HEAD revision, local modifications are taken into account in the after-processing anyway.