[PATCH v2] send-email: allow use of basic email list in --cc --to and --bcc

2013-06-19 Thread Jorge-Juan . Garcia-Garcia
From: Jorge Juan Garcia Garcia jorge-juan.garcia-gar...@ensimag.imag.fr

Make it so that we can use a list of email in flags
instead of having to use one flag per email address.

The use-case is to copy-paste a list of addresses from an email.
This change makes it so that we no longer need to cut the list.

The format of email list handled is pretty basic for now:
$ git send-email --to='Foo f...@example.com, b...@example.com'
We thought it would be nice to have a first-step version which works
before handling more complex ones such as names with commas:
$ git send-email --to='Foo, Bar foo...@example.com'

This artificial limitation is imposed by 79ee555b (Check and document
the options to prevent mistakes, 2006-06-21).

Signed-off-by: Mathieu Lienard--Mayor mathieu.lienard--ma...@ensimag.imag.fr
Signed-off-by: Jorge Juan Garcia Garcia 
jorge-juan.garcia-gar...@ensimag.imag.fr
Signed-off-by: Matthieu Moy matthieu@grenoble-inp.fr
---

Changes since v1:
 - more detailed commit message, explaining the most common use-case,
   and referring to the commit which introduced the comma limitation
 - use of map in the function, to match sanitize_address_list
 - did not change the two regexp into one, because it's faster with two

 Documentation/git-send-email.txt |   21 +++--
 git-send-email.perl  |   36 ++--
 t/t9001-send-email.sh|   37 -
 3 files changed, 73 insertions(+), 21 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 40a9a9a..e3444cf 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -50,16 +50,22 @@ Composing
'sendemail.multiedit'.
 
 --bcc=address::
+--bcc=[address,...]::
Specify a Bcc: value for each email. Default is the value of
'sendemail.bcc'.
-+
-The --bcc option must be repeated for each user you want on the bcc list.
+   The format supported for email list is the following:
+   Foo f...@example.com, b...@example.com.
+   Please notice that the email list does not handle commas in
+   email names such as Foo, Bar foo...@example.com.
 
 --cc=address::
+--cc=[address,...]::
Specify a starting Cc: value for each email.
Default is the value of 'sendemail.cc'.
-+
-The --cc option must be repeated for each user you want on the cc list.
+   The format supported for email list is the following:
+   Foo f...@example.com, b...@example.com.
+   Please notice that the email list does not handle commas in
+   email names such as Foo, Bar foo...@example.com.
 
 --compose::
Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1])
@@ -111,12 +117,15 @@ is not set, this will be prompted for.
is not set, this will be prompted for.
 
 --to=address::
+--to=[address,...]::
Specify the primary recipient of the emails generated. Generally, this
will be the upstream maintainer of the project involved. Default is the
value of the 'sendemail.to' configuration value; if that is unspecified,
and --to-cmd is not specified, this will be prompted for.
-+
-The --to option must be repeated for each user you want on the to list.
+   The format supported for email list is the following:
+   Foo f...@example.com, b...@example.com.
+   Please notice that the email list does not handle commas in
+   email names such as Foo, Bar foo...@example.com.
 
 --8bit-encoding=encoding::
When encountering a non-ASCII message or subject that does not
diff --git a/git-send-email.perl b/git-send-email.perl
index 671762b..03f3876 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -426,20 +426,6 @@ my ($repoauthor, $repocommitter);
 ($repoauthor) = Git::ident_person(@repo, 'author');
 ($repocommitter) = Git::ident_person(@repo, 'committer');
 
