Diff view: include boundary commits.
In a nearly empty repo, you want to include the boundary commits for the
diff view list commit list.
diff --git a/git_tools/git_tools.go b/git_tools/git_tools.go
index eb91ae4..242a8de 100644
--- a/git_tools/git_tools.go
+++ b/git_tools/git_tools.go
@@ -258,7 +258,7 @@
}
// Use the determined range with the specified format for easy parsing
- cmd := exec.Command("git", "-C", repoDir, "log", "-n", "1000", "--oneline", "--decorate", "--pretty=%H%x00%s%x00%d", fromRange)
+ cmd := exec.Command("git", "-C", repoDir, "log", "--boundary", "-n", "1000", "--oneline", "--decorate", "--pretty=%H%x00%s%x00%d", fromRange)
out, err := cmd.CombinedOutput()
if err != nil {
return nil, fmt.Errorf("error executing git log: %w - %s", err, string(out))
diff --git a/git_tools/git_tools_test.go b/git_tools/git_tools_test.go
index e26af43..4c67ec7 100644
--- a/git_tools/git_tools_test.go
+++ b/git_tools/git_tools_test.go
@@ -284,11 +284,11 @@
}
// No need to check specific entries in order
- // Just validate we can find the second and third commits we created
+ // Just validate we can find all commits (including boundary commit)
// Verify that we have the correct behavior with the fromCommit parameter:
- // 1. We should find the second and third commits
- // 2. We should NOT find the initial commit (it should be excluded)
+ // With --boundary flag, we should find all commits including the boundary (initial) commit
+ // 1. We should find the initial, second and third commits
foundThird := false
foundSecond := false
foundInitial := false
@@ -309,8 +309,8 @@
if !foundSecond {
t.Errorf("Expected to find 'Second commit' in log entries")
}
- if foundInitial {
- t.Errorf("Should NOT have found 'Initial commit' in log entries (fromCommit parameter should exclude it)")
+ if !foundInitial {
+ t.Errorf("Expected to find 'Initial commit' in log entries (--boundary flag should include it)")
}
}