git cl: fix a bug that may output stale upstream branch
git cl upstream will run `git branch --set-upstream-to xxx` command which modifies the git config. However, it doesn't invalidate config cache. I think an ideal fix would be the git scm exposes method to invalidate cache and the caller of git command needs to explicitly invalidate the cache right after git command invocation. However, I decide to take a "clever" approach here because this seems to be the only place in git cl that requires explicit cache eviction. It may not be worth to expose the existence of cache just for this reason. The "clever" approach swaps the order of subseqent config modification and config reading. The config modification will always invalidate the cache. Therefore, It will ensure we are always reading up-to-date upstream branch name from the fresh config cahce. Bug: 40942309 Change-Id: I3786fd37799092ce269c7c4d3945c51d077335cb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5479950 Reviewed-by: Josip Sokcevic <sokcevic@chromium.org> Commit-Queue: Yiwei Zhang <yiwzhang@google.com>changes/50/5479950/2
parent
b0e9b98aef
commit
85e409e69a
Loading…
Reference in New Issue