-# Verify the user input
-
-foreach my $entry (@initial_to) {
-   die Comma in --to entry: $entry'\n unless $entry !~ m/,/;
-}
-
-foreach my $entry (@initial_cc) {
-   die Comma in --cc entry: $entry'\n unless $entry !~ m/,/;
-}
-
-foreach my $entry (@bcclist) {
-   die Comma in --bcclist entry: $entry'\n unless $entry !~ m/,/;
-}
-
 sub parse_address_line {
if ($have_mail_address) {
return map { $_-format } Mail::Address-parse($_[0]);
@@ -1079,6 +1065,25 @@ sub smtp_auth_maybe {
return $auth;
 }
 
+sub split_emails {
+my ($emails) = @_;
+my @split_list;
+if ($emails =~ /,/) {
+   @split_list = split(/,/, $emails);
+} else {
+   @split_list = $emails;
+}
+# Removal of unwanted spaces
+for (my $j = 0; $j = $#split_list; $j++) {
+   $split_list[$j] =~ s/^\s+//;
+   $split_list[$j] =~ s/\s+$//;
+}
+return @split_list;
+}
+
+sub split_emails_list {
+   return (map { split_emails($_) } @_);
+}
 # Returns 1 if the message was sent, and 0 otherwise

[PATCH] send-email: allow use of basic email list in --cc --to and --bcc

2013-06-18 Thread Jorge-Juan . Garcia-Garcia
From: Jorge Juan Garcia Garcia jorge-juan.garcia-gar...@ensimag.imag.fr

Make it so that we can use a list of email in flags
instead of having to use one flag per email address.

The format of email list handled is pretty basic for now:
$ git send-email --to='Foo f...@example.com, b...@example.com'
We thought it would be nice to have a first-step version which works
before handling more complex ones such as:
$ git send-email --to='Foo, Bar foo...@example.com'

Signed-off-by: Mathieu Lienard--Mayor mathieu.lienard--ma...@ensimag.imag.fr
Signed-off-by: Jorge Juan Garcia Garcia 
jorge-juan.garcia-gar...@ensimag.imag.fr
Signed-off-by: Matthieu Moy matthieu@grenoble-inp.fr
---

Changes in the patch:
 -Update documentation
 -Removal of no-longer needed user input verification
 -New function that splits email list into seperate email addresses
 -New test to make sure it behaves the way intended

 Documentation/git-send-email.txt |   21 +++--
 git-send-email.perl  |   38 --
 t/t9001-send-email.sh|   37 -
 3 files changed, 75 insertions(+), 21 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 40a9a9a..e3444cf 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -50,16 +50,22 @@ Composing
'sendemail.multiedit'.
 
 --bcc=address::
+--bcc=[address,...]::
Specify a Bcc: value for each email. Default is the value of
'sendemail.bcc'.
-+
-The --bcc option must be repeated for each user you want on the bcc list.
+   The format supported for email list is the following:
+   Foo f...@example.com, b...@example.com.
+   Please notice that the email list does not handle commas in
+   email names such as Foo, Bar foo...@example.com.
 
 --cc=address::
+--cc=[address,...]::
Specify a starting Cc: value for each email.
Default is the value of 'sendemail.cc'.
-+
-The --cc option must be repeated for each user you want on the cc list.
+   The format supported for email list is the following:
+   Foo f...@example.com, b...@example.com.
+   Please notice that the email list does not handle commas in
+   email names such as Foo, Bar foo...@example.com.
 
 --compose::
Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1])
@@ -111,12 +117,15 @@ is not set, this will be prompted for.
is not set, this will be prompted for.
 
 --to=address::
+--to=[address,...]::
Specify the primary recipient of the emails generated. Generally, this
will be the upstream maintainer of the project involved. Default is the
value of the 'sendemail.to' configuration value; if that is unspecified,
and --to-cmd is not specified, this will be prompted for.
-+
-The --to option must be repeated for each user you want on the to list.
+   The format supported for email list is the following:
+   Foo f...@example.com, b...@example.com.
+   Please notice that the email list does not handle commas in
+   email names such as Foo, Bar foo...@example.com.
 
 --8bit-encoding=encoding::
When encountering a non-ASCII message or subject that does not
diff --git a/git-send-email.perl b/git-send-email.perl
index 671762b..d7e4887 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -426,20 +426,6 @@ my ($repoauthor, $repocommitter);
 ($repoauthor) = Git::ident_person(@repo, 'author');
 ($repocommitter) = Git::ident_person(@repo, 'committer');
 
-# Verify the user input
-
-foreach my $entry (@initial_to) {
-   die Comma in --to entry: $entry'\n unless $entry !~ m/,/;
-}
-
-foreach my $entry (@initial_cc) {
-   die Comma in --cc entry: $entry'\n unless $entry !~ m/,/;
-}
-
-foreach my $entry (@bcclist) {
-   die Comma in --bcclist entry: $entry'\n unless $entry !~ m/,/;
-}
-
 sub parse_address_line {
if ($have_mail_address) {
return map { $_-format } Mail::Address-parse($_[0]);
@@ -1079,6 +1065,27 @@ sub smtp_auth_maybe {
return $auth;
 }
 
+sub split_email_list {
+my(@list) = @_;
+my @tmp;
+my @emails;
+   for (my $i = 0; $i = $#list; $i++) {
+   if ($list[$i] =~ /,/) {
+   @emails = split(/,/, $list[$i]);
+   } else {
+   @emails = $list[$i];
+   }
+   # Removal of unwanted spaces
+   for (my $j = 0; $j = $#emails; $j++) {
+   $emails[$j] =~ s/^\s+//;
+   $emails[$j] =~ s/\s+$//;
+   }
+   @tmp = (@tmp, @emails);
+   }
+return(@tmp);
+}
+
+
 # Returns 1 if the message was sent, and 0 otherwise.
 # In actuality, the whole program dies when there
 # is an error sending a message.
@@ -1089,6 +1096,9 @@ sub send_message {
  not grep { $cc eq $_ || $_ =~ /\Q${cc}\E$/ } @recipients
}
   @cc

[PATCH v4 1/2] status: introduce status.short to enable --short by default

2013-06-11 Thread Jorge-Juan . Garcia-Garcia
From: Jorge Juan Garcia Garcia jorge-juan.garcia-gar...@ensimag.imag.fr

Some people always run 'git status -s'.
The configuration variable status.short allows to set it by default.

Signed-off-by: Jorge Juan Garcia Garcia 
jorge-juan.garcia-gar...@ensimag.imag.fr
Signed-off-by: Mathieu Lienard--Mayor mathieu.lienard--ma...@ensimag.imag.fr
Signed-off-by: Matthieu Moy matthieu@grenoble-inp.fr
---
Changes since v3:
- Changes the order of the test between expected and actual.
- Format by default when status.short is not defined adequately.
- The number of test is the same (all posibilities that I wanted tested).
---
 Documentation/config.txt |4 
 builtin/commit.c |7 +++
 t/t7508-status.sh|   35 +++
 3 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 6e53fc5..1983bf7 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2066,6 +2066,10 @@ status.relativePaths::
relative to the repository root (this was the default for Git
prior to v1.5.4).
 
+status.short::
+   Set to true to enable --short by default in linkgit:git-status[1].
+   The option --no-short takes precedence over this variable.
+
 status.showUntrackedFiles::
By default, linkgit:git-status[1] and linkgit:git-commit[1] show
files which are not currently tracked by Git. Directories which
diff --git a/builtin/commit.c b/builtin/commit.c
index 1621dfc..075a91c 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1112,6 +1112,13 @@ static int git_status_config(const char *k, const char 
*v, void *cb)
s-submodule_summary = -1;
return 0;
}
+   if (!strcmp(k, status.short)) {
+   if (git_config_bool(k, v))
+   status_format = STATUS_FORMAT_SHORT;
+   else
+   status_format = STATUS_FORMAT_NONE;
+   return 0;
+   }
if (!strcmp(k, status.color) || !strcmp(k, color.status)) {
s-use_color = git_config_colorbool(k, v);
return 0;
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index e2ffdac..3c0818b 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -1335,4 +1335,39 @@ test_expect_failure '.git/config ignore=all suppresses 
submodule summary' '
git config -f .gitmodules  --remove-section submodule.subname
 '
 
+test_expect_success 'Setup of test environment' '
+   git config status.showUntrackedFiles no
+'
+
+test_expect_success 'status.short=true same as -s' '
+   git -c status.short=true status actual 
+   git status -s expected_short 
+   test_cmp expected_short actual
+'
+
+test_expect_success 'status.short=true different from --no-short' '
+   git status --no-short expected_noshort 
+   test_must_fail test_cmp expected_noshort actual
+'
+
+test_expect_success 'status.short=true weaker than --no-short' '
+   git -c status.short=true status --no-short actual 
+   test_cmp expected_noshort actual
+'
+
+test_expect_success 'status.short=false same as --no-short' '
+   git -c status.short=false status actual 
+   git status -s expected_short 
+   test_cmp expected_noshort actual
+'
+
+test_expect_success 'status.short=false weaker than -s' '
+   git -c status.short=false status -s actual 
+   test_cmp expected_short actual
+'
+
+test_expect_success 'Restore default test environment' '
+   git config --unset status.showUntrackedFiles
+'
+
 test_done
-- 
1.7.8

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] status: introduce status.short to enable --short by default

2013-06-10 Thread Jorge Juan Garcia Garcia
Some people always run 'git status -s'.
The configuration variable status.short allows to set it by default.

Signed-off-by: Jorge Juan Garcia Garcia 
jorge-juan.garcia-gar...@ensimag.imag.fr
Signed-off-by: Mathieu Lienard--Mayor mathieu.lienard--ma...@ensimag.imag.fr
Signed-off-by: Matthieu Moy matthieu@grenoble-inp.fr
---

Changes since v1:
 -documentation more accurate
 -removal of unappropriate function calls
 -clean-up in the test

 Documentation/config.txt |4 
 builtin/commit.c |5 +
 t/t7508-status.sh|   35 +++
 3 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 6e53fc5..1983bf7 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2066,6 +2066,10 @@ status.relativePaths::
relative to the repository root (this was the default for Git
prior to v1.5.4).
 
+status.short::
+   Set to true to enable --short by default in linkgit:git-status[1].
+   The option --no-short takes precedence over this variable.
+
 status.showUntrackedFiles::
By default, linkgit:git-status[1] and linkgit:git-commit[1] show
files which are not currently tracked by Git. Directories which
diff --git a/builtin/commit.c b/builtin/commit.c
index 1621dfc..287f1cb 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1112,6 +1112,11 @@ static int git_status_config(const char *k, const char 
*v, void *cb)
s-submodule_summary = -1;
return 0;
}
+   if (!strcmp(k, status.short)) {
+   if (git_config_bool(k, v))
+   status_format = STATUS_FORMAT_SHORT;
+   return 0;
+   }
if (!strcmp(k, status.color) || !strcmp(k, color.status)) {
s-use_color = git_config_colorbool(k, v);
return 0;
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index e2ffdac..9a07f15 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -1335,4 +1335,39 @@ test_expect_failure '.git/config ignore=all suppresses 
submodule summary' '
git config -f .gitmodules  --remove-section submodule.subname
 '
 
+test_expect_success 'Setup of environment of test' '
+   git config status.showUntrackedFiles no
+'
+
+test_expect_success 'status.short=true same as -s' '
+   git -c status.short=true status actual 
+   git status -s expected_short 
+   test_cmp actual expected_short
+'
+
+test_expect_success 'status.short=true different from --no-short' '
+   git status --no-short expected_noshort 
+   test_must_fail test_cmp actual expected_noshort
+'
+
+test_expect_success 'status.short=true weaker than --no-short' '
+   git -c status.short=true status --no-short actual 
+   test_cmp actual expected_noshort
+'
+
+test_expect_success 'status.short=false same as --no-short' '
+   git -c status.short=false status actual 
+   git status -s expected_short 
+   test_cmp actual expected_noshort
+'
+
+test_expect_success 'status.short=false weaker than -s' '
+   git -c status.short=false status -s actual 
+   test_cmp actual expected_short
+'
+
+test_expect_success 'Back to environment of test by default' '
+   git config status.showUntrackedFiles yes
+'
+
 test_done
-- 
1.7.8

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/2] status:introduce status.branch to enable --branch by default

