git-lfs/lfs
Chris Darroch ac73c0a587 lfs/gitscanner_catfilebatchcheck.go: close channel
In commit 08c5ae6c6482b6dd161bb30ea4312caa77de2326 of PR #1953 the
runCatFileBatchCheck() and runCatFileBatch() functions of the "lfs"
package were updated to write the pathspecs of locked files which are
not Git LFS pointers to a dedicated channel created by the
catFileBatchCheck() and catFileBatch() wrapper functions, respectively.

The scanRefsToChan() function, which calls both of these with a
potentially non-nil *lockableNameSet paramter (and is the only caller
to do so), starts a goroutine with an anonymous function to read any
events on the channel returned by catFileBatchCheck(), and then reads
all events on the channel returned by catFileBatch() directly.  In the
latter case, this would cause scanRefsToChan() to stall indefinitely
unless the channel is closed, so the anonymous function started by the
runCatFileBatch() function that writes to the channel always closes
the channel upon exit.

However, the anonymous function started by the runCatFileBatchCheck()
function that writes to its lock path channel does not do the same.
While this does not cause a stalled program because scanRefsToChan()
creates its own anonymous function to read from the channel, that
function will not exit until the progam stops.

By adding an explicit close() of the channel at the end of the
anonymous function started by runCatFileBatchCheck(), we can ensure
the anonymous function which reads that channel will also exit
as soon as possible.
2023-06-07 15:57:35 -07:00
..
attribute.go Add a --file option to install and uninstall 2023-05-02 14:11:27 +00:00
config_test.go Set package version to v3 2021-09-02 20:41:08 +00:00
config.go Set package version to v3 2021-09-02 20:41:08 +00:00
diff_index_scanner.go make additional message strings translatable 2022-01-29 22:36:19 -08:00
extension.go subprocess: report errors when finding executables 2022-04-19 09:45:20 -07:00
gitfilter_clean.go Set package version to v3 2021-09-02 20:41:08 +00:00
gitfilter_smudge.go tq: make Manifest an interface 2023-03-23 16:55:57 +00:00
gitfilter.go commands,git,lfs: rename left/right RefUpdate vars 2022-02-06 21:32:27 -08:00
gitscanner_catfilebatch.go update comments for catFileBatch() functions 2022-10-31 12:31:37 -07:00
gitscanner_catfilebatchcheck.go lfs/gitscanner_catfilebatchcheck.go: close channel 2023-06-07 15:57:35 -07:00
gitscanner_catfilebatchcheckscanner_test.go lfs: teach gitscanner how to emit lockable files that aren't lfs objects 2017-02-16 16:52:40 -07:00
gitscanner_index.go Set package version to v3 2021-09-02 20:41:08 +00:00
gitscanner_log.go lfs/gitscanner{_log}.go: drop unused scan arg 2023-06-07 15:57:34 -07:00
gitscanner_pointerscanner_test.go Set package version to v3 2021-09-02 20:41:08 +00:00
gitscanner_refs.go commands,lfs: simplify GitScanner upload setup 2023-06-07 15:57:35 -07:00
gitscanner_remotes.go Set package version to v3 2021-09-02 20:41:08 +00:00
gitscanner_tree.go update more comments for catFileBatch() functions 2022-10-31 22:15:22 -07:00
gitscanner.go commands,lfs: simplify GitScanner upload setup 2023-06-07 15:57:35 -07:00
hook.go hooks: mention core.hookspath instead of just .git/hooks 2023-01-05 17:08:25 +00:00
lfs_test.go Set package version to v3 2021-09-02 20:41:08 +00:00
lfs.go tq: make Manifest an interface 2023-03-23 16:55:57 +00:00
pointer_test.go Set package version to v3 2021-09-02 20:41:08 +00:00
pointer.go make additional message strings translatable 2022-01-29 22:36:19 -08:00
scanner_git_test.go commands,lfs: drop GitScanner Close() method 2023-06-07 15:57:35 -07:00
scanner_test.go Set package version to v3 2021-09-02 20:41:08 +00:00
scanner.go update comments for catFileBatch() functions 2022-10-31 12:31:37 -07:00
util_generic.go Update formatting for Go 1.17 2021-08-17 20:24:58 +02:00
util_test.go Set package version to v3 2021-09-02 20:41:08 +00:00
util.go make additional message strings translatable 2022-01-29 22:36:19 -08:00