Comments (25)
When you say it works well, do the files get added/committed correctly?
What happens when you separate each git.function() command?
I only get that issue if I manually run two git tasks at the same time on the same repo, and one returns an error.
from gulp-git.
I'm having the same issue. It seems to commit the first file in the pipe and then tries to commit the other file separately, i.e. what happens in my case is that composer.json
gets updated and then package.json
has the changes applied but is unstaged. My code is pretty much the same:
gulp.task('bump', function() {
return gulp.src(['./composer.json', './package.json'])
.pipe(bump({ type: gutil.env.type }))
.pipe(beautify({ indentSize: 4 }))
.pipe(gulp.dest('./'));
});
gulp.task('release', ['bump'], function() {
var version = require('./package.json').version;
return gulp.src(['./composer.json', './package.json'])
.pipe(git.commit(version))
.pipe(git.tag(version, version));
});
If I remove the git.tag()
pipe then it still throws.
from gulp-git.
@stevelacy yes, I changed app.min.js and it was commited successfully, as it should be, but with the errors above. I haven't tested what happens when more than 1 file is going to be added and commited, will try it later though.
from gulp-git.
➜ test git:(master) ✗ gst
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: public/app.min.css
# modified: public/app.min.js
#
no changes added to commit (use "git add" and/or "git commit -a")
➜ test git:(master) ✗ gulp cbf
[gulp] Using file /Users/Svilen/Development/test/gulpfile.js
[gulp] Working directory changed to /Users/Svilen/Development/test
[gulp] Running 'cbf'...
[gulp] Finished 'cbf' in 5.43 ms
[gulp] { [Error: Command failed: fatal: Unable to create '/Users/Svilen/Development/test/.git/index.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
] killed: false, code: 128, signal: null }
[gulp] fatal: Unable to create '/Users/Svilen/Development/test/.git/index.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
[gulp]
[gulp] { [Error: Command failed: fatal: Unable to create '/Users/Svilen/Development/test/.git/index.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
] killed: false, code: 128, signal: null }
[gulp] fatal: Unable to create '/Users/Svilen/Development/test/.git/index.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
[gulp] [master c6c9ebd] Minified scripts for production
1 file changed, 2 insertions(+), 1 deletion(-)
*** Preserving this moment in history.
➜ test git:(master) ✗
So, looks like app.min.js was commited, but app.min.css was not.
from gulp-git.
What version of gulp-git
are you using?
I only now noticed that this PR #7 broke the plugin Entirely on UNIX systems!
from gulp-git.
I'm using the latest release, 0.3.3.
from gulp-git.
While I fix the error, could you install 0.3.2/0.3.1 and test that one?
from gulp-git.
I've tried with 0.3.0, 0.3.1 and 0.3.2. No joy I'm afraid.
I think the problem is that you are iterating over each file in the pipe with map stream, this is fine for one file but fails on multiple files. It seems you might be better off using a through stream to collect the files in the pipeline and act on them in through's flush function, such as a plugin like gulp-size:
https://github.com/sindresorhus/gulp-size/blob/master/index.js
from gulp-git.
Yes, on the note of multiple files, I will add the through stream when I get time.
from gulp-git.
I added the through2 stream to allow a 'glob' of file paths to be commited at once.
Can you see if it works for you?
from gulp-git.
Did it fix your issue?
from gulp-git.
I've actually been using my own function for this in the meantime:
var commit = function(message) {
return through.obj(function(file, enc, cb) {
exec('git add ' + file.path, { cwd: file.cwd }, function(err, stdout, stderr) {
if (err) {
gutil.log(err);
}
cb(null, file);
})
}, function(cb) {
exec('git commit -m "' + message + '"', function(err, stdout, stderr) {
if (err) {
gutil.log(err);
}
if (stdout.indexOf(message) > -1) {
gutil.log('Release ' + gutil.colors.green(message) + ' ' + stdout.replace(message, ''));
}
cb();
});
});
};
I think this patch will fix the issue for me, but I've got other things to be looking into so I haven't had chance to update my dev dependencies yet.
from gulp-git.
Changes added by way of #17 should fix the issues.
from gulp-git.
I've updated to 0.4.0 but am still running into these errors with /.git/index.lock
. I am trying to run git init
, git add
, and git commit
in sequence and it fails regardless of whether I break them out into separate tasks or put them in one sequence. Same errors as others have reported in this thread.
The trial run I just did was:
gulp.task('init', function(){
git.init();
});
gulp.task('add', function(){
return gulp.src('./*')
.pipe(git.add());
});
gulp.task('commit', function(){
return gulp.src('./*')
.pipe(git.commit('initial commit'));
});
gulp.task('setup',['styles','init','add','commit']);
Where the styles task is processing SCSS and runs fine, init runs fine, and then add and commit run into the issues with fatal: Unable to create '/Users/user/Desktop/test/.git/index.lock': File exists.
It does seem to get further when I combine git add
and git commit
like so:
gulp.task('init', function(){
git.init();
});
gulp.task('commit', function(){
return gulp.src('./*')
.pipe(git.add());
.pipe(git.commit('initial commit'));
});
gulp.task('setup',['styles','init','commit']);
With this, I get the error:
stream.js:94
throw er; // Unhandled stream error in pipe.
^
Error: Command failed: fatal: Unable to create '/Users/user/Desktop/new-test/.git/index.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
at ChildProcess.exithandler (child_process.js:637:15)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
Sorry for the novel, just trying to be thorough :)
from gulp-git.
I am also getting this error, all I am trying to do is git.add(). And I am using MacOSX 10.9.2 and Git version 1.8.5.3
from gulp-git.
@zoerooney I thought I had replied a while back, sorry for the delay.
@zoerooney, @crossborne Can you add your git version?
from gulp-git.
Sure, I updated my previous comment so find it there. It seems like the git commands are called asynchronously like more at once and that must be the problem.
from gulp-git.
I am using Git version 1.7.11.3 (guess I should probably update one of these days)
from gulp-git.
Got the same problem too with GIT 1.9.2 on Windows and Gulp-Git 0.4.3.
gulp.task('git', function() {
return gulp.src('./*')
.pipe(git.add())
.pipe(git.commit("Updated repo"));
});
from gulp-git.
I am looking into switching from exec
to stream spawn
.
This issue seems related to the git process creating spinoffs, which do not end when gulp-git
calls the end
from gulp-git.
Please install the master git branch to test the new changes added
npm i https://github.com/stevelacy/gulp-git/tarball/master
from gulp-git.
Works fine for me now! Cheers! 👍 Could you leave here a message once published?
from gulp-git.
@crossborne sounds good, I will.
from gulp-git.
Actually, when I run the git.add in parallel it dies on the same error (index.lock being used / already exists) ... But that may not be that easy to fix as you would have to save the filepath into some array and proceed the array once all gulp tasks had finished.
For me you are free to close this issue, since it works fine when I do the workaround mentioned above. But still, it would be nice to know when gulp(the root process) is about to end. (Maybe its possible? I am not sure really)
Cheers, bye
from gulp-git.
Yes, git is Very finicky with processes running in parallel, as git does not seem to kill until after the callback is called in child_proccess.exec
Just published to 0.5.0
from gulp-git.
Related Issues (20)
- Get current branch name? HOT 2
- git add is broken in Node 8 HOT 1
- git.add does not allow for specified files to add in another cwd HOT 4
- gulp-git breaks in Node 9.5.0. HOT 3
- Error creating commit on new git version HOT 20
- Error: i can't commit HOT 2
- How to use git clone with ssh HOT 2
- How to clone with a specified branch? HOT 5
- commit() will commit also unstaged files HOT 2
- Git add . all files HOT 2
- Cannot use '-a' anymore for commit HOT 4
- how can I checkout a file HOT 1
- stdout maxBuffer length exceeded (diff.js) HOT 1
- Problem with absolute path or Gulp v4
- Cherry-pick - feature request HOT 1
- finish event listener registration error
- Gulp 4 compatibility HOT 1
- Add rebase command HOT 2
- "The command line is too long." on `git.add()` HOT 1
- lodash.template critical vulnerabilities from Mend HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-git.