| 366 | } |
| 367 | |
| 368 | static 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 | |
| 394 | Git::Branch parseLocalBranch( const std::string_view& raw ) { |
| 395 | auto split = String::split( raw, '\t', true ); |
no test coverage detected