Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
composer.json Utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Composer
library
composer.json Utils
Commits
dbd9c2a5
Commit
dbd9c2a5
authored
5 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Make sure git init was called before any other git command
parent
6857146a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Utils.php
+11
-0
11 additions, 0 deletions
Utils.php
with
11 additions
and
0 deletions
Utils.php
+
11
−
0
View file @
dbd9c2a5
...
...
@@ -179,10 +179,20 @@ final class Utils {
return
$this
;
}
/**
* Make sure that git init was called.
*/
protected
static
function
gitInit
()
{
if
(
!
file_exists
(
'.git'
))
{
passthru
(
escapeshellcmd
(
'git init'
));
}
}
/**
* @param string $command
*/
public
static
function
git
(
$command
)
{
self
::
gitInit
();
passthru
(
escapeshellcmd
(
'git -c "user.email=composer@lakedrops.com" '
.
$command
));
}
...
...
@@ -212,6 +222,7 @@ final class Utils {
*/
public
static
function
gitLFS
(
$pattern
)
{
if
(
self
::
$lfsGitPatterns
===
NULL
)
{
self
::
gitInit
();
$output
=
[];
exec
(
'git lfs track'
,
$output
);
self
::
$lfsGitPatterns
=
implode
(
PHP_EOL
,
$output
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment