git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 1/2] Add "--only-untracked" flag to status commands.
       [not found] <4fcfda4a654b003f3ae3dc8d56424b5f59f48093.1187897406.git.v@pp.inet.fi>
@ 2007-08-23 19:58 ` Väinö Järvelä
  2007-08-23 20:50   ` Matthieu Moy
       [not found] ` <4ec861b086e2d349289f956ea0fe9f4d0559a568.1187897406.git.v@pp.inet.fi>
  2007-08-23 20:32 ` [PATCH 1/2] Add "--only-untracked" flag to status commands Alex Riesen
  2 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

* [PATCH 2/2] Documented "--only-untracked" flag.
       [not found] ` <4ec861b086e2d349289f956ea0fe9f4d0559a568.1187897406.git.v@pp.inet.fi>
@ 2007-08-23 19:58   ` Väinö Järvelä
  0 siblings, 0 replies; 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ä

Also moved a paragraph about git-status options from description
section, to options section. Which makes it easier to quickly search for
git-status options without reading the description, even though the
description for options forwards to git-commit manual.

Signed-off-by: Väinö Järvelä <v@pp.inet.fi>
---
 Documentation/git-runstatus.txt |    4 +++-
 Documentation/git-status.txt    |   17 ++++++++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-runstatus.txt b/Documentation/git-runstatus.txt
index dee5d0d..56af1c1 100644
--- a/Documentation/git-runstatus.txt
+++ b/Documentation/git-runstatus.txt
@@ -8,7 +8,7 @@ git-runstatus - A helper for git-status and git-commit
 
 SYNOPSIS
 --------
-'git-runstatus' [--color|--nocolor] [--amend] [--verbose] [--untracked]
+'git-runstatus' [--color|--nocolor] [--amend] [--verbose] [--untracked] [--only-tracked]
 
 
 DESCRIPTION
@@ -47,6 +47,8 @@ OPTIONS
 	option only its name and a trailing slash are displayed
 	for each untracked directory.
 
+--only-tracked:
+	Hide untracked files from the output.
 
 OUTPUT
 ------
diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index 8fd0fc6..de9f5ff 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -8,7 +8,7 @@ git-status - Show the working tree status
 
 SYNOPSIS
 --------
-'git-status' <options>...
+'git-status' [--only-tracked] <options>...
 
 DESCRIPTION
 -----------
@@ -23,10 +23,6 @@ If there is no path that is different between the index file and
 the current HEAD commit, the command exits with non-zero
 status.
 
-The command takes the same set of options as `git-commit`; it
-shows what would be committed if the same options are given to
-`git-commit`.
-
 If any paths have been touched in the working tree (that is,
 their modification times have changed) but their contents and
 permissions are identical to those in the index file, the command
@@ -35,6 +31,17 @@ subsequent operations such as `git-diff` if the working tree
 contains many paths that have been touched but not modified.
 
 
+OPTIONS
+-------
+--only-tracked::
+	Hide untracked files from the output.
+
+<options>::
+	The command takes the same set of options as `git-commit`; it
+	shows what would be committed if the same options are given to
+	`git-commit`.
+
+
 OUTPUT
 ------
 The output from this command is designed to be used as a commit
-- 
1.5.3.rc6.17.g1911-dirty

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
       [not found] <4fcfda4a654b003f3ae3dc8d56424b5f59f48093.1187897406.git.v@pp.inet.fi>
  2007-08-23 19:58 ` [PATCH 1/2] Add "--only-untracked" flag to status commands Väinö Järvelä
       [not found] ` <4ec861b086e2d349289f956ea0fe9f4d0559a568.1187897406.git.v@pp.inet.fi>
@ 2007-08-23 20:32 ` Alex Riesen
  2007-08-24  6:35   ` Väinö Järvelä
  2 siblings, 1 reply; 21+ messages in thread
