Skip to content

Commit

Permalink
branches challenge
Browse files Browse the repository at this point in the history
  • Loading branch information
jlord committed Jan 4, 2014
1 parent 63e9240 commit 2e33a30
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
3 changes: 3 additions & 0 deletions problems/branches_arent_just_for_birds/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function () {
return { args: [], stdin: null }
}
1 change: 1 addition & 0 deletions problems/branches_arent_just_for_birds/solution.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log(true)
47 changes: 47 additions & 0 deletions problems/branches_arent_just_for_birds/verify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env node

var spawn = require('child_process').spawn
var concat = require('concat-stream')

var status = spawn('git', ['status'])


status.stdout.pipe(concat(onRemote))

function onRemote(output) {
var status = output.toString().trim()
if (!status.match("master"))
console.log(true)
else console.log("no upstream remote")
}

// check via the github api? would need username
// and repo name (repo name could be assumed/gotten
// via the name of the current directory locally)

// git show-branch origin/master

// var remote = spawn('git', ['show-branch', 'origin/master'])

// If commits but no remote pushes
//
// jlord:test jessicalord$ git show-branch origin/master
// fatal: bad sha1 reference origin/master

// If empty git repo, no commits
//
// jlord:test jessicalord$ git show-branch master
// fatal: bad sha1 reference master
//
// git remote returns nothing

// If no pushes
//
// jlord:test jessicalord$ git reflog show origin/master
// fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.
// Use '--' to separate paths from revisions, like this:
// 'git <command> [<revision>...] -- [<file>...]'

// jlord:git-it jessicalord$ git reflog show origin/master
// c63d2bc refs/remotes/origin/master@{0}: update by push
// c11f47a refs/remotes/origin/master@{1}: update by push

0 comments on commit 2e33a30

Please sign in to comment.