1
1
mirror of https://github.com/kahole/edamagit.git synced 2024-08-15 18:20:30 +03:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Kristian Andersen Hole
cc51974ce9 changelog 2024-01-18 22:25:45 +01:00
Kristian Andersen Hole
12617656c6 adds no verify switch to merging commands 2024-01-18 22:23:52 +01:00
Kristian Andersen Hole
3f66cd1cb5 check cursor-word chooseRef is actually a commit, otherwise throw away 2024-01-18 22:23:06 +01:00
Kristian Andersen Hole
153b0d6751 adds git -c diff.noprefix=false to raw commands (adressing #276) 2024-01-18 22:21:26 +01:00
8 changed files with 29 additions and 10 deletions

View File

@ -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
View File

@ -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",

View File

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

View File

@ -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);
}
}
}

View File

@ -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) {

View File

@ -18,3 +18,5 @@ export enum SemanticTokenTypes {
RemoteHeadName = 'magit-remote-head-name',
TagName = 'magit-tag-name',
}
export const GitConfigOverrideArgs = ['-c', 'diff.noprefix=false'];

View File

@ -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 {
@ -177,9 +178,9 @@ async function _exec(args: string[], options: SpawnOptions = {}): Promise<IExecu
if (pathHints.length !== 0) {
pathHints = pathHints.filter(p => path.isAbsolute(p));
}
const git = await findGit(pathHints, () => true);
const child = spawn(git.path, args, options);
const child = spawn(git.path, [...GitConfigOverrideArgs, ...args], options);
// options.onSpawn?.(child);

View File

@ -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);