From: Alex Riesen @ 2007-08-23 20:32 UTC (permalink / raw)
  To: Väinö Järvelä; +Cc: git, Junio C Hamano

Väinö Järvelä, Thu, Aug 23, 2007 21:58:31 +0200:
> 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.

"git diff -r --name-status; git diff --cached -r --name-status" is not enough?

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

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

Väinö Järvelä <v@pp.inet.fi> writes:

> Subject: Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
                                       ^^

I suppose you meant --only-tracked.

>  static const char runstatus_usage[] =
> -"git-runstatus [--color|--nocolor] [--amend] [--verbose] [--untracked]";
> +"git-runstatus [--color|--nocolor] [--amend] [--verbose]
> [--untracked]" "[--only-tracked]";
               ^^^

The compiler will concatenate the strings, but won't add a space. That
results in "... [--untracked][--only-tracked]".

Otherwise, the patch sounds fine to me. Not /terribly/ usefull, but
why not.

-- 
Matthieu

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  2007-08-23 20:50   ` Matthieu Moy
@ 2007-08-24  6:28     ` Väinö Järvelä
  0 siblings, 0 replies; 21+ messages in thread
From: Väinö Järvelä @ 2007-08-24  6:28 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: git, Junio C Hamano

On Aug 23, 2007, at 23:50, Matthieu Moy wrote:

> Väinö Järvelä <v@pp.inet.fi> writes:
>
>> Subject: Re: [PATCH 1/2] Add "--only-untracked" flag to status  
>> commands.
>                                        ^^
>
> I suppose you meant --only-tracked.

Yes, a stupid typo. It should be --only-tracked.

>>  static const char runstatus_usage[] =
>> -"git-runstatus [--color|--nocolor] [--amend] [--verbose] [-- 
>> untracked]";
>> +"git-runstatus [--color|--nocolor] [--amend] [--verbose]
>> [--untracked]" "[--only-tracked]";
>                ^^^
>
> The compiler will concatenate the strings, but won't add a space. That
> results in "... [--untracked][--only-tracked]".

Should have checked it more properly, sorry about that.

>
> Otherwise, the patch sounds fine to me. Not /terribly/ usefull, but
> why not.

This is something that has come up many times on our project, there  
might be a lot of temporary files that are used inside the project  
tree, to test the code, and the user just wants to see the  
modifications to tracked files without using a pager. One could use  
gitignore, but in our case, it would be hard to create a gitignore  
which would ignore all of the test files, and none of the actual  
project files, so it's quite convenient to use --only-tracked.

A better behavior might be to test outside of the project tree.

>
> -- 
> Matthieu

--
Väinö

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  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
                       ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Väinö Järvelä @ 2007-08-24  6:35 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git, Junio C Hamano

On Aug 23, 2007, at 23:32, Alex Riesen wrote:

> Väinö Järvelä, Thu, Aug 23, 2007 21:58:31 +0200:
>> 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.
>
> "git diff -r --name-status; git diff --cached -r --name-status" is  
> not enough?

That line will result in duplicate entries, if files are staged, and  
the output of git-status is neater (but longer) in my opinion.

"""
M       Makefile
M       Makefile
"""
vs.
"""
# On branch entity_class
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   Makefile
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#
#       modified:   Makefile
#
# Untracked files were filtered by "--only-tracked"
"""

Sure you could remove duplicate entries with "sort|uniq", or  
something, but just running "git status --only-tracked", is cleaner,  
and more user friendly.

The way I see the flag used is: A user runs "git status", sees that  
there is too much untracked files and not enough scrollback, so he  
runs "git status --only-tracked" to filter the results.

