Giter VIP home page Giter VIP logo

Comments (8)

KnisterPeter avatar KnisterPeter commented on June 15, 2024 2

Ah, I've found it (long time ago that I've written and used it).
Here you have the function which does it:

async function conditionallyStageFiles(cwd: string): Promise<void> {
const hasSmartCommitEnabled =
vscode.workspace
.getConfiguration('git')
.get<boolean>('enableSmartCommit') === true;
if (hasSmartCommitEnabled && !(await hasStagedFiles(cwd))) {
channel.appendLine(
'Staging all files (enableSmartCommit enabled with nothing staged)'
);
await vscode.commands.executeCommand('git.stageAll');
}
}
async function hasStagedFiles(cwd: string): Promise<boolean> {
const result = await execa('git', ['diff', '--name-only', '--cached'], {
cwd
});
return hasOutput(result);
}

It is the git.stageAll command provided by vscode. If you disable 'enableSmartCommit' this will not happen.

from vscode-commitizen.

KnisterPeter avatar KnisterPeter commented on June 15, 2024 1

@LongYue9608 Did that help you?

from vscode-commitizen.

KnisterPeter avatar KnisterPeter commented on June 15, 2024

@LongYue9608 I don't understand this question. Please be a bit more specific and add more details to your request

from vscode-commitizen.

LongYue9608 avatar LongYue9608 commented on June 15, 2024
  1. git add . or git add -A
  2. git commit -m'xxxx'
  3. git push
    The plug-in helped us to do the first step and the first step,I want to know which command is the first step in the plug-in。
    git add . or git add -A
    @KnisterPeter

from vscode-commitizen.

KnisterPeter avatar KnisterPeter commented on June 15, 2024

@LongYue9608 Neither nor. This extension just runs git commit when you call it's commitizen command.
You need to add and prepare your git stage on your own. vscode is already quite good at that.

from vscode-commitizen.

LongYue9608 avatar LongYue9608 commented on June 15, 2024

I'm just confused that when I add a new file and run the plug-in, I can directly commit without git add @KnisterPeter

from vscode-commitizen.

KnisterPeter avatar KnisterPeter commented on June 15, 2024

@LongYue9608 Not sure on your process of adding files and calling this extension.
Just be sure I wasn't wrong, I did a quick search for add which isn't called in this extension: https://github.com/KnisterPeter/vscode-commitizen/search?q=add

from vscode-commitizen.

LongYue9608 avatar LongYue9608 commented on June 15, 2024

step

Commit is not allowed if there are no files in the temporary storage area. However, when I use the plug-in, I will automatically add to the temporary storage area and commit. I want to know which command is used inside the plug-in,git add . or git add -A?I'm sorry, I just want to know that
@KnisterPeter

from vscode-commitizen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.