Skip to content

Commit ae07c53

Browse files
hramosfacebook-github-bot
authored andcommitted
Resolve "fatal: not a git repository" error outside of git repositories
Summary: CocoaPods will display a "fatal: not a git repository" when these podspecs are consumed within Facebook's internal Mercurial repository due to the reliance on `git` to obtain the current commit hash. In these cases, the podspec is being consumed locally and the commit hash is unnecessary. The error is removed by avoiding the use of `git` if the current working directory is not a git repository (or any of the parent directories). Changelog: [Internal] [iOS] - Remove CocoaPods error within Facebook's repository Reviewed By: fkgozali Differential Revision: D27750974 fbshipit-source-id: 99159611c580baf5526f116948c5ff60e1c02e5c
1 parent e1eb938 commit ae07c53

33 files changed

+63
-63
lines changed

Libraries/ActionSheetIOS/React-RCTActionSheet.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = package['version']
1111
source = { :git => 'https://github.com/facebook/react-native.git' }
1212
if version == '1000.0.0'
1313
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14-
source[:commit] = `git rev-parse HEAD`.strip
14+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
1515
else
1616
source[:tag] = "v#{version}"
1717
end

Libraries/Blob/React-RCTBlob.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = package['version']
1111
source = { :git => 'https://github.com/facebook/react-native.git' }
1212
if version == '1000.0.0'
1313
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14-
source[:commit] = `git rev-parse HEAD`.strip
14+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
1515
else
1616
source[:tag] = "v#{version}"
1717
end

Libraries/FBLazyVector/FBLazyVector.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = package['version']
1111
source = { :git => 'https://github.com/facebook/react-native.git' }
1212
if version == '1000.0.0'
1313
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14-
source[:commit] = `git rev-parse HEAD`.strip
14+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
1515
else
1616
source[:tag] = "v#{version}"
1717
end

Libraries/Image/React-RCTImage.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = package['version']
1111
source = { :git => 'https://github.com/facebook/react-native.git' }
1212
if version == '1000.0.0'
1313
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14-
source[:commit] = `git rev-parse HEAD`.strip
14+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
1515
else
1616
source[:tag] = "v#{version}"
1717
end

Libraries/LinkingIOS/React-RCTLinking.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = package['version']
1111
source = { :git => 'https://github.com/facebook/react-native.git' }
1212
if version == '1000.0.0'
1313
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14-
source[:commit] = `git rev-parse HEAD`.strip
14+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
1515
else
1616
source[:tag] = "v#{version}"
1717
end

Libraries/NativeAnimation/React-RCTAnimation.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = package['version']
1111
source = { :git => 'https://github.com/facebook/react-native.git' }
1212
if version == '1000.0.0'
1313
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14-
source[:commit] = `git rev-parse HEAD`.strip
14+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
1515
else
1616
source[:tag] = "v#{version}"
1717
end

Libraries/Network/React-RCTNetwork.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = package['version']
1111
source = { :git => 'https://github.com/facebook/react-native.git' }
1212
if version == '1000.0.0'
1313
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14-
source[:commit] = `git rev-parse HEAD`.strip
14+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
1515
else
1616
source[:tag] = "v#{version}"
1717
end

Libraries/PushNotificationIOS/React-RCTPushNotification.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = package['version']
1111
source = { :git => 'https://github.com/facebook/react-native.git' }
1212
if version == '1000.0.0'
1313
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14-
source[:commit] = `git rev-parse HEAD`.strip
14+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
1515
else
1616
source[:tag] = "v#{version}"
1717
end

Libraries/RCTRequired/RCTRequired.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = package['version']
1111
source = { :git => 'https://github.com/facebook/react-native.git' }
1212
if version == '1000.0.0'
1313
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14-
source[:commit] = `git rev-parse HEAD`.strip
14+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
1515
else
1616
source[:tag] = "v#{version}"
1717
end

Libraries/Settings/React-RCTSettings.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = package['version']
1111
source = { :git => 'https://github.com/facebook/react-native.git' }
1212
if version == '1000.0.0'
1313
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14-
source[:commit] = `git rev-parse HEAD`.strip
14+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
1515
else
1616
source[:tag] = "v#{version}"
1717
end

0 commit comments

Comments
 (0)