Class: RepoTender::SCM::Status

Inherits:
Data
  • Object
show all
Defined in:
lib/repo_tender/scm/status.rb

Overview

Value object produced by parsing ‘git status –porcelain=v2 –branch –untracked-files=normal`. v2 is mandatory (per AGENTS.md gotcha) so submodule state and rename detection are stable.

A working tree is “clean” iff the only porcelain-v2 lines are the ‘# branch.*` header lines. Any `1`/`2`/`u`/`?`/`!` line is dirty.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(clean:, branch: nil, upstream: nil, ahead: 0, behind: 0, detached: false, entries: [], unborn: false) ⇒ Status

Returns a new instance of Status.



13
14
15
# File 'lib/repo_tender/scm/status.rb', line 13

def initialize(clean:, branch: nil, upstream: nil, ahead: 0, behind: 0, detached: false, entries: [], unborn: false)
  super
end

Instance Attribute Details

#aheadObject (readonly)

Returns the value of attribute ahead

Returns:

  • (Object)

    the current value of ahead



12
13
14
# File 'lib/repo_tender/scm/status.rb', line 12

def ahead
  @ahead
end

#behindObject (readonly)

Returns the value of attribute behind

Returns:

  • (Object)

    the current value of behind



12
13
14
# File 'lib/repo_tender/scm/status.rb', line 12

def behind
  @behind
end

#branchObject (readonly)

Returns the value of attribute branch

Returns:

  • (Object)

    the current value of branch



12
13
14
# File 'lib/repo_tender/scm/status.rb', line 12

def branch
  @branch
end

#cleanObject (readonly)

Returns the value of attribute clean

Returns:

  • (Object)

    the current value of clean



12
13
14
# File 'lib/repo_tender/scm/status.rb', line 12

def clean
  @clean
end

#detachedObject (readonly)

Returns the value of attribute detached

Returns:

  • (Object)

    the current value of detached



12
13
14
# File 'lib/repo_tender/scm/status.rb', line 12

def detached
  @detached
end

#entriesObject (readonly)

Returns the value of attribute entries

Returns:

  • (Object)

    the current value of entries



12
13
14
# File 'lib/repo_tender/scm/status.rb', line 12

def entries
  @entries
end

#unbornObject (readonly)

Returns the value of attribute unborn

Returns:

  • (Object)

    the current value of unborn



12
13
14
# File 'lib/repo_tender/scm/status.rb', line 12

def unborn
  @unborn
end

#upstreamObject (readonly)

Returns the value of attribute upstream

Returns:

  • (Object)

    the current value of upstream



12
13
14
# File 'lib/repo_tender/scm/status.rb', line 12

def upstream
  @upstream
end

Instance Method Details

#clean?Boolean

Returns:

  • (Boolean)


17
# File 'lib/repo_tender/scm/status.rb', line 17

def clean? = clean

#detached?Boolean

Returns:

  • (Boolean)


19
# File 'lib/repo_tender/scm/status.rb', line 19

def detached? = detached

#unborn?Boolean

Returns:

  • (Boolean)


21
# File 'lib/repo_tender/scm/status.rb', line 21

def unborn? = unborn