golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.72k stars 17.5k forks source link

x/review/git-codereview: reword doesn't work properly in alternate worktree #43695

Open thanm opened 3 years ago

thanm commented 3 years ago

What version of Go are you using (go version)?

$ go version
go version devel +9734fd482d Thu Jan 14 08:31:22 2021 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

$ git worktree list /ssd2/go bcd9ec47a1 [abi_wrap_gen] /ssd2/xgo f9fbdb4640 [dwarf_minimal_line_table] /ssd2/ygo 9734fd482d [dev.regabi] $ cd /ssd2/xgo $ git codereview reword HEAD

What did you expect to see?

Normal reword

What did you see instead?

Instead got error

git-codereview: cannot save messages: open /ssd2/xgo/.git/REWORD_MSGS: not a directory

Looks like the recipe that 'git codereview reword' is using to locate the .git dir is not correct in the presence of multiple work trees. I will send a patch.

gopherbot commented 3 years ago

Change https://golang.org/cl/283646 mentions this issue: git-codereview: fix buglet in 'reword' related to work trees

thanm commented 3 years ago

Looks like the sync-branch subcommand has the same issue (I am just now getting around to trying it). Will send a CL.