commit - bb5126eae54e9983853ff1474cb79031db490c2e
commit + f6343036aa4d7e3805a44832b566b531271c1c6d
blob - 8e0440ccdc48b95f490d2569a5b63f60004d1480
blob + ea184ea1a744cc0dc2f55f94cb55c6ca80c420f6
--- got/got.1
+++ got/got.1
.Cm got status
are as follows:
.Bl -tag -width Ds
+.It Fl I
+Show unversioned files even if they match an ignore pattern.
.It Fl s Ar status-codes
Only show files with a modification status matching any of the
single-character status codes contained in the
blob - 097226da2568c25ff532d61bf72b41de086e3af9
blob + 3af8d5f635cb8536c5f4a4f0f2466edb846ae896
--- got/got.c
+++ got/got.c
if (error)
goto done;
- error = got_worktree_status(worktree, &paths, repo, print_diff,
- &arg, check_cancelled, NULL);
+ error = got_worktree_status(worktree, &paths, repo, 0,
+ print_diff, &arg, check_cancelled, NULL);
free(id_str);
got_pathlist_free(&paths);
goto done;
__dead static void
usage_status(void)
{
- fprintf(stderr, "usage: %s status [-s status-codes ] [path ...]\n",
+ fprintf(stderr, "usage: %s status [-I] [-s status-codes ] [path ...]\n",
getprogname());
exit(1);
}
char *cwd = NULL, *status_codes = NULL;;
struct got_pathlist_head paths;
struct got_pathlist_entry *pe;
- int ch, i;
+ int ch, i, no_ignores = 0;
TAILQ_INIT(&paths);
- while ((ch = getopt(argc, argv, "s:")) != -1) {
+ while ((ch = getopt(argc, argv, "Is:")) != -1) {
switch (ch) {
+ case 'I':
+ no_ignores = 1;
+ break;
case 's':
for (i = 0; i < strlen(optarg); i++) {
switch (optarg[i]) {
if (error)
goto done;
- error = got_worktree_status(worktree, &paths, repo, print_status,
- status_codes, check_cancelled, NULL);
+ error = got_worktree_status(worktree, &paths, repo, no_ignores,
+ print_status, status_codes, check_cancelled, NULL);
done:
TAILQ_FOREACH(pe, &paths, entry)
free((char *)pe->path);
if (error)
goto done;
error = got_worktree_status(worktree, &paths,
- repo, check_local_changes, &have_changes,
+ repo, 0, check_local_changes, &have_changes,
check_cancelled, NULL);
got_pathlist_free(&paths);
if (error) {
goto done;
if (list_stage)
- error = got_worktree_status(worktree, &paths, repo,
+ error = got_worktree_status(worktree, &paths, repo, 0,
print_stage, NULL, check_cancelled, NULL);
else {
cpa.patch_script_file = patch_script_file;
blob - 9246dbdca16b2907e56bbebc9f597bb7e3e91b10
blob + 5cf85929bb38eed74f828e89ad78c63e26ce9cca
--- include/got_worktree.h
+++ include/got_worktree.h
* a path, and a corresponding status code.
*/
const struct got_error *got_worktree_status(struct got_worktree *,
- struct got_pathlist_head *, struct got_repository *,
+ struct got_pathlist_head *, struct got_repository *, int no_ignores,
got_worktree_status_cb, void *, got_cancel_cb cancel_cb, void *);
/*
blob - 8fda1956ff24817df54807e1982ca82da40af38a
blob + c6a9ee611f39f7106cbf6b33215f75f9f7a5c715
--- lib/worktree.c
+++ lib/worktree.c
const struct got_error *
got_worktree_status(struct got_worktree *worktree,
struct got_pathlist_head *paths, struct got_repository *repo,
- got_worktree_status_cb status_cb, void *status_arg,
+ int no_ignores, got_worktree_status_cb status_cb, void *status_arg,
got_cancel_cb cancel_cb, void *cancel_arg)
{
const struct got_error *err = NULL;
TAILQ_FOREACH(pe, paths, entry) {
err = worktree_status(worktree, pe->path, fileindex, repo,
- status_cb, status_arg, cancel_cb, cancel_arg, 0, 0);
+ status_cb, status_arg, cancel_cb, cancel_arg,
+ no_ignores, 0);
if (err)
break;
}
blob - 551a9622836341a7e773fd8bd8c3dbb99188cac8
blob + 8c6c24e701901e9c2ad8922e593794b9365ff248
--- regress/cmdline/status.sh
+++ regress/cmdline/status.sh
echo '? epsilon/boo' >> $testroot/stdout.expected
echo '? foop' >> $testroot/stdout.expected
(cd $testroot/wt/gamma && got status > $testroot/stdout)
+
+ cmp -s $testroot/stdout.expected $testroot/stdout
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stdout.expected $testroot/stdout
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ cat > $testroot/stdout.expected <<EOF
+? .cvsignore
+? epsilon/.cvsignore
+? epsilon/bar
+? epsilon/boo
+? epsilon/foo
+? epsilon/moo
+? epsilon/new/foo
+? foo
+? foop
+EOF
+ (cd $testroot/wt && got status -I > $testroot/stdout)
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ echo "got status failed unexpectedly" >&2
+ test_done "$testroot" "1"
+ return 1
+ fi
cmp -s $testroot/stdout.expected $testroot/stdout
ret="$?"
ret="$?"
if [ "$ret" != "0" ]; then
diff -u $testroot/stdout.expected $testroot/stdout
+ test_done "$testroot" "$ret"
+ return 1
fi
+
+ cat > $testroot/stdout.expected <<EOF
+? .gitignore
+? a/b/c/foo
+? a/b/c/zoo
+? barp
+? epsilon/bar
+? epsilon/boo
+? epsilon/moo
+? foo
+? foop
+EOF
+ (cd $testroot/wt && got status -I > $testroot/stdout)
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ echo "got status failed unexpectedly" >&2
+ test_done "$testroot" "1"
+ return 1
+ fi
+
+ cmp -s $testroot/stdout.expected $testroot/stdout
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stdout.expected $testroot/stdout
+ fi
test_done "$testroot" "$ret"
}