Skip to contentSkip to conversation

git status -q (similar to subversion)

PATCH In review Unknown 5 participants 11 messages Jun 15, 2016

lore
Share & tools
lore

Unknown

author
#0 lore raw

PATCH 1/1 git status -q (similar to subversion)

Here is a tiny patch adding -q option to git status. It means -uno (Show no untracked files).

Not sure where to add that in documentation.
Maybe in git-commit man just below -u:
-q (for git-status only, equals to -uno).
Or something like this?

Regards,
Borg

builtin-commit.c +2 -0
index 41e222d..e4e0074 100644
@@ -826,6 +826,8 @@ int cmd_status(int argc, const char **argv, const char *prefix)
 		diff_use_color_default = git_use_color_default;
 
 	argc = parse_and_validate_options(argc, argv, builtin_status_usage, prefix);
+	if(quiet)
+		show_untracked_files = SHOW_NO_UNTRACKED_FILES;
 
 	index_file = prepare_index(argc, argv, prefix);
 
#1 lore raw
Quoted 7 lines · Unknown

Here is a tiny patch adding -q option to git status. It means -uno (Show no untracked files).

Not sure where to add that in documentation.
Maybe in git-commit man just below -u:
-q (for git-status only, equals to -uno).
Or something like this?

I'm not sure if this is a good idea. As you mention, there is already "-uno" to accomplish the same thing. So we are making the interface redundant.

It seems from the subject like you are trying to emulate a similar option in "svn status". But my understanding (and I was never a big subversion user, so I am going off of things said on the git list) is that there are quite a few differences between "svn status" and "git status". Enough that we do not want users to really equate them (a subject which has come up over and over on the list).

In other words, it seems like we are at best simply adding a redundant option, and at worst, confusing people even more about the equivalence between the "status" commands of the two systems.

-Peff

#2 lore raw
Quoted 6 lines · Jeff King
Quoted 2 lines · Unknown

Here is a tiny patch adding -q option to git status. It means -uno (Show no untracked files).

It seems from the subject like you are trying to emulate a similar option in "svn status".

As a former svn user I also miss -q. I like to keep untracked non-ignored files lying around as a short-term TODO list.

I think the point is not SVN compatibility. The point is that SVN just got the commandline interface right here ;-) because -q easier to discover and remember (many programs have --quiet/-q). And when you use it you will use it several times in a row. For this -uno is already too much to bother typing (assuming you have an alias 'git st').

bye,
Martin

#3 lore raw
Quoted 8 lines · Martin Renold

As a former svn user I also miss -q. I like to keep untracked non-ignored files lying around as a short-term TODO list.

I think the point is not SVN compatibility. The point is that SVN just got the commandline interface right here ;-) because -q easier to discover and remember (many programs have --quiet/-q). And when you use it you will use it several times in a row. For this -uno is already too much to bother typing (assuming you have an alias 'git st').

If it is convenience you want, perhaps you would be even happier with:

git config status.showUntrackedFiles no

As far as "SVN got it right": that may well be the case, but we have to deal with the fact that "git status" is really a dry-run version of "git commit", which already has a "-q" option, which does something totally different. So I am a little hesitant to endorse its use in "git status" for something unrelated (and I am hesitant to have redundant command line options, as well).

-Peff

#4 lore raw
Quoted 2 lines · Jeff King

If it is convenience you want, perhaps you would be even happier with:
git config status.showUntrackedFiles no

No, that doesn't help in my usecase. I want to be reminded about the untracked files by default because I intend to clean them up later.

Quoted 2 lines

[...] but we have to deal with the fact that "git status" is really a dry-run version of "git commit", which already has a "-q" option

Good point. However I think those commands are similar only from an implementation point of view. As an user I think of them as being quite different. I would not be surprised about different meaning of options - certainly less than about "git commit -a" vs "git add -u".

Quoted 3 lines

So I am a little hesitant to endorse its use in "git status" for something unrelated (and I am hesitant to have redundant command line options, as well).

Yes I understand that. I'm using a wrapper script for now, but if it was any other one-letter shortcut, I would prefer to learn that instead.

bye,
Martin