--
Väinö

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  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 22:33     ` Alex Riesen
  2 siblings, 1 reply; 21+ messages in thread
From: Jakub Narebski @ 2007-08-24  7:40 UTC (permalink / raw)
  To: git

Väinö Järvelä wrote:

> The way I see the flag used is: A user runs "git status", sees that  
> there is too much untracked files and not enough scrollback, so he  
> runs "git status --only-tracked" to filter the results.

I like it.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  2007-08-24  6:35   ` Väinö Järvelä
  2007-08-24  7:40     ` Jakub Narebski
@ 2007-08-24  7:46     ` Junio C Hamano
  2007-08-24  9:31       ` Väinö Järvelä
  2007-08-24 22:47       ` Jakub Narebski
  2007-08-24 22:33     ` Alex Riesen
  2 siblings, 2 replies; 21+ messages in thread
From: Junio C Hamano @ 2007-08-24  7:46 UTC (permalink / raw)
  To: Väinö Järvelä; +Cc: Alex Riesen, git

Väinö Järvelä <v@pp.inet.fi> writes:

> The way I see the flag used is: A user runs "git status", sees that
> there is too much untracked files and not enough scrollback, so he
> runs "git status --only-tracked" to filter the results.

Why?

Just set up .gitignore once then (1) you do not have to worry
about them ever again, and (2) you _will_ still be able to
notice if you accidentally added more cruft, or more
importantly, if you forgot to tell an important file to git.

I think the latter is more important point.  If you train a
naive user to use --only-tracked to ignore "Untracked" list, you
are doing him or her a great disservice.  Mistake to forget "git
add" a new file before commiting will bound to happen.

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  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 22:47       ` Jakub Narebski
  1 sibling, 1 reply; 21+ messages in thread
From: Väinö Järvelä @ 2007-08-24  9:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Alex Riesen, git

On Aug 24, 2007, at 10:46, Junio C Hamano wrote:

> Väinö Järvelä <v@pp.inet.fi> writes:
>
>> The way I see the flag used is: A user runs "git status", sees that
>> there is too much untracked files and not enough scrollback, so he
>> runs "git status --only-tracked" to filter the results.
>
> Why?
>
> Just set up .gitignore once then (1) you do not have to worry
> about them ever again, and (2) you _will_ still be able to
> notice if you accidentally added more cruft, or more
> importantly, if you forgot to tell an important file to git.
>
> I think the latter is more important point.  If you train a
> naive user to use --only-tracked to ignore "Untracked" list, you
> are doing him or her a great disservice.  Mistake to forget "git
> add" a new file before commiting will bound to happen.

I also think that maintaining a proper .gitignore is imporant, and  
more productive than using --only-tracked instead. But when I have  
cruft that can't be put in .gitignore, or it would ignore files that  
are supposed to be shown and tracked, I use --only-tracked.

It's true though, that the user might forget to add a file if he  
always uses --only-tracked, that's why I added the note in the status  
that the untracked files were filtered out. The flag is supposed to  
be a helper for situations where .gitignore wouldn't work, not a way  
to work always. Maybe if this flag is accepted, the manual should say  
that in most cases it's better to use .gitignore.

