From b4a75c4cd46dc04d29dbafed594f1d0f4a70fae9 Mon Sep 17 00:00:00 2001 From: "bauerb@chromium.org" Date: Tue, 8 Mar 2011 08:35:38 +0000 Subject: [PATCH] Use reset --soft to squash before dcomitting. Using reset --soft doesn't require touching the working copy, so it should be faster and not require rebuilds. BUG=none TEST=none Review URL: http://codereview.chromium.org/6575031 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@77267 0039d316-1c4b-4281-b951-d872f2087c98 --- git_cl/git_cl.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/git_cl/git_cl.py b/git_cl/git_cl.py index a89b1e7e3..ec3bd9770 100644 --- a/git_cl/git_cl.py +++ b/git_cl/git_cl.py @@ -967,8 +967,8 @@ def SendUpstream(parser, args, cmd): # We want to squash all this branch's commits into one commit with the # proper description. - # We do this by doing a "merge --squash" into a new commit branch, then - # dcommitting that. + # We do this by doing a "reset --soft" to the base branch (which keeps + # the working copy the same), then dcommitting that. MERGE_BRANCH = 'git-cl-commit' # Delete the merge branch if it already exists. if RunGitWithCode(['show-ref', '--quiet', '--verify', @@ -987,8 +987,8 @@ def SendUpstream(parser, args, cmd): # we clean up the branches. retcode = -1 try: - RunGit(['checkout', '-q', '-b', MERGE_BRANCH, base_branch]) - RunGit(['merge', '--squash', cl.GetBranchRef()]) + RunGit(['checkout', '-q', '-b', MERGE_BRANCH]) + RunGit(['reset', '--soft', base_branch]) if options.contributor: RunGit(['commit', '--author', options.contributor, '-m', description]) else: