Sha256: f14476385dddca4446d7f37e6d340cc2601e27985d39555c9c29615ac8910f10

Contents?: true

Size: 1.7 KB

Versions: 1

Compression:

Stored size: 1.7 KB

Contents

# -*- encoding: utf-8 -*-

desc 'stage files'
command :stage do
  applies_to do |index, work_tree|
    work_tree == :modified || work_tree == :deleted
  end

  action do |index, work_tree, path|
    case work_tree
      when :modified
        ['add --', path]
      when :deleted
        ['rm --quiet --', path]
    end
  end
end

desc 'stage patches'
command :stage_with_patch do
  applies_to do |index, work_tree|
    work_tree == :modified
  end

  action do |index, work_tree, path|
    case work_tree
      when :modified
        ['add --patch --', path]
    end
  end
end

desc 'track files'
command :track do
  applies_to do |index, work_tree|
    index == :untracked || work_tree == :untracked
  end

  action do |index, work_tree, path|
    ['add --', path] if work_tree == :untracked
  end
end

desc 'diff files'
command :diff do
  applies_to do |index, work_tree|
    work_tree == :modified || work_tree == :deleted
  end

  action do |index, work_tree, path|
    ['diff --', path]
  end
end

desc 'diff cached (staged) files'
command :diff_cached do
  applies_to do |index, work_tree|
    index == :modified || index == :deleted
  end

  action do |index, work_tree, path|
    ['diff --cached --', path]
  end
end

desc 'checkout files'
command :checkout do
  applies_to do |index, work_tree|
    work_tree == :modified || work_tree == :deleted
  end

  action do |index, work_tree, path|
    ['checkout --', path]
  end
end

desc 'unstage files'
command :unstage do
  applies_to do |index, work_tree|
    index == :modified || index == :deleted || index == :added
  end

  action do |index, work_tree, path|
    ['reset HEAD --', path]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_shizzle-0.2.8 lib/commands.rb