All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Add "--only-untracked" flag to status commands.
@ 2007-08-23 19:58 ` Väinö Järvelä
  2007-08-23 20:50   ` Matthieu Moy
  0 siblings, 1 reply; 21+ messages in thread
From: Väinö Järvelä @ 2007-08-23 19:58 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Väinö Järvelä

With this flag, the user can choose to filter untracked files from the
status output. This can be used to either speed up the status output, as
the untracked files are not fetched at all, or to just cleanup the
output without using gitignore.

Signed-off-by: Väinö Järvelä <v@pp.inet.fi>
---
 builtin-runstatus.c |    4 +++-
 git-commit.sh       |   11 +++++++++--
 wt-status.c         |    8 +++++++-
 wt-status.h         |    1 +
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/builtin-runstatus.c b/builtin-runstatus.c
index 2db25c8..2121762 100644
--- a/builtin-runstatus.c
+++ b/builtin-runstatus.c
@@ -5,7 +5,7 @@
 extern int wt_status_use_color;
 
 static const char runstatus_usage[] =
-"git-runstatus [--color|--nocolor] [--amend] [--verbose] [--untracked]";
+"git-runstatus [--color|--nocolor] [--amend] [--verbose] [--untracked]" "[--only-tracked]";
 
 int cmd_runstatus(int argc, const char **argv, const char *prefix)
 {
@@ -28,6 +28,8 @@ int cmd_runstatus(int argc, const char **argv, const char *prefix)
 			s.verbose = 1;
 		else if (!strcmp(argv[i], "--untracked"))
 			s.untracked = 1;
+		else if (!strcmp(argv[i], "--only-tracked"))
+			s.only_tracked = 1;
 		else
 			usage(runstatus_usage);
 	}
diff --git a/git-commit.sh b/git-commit.sh
index d7e7028..0ef50d9 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -3,7 +3,7 @@
 # Copyright (c) 2005 Linus Torvalds
 # Copyright (c) 2006 Junio C Hamano
 
-USAGE='[-a | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [--template <file>] [[-i | -o] <path>...]'
+USAGE='[-a | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [--template <file>] [--only-tracked] [[-i | -o] <path>...]'
 SUBDIRECTORY_OK=Yes
 . git-sh-setup
 require_work_tree
@@ -56,7 +56,8 @@ run_status () {
 	git runstatus ${color} \
 		${verbose:+--verbose} \
 		${amend:+--amend} \
-		${untracked_files:+--untracked}
+		${untracked_files:+--untracked} \
+		${only_tracked:+--only-tracked}
 }
 
 trap '
@@ -87,6 +88,7 @@ signoff=
 force_author=
 only_include_assumed=
 untracked_files=
+only_tracked=
 templatefile="`git config commit.template`"
 while case "$#" in 0) break;; esac
 do
@@ -269,6 +271,11 @@ $1"
 		untracked_files=t
 		shift
 		;;
+    --only-|--only-t|--only-tr|--only-tra|--only-trac|--only-track|\
+    --only-tracke|--only-tracked)
+        only_tracked=t
+        shift
+        ;;
 	--)
 		shift
 		break
diff --git a/wt-status.c b/wt-status.c
index 5205420..7c2c468 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -331,7 +331,13 @@ void wt_status_print(struct wt_status *s)
 	}
 
 	wt_status_print_changed(s);
-	wt_status_print_untracked(s);
+
+	if (!s->only_tracked) {
+		wt_status_print_untracked(s);
+	}
+	else {
+		printf("# Untracked files were filtered by \"--only-tracked\"\n");
+	}
 
 	if (s->verbose && !s->is_initial)
 		wt_status_print_verbose(s);
diff --git a/wt-status.h b/wt-status.h
index cfea4ae..45b7e09 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -15,6 +15,7 @@ struct wt_status {
 	int verbose;
 	int amend;
 	int untracked;
+	int only_tracked;
 	/* These are computed during processing of the individual sections */
 	int commitable;
 	int workdir_dirty;
-- 
1.5.3.rc6.17.g1911-dirty

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2007-08-27 13:18 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-23 19:58 [PATCH 1/2] Add "--only-untracked" flag to status commands Väinö Järvelä
2007-08-23 19:58 ` Väinö Järvelä
2007-08-23 20:50   ` Matthieu Moy
2007-08-24  6:28     ` Väinö Järvelä
2007-08-23 19:58 ` [PATCH 2/2] Documented "--only-untracked" flag Väinö Järvelä
2007-08-23 19:58   ` Väinö Järvelä
2007-08-23 20:32 ` [PATCH 1/2] Add "--only-untracked" flag to status commands Alex Riesen
2007-08-24  6:35   ` Väinö Järvelä
2007-08-24  7:40     ` Jakub Narebski
2007-08-27 13:18       ` Andreas Ericsson
2007-08-24  7:46     ` Junio C Hamano
2007-08-24  9:31       ` Väinö Järvelä
2007-08-24  9:55         ` Johannes Schindelin
2007-08-24 10:52           ` Väinö Järvelä
2007-08-25 14:39             ` Johannes Schindelin
2007-08-24 11:40           ` Matthieu Moy
2007-08-24 22:47       ` Jakub Narebski
2007-08-24 23:06         ` Junio C Hamano
2007-08-25  6:16           ` Väinö Järvelä
2007-08-25 14:42             ` Johannes Schindelin
2007-08-24 22:33     ` Alex Riesen
2007-08-25  5:37       ` Väinö Järvelä
2007-08-25  6:10         ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.