-
msb@chromium.org authored
I found including a git repo in my DEPS file to be unreliable, esp since I pinning to a specific commit. Whenever I changed the commit in the DEPS file, gclient would attempt to do a rebase and this was failing due to how rebase was being invoked. While investigating the problem, I decided it might be better to take a different approach. Namely, when cloning gclient should just checkout the working tree to a detached HEAD. In this way, gclient can more easily determine if the user has made any changes in the cloned repo. Future updates (as long as there are no changes) become a much simpler operation w/no need to invoke rebase. This is a series of five commits, but sadly, git cl will squash them into this single review. Here are the original commit messages: commit 8cd2213f006a6f4b3f6b8c448a1362b9410d47f1 Author: Jay Soffian <jaysoffian@gmail.com> Date: Wed Apr 14 18:29:18 2010 -0400 Use rev-parse to determine current branch Git branch is a so-called porcelain and its output cannot be relied upon; use git rev-parse instead. gclient_scm.py | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) commit 1a09e04554acfa2671f9588ee9eef0bdbe677ed2 Author: Jay Soffian <jaysoffian@gmail.com> Date: Wed Apr 14 22:16:53 2010 -0400 Detached HEAD does not always imply rebasing; use an _IsRebasing() function instead. gclient_scm.py | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) commit 45308a58c3f1e30b760f13abe3a6288267265fa8 Author: Jay Soffian <jaysoffian@gmail.com> Date: Wed Apr 14 22:19:10 2010 -0400 Clarify comments to use common git terminology gclient_scm.py | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) commit 5e5a661b7dd9c83b2c9c35950f3267d15b7e840a Author: Jay Soffian <jaysoffian@gmail.com> Date: Tue May 4 12:15:40 2010 -0400 Make CaptureStatus use GetUpstreamBranch() instead of assuming 'origin' scm.py | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) commit 42a8bfebd2e1b1be01025c1324d75920ac6eb0e1 Author: Jay Soffian <jaysoffian@gmail.com> Date: Wed Apr 14 22:19:29 2010 -0400 Use a detached HEAD when checking out a tag or commit After cloning, if a tag or commit was specified, leave a detached HEAD. This way we can reliably detect if the user changed the working tree (since HEAD would no longer be detached). Further, this simplifies the code path when the dependency is updated to a new tag/commit. As long as HEAD is detached when we update, we simply checkout whatever we fetched w/o needing to worry about rebasing. gclient_scm.py | 126 +++++++++++++++++++++++++++++++------------- tests/gclient_scm_test.py | 6 +-- 2 files changed, 91 insertions(+), 41 deletions(-) Review URL: http://codereview.chromium.org/1652007 Patch from Jay Soffian <jaysoffian@gmail.com>. git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@48722 0039d316-1c4b-4281-b951-d872f2087c98
786fb68d