Skip to content

Commit efc693b

Browse files
committed
fix leading slash
1 parent 402ead2 commit efc693b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

GitContentSearch/GitHelper.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ public string GetCommitTime(string commitHash)
4141

4242
public void RunGitShow(string commit, string filePath, string outputFile)
4343
{
44+
// Ensure the file path is properly formatted for Git
45+
if (filePath.StartsWith("/"))
46+
{
47+
filePath = filePath.Substring(1); // Remove the leading slash if it exists
48+
}
49+
4450
string quotedFilePath = $"\"{filePath}\"";
4551

4652
var startInfo = new ProcessStartInfo

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ cd /path/to/your/git/repository
6868
GitContentSearch.exe <file-path> <search-string> [--earliest-commit=<commit>] [--latest-commit=<commit>]
6969
```
7070
71+
Note: Make sure the file path does not start with a forward slash (/), as this can cause errors when Git tries to locate the file.
72+
7173
### Arguments
7274
7375
* `<file-path>`: The path to the Content file within the Git repository.

0 commit comments

Comments
 (0)