Skip to content

Commit

Permalink
Revert "Remove defunct commit helper utility."
Browse files Browse the repository at this point in the history
This reverts commit 3a43238.

This included working changes to `cursor.js`.
  • Loading branch information
flatheadmill committed Mar 1, 2015
1 parent 3a43238 commit cb9ca44
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 deletions.
28 changes: 28 additions & 0 deletions commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

abend()
{
local message=$1
echo "fatal: $message" 1>&2
exit 1
}

files=$(git ls-files -m | wc -l | tr -d ' ')

[ "$files" -ne 1 ] && abend "only one modified file at a time please"

file=$(git ls-files -m)
node "$file" || abend "test is now failing"
name=$(basename $file)

case "$1" in
tidy)
git commit -a -m 'Tidy `'$file'`.'$'\n\nSee #351.'
;;
assert)
git commit -a -m 'Use `assert` in `'$name'`.'$'\n\nSee #351.'
;;
vivify)
git commit -a -m 'Use `vivify` in `'$name'`.'$'\n\nSee #352.'
;;
esac
12 changes: 3 additions & 9 deletions cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ Cursor.prototype.next = cadence(function (async) {
// to user land
Cursor.prototype.indexOf = function (key, index) {
ok(arguments.length == 2, 'index requires two arguments')
ok(index === 0 || index === 1, 'unexpected index')
var page = this._page
var index = this._sheaf.find(page, key, 0)
var index = this._sheaf.find(page, key, index)
var unambiguous
unambiguous = -1 < index // <- todo: ?
|| ~ index < this._page.items.length
Expand Down Expand Up @@ -104,7 +103,7 @@ Cursor.prototype._filename = function (page) {

Cursor.prototype.insert = function (record, key, index) {
ok(this.exclusive, 'cursor is not exclusive')
ok(index > 0 || this._page.address == 1 || this._page.ghosts === 1, 'insert at ghost')
ok(index > 0 || this._page.address == 1)

this._sheaf.unbalanced(this._page)

Expand All @@ -113,13 +112,8 @@ Cursor.prototype.insert = function (record, key, index) {
}

var heft = this._appender.writeInsert(index, record).heft
var replace = 0
if (index === 0) {
this._page.ghosts--
replace = 1
}

this._page.splice(index, replace, {
this._page.splice(index, 0, {
key: key,
record: record,
heft: heft
Expand Down
1 change: 0 additions & 1 deletion release.ft
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ The common utility functions are now exported globally. They may move into a uti

### Issue by Issue

* Remove defunct commit helper utility. #501.
* Upgrade Advance and Splice. #498.
* Upgrade Cadence to 0.0.52. #497.
* User record serializer in `writeInsert`. #495.
Expand Down
5 changes: 2 additions & 3 deletions t/proof.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,13 @@ function abstracted (dir) {
b = b.name.split('.').pop()
return +(a) - +(b)
})
console.log(files.map(function (file) { return file.name }))
// console.log(files.map(function (file) { return file.name }))
record = { log: [] }
var entry = 0
files.forEach(function (file) {
position = 0
console.log(file)
file.body.forEach(function (line, index) {
console.log(line)
// console.log(line)
var json = line.header
ok(++entry == json[0], 'entry record is wrong')
if (json[1]) {
Expand Down

0 comments on commit cb9ca44

Please sign in to comment.