#5 lore raw
Quoted 7 lines · Martin Renold
Quoted 2 lines

[...] but we have to deal with the fact that "git status" is really a dry-run version of "git commit", which already has a "-q" option

Good point. However I think those commands are similar only from an implementation point of view. As an user I think of them as being quite different. I would not be surprised about different meaning of options - certainly less than about "git commit -a" vs "git add -u".

The main difference that trips people, I think, is that they expect "git status <file>" to restrict status to a subset of the tree. But it is about "what would happen if I did 'git commit <file>'", which is quite different.

There has been much discussion about an alternate command that would be more like "svn status", and even some partial implementations. But it needs somebody who really cares about the feature to step up and complete it.

-Peff

#6 lore raw
Quoted 5 lines

There has been much discussion about an alternate command that would be more like "svn status", and even some partial implementations. But it needs somebody who really cares about the feature to step up and complete it.

An alias

        changes=diff --name-status -r

already does almost the same function as "svn status -q". If you wanted full svn status with untracked files you could use this:

changes = "!sh -c 'git status | sed -n
\"/Untracked/N;//N;1,//d;s/^#/?/p\"; git diff --name-status -r \"$@\"' -"

Paolo

#7 lore raw
In reply to Unknown
Quoted 10 lines · Unknown

Here is a tiny patch adding -q option to git status. It means -uno (Show no untracked files).

Not sure where to add that in documentation.
Maybe in git-commit man just below -u:
-q (for git-status only, equals to -uno).
Or something like this?

Regards,
Borg

Hello

Please take a look at Documentation/SubmittingPatches (all of the documentation lives in Documentation/).

It doesn't seem like this patch was generated with git format-patch. You'll also want to submit your patch using git send-email, as we require inline patches instead of attachments.

You'll need to include a signed-off-by line (which you can do by using git commit -s) and it seems like you need to introduce yourself to git:

http://book.git-scm.com/2_setup_and_initialization.html

Sorry, we cannot accept patches from "Unknown" for a number of reasons.

Thanks for your help and we look forward to hearing your response to the rest of the feedback received in this thread.

Quoted 13 lines
builtin-commit.c +2 -0
index 41e222d..e4e0074 100644
@@ -826,6 +826,8 @@ int cmd_status(int argc, const char **argv, const char *prefix)
 		diff_use_color_default = git_use_color_default;
 
 	argc = parse_and_validate_options(argc, argv, builtin_status_usage, prefix);
+	if(quiet)
+		show_untracked_files = SHOW_NO_UNTRACKED_FILES;
 
 	index_file = prepare_index(argc, argv, prefix);
 
Signature · 1 line
	David
author
#8 lore raw
Quoted 1 line · David Aguilar

Hello

Hi and thanks for reply.

Quoted 7 lines

Please take a look at Documentation/SubmittingPatches (all of the documentation lives in Documentation/).

It doesn't seem like this patch was generated with git format-patch. You'll also want to submit your patch using git send-email, as we require inline patches instead of attachments.

Right. I though such a small patch can be provided as is. Anyway, I will take necessary steps to peform better next time.

The question is, would that patch will be applied anyway?
I already received some criticism about not applying it.
I can only answer that where svn status and git status differ in many cases, there are also similar in some.

For now, I would rather want to see a discus about it (Pro vs Cons).

Other solution I see is add extra config variable like:
status.showUntrackedDefault = (no|normal|all) So when you peform 'git status -u' it will be used.

Looks better to me if we really want to have difference between git status vs svn status.

Regards,
Borg

#9 lore raw
Quoted 3 lines · Unknown

Other solution I see is add extra config variable like:
status.showUntrackedDefault = (no|normal|all) So when you peform 'git status -u' it will be used.

It exists, but is called showUntrackedFiles. See "git help config" for details.

-Peff

author
#10 lore raw
Quoted 2 lines · Jeff King

It exists, but is called showUntrackedFiles. See "git help config" for details.

Its not what I meant. showUntrackedFiles is used when you do not specify '-u' option. showUnrackedDefault (not so good name, someone have better idea?) would be used if you specify '-u' option without argument. Currently argument 'all' is used.

Signature · 1 line
Borg