-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add method to get an edit link to a file
- Loading branch information
1 parent
afcf39b
commit ad02952
Showing
7 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,8 @@ t.test('string methods populate correctly', t => { | |
t.equal(parsed.hash(), '', 'hash() returns empty string when committish is unset') | ||
t.equal(parsed.ssh(), '[email protected]:foo/bar.git') | ||
t.equal(parsed.sshurl(), 'git+ssh://[email protected]/foo/bar.git') | ||
t.equal(parsed.edit(), 'https://bitbucket.org/foo/bar') | ||
t.equal(parsed.edit('/lib/index.js'), 'https://bitbucket.org/foo/bar/src/master/lib/index.js?mode=edit') | ||
t.equal(parsed.browse(), 'https://bitbucket.org/foo/bar') | ||
t.equal(parsed.browse('/lib/index.js'), 'https://bitbucket.org/foo/bar/src/master/lib/index.js') | ||
t.equal(parsed.browse('/lib/index.js', 'L100'), 'https://bitbucket.org/foo/bar/src/master/lib/index.js#l100') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -345,6 +345,8 @@ t.test('string methods populate correctly', t => { | |
t.equal(parsed.hash(), '', 'hash() returns empty string when committish is unset') | ||
t.equal(parsed.ssh(), '[email protected]:feedbeef.git') | ||
t.equal(parsed.sshurl(), 'git+ssh://[email protected]/feedbeef.git') | ||
t.equal(parsed.edit(), 'https://gist.github.com/foo/feedbeef/edit', 'gist link only redirects with a user') | ||
t.equal(parsed.edit('/lib/index.js'), 'https://gist.github.com/foo/feedbeef/edit', 'gist link only redirects with a user') | ||
t.equal(parsed.browse(), 'https://gist.github.com/feedbeef') | ||
t.equal(parsed.browse('/lib/index.js'), 'https://gist.github.com/feedbeef#file-libindex-js') | ||
t.equal(parsed.browse('/lib/index.js', 'L100'), 'https://gist.github.com/feedbeef#file-libindex-js') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,6 +230,9 @@ t.test('string methods populate correctly', t => { | |
t.equal(parsed.hash(), '', 'hash() returns empty string when committish is unset') | ||
t.equal(parsed.ssh(), '[email protected]:foo/bar.git') | ||
t.equal(parsed.sshurl(), 'git+ssh://[email protected]/foo/bar.git') | ||
t.equal(parsed.edit(), 'https://github.com/foo/bar') | ||
t.equal(parsed.edit('/lib/index.js'), 'https://github.com/foo/bar/edit/master/lib/index.js') | ||
t.equal(parsed.edit('/lib/index.js', { committish: 'docs' }), 'https://github.com/foo/bar/edit/docs/lib/index.js') | ||
t.equal(parsed.browse(), 'https://github.com/foo/bar') | ||
t.equal(parsed.browse('/lib/index.js'), 'https://github.com/foo/bar/tree/master/lib/index.js') | ||
t.equal(parsed.browse('/lib/index.js', 'L100'), 'https://github.com/foo/bar/tree/master/lib/index.js#l100') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -287,6 +287,8 @@ t.test('string methods populate correctly', t => { | |
t.equal(parsed.hash(), '', 'hash() returns empty string when committish is unset') | ||
t.equal(parsed.ssh(), '[email protected]:foo/bar.git') | ||
t.equal(parsed.sshurl(), 'git+ssh://[email protected]/foo/bar.git') | ||
t.equal(parsed.edit(), 'https://gitlab.com/foo/bar') | ||
t.equal(parsed.edit('/lib/index.js'), 'https://gitlab.com/foo/bar/-/edit/master/lib/index.js') | ||
t.equal(parsed.browse(), 'https://gitlab.com/foo/bar') | ||
t.equal(parsed.browse('/lib/index.js'), 'https://gitlab.com/foo/bar/tree/master/lib/index.js') | ||
t.equal(parsed.browse('/lib/index.js', 'L100'), 'https://gitlab.com/foo/bar/tree/master/lib/index.js#l100') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,8 @@ t.test('string methods populate correctly', t => { | |
t.equal(parsed.hash(), '', 'hash() returns empty string when committish is unset') | ||
t.equal(parsed.ssh(), '[email protected]:~foo/bar.git') | ||
t.equal(parsed.sshurl(), 'git+ssh://[email protected]/~foo/bar.git') | ||
t.equal(parsed.edit('/lib/index.js'), 'https://git.sr.ht/~foo/bar', 'no editing, link to browse') | ||
t.equal(parsed.edit(), 'https://git.sr.ht/~foo/bar', 'no editing, link to browse') | ||
t.equal(parsed.browse(), 'https://git.sr.ht/~foo/bar') | ||
t.equal(parsed.browse('/lib/index.js'), 'https://git.sr.ht/~foo/bar/tree/main/lib/index.js') | ||
t.equal( | ||
|