I have an utility in Go that runs commits checkouts via os/exec
and then does some operations on files from the commit.
I suspect that at the moment this command returns its return code:
_, err := exec.Command("git", "-C", sourceDir, "checkout", hash).Output()
The whole file tree is up to date in the folder and I can do whatever I want with the files, without the need to wait for some operations to finish in background.
What if it's a very large repository, where one commit differs much from another one and it takes time to sync deleted/added/modified files when switching from one commit to another?
Can I run my operations right after git checkout
returns 0
?