1
1
mirror of https://github.com/kahole/edamagit.git synced 2024-09-11 07:15:31 +03:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Kristian Andersen Hole
7d575c50be changelog 2023-12-27 11:19:14 +01:00
Kristian Andersen Hole
d438b66fd8 fix "visit change" uris for commit and stash detail views 2023-12-27 11:17:56 +01:00
5 changed files with 10 additions and 7 deletions

View File

@ -1,5 +1,8 @@
# Changelog
## [0.6.54]
- Fixes "visit change" for commit and stash detail views
## [0.6.51]
- Make commit and stash detail view update on changes (fixes #282)

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "magit",
"version": "0.6.53",
"version": "0.6.54",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "magit",
"version": "0.6.53",
"version": "0.6.54",
"license": "MIT",
"dependencies": {
"@vscode/iconv-lite-umd": "^0.7.0",

View File

@ -7,7 +7,7 @@
"author": {
"name": "Kristian Andersen Hole"
},
"version": "0.6.53",
"version": "0.6.54",
"engines": {
"vscode": "^1.50.0"
},

View File

@ -104,7 +104,7 @@ async function showStash({ repository }: MenuState) {
}
}
export function stashToMagitChanges(nameStatusText: string, diff: string): MagitChange[] {
export function stashToMagitChanges(repository: MagitRepository, nameStatusText: string, diff: string): MagitChange[] {
const DIFF_PREFIX = 'diff --git';
const filesWithStatus = nameStatusText.split(Constants.LineSplitterRegex).filter(t => t !== '').map(s => s.split('\t'));
const diffs = diff.split(DIFF_PREFIX).filter(r => r !== '');
@ -115,7 +115,7 @@ export function stashToMagitChanges(nameStatusText: string, diff: string): Magit
return diffs.map((diff, idx) => {
const [status, ...paths] = filesWithStatus[idx];
const uri = Uri.file(paths[paths.length - 1]);
const uri = Uri.from({ ...repository.gitRepository.rootUri, path: repository.gitRepository.rootUri.path + '/' + paths[paths.length - 1] });
const fileStatus = getStatusFromString(status);
return {
diff,
@ -171,7 +171,7 @@ export async function showStashDetail(repository: MagitRepository, stash: Stash)
const nameStatusText = (await nameStatusTask).stdout;
const stashDiff = (await stashShowTask).stdout;
return ViewUtils.showView(uri, new StashDetailView(uri, stash, stashToMagitChanges(nameStatusText, stashDiff), stashUntrackedFiles));
return ViewUtils.showView(uri, new StashDetailView(uri, stash, stashToMagitChanges(repository, nameStatusText, stashDiff), stashUntrackedFiles));
}
async function showCommit({ repository }: MenuState) {

View File

@ -148,5 +148,5 @@ export async function visitCommit(repository: MagitRepository, commitHash: strin
const commit: MagitCommit = { hash: commitHash, message: '', parents: [] };
const uri = CommitDetailView.encodeLocation(repository, commit.hash);
return ViewUtils.showView(uri, new CommitDetailView(uri, commit, header.stdout, stashToMagitChanges(nameStatus.stdout, diffs.stdout)));
return ViewUtils.showView(uri, new CommitDetailView(uri, commit, header.stdout, stashToMagitChanges(repository, nameStatus.stdout, diffs.stdout)));
}