mirror of
https://github.com/kahole/edamagit.git
synced 2024-09-11 07:15:31 +03:00
Compare commits
4 Commits
f026de4e19
...
cc51974ce9
Author | SHA1 | Date | |
---|---|---|---|
|
cc51974ce9 | ||
|
12617656c6 | ||
|
3f66cd1cb5 | ||
|
153b0d6751 |
@ -1,5 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
## [0.6.56]
|
||||
- adds `git -c diff.noprefix=false` to raw commands (adressing #276)
|
||||
- check cursor-word chooseRef is actually a commit, otherwise throw away
|
||||
- develop adds `no verify` switch to merging commands
|
||||
|
||||
## [0.6.55]
|
||||
- Fixes loss of fold functionality with CommitDetail due to overwriting the registered view
|
||||
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "magit",
|
||||
"version": "0.6.55",
|
||||
"version": "0.6.56",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "magit",
|
||||
"version": "0.6.55",
|
||||
"version": "0.6.56",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vscode/iconv-lite-umd": "^0.7.0",
|
||||
|
@ -7,7 +7,7 @@
|
||||
"author": {
|
||||
"name": "Kristian Andersen Hole"
|
||||
},
|
||||
"version": "0.6.55",
|
||||
"version": "0.6.56",
|
||||
"engines": {
|
||||
"vscode": "^1.50.0"
|
||||
},
|
||||
|
@ -1,3 +1,4 @@
|
||||
import * as Constants from '../common/constants';
|
||||
import { ViewColumn, window } from 'vscode';
|
||||
import { MenuState, MenuUtil } from '../menu/menu';
|
||||
import { PickMenuUtil } from '../menu/pickMenu';
|
||||
@ -195,7 +196,8 @@ async function _createBranch({ repository }: MenuState, checkout: boolean) {
|
||||
return gitRun(repository.gitRepository, args);
|
||||
|
||||
} else {
|
||||
throw new Error('No name given for new branch');
|
||||
|
||||
window.setStatusBarMessage('No name given for new branch', Constants.StatusMessageDisplayTimeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ export async function merging(repository: MagitRepository) {
|
||||
const switches = [
|
||||
{ key: '-f', name: '--ff-only', description: 'Fast-forward only' },
|
||||
{ key: '-n', name: '--no-ff', description: 'No fast-forward' },
|
||||
{ key: '-n', name: '--no-verify', description: 'Disable hooks' },
|
||||
];
|
||||
|
||||
if (repository.mergingState) {
|
||||
|
@ -18,3 +18,5 @@ export enum SemanticTokenTypes {
|
||||
RemoteHeadName = 'magit-remote-head-name',
|
||||
TagName = 'magit-tag-name',
|
||||
}
|
||||
|
||||
export const GitConfigOverrideArgs = ['-c', 'diff.noprefix=false'];
|
@ -5,6 +5,7 @@ import { findGit } from './findGit';
|
||||
import * as iconv from '@vscode/iconv-lite-umd';
|
||||
import { dispose, IDisposable, toDisposable } from './disposable';
|
||||
import { magitConfig } from '../../extension';
|
||||
import { GitConfigOverrideArgs } from '../../common/constants';
|
||||
|
||||
const canceledName = 'Canceled';
|
||||
class CancellationError extends Error {
|
||||
@ -179,7 +180,7 @@ async function _exec(args: string[], options: SpawnOptions = {}): Promise<IExecu
|
||||
}
|
||||
|
||||
const git = await findGit(pathHints, () => true);
|
||||
const child = spawn(git.path, args, options);
|
||||
const child = spawn(git.path, [...GitConfigOverrideArgs, ...args], options);
|
||||
|
||||
// options.onSpawn?.(child);
|
||||
|
||||
|
@ -9,6 +9,7 @@ import { RefType, Repository } from '../typings/git';
|
||||
import { PickMenuItem, PickMenuUtil } from '../menu/pickMenu';
|
||||
import GitTextUtils from '../utils/gitTextUtils';
|
||||
import * as Constants from '../common/constants';
|
||||
import { getCommit } from './commitCache';
|
||||
|
||||
export interface Selection {
|
||||
key: string;
|
||||
@ -150,24 +151,31 @@ export default class MagitUtils {
|
||||
|
||||
public static async chooseRef(repository: MagitRepository, prompt: string, showCurrent = false, showHEAD = false, allowFreeform = true, remoteOnly = false): Promise<string> {
|
||||
|
||||
const getCursorCommitHash: () => PickMenuItem<string> | undefined = () => {
|
||||
const getCursorCommitHash: () => Promise<PickMenuItem<string> | undefined> = async () => {
|
||||
const activeEditor = vscode.window.activeTextEditor;
|
||||
if (activeEditor === undefined) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
const document = activeEditor.document;
|
||||
const selection = activeEditor.selection;
|
||||
const hashWordRange = document.getWordRangeAtPosition(selection.active, /[0-9a-z]{7}/);
|
||||
if (hashWordRange === undefined) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
const hash = document.getText(hashWordRange);
|
||||
|
||||
try {
|
||||
await getCommit(repository.gitRepository, hash);
|
||||
} catch (error) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return { label: hash, meta: hash };
|
||||
};
|
||||
|
||||
const refs: PickMenuItem<string>[] = [];
|
||||
|
||||
const cursorCommitHash = getCursorCommitHash();
|
||||
const cursorCommitHash = await getCursorCommitHash();
|
||||
|
||||
if (cursorCommitHash) {
|
||||
refs.push(cursorCommitHash);
|
||||
|
Loading…
Reference in New Issue
Block a user