Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cmd/git-sync/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ var flMaxSyncFailures = flag.Int("max-sync-failures", envInt("GIT_SYNC_MAX_SYNC_
"the number of consecutive failures allowed before aborting (the first pull must succeed)")
var flChmod = flag.Int("change-permissions", envInt("GIT_SYNC_PERMISSIONS", 0),
"the file permissions to apply to the checked-out files")
var flChown = flag.String("change-ownership", envString("GIT_SYNC_OWNER", ""),
"the owner of the checked-out files (user:group)")

var flUsername = flag.String("username", envString("GIT_SYNC_USERNAME", ""),
"the username to use")
Expand Down Expand Up @@ -325,6 +327,14 @@ func addWorktreeAndSwap(gitRoot, dest, branch, rev, hash string) error {
}
}

if *flChown != "" {
// set file owner
_, err = runCommand("", "chown", "-R", *flChown, worktreePath)
if err != nil {
return err
}
}

return updateSymlink(gitRoot, dest, worktreePath)
}

Expand Down