You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2016/01/14 01:30:33 UTC

[2/2] mesos git commit: Using 'git rev-parse --git-common-dir' in post-reviews.py.

Using 'git rev-parse --git-common-dir' in post-reviews.py.

The post-reviews.py script has similar problems to the bootstrap script
in assuming that .git is a folder in the top-level directory of the git
repo.  This may not be true when mesos is included as a submodule in
another project. Use 'git rev-parse --git-common-dir' instead.

Review: https://reviews.apache.org/r/41244/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/78a60aef
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/78a60aef
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/78a60aef

Branch: refs/heads/master
Commit: 78a60aef56c749aac69f8c66f9a8617f02d43f47
Parents: c71cb9a
Author: Kevin Klues <kl...@gmail.com>
Authored: Wed Jan 13 20:03:46 2016 +0100
Committer: Till Toenshoff <to...@me.com>
Committed: Thu Jan 14 01:23:11 2016 +0100

----------------------------------------------------------------------
 support/post-reviews.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/78a60aef/support/post-reviews.py
----------------------------------------------------------------------
diff --git a/support/post-reviews.py b/support/post-reviews.py
index 170be83..c738f2a 100755
--- a/support/post-reviews.py
+++ b/support/post-reviews.py
@@ -95,6 +95,7 @@ if diff_stat:
   sys.exit(1)
 
 top_level_dir = execute(['git', 'rev-parse', '--show-toplevel']).strip()
+git_dir = execute(['git', 'rev-parse', '--git-common-dir']).strip()
 
 # Use the tracking_branch specified by the user if exists.
 parser = argparse.ArgumentParser(add_help=False)
@@ -295,7 +296,7 @@ for i in range(len(shas)):
 
     # Now rebase all remaining shas on top of this amended commit.
     j = i + 1
-    old_sha = execute(['cat', os.path.join(top_level_dir, '.git/refs/heads', temporary_branch)]).strip()
+    old_sha = execute(['cat', os.path.join(git_dir, 'refs/heads', temporary_branch)]).strip()
     previous = old_sha
     while j < len(shas):
         execute(['git', 'checkout', shas[j]])
@@ -313,7 +314,7 @@ for i in range(len(shas)):
 
     # Okay, now update the actual branch to our temporary branch.
     new_sha = old_sha
-    old_sha = execute(['cat', os.path.join(top_level_dir, '.git/refs/heads', branch)]).strip()
+    old_sha = execute(['cat', os.path.join(git_dir, 'refs/heads', branch)]).strip()
     execute(['git', 'update-ref', 'refs/heads/' + branch, new_sha, old_sha])
 
     i = i + 1