--
Väinö

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  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-24 11:40           ` Matthieu Moy
  0 siblings, 2 replies; 21+ messages in thread
From: Johannes Schindelin @ 2007-08-24  9:55 UTC (permalink / raw)
  To: Väinö Järvelä; +Cc: Junio C Hamano, Alex Riesen, git

Hi,

On Fri, 24 Aug 2007, V?in? J?rvel wrote:

> On Aug 24, 2007, at 10:46, Junio C Hamano wrote:
> 
> > V?in? J?rvel? <v@pp.inet.fi> writes:
> > 
> > > The way I see the flag used is: A user runs "git status", sees that
> > > there is too much untracked files and not enough scrollback, so he
> > > runs "git status --only-tracked" to filter the results.
> > 
> > Why?
> > 
> > Just set up .gitignore once then (1) you do not have to worry
> > about them ever again, and (2) you _will_ still be able to
> > notice if you accidentally added more cruft, or more
> > importantly, if you forgot to tell an important file to git.
> > 
> > I think the latter is more important point.  If you train a
> > naive user to use --only-tracked to ignore "Untracked" list, you
> > are doing him or her a great disservice.  Mistake to forget "git
> > add" a new file before commiting will bound to happen.
> 
> I also think that maintaining a proper .gitignore is imporant, and more
> productive than using --only-tracked instead. But when I have cruft that can't
> be put in .gitignore, or it would ignore files that are supposed to be shown
> and tracked, I use --only-tracked.

Would it not be better to imitate the "-x" and "-X" options of ls-files, 
then?  You could achieve the effect you desire by "git status -x \*" then.

Ciao,
Dscho

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  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
  1 sibling, 1 reply; 21+ messages in thread
From: Väinö Järvelä @ 2007-08-24 10:52 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, Alex Riesen, git

On Aug 24, 2007, at 12:55, Johannes Schindelin wrote:
> On Fri, 24 Aug 2007, V?in? J?rvel wrote:
>> I also think that maintaining a proper .gitignore is imporant, and  
>> more
>> productive than using --only-tracked instead. But when I have  
>> cruft that can't
>> be put in .gitignore, or it would ignore files that are supposed  
>> to be shown
>> and tracked, I use --only-tracked.
>
> Would it not be better to imitate the "-x" and "-X" options of ls- 
> files,
> then?  You could achieve the effect you desire by "git status -x  
> \*" then.
>
> Ciao,
> Dscho

I haven't used that option, do I understand correctly, that with that  
option, you should provide another exclusion file? That would remove  
the dynamic ability of --only-tracked.

--
Väinö

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  2007-08-24  9:55         ` Johannes Schindelin
  2007-08-24 10:52           ` Väinö Järvelä
@ 2007-08-24 11:40           ` Matthieu Moy
  1 sibling, 0 replies; 21+ messages in thread
From: Matthieu Moy @ 2007-08-24 11:40 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Väinö Järvelä, Junio C Hamano, Alex Riesen,
	git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Would it not be better to imitate the "-x" and "-X" options of ls-files, 
> then?  You could achieve the effect you desire by "git status -x \*"
> then.

That's equivalent feature-wise, but a bit slower performance-wise (the
proposed patch skips file listing totally). But since the use-case for
it is not the common case, it probably doesn't matter (and in case,
it's possible to hardcode an optimisation if the pattern is "*").

-- 
Matthieu

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  2007-08-24  6:35   ` Väinö Järvelä
  2007-08-24  7:40     ` Jakub Narebski
  2007-08-24  7:46     ` Junio C Hamano
@ 2007-08-24 22:33     ` Alex Riesen
  2007-08-25  5:37       ` Väinö Järvelä
  2 siblings, 1 reply; 21+ messages in thread
From: Alex Riesen @ 2007-08-24 22:33 UTC (permalink / raw)
  To: Väinö Järvelä; +Cc: git, Junio C Hamano

Väinö Järvelä, Fri, Aug 24, 2007 08:35:13 +0200:
> On Aug 23, 2007, at 23:32, Alex Riesen wrote:
> 
> >Väinö Järvelä, Thu, Aug 23, 2007 21:58:31 +0200:
> >>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.
> >
> >"git diff -r --name-status; git diff --cached -r --name-status" is  
> >not enough?
> 
> That line will result in duplicate entries, if files are staged, and  
> the output of git-status is neater (but longer) in my opinion.

That is because it _is_ two times different: between working directory
and the index, and between index and HEAD. git-status _will_ show you
the same for the same reason.

Besides, why do you want to hide this "duplication"? It shows how the
matters really are.

Besides, it looks like you are using "friendly" where you actually
wanted to say "I consider you too dumb to know what happens". Someone
may feel offended

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  2007-08-24  7:46     ` Junio C Hamano
  2007-08-24  9:31       ` Väinö Järvelä
@ 2007-08-24 22:47       ` Jakub Narebski
  2007-08-24 23:06         ` Junio C Hamano
  1 sibling, 1 reply; 21+ messages in thread
From: Jakub Narebski @ 2007-08-24 22:47 UTC (permalink / raw)
  To: git

Junio C Hamano wrote:

> I think the latter is more important point.  If you train a
> naive user to use --only-tracked to ignore "Untracked" list, you
> are doing him or her a great disservice.  Mistake to forget "git
> add" a new file before commiting will bound to happen.

If it won't acquire short version, nor tab completion, mosts users when
confronted with such a mothful of option-name wouldn't use it unless
necessary, I think...

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  2007-08-24 22:47       ` Jakub Narebski
@ 2007-08-24 23:06         ` Junio C Hamano
  2007-08-25  6:16           ` Väinö Järvelä
  0 siblings, 1 reply; 21+ messages in thread
