forked from jlord/git-it
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jlord
committed
Jan 4, 2014
1 parent
63e9240
commit 2e33a30
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function () { | ||
return { args: [], stdin: null } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |