Skip to content

Commit 2d24031

Browse files
committed
Revert latest broken merge
1 parent 1646d8e commit 2d24031

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Open in GitHub / Bitbucket / VisualStudio.com !",
44
"description": "Jump to a source code line in Github / Bitbucket / VisualStudio.com !",
55
"icon": "images/icon_200.png",
6-
"version": "1.1.0",
6+
"version": "1.1.2",
77
"publisher": "ziyasal",
88
"license": "SEE LICENSE IN LICENSE.md",
99
"galleryBanner": {

src/extension.js

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,12 @@ var parse = require('github-url-from-git');
1414
var open = require('open');
1515
var copy = require('copy-paste').copy
1616
var gitRev = require('git-rev-2');
17-
var process = require('child_process');
1817

1918
function getGitHubLink(cb) {
2019
var cwd = workspace.rootPath;
21-
var repoRootDirectory = null;
22-
var repoRelativePath = "";
23-
24-
try {
25-
// determine the associated git repo: if cwd is not a git repo, we will search up until we find one
26-
repoRootDirectory = process.execSync('git rev-parse --show-toplevel', { cwd: cwd }).toString().replace('\n','');
27-
// if repo root is not cwd, repoRelativePath will be the path relative path to get from repo root to workspace root
28-
repoRelativePath = cwd.replace(repoRootDirectory, "");
29-
} catch (ex) {
30-
// error: just use cwd
31-
repoRootDirectory = cwd;
32-
}
3320

3421
git({
35-
cwd: repoRootDirectory
22+
cwd: cwd
3623
}, function (err, config) {
3724
var rawUri, parseOpts, lineIndex = 0, parsedUri, branch, editor, selection
3825
, projectName, subdir, gitLink, scUrls, workspaceConfiguration;
@@ -59,7 +46,7 @@ function getGitHubLink(cb) {
5946
parsedUri = rawUri;
6047
}
6148

62-
gitRev.branch(repoRootDirectory, function (branchErr, branch) {
49+
gitRev.branch( cwd, function (branchErr, branch) {
6350
if (branchErr || !branch)
6451
branch = 'master';
6552
editor = Window.activeTextEditor;
@@ -69,7 +56,7 @@ function getGitHubLink(cb) {
6956
lineIndex = selection.active.line + 1;
7057
projectName = parsedUri.substring(parsedUri.lastIndexOf("/") + 1, parsedUri.length);
7158

72-
subdir = repoRelativePath + editor.document.uri.fsPath.substring(workspace.rootPath.length).replace(/\"/g, "");
59+
subdir = editor.document.uri.fsPath.substring(workspace.rootPath.length).replace(/\"/g, "");
7360

7461
if (parsedUri.startsWith(scUrls.github)) {
7562
gitLink = parsedUri + "/blob/" + branch + subdir + "#L" + lineIndex;

0 commit comments

Comments
 (0)