From: Junio C Hamano @ 2007-08-24 23:06 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Jakub Narebski <jnareb@gmail.com> writes:

> Junio C Hamano wrote:
>
>> I think the latter is more important point.  If you train a
>> naive user to use --only-tracked to ignore "Untracked" list, you
>> are doing him or her a great disservice.  Mistake to forget "git
>> add" a new file before commiting will bound to happen.
>
> If it won't acquire short version, nor tab completion, mosts users when
> confronted with such a mothful of option-name wouldn't use it unless
> necessary, I think...

Yeah, but if we accept that --only-tracked patch, I know from
the past experience that people would send a "shorter synonym"
patch, arguing that the capability is already there.

I really think we should resist temptation to add misfeatures
that would encourage bad workflows and new user mistakes.

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  2007-08-24 22:33     ` Alex Riesen
@ 2007-08-25  5:37       ` Väinö Järvelä
  2007-08-25  6:10         ` Junio C Hamano
  0 siblings, 1 reply; 21+ messages in thread
From: Väinö Järvelä @ 2007-08-25  5:37 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git, Junio C Hamano


On Aug 25, 2007, at 01:33, Alex Riesen wrote:

> Väinö Järvelä, Fri, Aug 24, 2007 08:35:13 +0200:
>> On Aug 23, 2007, at 23:32, Alex Riesen wrote:
>>
>>> Väinö Järvelä, Thu, Aug 23, 2007 21:58:31 +0200:
>>>> 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.
>>>
>>> "git diff -r --name-status; git diff --cached -r --name-status" is
>>> not enough?
>>
>> That line will result in duplicate entries, if files are staged, and
>> the output of git-status is neater (but longer) in my opinion.
>
> That is because it _is_ two times different: between working directory
> and the index, and between index and HEAD. git-status _will_ show you
> the same for the same reason.
>
> Besides, why do you want to hide this "duplication"? It shows how the
> matters really are.

git status --only-tracked, does not hide the fact that there are  
files staged for commit, and modified files relative to the index.  
The difference is, that it shows them in a clean way. Sure you could  
make a script like:

echo "Changes to be committed:"; git diff --cached -r --name-status;  
echo "Changed but not updates:"; git diff -r --name-status

But that is quite long, for a quick look at the state, without any  
untracked files.

>
> Besides, it looks like you are using "friendly" where you actually
> wanted to say "I consider you too dumb to know what happens". Someone
> may feel offended

I don't see where I consider users dumb, but hey, I'm sorry if I made  
someone feel offended.

--
Väinö

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  2007-08-25  5:37       ` Väinö Järvelä
@ 2007-08-25  6:10         ` Junio C Hamano
  0 siblings, 0 replies; 21+ messages in thread
From: Junio C Hamano @ 2007-08-25  6:10 UTC (permalink / raw)
  To: Väinö Järvelä; +Cc: Alex Riesen, git

Väinö Järvelä <v@pp.inet.fi> writes:

> On Aug 25, 2007, at 01:33, Alex Riesen wrote:
>
>>> That line will result in duplicate entries, if files are staged, and
>>> the output of git-status is neater (but longer) in my opinion.
>>
>> That is because it _is_ two times different: between working directory
>> and the index, and between index and HEAD. git-status _will_ show you
>> the same for the same reason.
>>
>> Besides, why do you want to hide this "duplication"? It shows how the
>> matters really are.

The whole argument of "two entries are dups" is showing that you
might be repeating past mistake of Cogito where hiding the index
from the user would make git somehow more user friendly.  It was
a laudable attempt, but did not really fly well in practice.

But the --only-tracked has a bigger issue.

Letting the user know about untracked files that should be
tracked is really important to avoid mistakes.  If the status
output is so cluttered for you to want an option like this, it
is hard to spot such a file.  I do not think disabling the
untracked output is a solution to the real problem.

You earlier said that you may not be able to add certain
untracked files to .gitignore --- can you elaborate?

I do not think the reason is you are too lazy to do so, nor you
are incompetent to understand the ignore pattern.  There is
something else, which might show that the current ignore
facility needs to become easier to use for _your_ use of _your_
repository.  I still do not see in the thread what it is yet.

For example, maybe the reason why you do not want to place them
in the .gitignore file is because the clutter are your random
wip temporary files, whose naming convention is personal to you
and does not apply to others.  Naturally, you do not want to put
such patterns to the tracked .gitignore file, which is for all
participants of the project.  In such a case, you would want a
facility to allow you to specify your personal ignore patterns
that is used in addition to the .gitignore file [*1*].

The particular example use case above is covered by an existing
facility, but there might be other valid reasons that you cannot
express your ignore patterns easily with existing facilities.
In which case, we need to know that, so that you and people in
similar situation as you are in can express the necessary ignore
patterns more easily, in order to reduce the risk of forgetting
to add new files.


[Footnote]

*1* Which already exists.  Put them in .git/info/exclude file.

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  2007-08-24 23:06         ` Junio C Hamano
@ 2007-08-25  6:16           ` Väinö Järvelä
  2007-08-25 14:42             ` Johannes Schindelin
  0 siblings, 1 reply; 21+ messages in thread
