couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [13/50] git commit: Change how update-deps updates a git branch
Date Fri, 17 Jan 2014 23:12:58 GMT
Change how update-deps updates a git branch

Previously, update-deps on a dep tagged as {branch, ...} would do the
following:

  git fetch
  git checkout -q origin/<branch>

If you were already on that branch, the repo would end up in detached
head state. This is kind of annoying if you're doing local development.

This patch changes the behaviour to be

  git fetch
  git checkout -q <branch>
  git pull --ff-only --no-rebase -q <branch>

The intent of this is to move the branch's HEAD forward to match
upstream without destroying any local commits or changes, and without
accidentally causing merges or rebases. It will fail if the operation
can not be performed without losing history, merging or rebasing.

The previous behaviour has been around a very long time:

https://github.com/rebar/rebar/commit/064195dc5a90f5b0cc3ae92e8373671b0043033f#L0R308

It also exactly mirrors the download_source case, which is not really
true. With git tags and SHAs, one can assume that they don't change, but
branches move all the time.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/commit/f46e7b2e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/tree/f46e7b2e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/diff/f46e7b2e

Branch: refs/heads/import
Commit: f46e7b2e5c389ab8489121a3ab23159750dd1661
Parents: 0977d58
Author: Andrew Thompson <andrew@hijacked.us>
Authored: Mon Sep 23 15:13:26 2013 -0400
Committer: Andrew Thompson <andrew@hijacked.us>
Committed: Mon Sep 23 15:13:26 2013 -0400

----------------------------------------------------------------------
 src/rebar_deps.erl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-rebar/blob/f46e7b2e/src/rebar_deps.erl
----------------------------------------------------------------------
diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl
index 15e7594..4a98ddf 100644
--- a/src/rebar_deps.erl
+++ b/src/rebar_deps.erl
@@ -560,7 +560,8 @@ update_source1(AppDir, {git, Url, ""}) ->
 update_source1(AppDir, {git, _Url, {branch, Branch}}) ->
     ShOpts = [{cd, AppDir}],
     rebar_utils:sh("git fetch origin", ShOpts),
-    rebar_utils:sh(?FMT("git checkout -q origin/~s", [Branch]), ShOpts);
+    rebar_utils:sh(?FMT("git checkout -q ~s", [Branch]), ShOpts),
+    rebar_utils:sh(?FMT("git pull --ff-only --no-rebase -q origin ~s", [Branch]), ShOpts);
 update_source1(AppDir, {git, _Url, {tag, Tag}}) ->
     ShOpts = [{cd, AppDir}],
     rebar_utils:sh("git fetch --tags origin", ShOpts),


Mime
View raw message