Sitelet https://web.archive.org/web/20200916181621/https://github.com/nodegit/nodegit/pull/1255
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Writestream#write #1255

Open
wants to merge 1 commit into
base: master
from
Open

Conversation

@rafaelgieschke
Copy link
Contributor

rafaelgieschke commented Mar 23, 2017

#1010 added Blob.createFromStream() but no way to actually use the resulting Writestream.

This pull request adds Writstream#write, so you can create blobs like:

#!/usr/bin/env node

const Git = require("nodegit");

(async () => {
  const repo = await Git.Repository.init("test", 1);
  const stream = await Git.Blob.createFromStream(repo, "");
  const buffer = new Buffer("test\n");
  await stream.write(buffer, buffer.byteLength);
  const buffer2 = new Buffer("test2\n");
  await stream.write(buffer2, buffer2.byteLength);
  const oid = await Git.Blob.createFromstreamCommit(stream);
  console.log(oid);
})();

It does so by declaring a fake git_writestream_write function, matching the write function in struct writestream of libgit2 (https://github.com/libgit2/libgit2/blob/HEAD/include/git2/types.h#L430).

@johnhaley81
Copy link
Collaborator

johnhaley81 commented Apr 18, 2017

@rafaelgieschke thanks again. Same as the #1254 with adding tests to ensure functionality.

@rafaelgieschke rafaelgieschke force-pushed the rafaelgieschke:writestream branch from c900ade to 754544b May 10, 2017
@rafaelgieschke
Copy link
Contributor Author

rafaelgieschke commented May 10, 2017

Added a test.

@implausible implausible dismissed their stale review Nov 28, 2017

conflicts

@implausible
Copy link
Member

implausible commented Nov 28, 2017

@rafaelgieschke Any chance you can fix the conflicts? I'd like toget this into the codebase.

@rafaelgieschke rafaelgieschke force-pushed the rafaelgieschke:writestream branch from 754544b to b7e8260 Dec 5, 2017
@rafaelgieschke
Copy link
Contributor Author

rafaelgieschke commented Dec 5, 2017

@implausible Thanks for looking at this! I've rebased the PR onto the current master.

@implausible implausible force-pushed the nodegit:master branch from c345989 to c67b436 Aug 26, 2019
@implausible implausible force-pushed the nodegit:master branch from 2b7db46 to 69b010a Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.