2 # Copyright 2018 Google LLC. All Rights Reserved.
3 # Copyright 2017-2018 Nest Labs Inc. All Rights Reserved.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
20 # This file is the make "header" or pre make header that defines make
21 # convenience macros for interacting with git.
24 # nlGitGetConfigFromFileCommand <file>
26 # Command to get a value for a variable set in the specified git config file <file>.
28 nlGitGetConfigFromFileCommand = $(GIT) config --file $(1)
30 # nlGitListConfigFromFileCommand <file>
32 # Command to list all variables set in the specified config file <file>
34 nlGitListConfigFromFileCommand = $(call nlGitGetConfigFromFileCommand,$(1)) --list
36 # nlGitGetConfigFromFile <file>
38 # Get a value for a variable set in the specified git config file <file>.
40 nlGitGetConfigFromFile = $(shell $(call nlGitGetConfigFromFileCommand,$(1)))
42 # nlGitListConfigFromFile <file>
44 # List all variables set in the specified config file <file>
46 nlGitListConfigFromFile = $(shell $(call nlGitListConfigFromFileCommand,$(1)))
48 # nlGitGetValueForRepoFromNameFromFile <file> <repo name> <value>
50 # Get a value for a repo / submodule variable set in specified git config file <file>.
52 nlGitGetValueForRepoFromNameFromFile = $(shell $(call nlGitGetConfigFromFileCommand,$(1)) 'submodule.$(2).$(3)')
54 # nlGitGetBranchForRepoFromNameFromFile <file> <repo name>
56 # Get the remote branch for a repo / submodule variable set in specified git config file <file>.
58 nlGitGetBranchForRepoFromNameFromFile = $(call nlGitGetValueForRepoFromNameFromFile,$(1),$(2),branch)
60 # nlGitGetCommitForRepoFromNameFromFile <file> <repo name>
62 # Get the commit for a repo / submodule variable set in specified git config file <file>.
64 nlGitGetCommitForRepoFromNameFromFile = $(call nlGitGetValueForRepoFromNameFromFile,$(1),$(2),commit)
66 # nlGitGetURLForRepoFromNameFromFile <file> <repo name>
68 # Get the remote URL for a repo / submodule variable set in specified git config file <file>.
70 nlGitGetURLForRepoFromNameFromFile = $(call nlGitGetValueForRepoFromNameFromFile,$(1),$(2),url)
72 # nlGitGetPathForRepoFromNameFromFile <file> <repo name>
74 # Get the local path for a repo / submodule variable set in specified git config file <file>.
76 nlGitGetPathForRepoFromNameFromFile = $(call nlGitGetValueForRepoFromNameFromFile,$(1),$(2),path)
78 # nlGitGetMethodForPullFromFile <file>
80 # Get the pull method set in specified git config file <file>.
82 nlGitGetMethodForPullFromFile = $(shell $(call nlGitGetConfigFromFileCommand,$(1)) 'pull.method')