git-topic 0.2.3.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gvimrc +3 -5
- data/History.txt +5 -1
- data/VERSION.yml +2 -2
- data/lib/git_topic.rb +34 -8
- data/spec/comment_spec.rb +1 -0
- data/spec/git_topic_setup_spec.rb +55 -3
- metadata +3 -4
data/.gvimrc
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
2
|
-
" Setup tabs
|
3
|
-
|
4
|
-
Project .vimproject
|
2
|
+
" Setup tabs
|
5
3
|
|
6
4
|
tabnew
|
7
5
|
tabnew
|
@@ -13,11 +11,11 @@ tabnew
|
|
13
11
|
tabnew
|
14
12
|
tabnew
|
15
13
|
|
16
|
-
tabdo Project
|
17
|
-
tabdo wincmd l
|
18
14
|
tabdo wincmd n
|
15
|
+
tabdo wincmd =
|
19
16
|
|
20
17
|
1tabn
|
21
18
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
22
19
|
|
23
20
|
winpos 433 25
|
21
|
+
|
data/History.txt
CHANGED
data/VERSION.yml
CHANGED
data/lib/git_topic.rb
CHANGED
@@ -325,11 +325,22 @@ module GitTopic
|
|
325
325
|
|
326
326
|
# Setup .git/config.
|
327
327
|
#
|
328
|
-
# This
|
329
|
-
# comments.
|
328
|
+
# This means setting up:
|
329
|
+
# 1. refspecs for origin fetching for review comments.
|
330
|
+
# 2. notes.rewriteRef for copying review comments on rebase.
|
331
|
+
#
|
330
332
|
def setup( opts={} )
|
331
|
-
|
332
|
-
|
333
|
+
cmds = []
|
334
|
+
|
335
|
+
cmds <<(
|
336
|
+
"config --add remote.origin.fetch refs/notes/reviews/*:refs/notes/reviews/*"
|
337
|
+
) unless has_setup_refspec?
|
338
|
+
|
339
|
+
cmds <<(
|
340
|
+
"config --add notes.rewriteRef refs/notes/reviews/*"
|
341
|
+
) unless has_setup_notes_rewrite?
|
342
|
+
|
343
|
+
git cmds.compact
|
333
344
|
end
|
334
345
|
|
335
346
|
def install_aliases( opts={} )
|
@@ -378,18 +389,26 @@ module GitTopic
|
|
378
389
|
suppress_whine = `git config topic.checkForNotesRef`.chomp == "false"
|
379
390
|
return if suppress_whine
|
380
391
|
|
381
|
-
unless has_setup_refspec?
|
392
|
+
unless has_setup_refspec? && has_setup_notes_rewrite?
|
382
393
|
STDERR.puts "
|
383
394
|
Warning: git repository is not set up for git topic. Review comments
|
384
|
-
will not automatically be pulled on git fetch
|
385
|
-
for suppressing this message:
|
395
|
+
will not automatically be pulled on git fetch and will not be copied
|
396
|
+
on a rebase. You have two options for suppressing this message:
|
397
|
+
|
398
|
+
1. Run git-topic setup to setup fetch refspecs for origin and
|
399
|
+
comments copying on rebase.
|
386
400
|
|
387
|
-
1. Run git-topic setup to setup fetch refspecs for origin.
|
388
401
|
2. Run git config topic.checkForNotesRef false.
|
389
402
|
If you do this, you can manually fetch reviewers' comments with
|
390
403
|
the following command
|
391
404
|
|
392
405
|
git fetch origin refs/notes/reviews/*:refs/notes/reviews/*
|
406
|
+
|
407
|
+
Similarly, you can ensure your comments are not lost on rebase by running
|
408
|
+
|
409
|
+
GIT_NOTES_REWRITE_REF=refs/notes/reviews/* git rebase
|
410
|
+
|
411
|
+
instead of `git rebase`
|
393
412
|
".cleanup
|
394
413
|
end
|
395
414
|
end
|
@@ -401,6 +420,13 @@ module GitTopic
|
|
401
420
|
end
|
402
421
|
end
|
403
422
|
|
423
|
+
def has_setup_notes_rewrite?
|
424
|
+
notes_rewrites = capture_git( "config --get-all notes.rewriteRef" ).split( "\n" )
|
425
|
+
notes_rewrites.any? do |refs|
|
426
|
+
refs == "refs/notes/reviews/*"
|
427
|
+
end
|
428
|
+
end
|
429
|
+
|
404
430
|
end
|
405
431
|
end
|
406
432
|
|
data/spec/comment_spec.rb
CHANGED
@@ -9,14 +9,45 @@ describe GitTopic do
|
|
9
9
|
|
10
10
|
it "should install reviews refspec for origin" do
|
11
11
|
|
12
|
-
|
12
|
+
%x{
|
13
13
|
git config --get-all remote.origin.fetch
|
14
14
|
}.should_not =~ %r{refs/notes}
|
15
15
|
|
16
16
|
GitTopic.setup
|
17
|
+
|
18
|
+
%x{
|
19
|
+
git config --get-all remote.origin.fetch
|
20
|
+
}.should =~ %r{refs/notes}
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should configure notes.rewriteRef" do
|
24
|
+
|
17
25
|
%x{
|
26
|
+
git config --get-all notes.rewriteRef
|
27
|
+
}.should_not =~ %r{refs/notes}
|
28
|
+
|
29
|
+
GitTopic.setup
|
30
|
+
|
31
|
+
%x{
|
32
|
+
git config --get-all notes.rewriteRef
|
33
|
+
}.should =~ %r{refs/notes}
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should configure notes.rewriteRef even if refspecs are already set up" do
|
37
|
+
|
38
|
+
system "git config --add remote.origin.fetch refs/notes/reviews/*:refs/notes/reviews/*"
|
39
|
+
GitTopic.setup
|
40
|
+
%x{
|
41
|
+
git config --get-all notes.rewriteRef
|
42
|
+
}.should =~ %r{refs/notes}
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should configure refspecs even if notes.rewriteRef is already set up" do
|
46
|
+
system "git config --add notes.rewriteRef refs/notes/reviews/*"
|
47
|
+
GitTopic.setup
|
48
|
+
%x{
|
18
49
|
git config --get-all remote.origin.fetch
|
19
|
-
|
50
|
+
}.should =~ %r{refs/notes}
|
20
51
|
end
|
21
52
|
|
22
53
|
it "should be idempotent" do
|
@@ -57,10 +88,31 @@ describe GitTopic do
|
|
57
88
|
end
|
58
89
|
end
|
59
90
|
|
91
|
+
describe "
|
92
|
+
when in a git repository that is set up for fetching, but not rewriting
|
93
|
+
notes
|
94
|
+
".oneline do
|
95
|
+
|
96
|
+
before( :each ) { use_repo 'in-progress' }
|
97
|
+
|
98
|
+
it "should ask the user to #setup or configure no-whine" do
|
99
|
+
|
100
|
+
system "git config --add remote.origin.fetch refs/notes/reviews/*:refs/notes/reviews/*"
|
101
|
+
|
102
|
+
with_argv( [] ) do
|
103
|
+
GitTopic.run
|
104
|
+
@err.should =~ /setup/
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
60
109
|
describe "when in a git repository configured for nowhining" do
|
61
110
|
before( :each ) { use_repo 'in-progress' }
|
62
111
|
|
63
|
-
it "
|
112
|
+
it "
|
113
|
+
should not whine, even when refs are not set up and notes.rewriteRef is
|
114
|
+
not setup
|
115
|
+
".oneline do
|
64
116
|
system "git config topic.checkForNotesRef false > /dev/null 2> /dev/null"
|
65
117
|
GitTopic.run
|
66
118
|
@err.should_not =~ /setup/
|
metadata
CHANGED
@@ -5,9 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 0.2.3.3
|
8
|
+
- 4
|
9
|
+
version: 0.2.4
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- David J. Hamilton
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-08-14 00:00:00 -07:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|