2013-06-10 Thread Jorge Juan Garcia Garcia
Some people often run 'git status -b'.
The config variable status.branch allows to set it by default.

Signed-off-by: Jorge Juan Garcia Garcia 
jorge-juan.garcia-gar...@ensimag.imag.fr
Signed-off-by: Mathieu Lienard--Mayor mathieu.lienard--ma...@ensimag.imag.fr
Signed-off-by: Matthieu Moy matthieu@grenoble-inp.fr
---

Changes since v1:
 -Documentation more accurate
 -removal of unappropriate function calls
 -clean up in the test

 Documentation/config.txt |4 
 builtin/commit.c |4 
 t/t7508-status.sh|   27 +++
 3 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 1983bf7..ecdcd6d 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2070,6 +2070,10 @@ status.short::
Set to true to enable --short by default in linkgit:git-status[1].
The option --no-short takes precedence over this variable.
 
+status.branch::
+   Set to true to enable --branch by default in linkgit:git-status[1].
+   The option --no-branch takes precedence over this variable.
+
 status.showUntrackedFiles::
By default, linkgit:git-status[1] and linkgit:git-commit[1] show
files which are not currently tracked by Git. Directories which
diff --git a/builtin/commit.c b/builtin/commit.c
index 287f1cb..f2b5d44 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1117,6 +1117,10 @@ static int git_status_config(const char *k, const char 
*v, void *cb)
status_format = STATUS_FORMAT_SHORT;
return 0;
}
+   if (!strcmp(k, status.branch)) {
+   s-show_branch = git_config_bool(k, v);
+   return 0;
+   }
if (!strcmp(k, status.color) || !strcmp(k, color.status)) {
s-use_color = git_config_colorbool(k, v);
return 0;
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 9a07f15..958617a 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -1366,6 +1366,33 @@ test_expect_success 'status.short=false weaker than 
-s' '
test_cmp actual expected_short
 '
 
+test_expect_success 'status.branch=true same as -b' '
+   git -c status.branch=true status -s actual 
+   git status -sb expected_branch 
+   test_cmp actual expected_branch
+'
+
+test_expect_success 'status.branch=true different from --no-branch' '
+   git -c status.branch=true status -s actual 
+   git status -s --no-branch  expected_nobranch 
+   test_must_fail test_cmp actual expected_nobranch
+'
+
+test_expect_success 'status.branch=true weaker than --no-branch' '
+   git -c status.branch=true status -s --no-branch actual 
+   test_cmp actual expected_nobranch
+'
+
+test_expect_success 'status.branch=false same as --no-branch' '
+   git -c status.branch=false status -s actual 
+   test_cmp actual expected_nobranch
+'
+
+test_expect_success 'status.branch=false weaker than -b' '
+   git -c status.branch=false status -sb actual 
+   test_cmp actual expected_branch
+'
+
 test_expect_success 'Back to environment of test by default' '
git config status.showUntrackedFiles yes
 '
-- 
1.7.8

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] status: introduce status.branch to enable --branch by default

