Top Level Namespace

Defined Under Namespace

Modules: BranchCommon, BranchFactory, Cmd, Commit, Git, Rebase Classes: ArgvIterator, Branch, DetachBranch, G

Constant Summary collapse

MAX =
5
PREFIX =

定数

'stash-commit'
TMP_SUFFIX =
'progresstmp'
PATCH_REMAIN_SUFFIX =
'patch-remain'
BACKUP_SUFFIX =
'backup'

Instance Method Summary collapse

Instance Method Details

#_tryCommit(stash, mode, commitMessage, &onFail) ⇒ Object



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/git/stash/commit.rb', line 137

def _tryCommit(stash, mode, commitMessage, &onFail)
  root = BranchFactory::find stash.name.match(/^#{PREFIX}\/(.+)@.+$/)[1]
  stash.commit(mode, commitMessage){
    # commit --patchのキャンセル時ここに来る
    root.checkout
    $g.backup.delete
    onFail.call
  }

  if Cmd::changesCount != '0'
    remain = DetachBranch.new "#{stash.name}-#{PATCH_REMAIN_SUFFIX}", stash.name
    remain.commit Branch::CommitMode::ALL, "patch-remain from \#{Cmd::revision stash.name}: \#{hash}\n\n*** patch remain ***\n'stash-commit --patch' working patch remain commit.\n\nplease fix conflicts without '\#{stash.name}' contents\n"
    $g.patch = remain
  end

  return true
end

#createBackup(_branch) ⇒ Object




122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/git/stash/commit.rb', line 122

def createBackup(_branch)
  retBackup = DetachBranch.new Cmd::stashName(_branch, BACKUP_SUFFIX), _branch
  branch = BranchFactory::find _branch
  retBackup.commit Branch::CommitMode::ALL, "backup from \#{_branch}: \#{Cmd::revision _branch}\n\n*** backup commit ***\n'stash-commit --to' working backup commit\n"
  branch.cherryPickNoCommit retBackup.name
  branch.reset # cancel 'git add'

  retBackup
end

#main(argv) ⇒ Object



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
# File 'lib/git/stash/commit.rb', line 562

def main(argv)
  hash = Cmd::revision
  branch = Cmd::branchName
  title = Cmd::title

  commitMessage = "WIP on #{branch}: #{hash} #{title}" # default
  to = nil
  from = nil
  rebase = nil
  commit = Commit::ALL
  renameOld = nil
  renameNew = nil

  listup = false
  listupAll = false

  # parse argv
  # ----------
  itArgv = ArgvIterator.new(argv)
  while itArgv.next? do
    arg = itArgv.next
    case arg
    when '-m', '--message'
      commitMessage = itArgv.next
    when '--to'
      to = itArgv.next
    when '--from'
      from = itArgv.next
    when '-a', '--all'
      commit = Commit::ALL
      listupAll = true
    when '-p', '--patch'
      commit = Commit::PATCH
    when '--continue'
      rebase = Rebase::CONTINUE
    when '--skip'
      rebase = Rebase::SKIP
    when '--abort'
      rebase = Rebase::ABORT
    when '--rename'
      renameOld = itArgv.next
      renameNew = itArgv.next
    when '-l', '--list'
      listup = true
    when 'help'
      usage
      Kernel.exit true
    when '-d', '--debug'
      $debugMode = true
    else
      puts "* error: unknown option:#{arg}"
      usage
      raise ''
    end
  end

  # --list [--all]
  if listup
    Cmd::listup branch, listupAll
    Kernel.exit true
  end

  # --continue | --skip | --abort
  # -----------------------------
  if rebase != nil
    begin
      raise '' if !validateRebase
      case rebase
      when Rebase::CONTINUE
        raise '' if !tryStashCommitContinue branch
      when Rebase::SKIP
        raise '' if !tryStashCommitSkip branch
      when Rebase::ABORT
        raise '' if !tryStashCommitAbort branch
      end
      return
    rescue => e
      puts "* failed: stash-commit #{rebase}"
      raise e
    end
  end

  # --rename
  # --------
  if renameOld != nil
    begin
      raise '' if !validateRename branch, renameOld, renameNew
      raise '' if !tryStashCommitRename branch, renameOld, renameNew
      return
    rescue => e
      puts '* failed: stash-commit --rename'
      raise e
    end
  end

  # --from | --to
  # -------------
  if from != nil
    begin
      raise '' if !validateFromTo from or !validateStashCommitFrom branch
      raise '' if !tryStashCommitFrom branch, from
      return
    rescue => e
      puts '* failed: stash-commit --from (index | name)'
      raise e
    end
  elsif to != nil
    # --to 指定がある時
    begin
      raise '' if !validateFromTo to or !validateStashCommitTo branch
      raise '' if !tryStashCommitToGrow branch, to, commitMessage, commit
      return
    rescue => e
      puts '* failed: stash-commit --to (index | name)'
      raise e
    end
  else
    # --to 指定がない時
    begin
      raise '' if !validateStashCommitTo branch
      (MAX+1).times do |i|
        if i == MAX
          puts '* error: branch is too many'
          raise ''
        end

        stashBranch = Cmd::stashName branch, i
        if Cmd::branchExist? stashBranch
          puts "\"#{stashBranch}\" is already exist"
          next
        end

        raise '' if !tryStashCommitTo stashBranch, commitMessage, commit
        return
      end
    rescue => e
      puts '* failed: stash-commit'
      raise e
    end
  end

  raise 'logic error' # ここには来ないはず
end

#osObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/git/stash/sclib/util.rb', line 3

def os
  @os ||= (
    host_os = RbConfig::CONFIG['host_os']
    case host_os
    when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
      :windows
    when /darwin|mac os/
      :macosx
    when /linux/
      :linux
    when /solaris|bsd/
      :unix
    else
      :unknown
    end
  )
end

#tryCommitAll(stash, commitMessage, &onFail) ⇒ Object



161
162
163
# File 'lib/git/stash/commit.rb', line 161

def tryCommitAll(stash, commitMessage, &onFail)
  _tryCommit(stash, Branch::CommitMode::ALL, commitMessage){onFail.call}
end

#tryCommitPatch(stash, commitMessage, &onFail) ⇒ Object



164
165
166
# File 'lib/git/stash/commit.rb', line 164

def tryCommitPatch(stash, commitMessage, &onFail)
  _tryCommit(stash, Branch::CommitMode::PATCH, commitMessage){onFail.call}
end

#tryStashCommitAbort(branch) ⇒ Object



479
480
481
482
483
484
485
486
487
488
# File 'lib/git/stash/commit.rb', line 479

def tryStashCommitAbort(branch)
  if $g.tmp or $g.patch
    return false if !tryStashCommitAbortTo $g.tmp, $g.patch
    $g.backup.delete if $g.backup
  else
    return false if !tryStashCommitAbortFrom branch
  end

  return true
end

#tryStashCommitAbortFrom(branch) ⇒ Object



464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/git/stash/commit.rb', line 464

def tryStashCommitAbortFrom(branch)
  # tmpが無いので、rebase中の時のみ継続
  return false if !Cmd::rebaseInProgress?

  rootMatch = branch.match(/.+rebasing #{PREFIX}\/(.+)@.+\)$/)
  return false if !rootMatch
  return false if !Cmd::execRet 'git rebase --abort'

  # ここまでくれば安心
  root = BranchFactory::find rootMatch[1]
  root.checkout

  return true
end

#tryStashCommitAbortTo(tmp, patch) ⇒ Object




429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/git/stash/commit.rb', line 429

def tryStashCommitAbortTo(tmp, patch)
  if !$g.backup
    puts "stop, '#{BACKUP_SUFFIX}' is not found, from starting stash-commit --to"
    return false
  end

  # rebase --abort前かもしれない
  Cmd::exec 'git rebase --abort' if Cmd::rebaseInProgress?

  if tmp
    root = BranchFactory::find tmp.name.match(/^#{PREFIX}\/(.+)@.+-#{TMP_SUFFIX}$/)[1]
    root.checkout
    tmp.delete
  end
  if patch
    root = BranchFactory::find patch.name.match(/^#{PREFIX}\/(.+)@.+-#{PATCH_REMAIN_SUFFIX}$/)[1]
    root.checkout
    patch.delete

    # もしかしたらtmpとして削除済み
    patchParent = BranchFactory::find patch.name.match(/^(#{PREFIX}\/.+)-#{PATCH_REMAIN_SUFFIX}$/)[1]
    if patchParent
      patchParent.delete
    end
  end

  # ここまでくれば安心
  root = BranchFactory::find $g.backup.name.match(/^#{PREFIX}\/(.+)@#{BACKUP_SUFFIX}$/)[1]
  root.checkout
  root.cherryPickNoCommit $g.backup.name
  root.reset # cancel 'git add'

  return true
end

#tryStashCommitContinue(branch) ⇒ Object



341
342
343
344
345
346
347
348
349
350
# File 'lib/git/stash/commit.rb', line 341

def tryStashCommitContinue(branch)
  if $g.tmp or $g.patch
    return false if !tryStashCommitContinueTo $g.tmp, $g.patch
    $g.backup.delete if $g.backup
  else
    return false if !tryStashCommitContinueFrom branch
  end

  return true
end

#tryStashCommitContinueFrom(branch) ⇒ Object



321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/git/stash/commit.rb', line 321

def tryStashCommitContinueFrom(branch)
  # tmpが無いので、rebase中の時のみ継続
  return false if !Cmd::rebaseInProgress?

  stashMatch = branch.match(/.+rebasing (#{PREFIX}\/.+)\)$/)
  rootMatch = branch.match(/.+rebasing #{PREFIX}\/(.+)@.+\)$/)
  return false if !stashMatch
  return false if !Cmd::execRet 'git rebase --continue'

  # ここまでくれば安心
  stash = BranchFactory::find stashMatch[1]
  root = BranchFactory::find rootMatch[1]
  revision = Cmd::revision root.name
  root.rebase stash.name
  stash.delete
  root.reset revision

  return true
end

#tryStashCommitContinueTo(tmp, patch) ⇒ Object




270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/git/stash/commit.rb', line 270

def tryStashCommitContinueTo(tmp, patch)
  # rebase --continue前かもしれない
  Cmd::exec('git rebase --continue') if Cmd::rebaseInProgress?

  if patch
    root = BranchFactory::find patch.name.match(/^#{PREFIX}\/(.+)@.+-#{PATCH_REMAIN_SUFFIX}$/)[1]
    # rebase --skip後かもしれない
    if Cmd::sameBranch? patch.name, root.name
      puts "stop, '#{PATCH_REMAIN_SUFFIX}' rebase --skip found, from starting stash-commit --patch"
      raise ''
    end
    # rebase --abort後かもしれない
    if !Cmd::parentChildBranch? patch.name, root.name
      patch.rebaseOnto root.name, "#{patch.name}~"
    end
  end
  if tmp
    stash = BranchFactory::find tmp.name.match(/^(#{PREFIX}\/.+)-#{TMP_SUFFIX}$/)[1]
    # rebase --skip後かもしれない
    if Cmd::sameBranch? tmp.name, stash.name
      puts "stop, '#{TMP_SUFFIX}' rebase --skip found, from starting stash-commit --to"
      raise ''
    end
    # rebase --abort後かもしれない
    if !Cmd::parentChildBranch? tmp.name, stash.name
      tmp.rebaseOnto stash.name, "#{tmp.name}~"
    end
  end

  # ここまでくれば安心
  if tmp
    root = BranchFactory::find tmp.name.match(/^#{PREFIX}\/(.+)@.+-#{TMP_SUFFIX}$/)[1]
    stash = BranchFactory::find tmp.name.match(/^(#{PREFIX}\/.+)-#{TMP_SUFFIX}$/)[1]

    tmp.rebase stash.name
    stash.rebase tmp.name
    tmp.delete
    root.checkout
  end
  if patch
    root = BranchFactory::find patch.name.match(/^#{PREFIX}\/(.+)@.+-#{PATCH_REMAIN_SUFFIX}$/)[1]
    revision = Cmd::revision root.name

    root.rebase patch.name
    patch.delete
    root.reset revision
  end

  return true
end

#tryStashCommitFrom(_branch, from) ⇒ Object




252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/git/stash/commit.rb', line 252

def tryStashCommitFrom(_branch, from)
  stash = BranchFactory::find (Cmd::stashName _branch, from)
  branch = BranchFactory::find _branch

  baseHash = Cmd::mergeBaseHash branch.name, stash.name
  stash.rebaseOnto branch.name, baseHash

  # ここまでくれば安心
  revision = Cmd::revision branch.name
  branch.rebase stash.name
  stash.delete
  branch.reset revision

  return true
end

#tryStashCommitRename(branch, renameOld, renameNew) ⇒ Object




492
493
494
# File 'lib/git/stash/commit.rb', line 492

def tryStashCommitRename(branch, renameOld, renameNew)
  Cmd::stashCommitRename renameOld, renameNew
end

#tryStashCommitSkip(branch) ⇒ Object



416
417
418
419
420
421
422
423
424
425
# File 'lib/git/stash/commit.rb', line 416

def tryStashCommitSkip(branch)
  if $g.tmp or $g.patch
    return false if !tryStashCommitSkipTo $g.tmp, $g.patch
    $g.backup.delete if $g.backup
  else
    return false if !tryStashCommitSkipFrom branch
  end

  return true
end

#tryStashCommitSkipFrom(branch) ⇒ Object



398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/git/stash/commit.rb', line 398

def tryStashCommitSkipFrom(branch)
  # tmpが無いので、rebase中の時のみ継続
  return false if !Cmd::rebaseInProgress?

  stashMatch = branch.match(/.+rebasing (#{PREFIX}\/.+)\)$/)
  rootMatch = branch.match(/.+rebasing #{PREFIX}\/(.+)@.+\)$/)
  return false if !stashMatch
  return false if !Cmd::execRet 'git rebase --skip'

  # ここまでくれば安心
  stash = BranchFactory::find stashMatch[1]
  root = BranchFactory::find rootMatch[1]
  root.rebase stash.name
  stash.delete

  return true
end

#tryStashCommitSkipTo(tmp, patch) ⇒ Object




354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
# File 'lib/git/stash/commit.rb', line 354

def tryStashCommitSkipTo(tmp, patch)
  # rebase --skip前かもしれない
  Cmd::exec('git rebase --skip') if Cmd::rebaseInProgress?

  if patch
    root = BranchFactory::find patch.name.match(/^#{PREFIX}\/(.+)@.+-#{PATCH_REMAIN_SUFFIX}$/)[1]
    # rebase --continue後かもしれない
    if Cmd::parentChildBranch? patch.name, root.name
      puts "stop, '#{PATCH_REMAIN_SUFFIX}' rebase --continue found, from starting stash-commit --patch"
      raise ''
    end
    # rebase --abort後はスルー
  end
  if tmp
    stash = BranchFactory::find tmp.name.match(/^(#{PREFIX}\/.+)-#{TMP_SUFFIX}$/)[1]
    # rebase --continue後かもしれない
    if Cmd::parentChildBranch? tmp.name, stash.name
      puts "stop, '#{TMP_SUFFIX}' rebase --continue found, from starting stash-commit --to"
      raise ''
    end
    # rebase --abort後はスルー
  end

  # ここまでくれば安心
  if tmp
    root = BranchFactory::find tmp.name.match(/^#{PREFIX}\/(.+)@.+-#{TMP_SUFFIX}$/)[1]
    root.checkout
    tmp.delete # skipなので捨てる
  end
  if patch
    root = BranchFactory::find patch.name.match(/^#{PREFIX}\/(.+)@.+-#{PATCH_REMAIN_SUFFIX}$/)[1]
    root.checkout
    patch.delete # skipなので捨てる

    # もしかしたらtmpとして削除済み
    patchParent = BranchFactory::find patch.name.match(/^(#{PREFIX}\/.+)-#{PATCH_REMAIN_SUFFIX}$/)[1]
    if patchParent
      patchParent.delete
    end
  end

  return true
end

#tryStashCommitTo(stashBranch, commitMessage, commit, reset = true, backup = true) ⇒ Object



201
202
203
204
205
# File 'lib/git/stash/commit.rb', line 201

def tryStashCommitTo(stashBranch, commitMessage, commit, reset=true, backup=true)
  rootBranch = stashBranch.match(/^#{PREFIX}\/(.+)@.+$/)[1]
  stash = Branch::new stashBranch, rootBranch
  tryStashCommitToInternal stash, commitMessage, commit, reset, backup
end

#tryStashCommitToGrow(branch, to, commitMessage, commit) ⇒ Object



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/git/stash/commit.rb', line 207

def tryStashCommitToGrow(branch, to, commitMessage, commit)
  stashBranch = Cmd::stashName branch, to
  root = BranchFactory::find stashBranch.match(/^#{PREFIX}\/(.+)@.+$/)[1]

  $g.backup = createBackup root.name

  if !Cmd::branchExist? stashBranch
    # 新規作成
    stash = Branch.new stashBranch, root.name
    return false if !tryStashCommitToInternal stash, commitMessage, commit, true, false
  else
    # 存在してるので、そのブランチへ追加する
    # 一端新規作成し
    tmp = DetachBranch.new "#{stashBranch}-#{TMP_SUFFIX}", root.name
    return false if !tryStashCommitToInternal tmp, commitMessage, commit, false, false

    stash = BranchFactory::find stashBranch

    # rebaseで追加
    tmp.rebase stash.name
    stash.rebase tmp.name
    tmp.delete

    root.checkout

    case commit
    when Commit::ALL
      # no-op
    when Commit::PATCH
      if $g.patch
        revision = Cmd::revision root.name
        root.rebase $g.patch.name
        $g.patch.delete
        root.reset revision
      end
    end
  end

  $g.backup.delete

  return true
end

#tryStashCommitToInternal(stash, commitMessage, commit, reset = true, backup = true) ⇒ Object



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/git/stash/commit.rb', line 168

def tryStashCommitToInternal(stash, commitMessage, commit, reset=true, backup=true)
  root = BranchFactory::find stash.name.match(/^#{PREFIX}\/(.+)@.+$/)[1]

  $g.backup = createBackup root.name if backup

  case commit
  when Commit::ALL
    return false if !tryCommitAll(stash, commitMessage){stash.delete}
    root.checkout
  when Commit::PATCH
    return false if !tryCommitPatch(stash, commitMessage){stash.delete}

    if $g.patch
      $g.patch.rebaseOnto root.name, "#{$g.patch.name}~"

      if reset
        revision = Cmd::revision root.name
        root.rebase $g.patch.name
        $g.patch.delete
        root.reset revision
      else
        root.checkout
      end
    else
      root.checkout
    end
  end

  $g.backup.delete if backup

  return true
end

#usageObject




498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
# File 'lib/git/stash/commit.rb', line 498

def usage
  print "usage)\n  git stash-commit [--to (index | name)] [-m <commit message>] [-a | -p]\n    options : --to              default: unused index\n              -m | --message    default: \"WIP on <branch>: <hash> <title>\"\n              -a | --all        default\n              -p | --patch\n    NOTE : --all   equal 'git commit --all'\n           --patch equal 'git commit --patch'\n  git stash-commit --from (index | name) [--no-reset]\n    NOTE : --no-reset rebase only\n  git stash-commit --continue\n  git stash-commit --skip\n  git stash-commit --abort\n  git stash-commit --rename <oldname> <newname>\n    NOTE : \#{PREFIX}/<oldname>@to \#{PREFIX}/<newname>@to\n  git stash-commit -l [-a]\n    options : -l | --list       listup stash-commit branch, in this group\n              -a | --all        listup stash-commit branch all\n  git stash-commit help\n  git stash-commit <any args> [-d]\n    options : -d | --debug      debug mode, show backtrace\n"
end

#validateFromTo(fromto) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/git/stash/commit.rb', line 32

def validateFromTo(fromto)
  # 数値 or ブランチ名
  if fromto == ''
    puts 'target name is empty'
    return false
  end
  if fromto.match(/^#{PREFIX}/)
    puts "/^#{PREFIX}/ is reserved words"
    return false
  end
  if fromto.match(/#{TMP_SUFFIX}$/)
    puts "/#{TMP_SUFFIX}$/ is reserved words"
    return false
  end
  if fromto.match(/#{PATCH_REMAIN_SUFFIX}$/)
    puts "/#{PATCH_REMAIN_SUFFIX}$/ is reserved words"
    return false
  end
  if fromto.match(/#{BACKUP_SUFFIX}$/)
    puts "/#{BACKUP_SUFFIX}$/ is reserved words"
    return false
  end
  if fromto.match(/@/)
    puts '@ is used in delimiter'
    return false
  end

  return true
end

#validateRebaseObject




23
24
25
26
27
28
29
30
# File 'lib/git/stash/commit.rb', line 23

def validateRebase
  return true if $g.tmp
  return true if Cmd::rebaseInProgress?
  return true if $g.patch

  puts 'stash-commit (--continue | --skip | --abort) is not need'
  return false
end

#validateRename(branch, renameOld, renameNew) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
# File 'lib/git/stash/commit.rb', line 88

def validateRename(branch, renameOld, renameNew)
  return false if !validateStashCommitFromTo branch # 同じ
  return false if !validateFromTo renameOld
  return false if !validateFromTo renameNew
  if renameOld == renameNew
    puts "old:\"#{renameOld}\" new:\"#{renameNew}\" is same"
    return false
  end

  return true
end

#validateStashCommitFrom(branch) ⇒ Object



100
101
102
103
104
105
106
107
108
# File 'lib/git/stash/commit.rb', line 100

def validateStashCommitFrom(branch)
  if Cmd::changesCount != '0'
    puts 'find editing files, please fix it'
    return false
  end
  return false if !validateStashCommitFromTo branch

  return true
end

#validateStashCommitFromTo(branch) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/git/stash/commit.rb', line 62

def validateStashCommitFromTo(branch)
  if Cmd::rebaseInProgress?
    puts 'now rebase in progress, please fix it'
    return false
  end
  if $g.tmp
    puts 'find tmp branch, please fix it'
    return false
  end
  if $g.patch
    puts 'find patch branch, please fix it'
    return false
  end
  if $g.backup
    puts'find backup branch, please fix it'
    return false
  end

  if branch.match(/^#{PREFIX}/)
    puts "can't work in stash-commit branch" # ネストはややこしい
    return false
  end

  return true
end

#validateStashCommitTo(branch) ⇒ Object



110
111
112
113
114
115
116
117
118
# File 'lib/git/stash/commit.rb', line 110

def validateStashCommitTo(branch)
  if Cmd::changesCount == '0'
    puts 'not need'
    return false
  end
  return false if !validateStashCommitFromTo branch

  return true
end

#win?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/git/stash/sclib/util.rb', line 21

def win?
  os == :windows
end