File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,13 +107,16 @@ def release
107107
108108 private
109109
110+ GIT_DIR = File . expand_path ( '../../.git' , File . dirname ( __FILE__ ) ) . freeze
111+
110112 COMPONENTS_CONFIG = '../../config/components.yml' . freeze
111113
112114 LIB_DIRECTORY = '.lib'
113115
114116 # Instances should only be constructed by this class.
115117 def initialize ( app_dir )
116118 @logger = JavaBuildpack ::Diagnostics ::LoggerFactory . get_logger
119+ Buildpack . log_git_data @logger
117120 Buildpack . dump_environment_variables @logger
118121 Buildpack . require_component_files
119122 components = Buildpack . components @logger
@@ -194,6 +197,15 @@ def self.jre_directory
194197 Pathname . new ( File . expand_path ( 'jre' , File . dirname ( __FILE__ ) ) )
195198 end
196199
200+ def self . log_git_data ( logger )
201+ # Log information about the buildpack's git repository to enable stale forks to be spotted.
202+ # Call the debug method passing a parameter rather than a block so that, should the git command
203+ # become inaccessible to the buildpack at some point in the future, we find out before someone
204+ # happens to switch on debug logging.
205+ logger . debug ( "git remotes: #{ `git --git-dir=#{ GIT_DIR } remote -v` } " )
206+ logger . debug ( "git HEAD commit: #{ `git --git-dir=#{ GIT_DIR } log HEAD^!` } " )
207+ end
208+
197209 def self . lib_directory ( app_dir )
198210 File . join app_dir , LIB_DIRECTORY
199211 end
You can’t perform that action at this time.
0 commit comments