summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-11-28 10:43:20 +0200
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-04-03 10:11:40 +0300
commit1b8e5f69a9595296338ff29b2b965338325abd56 (patch)
treefe31e4f7be95f4dd9d90e3251c8ed930b0720259
parentfd115ac9deaccc8e5bb486d2701940fc30fea58f (diff)
downloadgit-buildpackage-1b8e5f69a9595296338ff29b2b965338325abd56.tar.gz
git-buildpackage-1b8e5f69a9595296338ff29b2b965338325abd56.tar.bz2
git-buildpackage-1b8e5f69a9595296338ff29b2b965338325abd56.zip
import-orig-rpm: keep working copy in sync with branch HEAD
Update working copy and index (to branch HEAD) if we modify the currently checked-out branch. Otherwise the repository is left in unclean state when the current branch is upstream or pristine-tar and the '--no-merge' option is used. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rwxr-xr-xgbp/scripts/import_orig_rpm.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/gbp/scripts/import_orig_rpm.py b/gbp/scripts/import_orig_rpm.py
index de8b70e0..b379fc35 100755
--- a/gbp/scripts/import_orig_rpm.py
+++ b/gbp/scripts/import_orig_rpm.py
@@ -351,6 +351,12 @@ def main(argv):
env = { 'GBP_BRANCH': options.packaging_branch }
gbpc.Command(options.postimport % info, extra_env=env,
shell=True)()
+ # Update working copy and index if we've possibly updated the
+ # checked out branch
+ current_branch = repo.get_branch()
+ if (current_branch == options.upstream_branch or
+ current_branch == repo.pristine_tar_branch):
+ repo.force_head(current_branch, hard=True)
except (GitRepositoryError, gbpc.CommandExecFailed):
raise GbpError, "Import of %s failed" % source.path
except GbpError, err: