saltstack/salt — pull request #13667 by nlm (2014-06-24 12:06:17+00:00)
Title: git_pillar: removed unnecessary loops, moved configuration check responsibility to runner

When you have multiple "git"-type ext_pillar lines in your configuration, the GitPillar object is instantiated for each line. The previous behavior of the object was to rescan the configuration, try to match itself in it, and do its work, leading to an unoptimized lookup. It also used its index in the list to compute its cache directory path.

This patch
- removes the unnecessary loop in the GitPillar object __init__ function
- relies on hashlib to generate the cache path
- gives the runner the responsibility to check if the repo/branch is in the configuration
- improves the verbosity of the runner if the repo/branch does not exist

The cache path is safe from duplicates as long as the repo/branch is unique in the configuration, which is not a problem, because if you do a duplicate, you still get what you want. If the repo/branch is a duplicate except the "root" option, it will share the same repository cache directory, which, i think, should not cause any trouble.