Skip to content

Commit 90a08bd

Browse files
hsbtclaude
andcommitted
Use absolute git dir and refs/heads/ for branch verification
Address review feedback: use --absolute-git-dir instead of --git-dir to avoid CWD-dependent relative paths, and verify refs/heads/<name> instead of bare branch names to avoid matching tags with the same name. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9f51df0 commit 90a08bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tool/release.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def prepare!
231231
end
232232

233233
def check_git_state!
234-
git_dir = `git rev-parse --git-dir`.strip
234+
git_dir = `git rev-parse --absolute-git-dir`.strip
235235
errors = []
236236

237237
if File.exist?(File.join(git_dir, "index.lock"))
@@ -248,7 +248,7 @@ def check_git_state!
248248

249249
branches = [@release_branch]
250250
branches << "cherry_pick_changelogs" unless @prerelease
251-
existing = branches.select {|b| system("git", "rev-parse", "--verify", b, out: IO::NULL, err: IO::NULL) }
251+
existing = branches.select {|b| system("git", "rev-parse", "--verify", "refs/heads/#{b}", out: IO::NULL, err: IO::NULL) }
252252
unless existing.empty?
253253
errors << "Release branches already exist: #{existing.join(", ")}. Please delete them before running this task."
254254
end

0 commit comments

Comments
 (0)