Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit69e6ce7

Browse files
committed
validate git hash as short
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent0d5bac6 commit69e6ce7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

‎src/actions/setupActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const setupActions = async ({ actions, send, path }: SetupActions): Promi
2525
constcurrentCommits:string[]=awaitgit.loadCommitHistory()
2626
for(constcommitofcommits){
2727
// validate that commit has not already been created as a safety net
28-
if(currentCommits.includes(commit)){
28+
if(currentCommits.includes(git.getShortHash(commit))){
2929
logger(`Commit${commit} already loaded`)
3030
alreadyLoaded=true
3131
continue

‎src/services/git/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import*asTTfrom'typings/tutorial'
22
import{exec,exists}from'../node'
33
importloggerfrom'../logger'
4+
import{stringify}from'querystring'
45

56
constgitOrigin='coderoad'
67

@@ -153,3 +154,9 @@ export async function loadCommitHistory(): Promise<string[]> {
153154
return[]
154155
}
155156
}
157+
158+
// return the short form of a hash (first 7 characters)
159+
// using `git rev-parse` seems unnecessarily slower
160+
exportfunctiongetShortHash(hash:string):string{
161+
returnhash.slice(0,7)
162+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp