Skip to content

Commit 2617f8e

Browse files
committed
Centralize git log duration into a shared constant and update relevant git commands
1 parent 8cea104 commit 2617f8e

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

apps/editor/src/commands/apply-context-command/sources/commit-files-source.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as fs from 'fs'
44
import { execSync } from 'child_process'
55
import { WorkspaceProvider } from '../../../context/providers/workspace/workspace-provider'
66
import { LAST_CONTEXT_MERGE_REPLACE_OPTION_STATE_KEY } from '../../../constants/state-keys'
7+
import { GIT_LOG_SINCE_DURATION } from '../../../constants/values'
78
import { get_git_repository } from '@/utils/git-repository-utils'
89
import { Logger } from '@shared/utils/logger'
910
import { dictionary } from '@shared/constants/dictionary'
@@ -24,7 +25,7 @@ export const handle_commit_files_source = async (
2425

2526
while (true) {
2627
const log_output = execSync(
27-
'git log --since="6 months ago" --pretty=format:"%H|%s|%ar"',
28+
`git log --since="${GIT_LOG_SINCE_DURATION}" --pretty=format:"%H|%s|%ar"`,
2829
{
2930
cwd: repository.rootUri.fsPath,
3031
encoding: 'utf-8'

apps/editor/src/constants/values.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export const CHECKPOINT_DEFAULT_LIFESPAN = 24
22
export const DEFAULT_CONTEXT_SIZE_WARNING_THRESHOLD = 60000
33
export const MAX_FILE_TOKENS_FOR_COMMIT_MESSAGE = 20000
44
export const MAX_PROMPT_CHARS_IN_COMMIT_MESSAGE = 1000
5+
export const GIT_LOG_SINCE_DURATION = '6 months ago'

apps/editor/src/views/panel/backend/message-handlers/handle-hash-sign-quick-pick/symbols/commit-symbol.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as vscode from 'vscode'
22
import { execSync } from 'child_process'
33
import { dictionary } from '@shared/constants/dictionary'
44
import { LAST_SELECTED_REPOSITORY_IN_SYMBOLS_QUCK_PICK_STATE_KEY } from '@/constants/state-keys'
5+
import { GIT_LOG_SINCE_DURATION } from '@/constants/values'
56

67
export const handle_commit_item = async (
78
context: vscode.ExtensionContext,
@@ -107,7 +108,7 @@ export const handle_commit_item = async (
107108
}
108109

109110
const log_output = execSync(
110-
'git log --pretty=format:"%H%n%s%n%cr" -n 50',
111+
`git log --pretty=format:"%H%n%s%n%cr" --since="${GIT_LOG_SINCE_DURATION}"`,
111112
{
112113
encoding: 'utf-8',
113114
cwd: selected_folder.uri.fsPath

0 commit comments

Comments
 (0)