From 2bf30fe82290e762fc7003b3227377ab6274b140 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Wed, 16 Jul 2008 09:22:01 -0400 Subject: [PATCH] cmd_switch: don't let stat differences prevent a switch Before bailing out, run update-index --refresh. This command will exit with a non-zero exit code if it finds any content changes. --- yap/yap.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yap/yap.py b/yap/yap.py index 75fe220..abafbb6 100644 --- a/yap/yap.py +++ b/yap/yap.py @@ -690,8 +690,11 @@ of history. if not ref: raise YapError("No such branch: %s" % branch) - if '-f' not in flags and (self._get_unstaged_files() or self._get_staged_files()): - raise YapError("You have uncommitted changes. Use -f to continue anyway") + if '-f' not in flags: + if (self._get_staged_files() + or (self._get_unstaged_files() + and run_command("git update-index --refresh"))): + raise YapError("You have uncommitted changes. Use -f to continue anyway") if self._get_unstaged_files() and self._get_staged_files(): raise YapError("You have staged and unstaged changes. Perhaps unstage -a?") -- 2.11.4.GIT