MCPcopy Create free account
hub / github.com/SpartanJ/eepp / parseAheadBehind

Function parseAheadBehind

src/tools/ecode/plugins/git/git.cpp:368–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366}
367
368static void parseAheadBehind( std::string_view aheadBehind, Git::Branch& branch ) {
369 static constexpr auto BEHIND = "behind "sv;
370 static constexpr auto AHEAD = "ahead "sv;
371 if ( aheadBehind.empty() )
372 return;
373 if ( aheadBehind == "gone" ) {
374 branch.gone = true;
375 return;
376 }
377 auto split = String::split( aheadBehind, ',' );
378 for ( auto s : split ) {
379 s = String::trim( s );
380 if ( String::startsWith( s, BEHIND ) ) {
381 std::string numStr = std::string{ s.substr( BEHIND.size() ) };
382 Int64 val = 0;
383 if ( String::fromString( val, numStr ) )
384 branch.behind = val;
385 } else if ( String::startsWith( s, AHEAD ) ) {
386 std::string numStr = std::string{ s.substr( AHEAD.size() ) };
387 Int64 val = 0;
388 if ( String::fromString( val, numStr ) )
389 branch.ahead = val;
390 }
391 }
392}
393
394Git::Branch parseLocalBranch( const std::string_view& raw ) {
395 auto split = String::split( raw, '\t', true );

Callers 3

parseLocalBranchFunction · 0.85
parseRemoteBranchFunction · 0.85
parseTagFunction · 0.85

Calls 4

fromStringFunction · 0.85
substrMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected