From 55a5e323d241cfbd5a59d9a440c506b24b4c255a Mon Sep 17 00:00:00 2001 From: Eric Goodwin Date: Mon, 3 Mar 2008 10:49:28 -0800 Subject: Added in the stashes --- lib/git/lib.rb | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'lib/git/lib.rb') diff --git a/lib/git/lib.rb b/lib/git/lib.rb index ad34709..411b491 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -401,8 +401,38 @@ module Git arr_opts << commit.to_s if commit command('reset', arr_opts) end + + def stashes_all + arr = [] + filename = File.join(@git_dir, 'logs/refs/stash') + if File.exist?(filename) + File.open(filename).each_with_index { |line, i| + m = line.match(/:(.*)$/) + arr << [i, m[1].strip] + } + end + arr + end + + def stash_save(message) + output = command('stash save', [message]) + return false unless output.match(/HEAD is now at/) + return true + end - + def stash_apply(id) + command('stash apply', [id]) + # Already uptodate! ---???? What then + end + + def stash_clear + command('stash clear') + end + + def stash_list + command('stash list') + end + def branch_new(branch) command('branch', branch) end -- cgit