Use --set-upstream instead of --track to set upstream on older git
Use --set-upstream instead of --track to set upstream on older git

This pull request also adds some DRY logic to reduce code duplication,
adds an additional comment to the state return data in the event that
git.checkout was run, and fixes a minor logging inaccuracy (a
str.format() placeholder was used in a string but that string did not
call .format(), so the placeholder was being logged).

Other changes:

* If a new branch needs to be checked out, a hard reset to remote_rev was
  unnecessarily being performed afterwards. This had no functional effect
  since the act of checking out the new branch will place HEAD at
  remote_rev, but the reset was still redundant.

* Also, when a new branch is being checked out, the tracking branch was
  being unnecessarily set, since the act of checking out the branch would
  setup the tracking branch if the rev being checked out is a branch.

Fixes #31229.

saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt