Git::Status - obtain status of a git repository
use Git::Status;
my $status := Git::Status.new(:$directory);
if $status.is-clean {
say "Is clean";
}
if $status.modified -> @modified {
say "Modified:";
.say for @modified;
}
if $status.added -> @added {
say "Added:";
.say for @added;
}
if $status.deleted -> @deleted {
say "Deleted:";
.say for @deleted;
}
if $status.renamed -> @renamed {
say "Renamed:";
.say for @renamed;
}
if $status.copied -> @copied {
say "Copied:";
.say for @copied;
}
if $status.updated -> @updated {
say "Updated:";
.say for @updateded;
}
if $status.untracked -> @untracked {
say "Untracked:";
.say for @untracked;
}
Git::Status provides a simple way to obtain the status of a git repository using the git status --porcelain
command (version 1) and simplifying the results to indicate whether the repository is 'clean' or 'dirty'. This module's primary purpose is to determine whether any action is required to satisfy further use by App::Mi6
or to indicate user intervention is necessary.
Note the full output of git status --porcelain
is quite complex and completely identifies the situation with regards to both the index and the working tree (a complex task with many possible combinations). See the git-status
man page for details.
The directory of the git repository. Can be specified as either an IO::Path
object, or as a string. Defaults to $*CWD
. It should be readable.
Returns the value of the $!clean variable which is True for a "clean" Git directory.
A text representation of the object, empty string if there were no modified, added, deleted, renamed, copied, updated, or untracked files.
The paths of files that have been added.
The paths of files that have been deleted.
The directory of the repository, as an IO::Path
object.
The paths of files that have been modified.
The paths of files that are not tracked yet.
The paths of files that are new.
The paths of files that are renamed.
Elizabeth Mattijsen liz@raku.rocks
Source can be located at: https://github.com/lizmat/Git-Status . Comments and Pull Requests are welcome.
Copyright 2021, 2024 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.