Skip to content

Commit

Permalink
Adds the option to change the length of the abbreviated commit SHA.
Browse files Browse the repository at this point in the history
  • Loading branch information
skybldev authored and eamodio committed Jan 8, 2019
1 parent 4816809 commit 6a5e001
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,8 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
### Advanced Settings [#](#advanced-settings- 'Advanced Settings')

| Name | Description |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------|
| `gitlens.advanced.abbreviatedShaLength` | Specifies the length of the abbreviated commit SHA (a.k.a. commit ID). Default is 7.
| `gitlens.advanced.blame.customArguments` | Specifies additional arguments to pass to the `git blame` command |
| `gitlens.advanced.blame.delayAfterEdit` | Specifies the time (in milliseconds) to wait before re-blaming an unsaved document after an edit. Use 0 to specify an infinite wait |
| `gitlens.advanced.blame.sizeThresholdAfterEdit` | Specifies the maximum document size (in lines) allowed to be re-blamed after an edit while still unsaved. Use 0 to specify no maximum |
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,12 @@
"markdownDescription": "Specifies the description format of the status of a working or committed file in the views\n- Available tokens\n - `${directory}` — directory name\n - `${file}` — file name\n - `${filePath}` — formatted file name and path\n - `${path}` — full file path\n - `${working}` — optional indicator if the file is uncommitted",
"scope": "window"
},
"gitlens.advanced.abbreviatedShaLength": {
"type": "number",
"default": "7",
"markdownDescription": "Specifies the length of the abbreviated commit SHA (a.k.a. commit ID). Default is 7.",
"scope": "window"
},
"gitlens.advanced.blame.customArguments": {
"type": "array",
"default": null,
Expand Down
4 changes: 2 additions & 2 deletions src/git/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ export class Git {
if (index > 5) {
// Only grab a max of 5 chars for the suffix
const suffix = ref.substring(index).substring(0, 5);
return `${ref.substring(0, 7 - suffix.length)}${suffix}`;
return `${ref.substring(0, Container.config.advanced.abbreviatedShaLength - suffix.length)}${suffix}`;
}
return ref.substring(0, 7);
return ref.substring(0, Container.config.advanced.abbreviatedShaLength);
}

static splitPath(fileName: string, repoPath: string | undefined, extract: boolean = true): [string, string] {
Expand Down
1 change: 1 addition & 0 deletions src/ui/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export enum ViewFilesLayout {
}

export interface AdvancedConfig {
abbreviatedShaLength: number;
blame: {
customArguments: string[] | null;
delayAfterEdit: number;
Expand Down

0 comments on commit 6a5e001

Please sign in to comment.