git-modified 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +1 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +45 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/circle.yml +3 -0
- data/exe/git-modified +4 -0
- data/git-modified.gemspec +27 -0
- data/lib/git/modified/version.rb +5 -0
- data/lib/git/modified.rb +54 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3e9e874dfcf1d823226802f475953165d2805cc9
|
4
|
+
data.tar.gz: fe8cb08ac1466e016279867c5ed8846b3c3f2923
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7b28eb7283bebb82b1795eec8f2ed5db24bf7923f2618282d65d598bf265be0eefc27f196d55998f40e04399480d7685a04a59e2ac250b3ffc40a8c948482b29
|
7
|
+
data.tar.gz: 0cb3a73e51ee3c92fb1c4f7571fcf3d725793b22d1bd92a933b1ba0afdcf8d7c103918a348308d08ff31ed1cd74963eba3229fbc62dd0f29df99654b64e97b6e
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Kohei Hasegawa
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# git-modified [![Circle CI](https://img.shields.io/circleci/project/banyan/git-modified.svg)](https://circleci.com/gh/banyan/git-modified) [![Rubygems](https://img.shields.io/gem/v/git-modified.svg)](https://rubygems.org/gems/git-modified)
|
2
|
+
|
3
|
+
A Git subcommand to list modified files in git commit or from current working tree
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```shell
|
8
|
+
$ gem install git-modified
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
* Get modified files from current working tree if no argument is given
|
14
|
+
|
15
|
+
```shell
|
16
|
+
$ touch a.txt
|
17
|
+
$ git modified
|
18
|
+
a.txt
|
19
|
+
```
|
20
|
+
|
21
|
+
* Get modified files in git commit if argument is given
|
22
|
+
|
23
|
+
```shell
|
24
|
+
$ git modified fbb1185
|
25
|
+
actionpack/lib/action_dispatch/testing/integration.rb
|
26
|
+
```
|
27
|
+
|
28
|
+
## Tips
|
29
|
+
|
30
|
+
I often use [tig](https://github.com/jonas/tig) while I'm writing codes. No matter how I feel it's perfect, I would find mistakes soon when I check with tig.
|
31
|
+
Tig has `e` mode which opens file in editor, yet cursol should be on the files. `git-modified` is handy if you would like to open files with commit sets. It can be available with following tig bindings in `.tigrc`.
|
32
|
+
|
33
|
+
```tigrc
|
34
|
+
bind main K !<sh -c "vim -p $(git modified %(commit))"
|
35
|
+
bind diff K !<sh -c "vim -p $(git modified %(commit))"
|
36
|
+
bind log K !<sh -c "vim -p $(git modified %(commit))"
|
37
|
+
```
|
38
|
+
|
39
|
+
In this example, I use vim (`-p` is opening files in tabs), but it can be modified to any editor, also binding key (`K`) as well.
|
40
|
+
|
41
|
+
![git-modified](https://cloud.githubusercontent.com/assets/19625/6544632/686b5ad6-c527-11e4-9dff-e655ff6fef8a.gif)
|
42
|
+
|
43
|
+
## License
|
44
|
+
|
45
|
+
Licensed under the [MIT license](http://banyan.mit-license.org/)
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "git/modified"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/circle.yml
ADDED
data/exe/git-modified
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'git/modified/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "git-modified"
|
8
|
+
spec.version = Git::Modified::VERSION
|
9
|
+
spec.authors = ["Kohei Hasegawa"]
|
10
|
+
spec.email = ["ameutau@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A Git subcommand to list modified files in git commit}
|
13
|
+
spec.description = %q{A Git subcommand to list modified files in git commit}
|
14
|
+
spec.homepage = "https://github.com/banyan/git-modified"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "contracts", "~> 0.7"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.8"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec"
|
27
|
+
end
|
data/lib/git/modified.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require "git/modified/version"
|
2
|
+
require 'contracts'
|
3
|
+
|
4
|
+
module Git
|
5
|
+
module Modified
|
6
|
+
include Contracts
|
7
|
+
include Contracts::Modules
|
8
|
+
|
9
|
+
Contract Maybe[String] => nil
|
10
|
+
def self.run
|
11
|
+
case ARGV.first
|
12
|
+
when '-v', '--version'
|
13
|
+
version
|
14
|
+
else
|
15
|
+
modified ARGV.first
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
Contract String => nil
|
20
|
+
def self.version
|
21
|
+
puts Git::Modified::VERSION
|
22
|
+
end
|
23
|
+
|
24
|
+
Contract Maybe[String] => nil
|
25
|
+
def self.modified(hash = nil)
|
26
|
+
if hash.nil?
|
27
|
+
show_modified_files_on_working_tree
|
28
|
+
else
|
29
|
+
show_modified_files_on_commit hash
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Contract nil => nil
|
34
|
+
def self.show_modified_files_on_working_tree
|
35
|
+
puts `git status --porcelain`.each_line.map { |x| x[3..-1] }
|
36
|
+
end
|
37
|
+
|
38
|
+
Contract Maybe[String] => nil
|
39
|
+
def self.show_modified_files_on_commit(hash)
|
40
|
+
hashes = `git show --summary --format="%P" #{hash} | head -n 1`.split ' '
|
41
|
+
|
42
|
+
if hashes.size == 2
|
43
|
+
puts `git diff --name-only #{hashes[0]}...#{hashes[1]}`
|
44
|
+
else
|
45
|
+
puts `git log -m -1 --name-only --pretty="format:" #{hash}`
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
Contract nil => String
|
50
|
+
def self.latest_hash
|
51
|
+
`git log --pretty=format:'%h' -n 1`
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git-modified
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kohei Hasegawa
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: contracts
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A Git subcommand to list modified files in git commit
|
70
|
+
email:
|
71
|
+
- ameutau@gmail.com
|
72
|
+
executables:
|
73
|
+
- git-modified
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- CODE_OF_CONDUCT.md
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- circle.yml
|
87
|
+
- exe/git-modified
|
88
|
+
- git-modified.gemspec
|
89
|
+
- lib/git/modified.rb
|
90
|
+
- lib/git/modified/version.rb
|
91
|
+
homepage: https://github.com/banyan/git-modified
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.4.5
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: A Git subcommand to list modified files in git commit
|
115
|
+
test_files: []
|