How to use the js-git/lib/config-codec.encode function in js-git

To help you get started, we’ve selected a few js-git examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github creationix / git-tree / git-tree.js View on Github external
changeNames.forEach(function (root) {
        var meta = pendingChanges[root].meta;
        var path = join(root, ".gitmodules");

        var encoded = codec.encode(meta);
        if (!encoded.trim()) {
          // Delete the file if it's now empty
          writes[path] = {};
        }
        else {
          writes[path] = {
            mode: modes.file,
            content: encoded
          };
        }
      });
      pendingChanges = {};
github creationix / tedit / src / data / repos.js View on Github external
function join() {
    if (!meta || !childHead) return;
    if (!meta.submodule) meta.submodule = {};
    meta.submodule[localPath] = {
      path: localPath,
      url: url
    };
    callback(null, [
      { path: ".gitmodules",
        mode: modes.blob,
        content: encodeConfig(meta)
      },
      { path: localPath,
        mode: modes.commit,
        hash: childHead
      }
    ]);
  }
}