From: Väinö Järvelä @ 2007-08-25  6:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jakub Narebski, git


On Aug 25, 2007, at 02:06, Junio C Hamano wrote:

> Jakub Narebski <jnareb@gmail.com> writes:
>
>> Junio C Hamano wrote:
>>
>>> I think the latter is more important point.  If you train a
>>> naive user to use --only-tracked to ignore "Untracked" list, you
>>> are doing him or her a great disservice.  Mistake to forget "git
>>> add" a new file before commiting will bound to happen.
>>
>> If it won't acquire short version, nor tab completion, mosts users  
>> when
>> confronted with such a mothful of option-name wouldn't use it unless
>> necessary, I think...
>
> Yeah, but if we accept that --only-tracked patch, I know from
> the past experience that people would send a "shorter synonym"
> patch, arguing that the capability is already there.
>
> I really think we should resist temptation to add misfeatures
> that would encourage bad workflows and new user mistakes.

I really do think that there is a use case for this patch. But this  
assumes that the testing is done in the source tree, but maybe that  
in itself can be considered a bad workflow.

An example would be in game development, where I have a directory  
full of images, and I wish to try out different images in the place  
of one. I usually create different versions of the images with  
different names, filling up the image directory under VCS. This  
usually results in tens of images that will not be tracked (unless  
they replace the original images), but because of my bad habit of  
creating the files inside the source tree, which results in a little  
bit faster workflow for me. With all these untracked files, git- 
status will obscure the actual contents of the status I wish to see.

I cannot put those files inside .gitignore, as there would have to be  
some kind of exclusion pattern for them that won't match the tracked  
files. Sure I could prefix all of my test images with 'test_' or  
something similiar. Or I could just add '*' to .gitignore, and force  
adds. The latter seems like a bad habit for me, the other seems to  
include a lot of manual labor, especially when someone else sends  
test files for me.

So the end result for me is, that it's easier to use --only-tracked

Fringe case? Maybe. Workflow could be better, sure. But --only- 
tracked even works for the less technical folk, which might be scared  
of forcing the changes, or annoyed by having to name the files with a  
magic prefix.

--
Väinö

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  2007-08-24 10:52           ` Väinö Järvelä
@ 2007-08-25 14:39             ` Johannes Schindelin
  0 siblings, 0 replies; 21+ messages in thread
From: Johannes Schindelin @ 2007-08-25 14:39 UTC (permalink / raw)
  To: Väinö Järvelä; +Cc: Junio C Hamano, Alex Riesen, git

Hi,

On Fri, 24 Aug 2007, V?in? J?rvel wrote:

> On Aug 24, 2007, at 12:55, Johannes Schindelin wrote:
> > On Fri, 24 Aug 2007, V?in? J?rvel wrote:
> > > I also think that maintaining a proper .gitignore is imporant, and 
> > > more productive than using --only-tracked instead. But when I have 
> > > cruft that can't be put in .gitignore, or it would ignore files that 
> > > are supposed to be shown and tracked, I use --only-tracked.
> > 
> > Would it not be better to imitate the "-x" and "-X" options of 
> > ls-files, then?  You could achieve the effect you desire by "git 
> > status -x \*" then.
> 
> I haven't used that option, do I understand correctly, that with that 
> option, you should provide another exclusion file? That would remove the 
> dynamic ability of --only-tracked.

-X takes a filename, -x a pattern.

Hth,
Dscho

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  2007-08-25  6:16           ` Väinö Järvelä
@ 2007-08-25 14:42             ` Johannes Schindelin
  0 siblings, 0 replies; 21+ messages in thread
From: Johannes Schindelin @ 2007-08-25 14:42 UTC (permalink / raw)
  To: Väinö Järvelä; +Cc: Junio C Hamano, Jakub Narebski, git

Hi,

On Sat, 25 Aug 2007, V?in? J?rvel wrote:

> An example would be in game development, where I have a directory full 
> of images, and I wish to try out different images in the place of one. I 
> usually create different versions of the images with different names, 
> filling up the image directory under VCS.

I have a similar use case, funnily enough also with images.  I created a 
tmp/ directory and put the images there, cp'ing or ln -s'ing the current 
one into the cwd.  Then, "/tmp/" is put into .gitignore and all is well.

Especially the fact that I no longer forget to check in the images that I 
_do_ want to track.

Ciao,
Dscho

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

* Re: [PATCH 1/2] Add "--only-untracked" flag to status commands.
  2007-08-24  7:40     ` Jakub Narebski
@ 2007-08-27 13:18       ` Andreas Ericsson
  0 siblings, 0 replies; 21+ messages in thread
From: Andreas Ericsson @ 2007-08-27 13:18 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Jakub Narebski wrote:
> Väinö Järvelä wrote:
> 
>> The way I see the flag used is: A user runs "git status", sees that  
>> there is too much untracked files and not enough scrollback, so he  
>> runs "git status --only-tracked" to filter the results.
> 
> I like it.
> 

Ack on that. It's happened to me a bunch of times, usually followed by
<identical command> | sed '/Untracked/,$d'

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply	[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 --
     [not found] <4fcfda4a654b003f3ae3dc8d56424b5f59f48093.1187897406.git.v@pp.inet.fi>
2007-08-23 19:58 ` [PATCH 1/2] Add "--only-untracked" flag to status commands Väinö Järvelä
2007-08-23 20:50   ` Matthieu Moy
2007-08-24  6:28     ` Väinö Järvelä
     [not found] ` <4ec861b086e2d349289f956ea0fe9f4d0559a568.1187897406.git.v@pp.inet.fi>
2007-08-23 19:58   ` [PATCH 2/2] Documented "--only-untracked" flag 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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).