2013-06-08 Thread Jorge Juan Garcia Garcia
Some people often run 'git status -b'.
The config variable status.branch allows to set it by default.

Signed-off-by: Jorge Juan Garcia Garcia 
jorge-juan.garcia-gar...@ensimag.imag.fr
Signed-off-by: Mathieu Lienard--Mayor mathieu.lienard--ma...@ensimag.imag.fr
Signed-off-by: Matthieu Moy matthieu@grenoble-inp.fr
---
 Documentation/config.txt |3 +++
 builtin/commit.c |6 ++
 t/t7508-status.sh|   30 ++
 3 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 80cdf75..21ba9c2 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2069,6 +2069,9 @@ status.relativePaths::
 status.short::
Set to true to enable --short by default in linkgit:git-status[1].
 
+status.branch::
+   Set to true to enable --branch by default in linkgit:git-status[1].
+
 status.showUntrackedFiles::
By default, linkgit:git-status[1] and linkgit:git-commit[1] show
files which are not currently tracked by Git. Directories which
diff --git a/builtin/commit.c b/builtin/commit.c
index 0f3429f..d447857 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1121,6 +1121,12 @@ static int git_status_config(const char *k, const char 
*v, void *cb)
}
return 0;
}
+   if (!strcmp(k, status.branch)) {
+   if (!v)
+   return config_error_nonbool(k);
+   s-show_branch = git_config_bool(k,v);
+   return 0;
+   }
if (!strcmp(k, status.color) || !strcmp(k, color.status)) {
s-use_color = git_config_colorbool(k, v);
return 0;
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 4cb2b62..34cf30f 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -1369,4 +1369,34 @@ test_expect_success 'status.short=false weaker than 
-s' '
 test_cmp status1 status2
 '
 
+test_expect_success 'status.branch=true same as -b' '
+git -c status.branch=true status -s status2 
+git status -sb status1 
+test_cmp status1 status2
+'
+
+test_expect_success 'status.branch=true different from --no-branch' '
+git -c status.branch=true status -s status2 
+git status -s --no-branch  status1 
+test_must_fail test_cmp status1 status2
+'
+
+test_expect_success 'status.branch=true weaker than --no-branch' '
+git -c status.branch=true status -s --no-branch status2 
+git status -s --no-branch status1 
+test_cmp status1 status2
+'
+
+test_expect_success 'status.branch=false same as --no-branch' '
+git -c status.branch=false status -s status2 
+git status -s --no-branch status1 
+test_cmp status1 status2
+'
+
+test_expect_success 'status.branch=false weaker than -b' '
+git -c status.branch=false status -sb status2 
+git status -sb status1 
+test_cmp status1 status2
+'
+
 test_done
-- 
1.7.8

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] status: introduce status.short to enable --short by default

2013-06-08 Thread Jorge Juan Garcia Garcia
Some people always run 'git status -s'.
The configuration variable status.short allows to set it by default.

Signed-off-by: Jorge Juan Garcia Garcia 
jorge-juan.garcia-gar...@ensimag.imag.fr
Signed-off-by: Mathieu Lienard--Mayor mathieu.lienard--ma...@ensimag.imag.fr
Signed-off-by: Matthieu Moy matthieu@grenoble-inp.fr
---
 Documentation/config.txt |3 +++
 builtin/commit.c |9 +
 config.c |1 +
 t/t7508-status.sh|   34 ++
 4 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 6e53fc5..80cdf75 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2066,6 +2066,9 @@ status.relativePaths::
relative to the repository root (this was the default for Git
prior to v1.5.4).
 
+status.short::
+   Set to true to enable --short by default in linkgit:git-status[1].
+
 status.showUntrackedFiles::
By default, linkgit:git-status[1] and linkgit:git-commit[1] show
files which are not currently tracked by Git. Directories which
diff --git a/builtin/commit.c b/builtin/commit.c
index 1621dfc..0f3429f 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1112,6 +1112,15 @@ static int git_status_config(const char *k, const char 
*v, void *cb)
s-submodule_summary = -1;
return 0;
}
+   if (!strcmp(k, status.short)) {
+   if (!v)
+   return config_error_nonbool(k);
+   if (git_config_bool(k,v)) {
+   status_format = STATUS_FORMAT_SHORT;
+   wt_shortstatus_print(s);
+   }
+   return 0;
+   }
if (!strcmp(k, status.color) || !strcmp(k, color.status)) {
s-use_color = git_config_colorbool(k, v);
return 0;
diff --git a/config.c b/config.c
index 7a85ebd..85ddbf2 100644
--- a/config.c
+++ b/config.c
@@ -9,6 +9,7 @@
 #include exec_cmd.h
 #include strbuf.h
 #include quote.h
+#include commit.h
 
 typedef struct config_file {
struct config_file *prev;
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index e2ffdac..4cb2b62 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -1334,5 +1334,39 @@ test_expect_failure '.git/config ignore=all suppresses 
submodule summary' '
git config --remove-section submodule.subname 
git config -f .gitmodules  --remove-section submodule.subname
 '
+test_expect_success 'setup for testing status.short' '
+status1 
+status2
+'
+
+test_expect_success 'status.short=true same as -s' '
+git -c status.short=true status status2 
+git status -s status1 
+test_cmp status1 status2
+'
+
+test_expect_success 'status.short=true different from --no-short' '
+git -c status.short=true status status2 
+git status --no-short status1 
+test_must_fail test_cmp status1 status2
+'
+
+test_expect_success 'status.short=true weaker than --no-short' '
+git -c status.short=true status --no-short status2 
+git status --no-short status1 
+test_cmp status1 status2
+'
+
+test_expect_success 'status.short=false same as --no-short' '
+git -c status.short=false status status2 
+git status --no-short status1 
+test_cmp status1 status2
+'
+
+test_expect_success 'status.short=false weaker than -s' '
+git -c status.short=false status -s status2 
+git status -s status1 
+test_cmp status1 status2
+'
 
 test_done
-- 
1.7.8

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html