git-crecord 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7dd83bcf3fc3378b78623d0250febdbcb66aed3c
4
- data.tar.gz: 4349e3696a60f5a48c1801057644919e84eab154
3
+ metadata.gz: 32b27152b0c2462bac010cb3f9ded85e80555cc8
4
+ data.tar.gz: abb4843e7164833a17d309f49b7886b2f77b6b97
5
5
  SHA512:
6
- metadata.gz: 943dfa88d390346df32ca083a4d5b2c2516c2c40c2462cb8e7aa79219ec7f67af63c56648fd22f6efd13ed4d3c1192238e2041fa2d8bfa4db8968756f85e58db
7
- data.tar.gz: 735a723fdbe787c6acced19a2a203983bf87eeae75444f7ad0449d5f241b734698c9177841b2a932f7c73de924a12f792f680224dc855f848e6fda573b7e3aca
6
+ metadata.gz: e7237132d036b3efda7640151444aec7592a32ae0986d86b32d602e8836ff4ecba48c3a22c737d5fd9965a88b6ead0f83267a7fb8bd55fb4c826afd954a780f1
7
+ data.tar.gz: 3351f2120e57e49f1a4b6554bb17b5ecba9f894d5afb4ed1add950b1d726d79986e2d8f2a3d0333688b0170b9bd73c0e078d9ba32f4ea8c8ac37dad67fcf9912
data/README.md CHANGED
@@ -24,18 +24,25 @@ Key-bindings:
24
24
  j / ↓ - down
25
25
  k / ↑ - up
26
26
  h / ← - collapse hunk
27
- l / → - expand
27
+ l / → - expand hunk
28
28
  f - toggle fold
29
29
  g - go to first line
30
30
  G - go to last line
31
31
  C-P - up to previous hunk / file
32
- C-N - down to previous hunk / file
32
+ C-N - down to next hunk / file
33
33
  SPACE - toggle selection
34
34
  A - toggle all selections
35
35
  ? - display help
36
36
  R - force redraw
37
37
  ```
38
38
 
39
+ ## Configuration
40
+
41
+ ```shell
42
+ # configure tab-width to four spaces, default is two spaces:
43
+ $ git config --global crecord.tabwidth 4
44
+ ```
45
+
39
46
  ## Development
40
47
 
41
48
  ```shell
data/Rakefile CHANGED
@@ -11,4 +11,4 @@ task :systemtest do
11
11
  sh(File.join(__dir__, 'test/system-test.sh'))
12
12
  end
13
13
 
14
- task default: %i(test systemtest)
14
+ task default: %i[test systemtest]
data/git-crecord.gemspec CHANGED
@@ -9,19 +9,19 @@ GemSpec = Gem::Specification.new do |spec|
9
9
  spec.authors = 'Maik Brendler'
10
10
  spec.email = 'maik.brendler@invision.de'
11
11
  spec.summary = 'Git command to stage/commit hunks the simple way.'
12
- spec.description = %w(
12
+ spec.description = %w[
13
13
  This gem adds the git-crecord command.
14
14
  It provides a curses UI to stage/commit git-hunks.
15
- ).join(' ')
15
+ ].join(' ')
16
16
  spec.license = 'MIT'
17
17
  spec.homepage = 'https://github.com/mbrendler/git-crecord'
18
18
  spec.metadata = {
19
19
  'issue_tracker' => 'https://github.com/mbrendler/git-crecord/issues'
20
20
  }
21
- spec.require_paths = %w(lib)
21
+ spec.require_paths = %w[lib]
22
22
  spec.files = `git ls-files`.split($RS).delete_if{ |f| %r{^(spec|test)/} =~ f }
23
23
  spec.test_files = `git ls-files`.split($RS).grep(%r{^(spec|test)/})
24
- spec.executables = %w(git-crecord)
24
+ spec.executables = %w[git-crecord]
25
25
  spec.has_rdoc = false
26
26
  # Install curses dependency, via a native extension hack, because
27
27
  # ruby 2.0 includes curses and can't install curses-gem
@@ -61,7 +61,7 @@ module GitCrecord
61
61
  end
62
62
 
63
63
  def prefix(line_number)
64
- return SELECTED_MAP.fetch(selected) if line_number == 0 && selectable?
64
+ return SELECTED_MAP.fetch(selected) if line_number.zero? && selectable?
65
65
  ' ' * SELECTION_MARKER_WIDTH
66
66
  end
67
67
 
@@ -13,7 +13,7 @@ module GitCrecord
13
13
  end
14
14
 
15
15
  def to_s
16
- @line
16
+ @to_s ||= @line.include?("\t") ? @line.gsub(/\t/, Git.tab) : @line
17
17
  end
18
18
 
19
19
  def x_offset
@@ -48,5 +48,9 @@ module GitCrecord
48
48
  def self.toplevel_dir
49
49
  `git rev-parse --show-toplevel`.chomp
50
50
  end
51
+
52
+ def self.tab
53
+ @tab ||= ' ' * [2, `git config crecord.tabwidth`.to_i].max
54
+ end
51
55
  end
52
56
  end
@@ -10,12 +10,12 @@ module GitCrecord
10
10
  j / ↓ - down
11
11
  k / ↑ - up
12
12
  h / ← - collapse hunk
13
- l / → - expand
13
+ l / → - expand hunk
14
14
  f - toggle fold
15
15
  g - go to first line
16
16
  G - go to last line
17
17
  C-P - up to previous hunk / file
18
- C-N - down to previous hunk / file
18
+ C-N - down to next hunk / file
19
19
  SPACE - toggle selection
20
20
  A - toggle all selections
21
21
  ? - display help
@@ -1,3 +1,3 @@
1
1
  module GitCrecord
2
- VERSION = '1.0.4'.freeze
2
+ VERSION = '1.0.5'.freeze
3
3
  end
@@ -5,7 +5,7 @@ class HunkTest < Minitest::Test
5
5
 
6
6
  def test_strings
7
7
  hunk = Hunk.new('1234567890' * 5)
8
- expected = %w(12345678901 23456789012 34567890123 45678901234 567890)
8
+ expected = %w[12345678901 23456789012 34567890123 45678901234 567890]
9
9
  assert_equal(expected, hunk.strings(19))
10
10
  end
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-crecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maik Brendler