1
1
mirror of https://github.com/kahole/edamagit.git synced 2024-10-26 09:00:54 +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 # 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] ## [0.6.55]
- Fixes loss of fold functionality with CommitDetail due to overwriting the registered view - 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", "name": "magit",
"version": "0.6.55", "version": "0.6.56",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "magit", "name": "magit",
"version": "0.6.55", "version": "0.6.56",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vscode/iconv-lite-umd": "^0.7.0", "@vscode/iconv-lite-umd": "^0.7.0",

View File

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

View File

@ -1,3 +1,4 @@
import * as Constants from '../common/constants';
import { ViewColumn, window } from 'vscode'; import { ViewColumn, window } from 'vscode';
import { MenuState, MenuUtil } from '../menu/menu'; import { MenuState, MenuUtil } from '../menu/menu';
import { PickMenuUtil } from '../menu/pickMenu'; import { PickMenuUtil } from '../menu/pickMenu';
@ -195,7 +196,8 @@ async function _createBranch({ repository }: MenuState, checkout: boolean) {
return gitRun(repository.gitRepository, args); return gitRun(repository.gitRepository, args);
} else { } 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 = [ const switches = [
{ key: '-f', name: '--ff-only', description: 'Fast-forward only' }, { key: '-f', name: '--ff-only', description: 'Fast-forward only' },
{ key: '-n', name: '--no-ff', description: 'No fast-forward' }, { key: '-n', name: '--no-ff', description: 'No fast-forward' },
{ key: '-n', name: '--no-verify', description: 'Disable hooks' },
]; ];
if (repository.mergingState) { if (repository.mergingState) {

View File

@ -18,3 +18,5 @@ export enum SemanticTokenTypes {
RemoteHeadName = 'magit-remote-head-name', RemoteHeadName = 'magit-remote-head-name',
TagName = 'magit-tag-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 * as iconv from '@vscode/iconv-lite-umd';
import { dispose, IDisposable, toDisposable } from './disposable'; import { dispose, IDisposable, toDisposable } from './disposable';
import { magitConfig } from '../../extension'; import { magitConfig } from '../../extension';
import { GitConfigOverrideArgs } from '../../common/constants';
const canceledName = 'Canceled'; const canceledName = 'Canceled';
class CancellationError extends Error { class CancellationError extends Error {
@ -179,7 +180,7 @@ async function _exec(args: string[], options: SpawnOptions = {}): Promise<IExecu
} }
const git = await findGit(pathHints, () => true); const git = await findGit(pathHints, () => true);
const child = spawn(git.path, args, options); const child = spawn(git.path, [...GitConfigOverrideArgs, ...args], options);
// options.onSpawn?.(child); // options.onSpawn?.(child);

View File

@ -9,6 +9,7 @@ import { RefType, Repository } from '../typings/git';
import { PickMenuItem, PickMenuUtil } from '../menu/pickMenu'; import { PickMenuItem, PickMenuUtil } from '../menu/pickMenu';
import GitTextUtils from '../utils/gitTextUtils'; import GitTextUtils from '../utils/gitTextUtils';
import * as Constants from '../common/constants'; import * as Constants from '../common/constants';
import { getCommit } from './commitCache';
export interface Selection { export interface Selection {
key: string; 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> { 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; const activeEditor = vscode.window.activeTextEditor;
if (activeEditor === undefined) { if (activeEditor === undefined) {
return; return undefined;
} }
const document = activeEditor.document; const document = activeEditor.document;
const selection = activeEditor.selection; const selection = activeEditor.selection;
const hashWordRange = document.getWordRangeAtPosition(selection.active, /[0-9a-z]{7}/); const hashWordRange = document.getWordRangeAtPosition(selection.active, /[0-9a-z]{7}/);
if (hashWordRange === undefined) { if (hashWordRange === undefined) {
return; return undefined;
} }
const hash = document.getText(hashWordRange); const hash = document.getText(hashWordRange);
try {
await getCommit(repository.gitRepository, hash);
} catch (error) {
return undefined;
}
return { label: hash, meta: hash }; return { label: hash, meta: hash };
}; };
const refs: PickMenuItem<string>[] = []; const refs: PickMenuItem<string>[] = [];
const cursorCommitHash = getCursorCommitHash(); const cursorCommitHash = await getCursorCommitHash();
if (cursorCommitHash) { if (cursorCommitHash) {
refs.push(cursorCommitHash); refs.push(cursorCommitHash);