From 3f37f8f53db5c61dffc0cadca9b6a5b1ea532b59 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Thu, 20 Oct 2011 12:02:54 +0800 Subject: [PATCH] Made status command use grep instead of head & tail --- lib/git/status_shortcuts.rb | 1 + lib/git/status_shortcuts.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/git/status_shortcuts.rb b/lib/git/status_shortcuts.rb index c5da6b1..314bc49 100644 --- a/lib/git/status_shortcuts.rb +++ b/lib/git/status_shortcuts.rb @@ -156,5 +156,6 @@ end end end +print "@@filelist@@::" puts @output_files.map{|f| File.join(@project_root, f) }.join("|") diff --git a/lib/git/status_shortcuts.sh b/lib/git/status_shortcuts.sh index 6553201..ab4c9e5 100644 --- a/lib/git/status_shortcuts.sh +++ b/lib/git/status_shortcuts.sh @@ -25,13 +25,13 @@ git_status_shortcuts() { git status; return 1 fi # Fetch list of files from last line of script output - files="$(echo "$cmd_output" | tail -n1)" + files="$(echo "$cmd_output" | grep '@@filelist@@::')" # Export numbered env variables for each file local IFS="|" e=1; for file in $files; do export $git_env_char$e="$file"; let e++; done # Print status - echo "$cmd_output" | head -n-1 + echo "$cmd_output" | grep -v '@@filelist@@::' }