gip-remote 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +16 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -88,6 +88,22 @@ class Remote extends ReadyResource {
88
88
  return { ref: `refs/heads/${b.name}`, oid: b.commitOid }
89
89
  }
90
90
 
91
+ async deleteBranch(branchName) {
92
+ const branch = await this._db.get('@gip/branches', { name: branchName })
93
+ if (!branch) return false
94
+
95
+ await this._db.delete('@gip/branches', { name: branchName })
96
+
97
+ // Remove file records for this branch
98
+ const files = this._db.find('@gip/files', { branch: branchName })
99
+ for await (const file of files) {
100
+ await this._db.delete('@gip/files', { branch: branchName, path: file.path })
101
+ }
102
+
103
+ await this._db.flush()
104
+ return true
105
+ }
106
+
91
107
  // --- Push: store objects + index branch + files ---
92
108
 
93
109
  async push(branchName, commitOid, objects) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gip-remote",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "Git+Pear remote DB for handling git data",
5
5
  "main": "index.js",
6
6
  "scripts": {