[PATCH] Fix `git svn rebase` if top-level HEAD directory exist

2013-06-04 Thread ojab

Oh hai!
I have a svn repo with the top-level directory named HEAD and `git svn 
rebase [HEAD] [--]` fails with

$ git svn rebase
fatal: ambiguous argument 'HEAD': both revision and filename
Use '--' to separate paths from revisions, like this:
'git  [...] -- [...]'
rev-list --first-parent --pretty=medium HEAD: command returned error: 128


Works fine with patch in the attached file. please review.

//wbr ojab
From 522cbc8b8a7c4f2ab4268551a550585753164677 Mon Sep 17 00:00:00 2001
From: ojab 
Date: Tue, 4 Jun 2013 11:28:16 +0400
Subject: [PATCH] Fix `git svn rebase` if top-level HEAD directory exist
Signed-off-by: ojab 

---
 git-svn.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-svn.perl b/git-svn.perl
index d070de0..e35a66a 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1932,7 +1932,7 @@ sub cmt_sha2rev_batch {
 sub working_head_info {
my ($head, $refs) = @_;
my @args = qw/rev-list --first-parent --pretty=medium/;
-   my ($fh, $ctx) = command_output_pipe(@args, $head);
+   my ($fh, $ctx) = command_output_pipe(@args, $head, "--");
my $hash;
my %max;
while (<$fh>) {
-- 
1.8.2



Re: [PATCH v2] core: use env variable instead of config var to turn on logging pack access

2013-06-04 Thread Duy Nguyen
On Tue, Jun 4, 2013 at 1:26 PM, Junio C Hamano  wrote:
> Nguyễn Thái Ngọc Duy  writes:
>
>>  > Have you ever tested this?
>>  >
>>  > Once log_pack_access goes to NULL (e.g. when it sees the empty
>>  > string it was initialized to), this new test will happily
>>  > dereference NULL.
>>
>>  My bad. I did test when GIT_TRACE_PACK_ACCESS was set, not when it
>>  was set to an empty string. All cases tested now.
>>
>> @@ -1956,6 +1958,14 @@ static void write_pack_access_log(struct packed_git 
>> *p, off_t obj_offset)
>>  {
>>   static FILE *log_file;
>>
>> + if (!*log_pack_access) {
>
> The first time, we will see the static empty string and come into
> this block...
>
>> + log_pack_access = getenv("GIT_TRACE_PACK_ACCESS");
>> + if (log_pack_access && !*log_pack_access)
>> + log_pack_access = NULL;
>> + if (!log_pack_access)
>> + return;
>> + }
>
> This may
>
>  (1) not find the env-var, in which case log_pack_access becomes
>  NULL here, and the function returns.
>
>  (2) find the env-var to be an empty string, in which case
>  log_pack_access becomes NULL in the next statement, and the
>  function returns.
>
>  (3) find the env-var to be a non-empty string, and the function
>  does not return.
>
> And the next time around, (3) above may work fine; the first if()
> will fail and we do not come in.  But in either (1) or (2), don't
> you keep checking the environment every time you come here?
>
> Oh, no, it is worse than that.  Either case you set the variable to
> NULL, so the very first "if (!*log_pack_access)" would dereference
> NULL.

You found it out already. The only caller does this

if (log_pack_access) write_pack_access_log(p, obj_offset);

so in (1) and (2), write_pack_access_log() will never be called again.
Originally I had "log_pack_access && !*log_pack_access" in the first
if(), but I dropped it because of the caller's condition. It's a bit
fragile though. Imagine a new callsite is added.. (to be continued)

> Why not start from NULL:
>
> static const char *log_pack_access;
>
> treat that NULL as "unknown" state, and avoid running getenv over
> and over again by treating non-NULL value as "known"?  Perhaps like
> this?
>
> if (!log_pack_access) {
> /* First time: is env set? */
> log_pack_access = getenv("GIT_TRACE_PACK_ACCESS");
> if (!log_pack_access)
> log_pack_access = "";

or set log_pack_access to SomePredefinedButUselessString here. I
wanted to do this but couldn't because of global variable
initialization.

> }
> /* Now GIT_TRACE_PACK_ACCESS is known */
> if (!*log_pack_access)
> return; /* not wanted */
>
> As you can no longer rely on "config is read before we do anything
> else" by switching to lazy env checking, your guard at the caller
> needs to be updated, if you want to reduce unneeded call-return
> overhead:
>
> if (!log_pack_access || *log_pack_access)
> write_pack_access_log(...);

and this turns to "if (!log_.. || log != SomePrede...)", no more
peeking into log_pack_access.

>
> But the guard is purely for performance, not correctness, because
> the function now does the "return no-op if we know we are not
> wanted" itself.

(continued here) ..so yeah this looks better.

> Also you no longer need to have an extern variable in environment.c

will fix.
--
Duy
--
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


Re: [PATCH] Fix `git svn rebase` if top-level HEAD directory exist

2013-06-04 Thread Jeff King
On Tue, Jun 04, 2013 at 11:32:56AM +0400, ojab wrote:

> Oh hai!

You can haz patch?

> I have a svn repo with the top-level directory named HEAD and `git
> svn rebase [HEAD] [--]` fails with
> >$ git svn rebase
> >fatal: ambiguous argument 'HEAD': both revision and filename
> >Use '--' to separate paths from revisions, like this:
> >'git  [...] -- [...]'
> >rev-list --first-parent --pretty=medium HEAD: command returned error: 128

This rationale should probably go in the commit message.

> From 522cbc8b8a7c4f2ab4268551a550585753164677 Mon Sep 17 00:00:00 2001
> From: ojab 
> Date: Tue, 4 Jun 2013 11:28:16 +0400
> Subject: [PATCH] Fix `git svn rebase` if top-level HEAD directory exist

We prefer patches to be inline in the email; these lines can be
dropped, as they are picked up from your email headers.

> Signed-off-by: ojab 

Do you mind providing a real name? The point of Signed-off-by is for
licensing and attribution.

> diff --git a/git-svn.perl b/git-svn.perl
> index d070de0..e35a66a 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -1932,7 +1932,7 @@ sub cmt_sha2rev_batch {
>  sub working_head_info {
>   my ($head, $refs) = @_;
>   my @args = qw/rev-list --first-parent --pretty=medium/;
> - my ($fh, $ctx) = command_output_pipe(@args, $head);
> + my ($fh, $ctx) = command_output_pipe(@args, $head, "--");

Looks obviously correct to me. I did a quick grep, and there is one
other spot that probably should get the same treatment:

diff --git a/git-svn.perl b/git-svn.perl
index d070de0..07797ad 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -831,7 +831,7 @@ sub cmd_dcommit {
 sub cmd_dcommit {
my $head = shift;
command_noisy(qw/update-index --refresh/);
-   git_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }
+   git_cmd_try { command_oneline(qw/diff-index --quiet HEAD --/) }
'Cannot dcommit with a dirty index.  Commit your changes first, 
'
. "or stash them with `git stash'.\n";
$head ||= 'HEAD';

Feel free to squash it in if you re-roll your patch. There are a few
other spots that feed full sha1s. They are probably less likely to
trigger, but perhaps should be protected, too, just in case.

-Peff
--
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 v3 0/6] git send-email suppress-cc=self fixes

2013-06-04 Thread Michael S. Tsirkin
This includes bugfixes related to handling of --suppress-cc=self
flag. Tests are also included.

Changes from v2:
- add a new test, split patches differently add code comments
 to address comments by Junio
- rename example addresses in tests from redhat.com to example.com
Changes from v1:
- tweak coding style in tests to address comments by Junio


Michael S. Tsirkin (6):
  send-email: fix suppress-cc=self on cccmd
  t/send-email: test suppress-cc=self on cccmd
  send-email: make --suppress-cc=self sanitize input
  t/send-email: add test with quoted sender
  t/send-email: test suppress-cc=self with non-ascii
  test-send-email: test for pre-sanitized self name

 git-send-email.perl   | 23 +++
 t/t9001-send-email.sh | 34 +-
 2 files changed, 48 insertions(+), 9 deletions(-)

-- 
MST

--
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 v3 2/6] t/send-email: test suppress-cc=self on cccmd

2013-06-04 Thread Michael S. Tsirkin
Check that suppress-cc=self works when applied
to output of cccmd.

Signed-off-by: Michael S. Tsirkin 
---
 t/t9001-send-email.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index e1a7f3e..f81e5f5 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -204,13 +204,15 @@ test_suppress_self_unquoted () {
 
unquoted-$3
 
+   cccmd--$1 <$2>
+
Cc: $1 <$2>
Signed-off-by: $1 <$2>
EOF
 }
 
 test_expect_success $PREREQ 'self name is suppressed' "
-   test_suppress_self_unquoted 'A U Thor' 'aut...@redhat.com' \
+   test_suppress_self_unquoted 'A U Thor' 'aut...@example.com' \
'self_name_suppressed'
 "
 
-- 
MST

--
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 v3 3/6] send-email: make --suppress-cc=self sanitize input

2013-06-04 Thread Michael S. Tsirkin
--suppress-cc=self fails to filter sender address in many cases where it
needs to be sanitized in some way, for example quoted:
"A U. Thor" 
To fix, make send-email sanitize both sender and the address it is
compared against.

Signed-off-by: Michael S. Tsirkin 
---
 git-send-email.perl | 23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index f366baa..3b828f6 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -760,6 +760,11 @@ if (!defined $sender) {
$sender = $repoauthor || $repocommitter || '';
 }
 
+# $sender could be an already sanitized address
+# (e.g. sendemail.from could be manually sanitized by user).
+# But it's a no-op to run sanitize_address on an already sanitized address.
+$sender = sanitize_address($sender);
+
 my $prompting = 0;
 if (!@initial_to && !defined $to_cmd) {
my $to = ask("Who should the emails be sent to (if any)? ",
@@ -1113,10 +1118,9 @@ sub send_message {
if ($cc ne '') {
$ccline = "\nCc: $cc";
}
-   my $sanitized_sender = sanitize_address($sender);
make_message_id() unless defined($message_id);
 
-   my $header = "From: $sanitized_sender
+   my $header = "From: $sender
 To: $to${ccline}
 Subject: $subject
 Date: $date
@@ -1133,7 +1137,7 @@ X-Mailer: git-send-email $gitversion
}
 
my @sendmail_parameters = ('-i', @recipients);
-   my $raw_from = $sanitized_sender;
+   my $raw_from = $sender;
if (defined $envelope_sender && $envelope_sender ne "auto") {
$raw_from = $envelope_sender;
}
@@ -1308,8 +1312,9 @@ foreach my $t (@files) {
}
elsif (/^From:\s+(.*)$/i) {
($author, $author_encoding) = 
unquote_rfc2047($1);
+   my $sauthor = sanitize_address($author);
next if $suppress_cc{'author'};
-   next if $suppress_cc{'self'} and $author eq 
$sender;
+   next if $suppress_cc{'self'} and $sauthor eq 
$sender;
printf("(mbox) Adding cc: %s from line '%s'\n",
$1, $_) unless $quiet;
push @cc, $1;
@@ -1323,7 +1328,9 @@ foreach my $t (@files) {
}
elsif (/^Cc:\s+(.*)$/i) {
foreach my $addr (parse_address_line($1)) {
-   if (unquote_rfc2047($addr) eq $sender) {
+   my $qaddr = unquote_rfc2047($addr);
+   my $saddr = sanitize_address($qaddr);
+   if ($saddr eq $sender) {
next if ($suppress_cc{'self'});
} else {
next if ($suppress_cc{'cc'});
@@ -1370,7 +1377,8 @@ foreach my $t (@files) {
chomp;
my ($what, $c) = ($1, $2);
chomp $c;
-   if ($c eq $sender) {
+   my $sc = sanitize_address($c);
+   if ($sc eq $sender) {
next if ($suppress_cc{'self'});
} else {
next if $suppress_cc{'sob'} and $what =~ 
/Signed-off-by/i;
@@ -1454,7 +1462,6 @@ foreach my $t (@files) {
 sub recipients_cmd {
my ($prefix, $what, $cmd, $file) = @_;
 
-   my $sanitized_sender = sanitize_address($sender);
my @addresses = ();
open my $fh, "-|", "$cmd \Q$file\E"
or die "($prefix) Could not execute '$cmd'";
@@ -1462,7 +1469,7 @@ sub recipients_cmd {
$address =~ s/^\s*//g;
$address =~ s/\s*$//g;
$address = sanitize_address($address);
-   next if ($address eq $sanitized_sender and 
$suppress_cc{'self'});
+   next if ($address eq $sender and $suppress_cc{'self'});
push @addresses, $address;
printf("($prefix) Adding %s: %s from: '%s'\n",
   $what, $address, $cmd) unless $quiet;
-- 
MST

--
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 v3 5/6] t/send-email: test suppress-cc=self with non-ascii

2013-06-04 Thread Michael S. Tsirkin
test suppress-cc=self when sender is non-acsii

Signed-off-by: Michael S. Tsirkin 
---
 t/t9001-send-email.sh | 5 +
 1 file changed, 5 insertions(+)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 6c0f715..0d50fa7 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -236,6 +236,11 @@ test_expect_success $PREREQ 'self name with dot is 
suppressed' "
'self_name_dot_suppressed'
 "
 
+test_expect_success $PREREQ 'non-ascii self name is suppressed' "
+   test_suppress_self_quoted 'Füñný Nâmé' 'odd_?=m...@example.com' \
+   'non_ascii_self_suppressed'
+"
+
 test_expect_success $PREREQ 'Show all headers' '
git send-email \
--dry-run \
-- 
MST

--
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 v3 6/6] test-send-email: test for pre-sanitized self name

2013-06-04 Thread Michael S. Tsirkin
Users can sanitize from address manually.
Verify that these are suppressed properly.

Signed-off-by: Michael S. Tsirkin 
---
 t/t9001-send-email.sh | 5 +
 1 file changed, 5 insertions(+)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 0d50fa7..38f407d 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -241,6 +241,11 @@ test_expect_success $PREREQ 'non-ascii self name is 
suppressed' "
'non_ascii_self_suppressed'
 "
 
+test_expect_success $PREREQ 'sanitized self name is suppressed' "
+   test_suppress_self_unquoted '\"A U. Thor\"' 'aut...@example.com' \
+   'self_name_sanitized_suppressed'
+"
+
 test_expect_success $PREREQ 'Show all headers' '
git send-email \
--dry-run \
-- 
MST

--
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 v3 1/6] send-email: fix suppress-cc=self on cccmd

2013-06-04 Thread Michael S. Tsirkin
When cccmd is used, old-style suppress-from filter
is applied by the newer suppress-cc=self isn't.
Fix this up.

Signed-off-by: Michael S. Tsirkin 
---

This makes one line a bit too long, but a follow-up patch
fixes this up.

 git-send-email.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index bd13cc8..f366baa 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1462,7 +1462,7 @@ sub recipients_cmd {
$address =~ s/^\s*//g;
$address =~ s/\s*$//g;
$address = sanitize_address($address);
-   next if ($address eq $sanitized_sender and $suppress_from);
+   next if ($address eq $sanitized_sender and 
$suppress_cc{'self'});
push @addresses, $address;
printf("($prefix) Adding %s: %s from: '%s'\n",
   $what, $address, $cmd) unless $quiet;
-- 
MST

--
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 v3 4/6] t/send-email: add test with quoted sender

2013-06-04 Thread Michael S. Tsirkin
add test where sender address needs to be quoted.
Make sure --suppress-cc=self works well in this case.

Signed-off-by: Michael S. Tsirkin 
---
 t/t9001-send-email.sh | 20 
 1 file changed, 20 insertions(+)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index f81e5f5..6c0f715 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -211,11 +211,31 @@ test_suppress_self_unquoted () {
EOF
 }
 
+test_suppress_self_quoted () {
+   test_suppress_self "$1" "$2" "quoted-$3" <<-EOF
+   test suppress-cc.self quoted-$3 with name $1 email $2
+
+   quoted-$3
+
+   cccmd--"$1" <$2>
+
+   Cc: $1 <$2>
+   Cc: "$1" <$2>
+   Signed-off-by: $1 <$2>
+   Signed-off-by: "$1" <$2>
+   EOF
+}
+
 test_expect_success $PREREQ 'self name is suppressed' "
test_suppress_self_unquoted 'A U Thor' 'aut...@example.com' \
'self_name_suppressed'
 "
 
+test_expect_success $PREREQ 'self name with dot is suppressed' "
+   test_suppress_self_quoted 'A U. Thor' 'aut...@example.com' \
+   'self_name_dot_suppressed'
+"
+
 test_expect_success $PREREQ 'Show all headers' '
git send-email \
--dry-run \
-- 
MST

--
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


Re: Re: What's cooking in git.git (May 2013, #09; Wed, 29)

2013-06-04 Thread John Keeping
On Tue, Jun 04, 2013 at 03:29:51PM +1000, Heiko Voigt wrote:
> On Mon, Jun 03, 2013 at 11:23:41PM +0100, John Keeping wrote:
> > > Sorry, I should have been more specific here. I saw that you did some
> > > changes to make "submodule add" do the right thing with relative paths,
> > > but the following change to t7406 does not work like I believe it
> > > should but instead makes the test fail:
> > > ---8<-
> > > diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
> > > index a4ffea0..9766b9e 100755
> > > --- a/t/t7406-submodule-update.sh
> > > +++ b/t/t7406-submodule-update.sh
> > > @@ -559,7 +559,9 @@ test_expect_success 'add different submodules to the 
> > > same pa
> > >  test_expect_success 'submodule add places git-dir in superprojects 
> > > git-dir' '
> > > (cd super &&
> > >  mkdir deeper &&
> > > -git submodule add ../submodule deeper/submodule &&
> > > +(cd deeper &&
> > > + git submodule add ../../submodule submodule
> > > +) &&
> > >  (cd deeper/submodule &&
> > >   git log > ../../expected
> > >  ) &&
> > > ---8<-
> > 
> > Ah, ok.  I think this case is problematic because the repository
> > argument is either relative to "remote.origin.url" or to the top of the
> > working tree if there is no "origin" remote.  I wonder if we should just
> > die when a relative path is given for the repository and we're not at
> > the top of the working tree.
> 
> Why not behave as if we are at the top of the working tree for relative
> paths? If there is an origin remote thats fine. If there is no origin
> remote you could warn that the path used is taken relative from the root
> of the superproject during add. What do you think?

That's what the patch currently queued on "pu" does, which Jens wants to
change, isn't it?
--
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


Re: [PATCH v2 5/8] sequencer: run post-rewrite hook

2013-06-04 Thread Thomas Rast
Junio C Hamano  writes:

> Felipe Contreras  writes:
>
>> +static void run_rewrite_hook(void)
>> +{
>> +struct strbuf buf = STRBUF_INIT;
>> +struct child_process proc;
>> +const char *argv[3];
>> +int code, i;
>> +
>> +argv[0] = find_hook("post-rewrite");
>> +if (!argv[0])
>> +return;
>> +
>> +argv[1] = "rebase";
>> +argv[2] = NULL;
>
> When the end-user action is "git cherry-pick A..B", shouldn't
> the rewrite hook be called with "cherry-pick" not "rebase" as its
> first argument?

The whole function was copied from builtin/commit.c except for that
string.  So it should be refactored anyway, with the "cherry-pick" being
an argument.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
--
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


Re: Git status reports untracked on tracked files

2013-06-04 Thread Andrey Kiyanovsky
I have tried Git 1.8.3 for Windows. Case is fixed. Thank you very much!

2013/6/4 Jeff King :
> On Wed, May 29, 2013 at 11:40:56AM +0300, Andrey Kiyanovsky wrote:
>
>> Git version 1.8.1.2. for Windows
>>
>> Git config:
>>
>> [core]
>>   repositoryformatversion = 0
>>   filemode = false
>>   bare = false
>>   logallrefupdates = true
>>   symlinks = false
>>   ignorecase = true
>>   hideDotFiles = dotGitOnly
>>   compression = 1
>
> In the past there have been some problems with status listings of
> untracked files when core.ignorecase is in use. I fixed some cases with
> a commit that went into v1.7.8, but some problems remained. Karsten
> Blees (cc'd) did some work that went into git v1.8.1.6, but I do not
> know off-hand if it would fix your case or not.
>
> Can you try with a more recent version of git?
>
> -Peff
--
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


SNI (SSL virtual hosts)

2013-06-04 Thread Janusz Harkot
I was trying to to a push some repo over https and after few unsuccessful tries 
I've managed to find a problem - multiple virtual SSL servers on one IP address…

Strange was, that initial communication was OK (http GET), but when there was 
http POST - git reported error (incorrect certificate).
The only workaround was to disable certificate verification.

My question is: does git support SNI on the https? If so - are there 
(undocumented) options to make it work?



Thanks!
Janusz  

--
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


Verbessern Sie den persönlichen Geschmack an lebensnotwendigen Gütern

2013-06-04 Thread Nanken
Leichtathletik  Nike Air Jordan
   begann, weil Leinwand
besten und Gummisohlen Schuhe oder Stiefel mit zu gesehen worden, weil
Turnschuhe. US Rubber die Firma Keds verwendet, um die primären sehr
Turnschuhe im Jahr 1917 zu vermarkten. Generell Turnschuhe über eine
erhebliche Menge an Entscheidungsträger aufgebaut wurden nur tatsächlichen
Ist Sportschuhen in Acht auf dem Markt, während mit United sagen ideal bis
vor die bisher aufgrund 1950er Jahren jeder einzelne und jedes Mal, wenn ein
Mitmensch in der Hochschulbildung mit Oregon Track Gruppe über die
Unterlegenheit der Turnschuhe für die Arbeit gesprochen und zusätzlich
Ausbildung im Zusammenhang .
 Im Jahr 1972, Ritter eine Werbe-und Marketing-Trick, die es einfacher für
bestimmte Nike in Bezug auf den Plan erstellt genutzt. Das Motto der Werbung
darauf hin, dass 4 von 7 Athleten, um die Anforderungen zu erfüllen, auch
unter Ausnutzung laufen Vereinigten sagt Olympischen Tests Ausdruck, dass
die Schuhe.
Die meisten der sportlich Produkt wurde entwickelt, um Komfort für die
Läufer zu versorgen. Allerdings ist die Herausforderung, wie eine richtige
Paar von diesen unter all den oberen Ende Malerei Produkte wählen? Die
Antwort ist einfach. Wählen Sie einen Satz, der die Fuß-Typ passt .
Sollten Sie sich entscheiden wollen entsprechende Fuß-Zubehör für den Zweck
des fließenden wählen, dann sind die Chancen sollten Sie versuchen, zu Fuß
in Sport am Nachmittag oder Abend möglicherweise kaufen da für die Dauer des
Tages Zeit weg Füße haben Neigung zu schwellen. Für mit gültiges Maß aller
Ihre Fuß-Typ, werden Sie wollen immer bestimmen die Art Fuß während der
Wartezeit.
In einer Art  Nike Air Max 1 Sale
   von Sport
in der Tat gibt es tatsächlich Schuhe für mehrere Ebenen im Zusammenhang
gewährt mit Wettbewerb und auch Körper Arten. Die Zunahme im Bereich der
weiblichen Athleten kürzlich Jahren motivierte Unternehmen bekommen hat
Studien und Versorgung Schuhe für ihre speziellen Anforderungen.
Darüber hinaus mit dem Test sicher, dass mit den echten Werten im
Zusammenhang stehen und zusätzlich der Nike Kostenlose three.0 V4 Männer
Fahrzeug Verkäufern. Ideen, überprüfen Sie ein paar Lesung
Einzel-Assessments an der Spitze von Mitteln, die helfen soll die Prüfung
eines einzigartigen Erlebnissen inmitten der Händler. Einzelheiten zu diesem
Ballett Schuhe Produkts wurden möglicherweise für den Nike erhoben werden
traditionellen Web-Adresse.
In der Tat gibt es keine innere Kurve für den Fall der flachen Fuß, während
eine hohe Bogenspannung ist deutlich sichtbar in dem Fall eines stark
gewölbten Fuß. Provider mit Sport-Zubehör im Zusammenhang mit Recht diese
Variationen in Fuß Arten gelobt und auch Malerei Produkte entsprechend für
mehrere Fußtypen.
Schuhe Enthusiasten aus Ländern weltweit genannt AIR Jordan Schuhe, am Ende
wird die "Sammler Turnschuhe". "Die größten Golfball shoes" wurde angewandt,
um AIR Jordan XX3, die das Herz, dass Männer  Nike Schuhe günstig
   und Frauen würden ihre Augen auf zu
beheben hat zu beschreiben. Es endete als bekannt, die eine Menge Leute
haben durch die Geschichte von "23" wurde daher um wunderbare Heimkehr
wieder lassen, Nike 706 Raum könnte "Casting-Legende", um Menschen
aufrichtig zu begehen.



-
nike schuhe herren 
nike schuhe online 
nike schuhe günstig 
--
View this message in context: 
http://git.661346.n2.nabble.com/Verbessern-Sie-den-personlichen-Geschmack-an-lebensnotwendigen-Gutern-tp7587859.html
Sent from the git mailing list archive at Nabble.com.
--
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


Nike - die Eleganz von innen heraus

2013-06-04 Thread Nanken
Eine größere  nike blazer low
   Anzahl von
Personen in der Erde nutzen irgendeine Art von Turnschuhen täglich. Es gibt
eine große Auswahl mit Bezug zur Auswahl. Die historische Vergangenheit von
Turnschuhen hat eine große Vielzahl von Änderungen in den Arten und Arten,
die getragen werden, gesehen. Ändern besitzen vor allem der Fall für die
Leichtathletik-Schuhe oder Stiefel. Es gibt unglaublich viele, die sie
fühlen können stoßen ist-Shops, die nur ihnen.
Ob eine Einzelperson sind ein Pro Runner oder vielleicht ein Morgen Jogger,
dem oberen Ende Betriebssystem Sportschuhen immer im Einzelfall zu ziehen,
da das Paar verbessern die Menge Komfort beim fließt. Athletisch Fuß für die
Ausübung kommen, um großartig zu irgendeiner Art von Athlet praktisch egal,
ob Ihr Mann ist in Marathon teilnehmen oder möglicherweise irgendeine Art
von kurzfristig zu unterstützen. Wenn im Falle eines Sportlers ist äußerst
angenehm, wenn fließenden, dass pr ihre sexuelle Leistung könnte automatisch
deutlich verbessern. Der sportliche Fuß trägt dazu beitragen, bei der
Vermehrung Leistung Menge, wie sie riesige Komfort für die Sportler bieten.
Aber können diese Produkte auch verschlechtern funktionalen
Performance-Level, wenn irgendeine Art von Athlet Einkäufe eine Reihe von
falschen Produkte für Sie oder Ihn.
Der Anstieg der Relaxationszeit in den frühen zwanzigsten Jahrhunderts fiel
mit Produktionsverfahren, die für wachsenden Palette von Turnschuhen
ermöglichen würde. Die folgenden Jahrzehnten führte zu einem starken Anstieg
in der Qualität und specialitzation der Schuhe für die Anzeige Bemühungen.
Eine individuelle Zusammenhang mit hundert vor vielen Jahren würde sich
gestresst fühlen, was genau ist heute zugänglich in den Markt.
Die  nike free 3.0 v3
   Entscheidung über
die besten Turnschuhe zum Joggen stützt sich auf welche Art von Fuß haben
Sie. Ihre beste beste Freundin kann wie ein und zusätzlich können Sie es
hassen. Zahlreiche Einzelhändler können heute ermutigen, zu kommen und es
ihnen ermöglichen, testen Sie Ihre Gangart. Dies ist sicherlich ein großer
Schritt, egal in welchem Sie kaufen die Schuhe oder Stiefel im Wesentlichen.
Ein großes Paar Schuhe sollten bequem letzten rund 500 Meilen.
Die Notwendigkeit für eine Boot verschiedener fiel zusammen mit der
fortschreitenden tech und Kenntnisse der Körper Techniker. Verschiedene
Sportarten haben unterschiedliche Bedürfnisse in Bezug auf ihre Schuhe. Ein
Schuh für das Spiel des Tennis heute erstellt werden zunehmend ganz anders,
wenn sie die für Basketball-Spieler verglichen. Tatsächlich gibt es
unterschiedliche Anforderungen für die Verwaltung und auch materielle
Auswirkungen Highlights.
Um die Technologien von Nike TN verstehen, müssen wir allerersten Blick in
ersten Kreationen von Nike: Nike Air, Air Max und Focus-Air. Nike Air war
die erste Luft-Technologie im Jahr 1979 von Nike für die höchstmögliche
Dämpfung entwickelt. Der unter Druck stehende Kraftstoff in einem flexiblen
Urethan Kunststoff Pille unter der Ferse positioniert, Vorfuß oder
vielleicht beides zu geringeren Auswirkungen auf den Fuß. Nach entwickelte
Nike ist Air Max Reihe zusammen mit dem sichtbaren Luft Vorrichtung
innerhalb der Ferse. Das Boot landete geschaffen, um die Hauptlast der hart,
häufige Einflüsse widerstehen. Früher oder später wird eine feinere und auch
robuste Polsterung System, Zoom Air, geschaffen worden war, um eine gute
Dämpfung zu liefern. Später hatte der TN oder möglicherweise Tuned
Air-Technologie auf den Markt als eine Strategie mit einzelnen Schoten unter
dem Stiefel gemeint Einflüsse an jedem der Bereiche des Fußes absorbieren
Zusammenhang gelehrt.
Es besitzt  nike blazer high
   ein
Ausgangspunkt 1mm leichter diskriminieren der Nike Kostenlose fünf., Könnten
die Menschen nicht erklären, das ist an sich, obwohl es eine nach oben geht
zu einem großen Teil wollen Bewegung in den konstanten Mechanik und wie der
Kurier scheint beim Betrieb. Dies ist sicherlich voll, weil es die Variante
mit Nike Free four.0 die bounder zusammen mit den Zehen erzeugt damit eine
größere Übung soweit nichts ändert Ihre Beine.



-
nike schuhe herren 
nike schuhe online 
nike schuhe günstig 
--
View this message in context: 
http://git.661346.n2.nabble.com/Nike-die-Eleganz-von-innen-heraus-tp7587860.html
Sent from the git mailing list archive at Nabble.com.
--
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


Re: SNI (SSL virtual hosts)

2013-06-04 Thread Daniel Stenberg

On Tue, 4 Jun 2013, Janusz Harkot wrote:

Strange was, that initial communication was OK (http GET), but when there 
was http POST - git reported error (incorrect certificate). The only 
workaround was to disable certificate verification.


My question is: does git support SNI on the https? If so - are there 
(undocumented) options to make it work?


It does. git uses libcurl for the HTTPS parts and it has support SNI for a 
long time, assuming you built libcurl with a TLS library that handles it.


Which libcurl version and SSL backend is this? (curl -V usually tells)

If you made it working by disabling certificate verification then it sounds as 
if SNI might still have worked and the problem was rahter something else, as 
without SNI you can't do name-based virtual hosting over HTTPS - but perhaps 
you wanted to communicate with the "default" server on that IP?


--

 / daniel.haxx.se
--
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


fetch delta resolution vs. checkout (was: java zlib woes)

2013-06-04 Thread Andreas Krey
On Mon, 27 May 2013 06:11:46 +, Andreas Krey wrote:
...
> 
> I now have a full test case (involving a generated repo just shy of 1GB)
> that will reproduce that hang. Will look up the existing jgit bug to
> report there.

On https://bugs.eclipse.org/bugs/show_bug.cgi?id=394078

A question: The delta decoding. If I understand correctly,
git and jgit do verify the packfile content after fetching/cloning,
and need to resolve any deltified files in the pack.

And when checking out a commit it needs this to again for the
files that are being checked out?

Because we now have the phenomenon that the packfile is fetched
ok, but a checkout then hangs (100%) CPU on one of the large files,
and on one that should, according to core.bigfilethreshold, not
even be deltified.

(Setting core.bigfilethreshold to 20m in the source repo (C git)
gets jgit to no longer hang in the fetch/delta resolution phase.
And it doesn't look like jgit would repack the pack file, and
uses it as it was received plus 20 bytes at the end.)

Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds 
Date: Fri, 22 Jan 2010 07:29:21 -0800
--
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


Re: SNI (SSL virtual hosts)

2013-06-04 Thread Janusz Harkot
> It does. git uses libcurl for the HTTPS parts and it has support SNI for a 
> long time, assuming you built libcurl with a TLS library that handles it.
> 
> Which libcurl version and SSL backend is this? (curl -V usually tells)
$ curl -V
curl 7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 
pop3s rtsp smtp smtps telnet tftp 
Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM NTLM_WB SSL libz 

$ otool -L /usr/local/bin/git
/usr/local/bin/git:
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, 
current version 1.0.0)
/usr/local/opt/openssl/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, 
current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 
169.3.0)



> If you made it working by disabling certificate verification then it sounds 
> as 
> if SNI might still have worked and the problem was rahter something else, as 
> without SNI you can't do name-based virtual hosting over HTTPS - but perhaps 
> you wanted to communicate with the "default" server on that IP?

here is a log (with GIT_CURL_VERBOSE=1)

https://gist.github.com/anonymous/8f6533a755ae5c710c75 

Initial connection is correct (line 10 - shows that it reads correct 
certificate),
 but then subsequent call to the server (line 68) shows that the defat server 
certificate is used.

It looks like the second call was without hostname (?).

Thanks!
Janusz

--
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] git-remote-mediawiki: use git.pm functions for credentials

2013-06-04 Thread benoit . person
From: Benoit Person 

In 52dce6d, a new credential function was added to git.pm, based on
git-remote-mediawiki's functions. The logical follow-up is to use
those functions in git-remote-mediawiki.

Signed-off-by: Benoit Person 
Signed-off-by: Matthieu Moy 
---
 contrib/mw-to-git/git-remote-mediawiki.perl | 66 -
 1 file changed, 9 insertions(+), 57 deletions(-)

diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl 
b/contrib/mw-to-git/git-remote-mediawiki.perl
index 9c14c1f..9fb281e 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -13,6 +13,7 @@
 
 use strict;
 use MediaWiki::API;
+use Git;
 use DateTime::Format::ISO8601;
 
 # By default, use UTF-8 to communicate with Git and the user
@@ -156,57 +157,6 @@ while () {
 
 ## Functions ##
 
-## credential API management (generic functions)
-
-sub credential_read {
-   my %credential;
-   my $reader = shift;
-   my $op = shift;
-   while (<$reader>) {
-   my ($key, $value) = /([^=]*)=(.*)/;
-   if (not defined $key) {
-   die "ERROR receiving response from git credential 
$op:\n$_\n";
-   }
-   $credential{$key} = $value;
-   }
-   return %credential;
-}
-
-sub credential_write {
-   my $credential = shift;
-   my $writer = shift;
-   # url overwrites other fields, so it must come first
-   print $writer "url=$credential->{url}\n" if exists $credential->{url};
-   while (my ($key, $value) = each(%$credential) ) {
-   if (length $value && $key ne 'url') {
-   print $writer "$key=$value\n";
-   }
-   }
-}
-
-sub credential_run {
-   my $op = shift;
-   my $credential = shift;
-   my $pid = open2(my $reader, my $writer, "git credential $op");
-   credential_write($credential, $writer);
-   print $writer "\n";
-   close($writer);
-
-   if ($op eq "fill") {
-   %$credential = credential_read($reader, $op);
-   } else {
-   if (<$reader>) {
-   die "ERROR while running git credential $op:\n$_";
-   }
-   }
-   close($reader);
-   waitpid($pid, 0);
-   my $child_exit_status = $? >> 8;
-   if ($child_exit_status != 0) {
-   die "'git credential $op' failed with code $child_exit_status.";
-   }
-}
-
 # MediaWiki API instance, created lazily.
 my $mediawiki;
 
@@ -217,22 +167,24 @@ sub mw_connect_maybe {
$mediawiki = MediaWiki::API->new;
$mediawiki->{config}->{api_url} = "$url/api.php";
if ($wiki_login) {
-   my %credential = (url => $url);
-   $credential{username} = $wiki_login;
-   $credential{password} = $wiki_passwd;
-   credential_run("fill", \%credential);
+   my %credential = (
+   'url' => $url,
+   'username' => $wiki_login,
+   'password' => $wiki_passwd
+   );
+   Git::credential \%credential;
my $request = {lgname => $credential{username},
   lgpassword => $credential{password},
   lgdomain => $wiki_domain};
if ($mediawiki->login($request)) {
-   credential_run("approve", \%credential);
+   Git::credential \%credential, 'approve';
print STDERR "Logged in mediawiki user 
\"$credential{username}\".\n";
} else {
print STDERR "Failed to log in mediawiki user 
\"$credential{username}\" on $url\n";
print STDERR "  (error " .
$mediawiki->{error}->{code} . ': ' .
$mediawiki->{error}->{details} . ")\n";
-   credential_run("reject", \%credential);
+   Git::credential \%credential, 'reject';
exit 1;
}
}
-- 
1.8.3.rc3.7.gc2f33ed.dirty

--
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


Re: Re: Re: What's cooking in git.git (May 2013, #09; Wed, 29)

2013-06-04 Thread Heiko Voigt
On Tue, Jun 04, 2013 at 09:10:45AM +0100, John Keeping wrote:
> On Tue, Jun 04, 2013 at 03:29:51PM +1000, Heiko Voigt wrote:
> > On Mon, Jun 03, 2013 at 11:23:41PM +0100, John Keeping wrote:
> > > > Sorry, I should have been more specific here. I saw that you did some
> > > > changes to make "submodule add" do the right thing with relative paths,
> > > > but the following change to t7406 does not work like I believe it
> > > > should but instead makes the test fail:
> > > > ---8<-
> > > > diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
> > > > index a4ffea0..9766b9e 100755
> > > > --- a/t/t7406-submodule-update.sh
> > > > +++ b/t/t7406-submodule-update.sh
> > > > @@ -559,7 +559,9 @@ test_expect_success 'add different submodules to 
> > > > the same pa
> > > >  test_expect_success 'submodule add places git-dir in superprojects 
> > > > git-dir' '
> > > > (cd super &&
> > > >  mkdir deeper &&
> > > > -git submodule add ../submodule deeper/submodule &&
> > > > +(cd deeper &&
> > > > + git submodule add ../../submodule submodule
> > > > +) &&
> > > >  (cd deeper/submodule &&
> > > >   git log > ../../expected
> > > >  ) &&
> > > > ---8<-
> > > 
> > > Ah, ok.  I think this case is problematic because the repository
> > > argument is either relative to "remote.origin.url" or to the top of the
> > > working tree if there is no "origin" remote.  I wonder if we should just
> > > die when a relative path is given for the repository and we're not at
> > > the top of the working tree.
> > 
> > Why not behave as if we are at the top of the working tree for relative
> > paths? If there is an origin remote thats fine. If there is no origin
> > remote you could warn that the path used is taken relative from the root
> > of the superproject during add. What do you think?
> 
> That's what the patch currently queued on "pu" does, which Jens wants to
> change, isn't it?

True I did not realize this when reading it the first time. But I think
we should still not die when in a subdirectory. After all this series is
trying to archive that the submodule command works in subdirectories
seamlessly right? So you probably want to translate a relative path
without "origin" remote given from a subdirectory to the superproject
level and use that. Then you do not have to die.

Cheers Heiko
--
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


Re: SNI (SSL virtual hosts)

2013-06-04 Thread Daniel Stenberg

On Tue, 4 Jun 2013, Janusz Harkot wrote:


Which libcurl version and SSL backend is this? (curl -V usually tells)

$ curl -V
curl 7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r 
zlib/1.2.5


From what I can tell, that OpenSSL version supports SNI fine and libcurl has 

supported it since 7.18.1.


here is a log (with GIT_CURL_VERBOSE=1)

https://gist.github.com/anonymous/8f6533a755ae5c710c75

Initial connection is correct (line 10 - shows that it reads correct 
certificate), but then subsequent call to the server (line 68) shows that 
the defat server certificate is used.


It looks like the second call was without hostname (?).


What makes you suggest that's what's happening? Sure, if it would've sent no 
or the wrong host name it would probably have that effect.


Any chance you can snoop on the network and the SSL handshake to see who's to 
blame? I can't but to think that is is a very common use case!


--

 / daniel.haxx.se
--
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 00/15] Towards a more awesome git-branch

2013-06-04 Thread Ramkumar Ramachandra
Hi,

Duy and I have been working on this topic for some time now.  Here's a
review candidate.  Duy did most of the chunky work, and I mostly
did review/documentation.  The key patches are:

[5/15]  is a brilliant patch that made this entire thing possible.
[10/15] is another brilliant patch to auto-calculate widths.

Duy is currently writing code to factor out -v[v] and adding --sort,
--count to git-branch, but I'm having a lot of difficulty working with
a series of this size.  I'm leaning towards getting this merged before
tackling branch (who wants to review a 40-part series?).  Especially
after [14/15] and [15/15], git for-each-ref should be usable in its
own right.  I currently have:

[pretty]
hot = %C(red)%(HEAD)%C(reset) 
%C(green)%(refname:short)%C(reset)%(upstream:trackshort)
[alias]
hot = for-each-ref --pretty=hot --count 10 --sort='-committerdate' refs/heads

Which is really useful and manageable until we port these options to
branch and get nice configuration variables.

Nguyễn Thái Ngọc Duy (8):
  for-each-ref, quote: convert *_quote_print -> *_quote_buf
  for-each-ref: don't print out elements directly
  pretty: extend pretty_print_context with callback
  pretty: allow passing NULL commit to format_commit_message()
  for-each-ref: get --pretty using format_commit_message
  for-each-ref: teach verify_format() about pretty's syntax
  for-each-ref: introduce format specifier %>(*) and %<(*)
  for-each-ref: improve responsiveness of %(upstream:track)

Ramkumar Ramachandra (7):
  tar-tree: remove dependency on sq_quote_print()
  quote: remove sq_quote_print()
  pretty: limit recursion in format_commit_one()
  for-each-ref: introduce %(HEAD) marker
  for-each-ref: introduce %(upstream:track[short])
  pretty: introduce get_pretty_userformat
  for-each-ref: use get_pretty_userformat in --pretty

 Documentation/git-for-each-ref.txt |  42 +-
 builtin/for-each-ref.c | 274 ++---
 builtin/tar-tree.c |  11 +-
 commit.h   |   9 ++
 pretty.c   |  77 ++-
 quote.c|  61 +++--
 quote.h|   8 +-
 7 files changed, 372 insertions(+), 110 deletions(-)

-- 
1.8.3.GIT

--
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 01/15] for-each-ref, quote: convert *_quote_print -> *_quote_buf

2013-06-04 Thread Ramkumar Ramachandra
From: Nguyễn Thái Ngọc Duy 

for-each-ref.c:print_value() currently prints values to stdout
immediately using {sq|perl|python|tcl}_quote_print, giving us no
opportunity to do any further processing.  In preparation for getting
print_value() to accept an additional strbuf argument to write to,
convert the *_quote_print functions and callers to *_quote_buf.

[rr: commit message, minor modifications]

Signed-off-by: Ramkumar Ramachandra 
---
 builtin/for-each-ref.c | 13 +
 quote.c| 44 ++--
 quote.h|  6 +++---
 3 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 7f059c3..1d4083c 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -867,24 +867,29 @@ static void sort_refs(struct ref_sort *sort, struct 
refinfo **refs, int num_refs
 static void print_value(struct refinfo *ref, int atom, int quote_style)
 {
struct atom_value *v;
+   struct strbuf sb = STRBUF_INIT;
get_value(ref, atom, &v);
switch (quote_style) {
case QUOTE_NONE:
fputs(v->s, stdout);
break;
case QUOTE_SHELL:
-   sq_quote_print(stdout, v->s);
+   sq_quote_buf(&sb, v->s);
break;
case QUOTE_PERL:
-   perl_quote_print(stdout, v->s);
+   perl_quote_buf(&sb, v->s);
break;
case QUOTE_PYTHON:
-   python_quote_print(stdout, v->s);
+   python_quote_buf(&sb, v->s);
break;
case QUOTE_TCL:
-   tcl_quote_print(stdout, v->s);
+   tcl_quote_buf(&sb, v->s);
break;
}
+   if (quote_style != QUOTE_NONE) {
+   fputs(sb.buf, stdout);
+   strbuf_release(&sb);
+   }
 }
 
 static int hex1(char ch)
diff --git a/quote.c b/quote.c
index 911229f..8c294df 100644
--- a/quote.c
+++ b/quote.c
@@ -463,72 +463,72 @@ int unquote_c_style(struct strbuf *sb, const char 
*quoted, const char **endp)
 
 /* quoting as a string literal for other languages */
 
-void perl_quote_print(FILE *stream, const char *src)
+void perl_quote_buf(struct strbuf *sb, const char *src)
 {
const char sq = '\'';
const char bq = '\\';
char c;
 
-   fputc(sq, stream);
+   strbuf_addch(sb, sq);
while ((c = *src++)) {
if (c == sq || c == bq)
-   fputc(bq, stream);
-   fputc(c, stream);
+   strbuf_addch(sb, bq);
+   strbuf_addch(sb, c);
}
-   fputc(sq, stream);
+   strbuf_addch(sb, sq);
 }
 
-void python_quote_print(FILE *stream, const char *src)
+void python_quote_buf(struct strbuf *sb, const char *src)
 {
const char sq = '\'';
const char bq = '\\';
const char nl = '\n';
char c;
 
-   fputc(sq, stream);
+   strbuf_addch(sb, sq);
while ((c = *src++)) {
if (c == nl) {
-   fputc(bq, stream);
-   fputc('n', stream);
+   strbuf_addch(sb, bq);
+   strbuf_addch(sb, 'n');
continue;
}
if (c == sq || c == bq)
-   fputc(bq, stream);
-   fputc(c, stream);
+   strbuf_addch(sb, bq);
+   strbuf_addch(sb, c);
}
-   fputc(sq, stream);
+   strbuf_addch(sb, sq);
 }
 
-void tcl_quote_print(FILE *stream, const char *src)
+void tcl_quote_buf(struct strbuf *sb, const char *src)
 {
char c;
 
-   fputc('"', stream);
+   strbuf_addch(sb, '"');
while ((c = *src++)) {
switch (c) {
case '[': case ']':
case '{': case '}':
case '$': case '\\': case '"':
-   fputc('\\', stream);
+   strbuf_addch(sb, '\\');
default:
-   fputc(c, stream);
+   strbuf_addch(sb, c);
break;
case '\f':
-   fputs("\\f", stream);
+   strbuf_addstr(sb, "\\f");
break;
case '\r':
-   fputs("\\r", stream);
+   strbuf_addstr(sb, "\\r");
break;
case '\n':
-   fputs("\\n", stream);
+   strbuf_addstr(sb, "\\n");
break;
case '\t':
-   fputs("\\t", stream);
+   strbuf_addstr(sb, "\\t");
break;
case '\v':
-   fputs("\\v", stream);
+   strbuf_addstr(sb, "\\v");
break;
}
}
-   fputc('"', stream

[PATCH 09/15] for-each-ref: teach verify_format() about pretty's syntax

2013-06-04 Thread Ramkumar Ramachandra
From: Nguyễn Thái Ngọc Duy 

Pretty format accepts either ' ', '+' or '-' after '%' and before the
placeholder name to modify certain behaviors. Teach verify_format()
about this so that it finds atom "upstream" in, for example,
'% (upstream)'. This is important because verify_format populates
used_atom, which get_value() and populate_value() later rely on.

Signed-off-by: Ramkumar Ramachandra 
---
 builtin/for-each-ref.c | 15 +--
 pretty.c   |  4 
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 576a882..f8a3880 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -150,7 +150,7 @@ static int parse_atom(const char *atom, const char *ep)
 /*
  * In a format string, find the next occurrence of %(atom).
  */
-static const char *find_next(const char *cp)
+static const char *find_next(const char *cp, int pretty)
 {
while (*cp) {
if (*cp == '%') {
@@ -160,6 +160,9 @@ static const char *find_next(const char *cp)
 */
if (cp[1] == '(')
return cp;
+   else if (pretty && cp[1] && cp[2] == '(' &&
+strchr(" +-", cp[1])) /* see 
format_commit_item() */
+   return cp + 1;
else if (cp[1] == '%')
cp++; /* skip over two % */
/* otherwise this is a singleton, literal % */
@@ -173,10 +176,10 @@ static const char *find_next(const char *cp)
  * Make sure the format string is well formed, and parse out
  * the used atoms.
  */
-static int verify_format(const char *format)
+static int verify_format(const char *format, int pretty)
 {
const char *cp, *sp;
-   for (cp = format; *cp && (sp = find_next(cp)); ) {
+   for (cp = format; *cp && (sp = find_next(cp, pretty)); ) {
const char *ep = strchr(sp, ')');
if (!ep)
return error("malformed format string %s", sp);
@@ -935,7 +938,7 @@ static void show_ref(struct strbuf *sb, struct refinfo 
*info,
 {
const char *cp, *sp, *ep;
 
-   for (cp = format; *cp && (sp = find_next(cp)); cp = ep + 1) {
+   for (cp = format; *cp && (sp = find_next(cp, 0)); cp = ep + 1) {
ep = strchr(sp, ')');
if (cp < sp)
emit(sb, cp, sp);
@@ -1093,8 +1096,8 @@ int cmd_for_each_ref(int argc, const char **argv, const 
char *prefix)
}
if (format != default_format && pretty)
die("--format and --pretty cannot be used together");
-   if ((pretty && verify_format(pretty)) ||
-   (!pretty && verify_format(format)))
+   if ((pretty && verify_format(pretty, 1)) ||
+   (!pretty && verify_format(format, 0)))
usage_with_options(for_each_ref_usage, opts);
 
if (!sort)
diff --git a/pretty.c b/pretty.c
index 816aa32..28c0a72 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1439,6 +1439,10 @@ static size_t format_commit_item(struct strbuf *sb, /* 
in UTF-8 */
ADD_SP_BEFORE_NON_EMPTY
} magic = NO_MAGIC;
 
+   /*
+* Note: any modification in what placeholder[0] contains
+* should be redone in builtin/for-each-ref.c:find_next().
+*/
switch (placeholder[0]) {
case '-':
magic = DEL_LF_BEFORE_EMPTY;
-- 
1.8.3.GIT

--
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 06/15] pretty: limit recursion in format_commit_one()

2013-06-04 Thread Ramkumar Ramachandra
To make sure that a pretty_ctx->format substitution doesn't result in an
infinite recursion, change the prototype of format_commit_one() to
accept one last argument: no_recurse.  So, a single substitution by
format() must yield a result that can be parsed by format_commit_one()
without the help of format().

Signed-off-by: Ramkumar Ramachandra 
---
 pretty.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/pretty.c b/pretty.c
index 095e5ba..0063f2d 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1061,7 +1061,8 @@ static size_t parse_padding_placeholder(struct strbuf *sb,
 
 static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
const char *placeholder,
-   void *context)
+   void *context,
+   int no_recurse)
 {
struct format_commit_context *c = context;
const struct commit *commit = c->commit;
@@ -1069,7 +1070,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in 
UTF-8 */
struct commit_list *p;
int h1, h2;
 
-   if (c->pretty_ctx->format) {
+   if (!no_recurse && c->pretty_ctx->format) {
struct strbuf subst = STRBUF_INIT;
int ret = c->pretty_ctx->format(sb, placeholder, context,
c->pretty_ctx->user_data,
@@ -1083,7 +1084,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in 
UTF-8 */
 * ret: the length of the original string
 * before substitution.
 */
-   ret = format_commit_one(sb, subst.buf, context) ? ret : 
0;
+   ret = format_commit_one(sb, subst.buf, context, 1) ? 
ret : 0;
strbuf_release(&subst);
return ret;
} else if (ret)
@@ -1332,7 +1333,7 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* 
in UTF-8 */
}
while (1) {
int modifier = *placeholder == 'C';
-   int consumed = format_commit_one(&local_sb, placeholder, c);
+   int consumed = format_commit_one(&local_sb, placeholder, c, 0);
total_consumed += consumed;
 
if (!modifier)
@@ -1452,7 +1453,7 @@ static size_t format_commit_item(struct strbuf *sb, /* in 
UTF-8 */
if (((struct format_commit_context *)context)->flush_type != no_flush)
consumed = format_and_pad_commit(sb, placeholder, context);
else
-   consumed = format_commit_one(sb, placeholder, context);
+   consumed = format_commit_one(sb, placeholder, context, 0);
if (magic == NO_MAGIC)
return consumed;
 
-- 
1.8.3.GIT

--
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 07/15] pretty: allow passing NULL commit to format_commit_message()

2013-06-04 Thread Ramkumar Ramachandra
From: Nguyễn Thái Ngọc Duy 

The new formatter, for-each-ref, may use non-commit placeholders only.
While it could audit the format line and warn/exclude commit
placeholders, that's a lot more work than simply ignore them.
Unrecognized placeholders are displayed as-is, pretty obvious that they
are not handled.

Signed-off-by: Ramkumar Ramachandra 
---
 pretty.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/pretty.c b/pretty.c
index 0063f2d..816aa32 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1156,6 +1156,9 @@ static size_t format_commit_one(struct strbuf *sb, /* in 
UTF-8 */
}
 
/* these depend on the commit */
+   if (!commit)
+   return 0;
+
if (!commit->object.parsed)
parse_object(commit->object.sha1);
 
@@ -1276,6 +1279,9 @@ static size_t format_commit_one(struct strbuf *sb, /* in 
UTF-8 */
}
 
 
+   if (!c->message)
+   return 0;
+
/* For the rest we have to parse the commit header. */
if (!c->commit_header_parsed)
parse_commit_header(c);
@@ -1510,9 +1516,10 @@ void format_commit_message(const struct commit *commit,
context.commit = commit;
context.pretty_ctx = pretty_ctx;
context.wrap_start = sb->len;
-   context.message = logmsg_reencode(commit,
- &context.commit_encoding,
- output_enc);
+   if (commit)
+   context.message = logmsg_reencode(commit,
+ &context.commit_encoding,
+ output_enc);
 
strbuf_expand(sb, format, format_commit_item, &context);
rewrap_message_tail(sb, &context, 0, 0, 0);
@@ -1535,7 +1542,8 @@ void format_commit_message(const struct commit *commit,
}
 
free(context.commit_encoding);
-   logmsg_free(context.message, commit);
+   if (commit)
+   logmsg_free(context.message, commit);
free(context.signature_check.gpg_output);
free(context.signature_check.signer);
 }
-- 
1.8.3.GIT

--
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 15/15] for-each-ref: use get_pretty_userformat in --pretty

2013-06-04 Thread Ramkumar Ramachandra
Use get_pretty_userformat() to interpret the --pretty string.  This
means that leading you can now reference a format specified in a pretty.*
configuration variable as an argument to 'git for-each-ref --pretty='.
There are two caveats:

1. A leading "format:" or "tformat:" is automatically stripped and
   ignored.  Separator semantics are not configurable (yet).

2. No built-in formats are available.  The ones specified in
   pretty-formats (oneline, short etc) don't make sense when displaying
   refs anyway.

Signed-off-by: Ramkumar Ramachandra 
---
 Documentation/git-for-each-ref.txt |  3 +++
 builtin/for-each-ref.c | 16 +---
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/Documentation/git-for-each-ref.txt 
b/Documentation/git-for-each-ref.txt
index 05ff7ba..7f3cba5 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -60,6 +60,9 @@ calculated.
 +
 Caveats:
 
+0. No built-in formats from PRETTY FORMATS (like oneline, short) are
+   available.
+
 1. Many of the placeholders in "PRETTY FORMATS" are designed to work
specifically on commit objects: when non-commit objects are
supplied, those placeholders won't work.
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index edaa6b2..c00ab05 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -1146,7 +1146,7 @@ int cmd_for_each_ref(int argc, const char **argv, const 
char *prefix)
int num_refs;
const char *default_format = "%(objectname) %(objecttype)\t%(refname)";
const char *format = default_format;
-   const char *pretty = NULL;
+   const char *pretty_raw = NULL, *pretty_userformat = NULL;
struct ref_sort *sort = NULL, **sort_tail = &sort;
int maxcount = 0, quote_style = 0;
struct refinfo **refs;
@@ -1165,13 +1165,15 @@ int cmd_for_each_ref(int argc, const char **argv, const 
char *prefix)
OPT_GROUP(""),
OPT_INTEGER( 0 , "count", &maxcount, N_("show only  matched 
refs")),
OPT_STRING(  0 , "format", &format, N_("format"), N_("format to 
use for the output")),
-   OPT_STRING(  0 , "pretty", &pretty, N_("format"), 
N_("alternative format to use for the output")),
+   OPT_STRING(  0 , "pretty", &pretty_raw, N_("format"), 
N_("alternative format to use for the output")),
OPT_CALLBACK(0 , "sort", sort_tail, N_("key"),
N_("field name to sort on"), &opt_parse_sort),
OPT_END(),
};
 
parse_options(argc, argv, prefix, opts, for_each_ref_usage, 0);
+   if (pretty_raw)
+   pretty_userformat = get_pretty_userformat(pretty_raw);
if (maxcount < 0) {
error("invalid --count argument: `%d'", maxcount);
usage_with_options(for_each_ref_usage, opts);
@@ -1180,10 +1182,10 @@ int cmd_for_each_ref(int argc, const char **argv, const 
char *prefix)
error("more than one quoting style?");
usage_with_options(for_each_ref_usage, opts);
}
-   if (format != default_format && pretty)
+   if (format != default_format && pretty_userformat)
die("--format and --pretty cannot be used together");
-   if ((pretty && verify_format(pretty, 1)) ||
-   (!pretty && verify_format(format, 0)))
+   if ((pretty_userformat && verify_format(pretty_userformat, 1)) ||
+   (!pretty_userformat && verify_format(format, 0)))
usage_with_options(for_each_ref_usage, opts);
 
if (!sort)
@@ -1204,8 +1206,8 @@ int cmd_for_each_ref(int argc, const char **argv, const 
char *prefix)
if (!maxcount || num_refs < maxcount)
maxcount = num_refs;
 
-   if (pretty)
-   show_pretty_refs(refs, maxcount, pretty, quote_style);
+   if (pretty_userformat)
+   show_pretty_refs(refs, maxcount, pretty_userformat, 
quote_style);
else
show_refs(refs, maxcount, format, quote_style);
return 0;
-- 
1.8.3.GIT

--
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 03/15] tar-tree: remove dependency on sq_quote_print()

2013-06-04 Thread Ramkumar Ramachandra
Currently, there is exactly one caller of sq_quote_print(), namely
cmd_tar_tree().  In the interest of removing sq_quote_print() and
simplification, replace it with an equivalent call to sq_quote_argv().
No functional changes intended.

Signed-off-by: Ramkumar Ramachandra 
---
 builtin/tar-tree.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/builtin/tar-tree.c b/builtin/tar-tree.c
index 3f1e701..ba3ffe6 100644
--- a/builtin/tar-tree.c
+++ b/builtin/tar-tree.c
@@ -26,8 +26,8 @@ int cmd_tar_tree(int argc, const char **argv, const char 
*prefix)
 * $0 tree-ish basedir ==>
 *  git archive --format-tar --prefix=basedir tree-ish
 */
-   int i;
const char **nargv = xcalloc(sizeof(*nargv), argc + 3);
+   struct strbuf sb = STRBUF_INIT;
char *basedir_arg;
int nargc = 0;
 
@@ -65,11 +65,10 @@ int cmd_tar_tree(int argc, const char **argv, const char 
*prefix)
fprintf(stderr,
"*** \"git tar-tree\" is now deprecated.\n"
"*** Running \"git archive\" instead.\n***");
-   for (i = 0; i < nargc; i++) {
-   fputc(' ', stderr);
-   sq_quote_print(stderr, nargv[i]);
-   }
-   fputc('\n', stderr);
+   sq_quote_argv(&sb, nargv, 0);
+   strbuf_addch(&sb, '\n');
+   fputs(sb.buf, stderr);
+   strbuf_release(&sb);
return cmd_archive(nargc, nargv, prefix);
 }
 
-- 
1.8.3.GIT

--
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 14/15] pretty: introduce get_pretty_userformat

2013-06-04 Thread Ramkumar Ramachandra
This helper function is intended to be used by callers implementing
--pretty themselves; it parses pretty.* configuration variables
recursively and hands the user-defined format back to the caller.  No
builtins are supported, as CMT_FMT_* are really only useful when
displaying commits.  Callers might like to define their own builtins in
the future.

Signed-off-by: Ramkumar Ramachandra 
---
 commit.h |  1 +
 pretty.c | 25 +
 2 files changed, 26 insertions(+)

diff --git a/commit.h b/commit.h
index 04bd935..48424c9 100644
--- a/commit.h
+++ b/commit.h
@@ -113,6 +113,7 @@ extern char *logmsg_reencode(const struct commit *commit,
 const char *output_encoding);
 extern void logmsg_free(char *msg, const struct commit *commit);
 extern void get_commit_format(const char *arg, struct rev_info *);
+extern const char *get_pretty_userformat(const char *arg);
 extern const char *format_subject(struct strbuf *sb, const char *msg,
  const char *line_separator);
 extern void userformat_find_requirements(const char *fmt, struct 
userformat_want *w);
diff --git a/pretty.c b/pretty.c
index 28c0a72..70e4e44 100644
--- a/pretty.c
+++ b/pretty.c
@@ -174,6 +174,31 @@ void get_commit_format(const char *arg, struct rev_info 
*rev)
 }
 
 /*
+ * Function to parse --pretty string, lookup pretty.* configuration
+ * variables and return the format string, assuming no builtin
+ * formats.  Not limited to commits, unlike get_commit_format().
+ */
+const char *get_pretty_userformat(const char *arg)
+{
+   struct cmt_fmt_map *commit_format;
+
+   if (!arg || !*arg)
+   return NULL;
+
+   if (!prefixcmp(arg, "format:") || !prefixcmp(arg, "tformat:"))
+   return xstrdup(strchr(arg, ':' + 1));
+
+   if (strchr(arg, '%'))
+   return xstrdup(arg);
+
+   commit_format = find_commit_format(arg);
+   if (!commit_format || commit_format->format != CMIT_FMT_USERFORMAT)
+   die("invalid --pretty format: %s", arg);
+
+   return xstrdup(commit_format->user_format);
+}
+
+/*
  * Generic support for pretty-printing the header
  */
 static int get_one_line(const char *msg)
-- 
1.8.3.GIT

--
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 04/15] quote: remove sq_quote_print()

2013-06-04 Thread Ramkumar Ramachandra
Remove sq_quote_print() since it has no callers.  A nicer alternative
sq_quote_buf() exists: its callers aren't forced to print immediately.

For historical context, sq_quote_print() was first introduced in
575ba9d6 (GIT_TRACE: show which built-in/external commands are executed,
2006-06-25) for the purpose of printing argv for $GIT_TRACE.  Today, we
achieve this using trace_argv_printf() -> sq_quote_argv() ->
sq_quote_buf(), which ultimately fills in a strbuf.

Signed-off-by: Ramkumar Ramachandra 
---
 quote.c | 17 -
 quote.h |  2 --
 2 files changed, 19 deletions(-)

diff --git a/quote.c b/quote.c
index 8c294df..778b39a 100644
--- a/quote.c
+++ b/quote.c
@@ -42,23 +42,6 @@ void sq_quote_buf(struct strbuf *dst, const char *src)
free(to_free);
 }
 
-void sq_quote_print(FILE *stream, const char *src)
-{
-   char c;
-
-   fputc('\'', stream);
-   while ((c = *src++)) {
-   if (need_bs_quote(c)) {
-   fputs("'\\", stream);
-   fputc(c, stream);
-   fputc('\'', stream);
-   } else {
-   fputc(c, stream);
-   }
-   }
-   fputc('\'', stream);
-}
-
 void sq_quote_argv(struct strbuf *dst, const char** argv, size_t maxlen)
 {
int i;
diff --git a/quote.h b/quote.h
index ed06df5..251f3cc 100644
--- a/quote.h
+++ b/quote.h
@@ -27,8 +27,6 @@ struct strbuf;
  * excluding the final null regardless of the buffer size.
  */
 
-extern void sq_quote_print(FILE *stream, const char *src);
-
 extern void sq_quote_buf(struct strbuf *, const char *src);
 extern void sq_quote_argv(struct strbuf *, const char **argv, size_t maxlen);
 
-- 
1.8.3.GIT

--
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 12/15] for-each-ref: introduce %(upstream:track[short])

2013-06-04 Thread Ramkumar Ramachandra
Introduce %(upstream:track) to display "[ahead M, behind N]" and
%(upstream:trackshort) to display "=", ">", "<", or "<>"
appropriately (inspired by the contrib/completion/git-prompt.sh).

Now you can use the following format in for-each-ref:

  %C(green)%(refname:short)%C(reset)%(upstream:trackshort)

to display refs with terse tracking information.

Note that :track and :trackshort only works with upstream, and errors
out when used with anything else.

Signed-off-by: Ramkumar Ramachandra 
---
 Documentation/git-for-each-ref.txt |  6 +-
 builtin/for-each-ref.c | 42 --
 2 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-for-each-ref.txt 
b/Documentation/git-for-each-ref.txt
index d529296..05ff7ba 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -118,7 +118,11 @@ objectname::
 upstream::
The name of a local ref which can be considered ``upstream''
from the displayed ref. Respects `:short` in the same way as
-   `refname` above.
+   `refname` above.  Additionally respects `:track` to show
+   "[ahead N, behind M]" and `:trackshort` to show the terse
+   version (like the prompt) ">", "<", "<>", or "=".  Has no
+   effect if the ref does not have tracking information
+   associated with it.
 
 HEAD::
Useful to indicate the currently checked out branch.  Is '*'
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index b0b8236..adc965e 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -628,6 +628,7 @@ static void populate_value(struct refinfo *ref)
int eaten, i;
unsigned long size;
const unsigned char *tagged;
+   int upstream_present = 0;
 
ref->value = xcalloc(sizeof(struct atom_value), used_atom_cnt);
 
@@ -645,6 +646,7 @@ static void populate_value(struct refinfo *ref)
int deref = 0;
const char *refname;
const char *formatp;
+   struct branch *branch;
 
if (*name == '*') {
deref = 1;
@@ -656,7 +658,6 @@ static void populate_value(struct refinfo *ref)
else if (!prefixcmp(name, "symref"))
refname = ref->symref ? ref->symref : "";
else if (!prefixcmp(name, "upstream")) {
-   struct branch *branch;
/* only local branches may have an upstream */
if (prefixcmp(ref->refname, "refs/heads/"))
continue;
@@ -666,6 +667,7 @@ static void populate_value(struct refinfo *ref)
!branch->merge[0]->dst)
continue;
refname = branch->merge[0]->dst;
+   upstream_present = 1;
}
else if (!strcmp(name, "flag")) {
char buf[256], *cp = buf;
@@ -683,6 +685,7 @@ static void populate_value(struct refinfo *ref)
} else if (!strcmp(name, "HEAD")) {
const char *head;
unsigned char sha1[20];
+
head = resolve_ref_unsafe("HEAD", sha1, 1, NULL);
if (!strcmp(ref->refname, head))
v->s = "*";
@@ -695,11 +698,46 @@ static void populate_value(struct refinfo *ref)
formatp = strchr(name, ':');
/* look for "short" refname format */
if (formatp) {
+   int num_ours, num_theirs;
+
formatp++;
if (!strcmp(formatp, "short"))
refname = shorten_unambiguous_ref(refname,
  warn_ambiguous_refs);
-   else
+   else if (!strcmp(formatp, "track") &&
+   !prefixcmp(name, "upstream")) {
+   char buf[40];
+
+   if (!upstream_present)
+   continue;
+   if (!stat_tracking_info(branch, &num_ours, 
&num_theirs))
+   v->s = "";
+   else if (!num_ours) {
+   sprintf(buf, "[behind %d]", num_theirs);
+   v->s = xstrdup(buf);
+   } else if (!num_theirs) {
+   sprintf(buf, "[ahead %d]", num_ours);
+   v->s = xstrdup(buf);
+   } else {
+   sprintf(buf, "[ahead %d, behind %d]",
+   num_ours, num_theirs);
+   v->s = xstrdup(buf);
+   

[PATCH 08/15] for-each-ref: get --pretty using format_commit_message

2013-06-04 Thread Ramkumar Ramachandra
From: Nguyễn Thái Ngọc Duy 

--format is very limited in its capabilities.  Introduce --pretty, which
extends the existing --format with pretty-formats.  In --pretty:

 - Existing --format %(atom) is available. They also accept some pretty
   magic.  For example, you can use "% (atom)" to only display a leading
   space if the atom produces something.

 - %ab to display a hex character 0xab is not available as it may
   conflict with other pretty's placeholders.  Use %xab instead.

 - Many pretty placeholders are designed to work on commits.  While some
   of them should work on tags too, they don't (yet).

 - Unsupported atoms cause for-each-ref to exit early and report.
   Unsupported pretty placeholders are displayed as-is.

 - Pretty placeholders can not be used as a sorting criteria.

--format is considered deprecated. If the user hits a bug specific in
--format code, they are advised to migrate to --pretty.

[rr: documentation]

Signed-off-by: Ramkumar Ramachandra 
---
 Documentation/git-for-each-ref.txt | 22 -
 builtin/for-each-ref.c | 67 --
 2 files changed, 85 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-for-each-ref.txt 
b/Documentation/git-for-each-ref.txt
index f2e08d1..6135812 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -9,7 +9,8 @@ SYNOPSIS
 
 [verse]
 'git for-each-ref' [--count=] [--shell|--perl|--python|--tcl]
-  [(--sort=)...] [--format=] [...]
+  [(--sort=)...] [--format=|--pretty=]
+  [...]
 
 DESCRIPTION
 ---
@@ -47,6 +48,25 @@ OPTIONS
`xx`; for example `%00` interpolates to `\0` (NUL),
`%09` to `\t` (TAB) and `%0a` to `\n` (LF).
 
+::
+   A format string with supporting placeholders described in the
+   "PRETTY FORMATS" section in linkgit:git-log[1].  Additionally
+   supports placeholders from ``
+   (i.e. `%[*](fieldname)`).
++
+Caveats:
+
+1. Many of the placeholders in "PRETTY FORMATS" are designed to work
+   specifically on commit objects: when non-commit objects are
+   supplied, those placeholders won't work.
+
+2. Does not interpolate `%ab` (where `ab` are hex digits) with the
+   corresponding hex code.  To print a byte from a hex code, use
+   `%xab` (from pretty-formats) instead.
+
+3. Only the placeholders inherited from `` will respect
+   quoting settings.
+
 ...::
If one or more patterns are given, only refs are shown that
match against at least one pattern, either using fnmatch(3) or
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index e2d6c5a..576a882 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -962,6 +962,58 @@ static void show_refs(struct refinfo **refs, int maxcount,
strbuf_release(&sb);
 }
 
+struct format_one_atom_context {
+   struct refinfo *info;
+   int quote_style;
+};
+
+static size_t format_one_atom(struct strbuf *sb, const char *placeholder,
+ void *format_context, void *user_data,
+ struct strbuf *subst)
+{
+   struct format_one_atom_context *ctx = user_data;
+   const char *ep;
+
+   if (*placeholder == '%') {
+   strbuf_addch(sb, '%');
+   return 1;
+   }
+
+   if (*placeholder != '(')
+   return 0;
+
+   ep = strchr(placeholder + 1, ')');
+   if (!ep)
+   return 0;
+   print_value(sb, ctx->info, parse_atom(placeholder + 1, ep),
+   ctx->quote_style);
+   return ep + 1 - placeholder;
+}
+
+static void show_pretty_refs(struct refinfo **refs, int maxcount,
+const char *format, int quote_style)
+{
+   struct pretty_print_context ctx = {0};
+   struct format_one_atom_context fctx;
+   struct strbuf sb = STRBUF_INIT;
+   int i;
+
+   ctx.format = format_one_atom;
+   ctx.user_data = &fctx;
+   fctx.quote_style = quote_style;
+   for (i = 0; i < maxcount; i++) {
+   struct commit *commit = NULL;
+   fctx.info = refs[i];
+   if (sha1_object_info(refs[i]->objectname, NULL) == OBJ_COMMIT)
+   commit = lookup_commit(refs[i]->objectname);
+   strbuf_reset(&sb);
+   format_commit_message(commit, format, &sb, &ctx);
+   strbuf_addch(&sb, '\n');
+   fputs(sb.buf, stdout);
+   }
+   strbuf_release(&sb);
+}
+
 static struct ref_sort *default_sort(void)
 {
static const char cstr_name[] = "refname";
@@ -1003,7 +1055,9 @@ static char const * const for_each_ref_usage[] = {
 int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
 {
int num_refs;
-   const char *format = "%(objectname) %(objecttype)\t%(refname)";
+   const char *default_format = "%(objectname) %(objecttype)\t%(refname)";
+   const char *format = default_for

[PATCH 13/15] for-each-ref: improve responsiveness of %(upstream:track)

2013-06-04 Thread Ramkumar Ramachandra
From: Nguyễn Thái Ngọc Duy 

Before anything is printed, for-each-ref sorts all refs first.  As
part of the sorting, populate_value() is called to fill the values in
for all atoms/placeholders per entry. By the time sort_refs() is done,
pretty much all data is already retrieved.

This works fine when data can be cheaply retrieved before
%(upstream:track) comes into the picture. It may take a noticeable
amount of time to process %(upstream:track) for each entry. All
entries add up and make --format='%(refname)%(upstream:track)' seem
hung for a few seconds, then display everything at once.

Improve the responsiveness by only processing the one atom (*) at a
time so that processing one atom for all entries (e.g. sorting) won't
cause much delay (unless you choose a "heavy" atom to process).

(*) This is not entirely correct. If you sort by an atom that needs
object database access, then it will fill all atoms that need odb.
Which is not a bad thing. We don't want to access odb once at sorting
phase and again at display phase.

Signed-off-by: Ramkumar Ramachandra 
---
 builtin/for-each-ref.c | 49 +
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index adc965e..edaa6b2 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -565,20 +565,6 @@ static void grab_sub_body_contents(struct atom_value *val, 
int deref, struct obj
 }
 
 /*
- * We want to have empty print-string for field requests
- * that do not apply (e.g. "authordate" for a tag object)
- */
-static void fill_missing_values(struct atom_value *val)
-{
-   int i;
-   for (i = 0; i < used_atom_cnt; i++) {
-   struct atom_value *v = &val[i];
-   if (v->s == NULL)
-   v->s = "";
-   }
-}
-
-/*
  * val is a list of atom_value to hold returned values.  Extract
  * the values for atoms in used_atom array out of (obj, buf, sz).
  * when deref is false, (obj, buf, sz) is the object that is
@@ -621,7 +607,7 @@ static inline char *copy_advance(char *dst, const char *src)
 /*
  * Parse the object referred by ref, and grab needed value.
  */
-static void populate_value(struct refinfo *ref)
+static void populate_value(struct refinfo *ref, int only_this_atom)
 {
void *buf;
struct object *obj;
@@ -630,13 +616,15 @@ static void populate_value(struct refinfo *ref)
const unsigned char *tagged;
int upstream_present = 0;
 
-   ref->value = xcalloc(sizeof(struct atom_value), used_atom_cnt);
+   if (!ref->value) {
+   ref->value = xcalloc(sizeof(struct atom_value), used_atom_cnt);
 
-   if (need_symref && (ref->flag & REF_ISSYMREF) && !ref->symref) {
-   unsigned char unused1[20];
-   ref->symref = resolve_refdup(ref->refname, unused1, 1, NULL);
-   if (!ref->symref)
-   ref->symref = "";
+   if (need_symref && (ref->flag & REF_ISSYMREF) && !ref->symref) {
+   unsigned char unused1[20];
+   ref->symref = resolve_refdup(ref->refname, unused1, 1, 
NULL);
+   if (!ref->symref)
+   ref->symref = "";
+   }
}
 
/* Fill in specials first */
@@ -648,6 +636,9 @@ static void populate_value(struct refinfo *ref)
const char *formatp;
struct branch *branch;
 
+   if (only_this_atom != -1 && only_this_atom != i)
+   continue;
+
if (*name == '*') {
deref = 1;
name++;
@@ -754,6 +745,10 @@ static void populate_value(struct refinfo *ref)
 
for (i = 0; i < used_atom_cnt; i++) {
struct atom_value *v = &ref->value[i];
+
+   if (only_this_atom != -1 && only_this_atom != i)
+   continue;
+
if (v->s == NULL)
goto need_obj;
}
@@ -809,9 +804,15 @@ static void populate_value(struct refinfo *ref)
  */
 static void get_value(struct refinfo *ref, int atom, struct atom_value **v)
 {
-   if (!ref->value) {
-   populate_value(ref);
-   fill_missing_values(ref->value);
+   if (!ref->value || !ref->value[atom].s) {
+   populate_value(ref, atom);
+   /*
+* We want to have empty print-string for field
+* requests that do not apply (e.g. "authordate" for a
+* tag object)
+*/
+   if (!ref->value[atom].s)
+   ref->value[atom].s = "";
}
*v = &ref->value[atom];
 }
-- 
1.8.3.GIT

--
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 10/15] for-each-ref: introduce format specifier %>(*) and %<(*)

2013-06-04 Thread Ramkumar Ramachandra
From: Nguyễn Thái Ngọc Duy 

Pretty placeholders %>(N) and %<(N) require a user provided width N,
which makes sense because the commit chain could be really long and the
user only needs to look at a few at the top, going to the end just to
calculate the best width wastes CPU cycles.

for-each-ref is different; the display set is small, and we display them
all at once. We even support sorting, which goes through all display
items anyway.  This patch introduces new %>(*) and %<(*), which are
supposed to be followed immediately by %(fieldname) (i.e. original
for-each-ref specifiers, not ones coming from pretty.c). They calculate
the best width for the %(fieldname), ignoring ansi escape sequences if
any.

[rr: documentation]

Signed-off-by: Ramkumar Ramachandra 
---
 Documentation/git-for-each-ref.txt |  7 +++
 builtin/for-each-ref.c | 38 ++
 2 files changed, 45 insertions(+)

diff --git a/Documentation/git-for-each-ref.txt 
b/Documentation/git-for-each-ref.txt
index 6135812..7d6db7f 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -47,6 +47,10 @@ OPTIONS
are hex digits interpolates to character with hex code
`xx`; for example `%00` interpolates to `\0` (NUL),
`%09` to `\t` (TAB) and `%0a` to `\n` (LF).
++
+Placeholders `%<(*)` and `%>(*)` work like `%<()` and `%>()`
+respectively, except that the width of the next placeholder is
+calculated.
 
 ::
A format string with supporting placeholders described in the
@@ -67,6 +71,9 @@ Caveats:
 3. Only the placeholders inherited from `` will respect
quoting settings.
 
+3. Only the placeholders inherited from `` will work with the
+   alignment placeholders `%<(*)` and '%>(*)`.
+
 ...::
If one or more patterns are given, only refs are shown that
match against at least one pattern, either using fnmatch(3) or
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index f8a3880..053a622 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -9,6 +9,7 @@
 #include "quote.h"
 #include "parse-options.h"
 #include "remote.h"
+#include "utf8.h"
 
 /* Quoting styles */
 #define QUOTE_NONE 0
@@ -966,10 +967,30 @@ static void show_refs(struct refinfo **refs, int maxcount,
 }
 
 struct format_one_atom_context {
+   struct refinfo **refs;
+   int maxcount;
+
struct refinfo *info;
int quote_style;
 };
 
+static unsigned int get_atom_width(struct format_one_atom_context *ctx,
+  const char *start, const char *end)
+{
+   struct strbuf sb = STRBUF_INIT;
+   int i, atom = parse_atom(start, end);
+   unsigned int len = 0, sb_len;
+   for (i = 0; i < ctx->maxcount; i++) {
+   print_value(&sb, ctx->refs[i], atom, ctx->quote_style);
+   sb_len = utf8_strnwidth(sb.buf, sb.len, 1);
+   if (sb_len > len)
+   len = sb_len;
+   strbuf_reset(&sb);
+   }
+   strbuf_release(&sb);
+   return len;
+}
+
 static size_t format_one_atom(struct strbuf *sb, const char *placeholder,
  void *format_context, void *user_data,
  struct strbuf *subst)
@@ -982,6 +1003,21 @@ static size_t format_one_atom(struct strbuf *sb, const 
char *placeholder,
return 1;
}
 
+   /*
+* Substitute %>(*)%(atom) and friends with real width.
+*/
+   if (*placeholder == '>' || *placeholder == '<') {
+   const char *star = placeholder + 1;
+   if (!prefixcmp(star, "(*)%(") &&
+   ((ep = strchr(star + strlen("(*)%("), ')')) != NULL)) {
+   star++;
+   strbuf_addf(subst, "%c(%u)",
+   *placeholder,
+   get_atom_width(ctx, star + strlen("*)%("), 
ep));
+   return 1 + strlen("(*)");
+   }
+   }
+
if (*placeholder != '(')
return 0;
 
@@ -1003,6 +1039,8 @@ static void show_pretty_refs(struct refinfo **refs, int 
maxcount,
 
ctx.format = format_one_atom;
ctx.user_data = &fctx;
+   fctx.refs = refs;
+   fctx.maxcount = maxcount;
fctx.quote_style = quote_style;
for (i = 0; i < maxcount; i++) {
struct commit *commit = NULL;
-- 
1.8.3.GIT

--
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 02/15] for-each-ref: don't print out elements directly

2013-06-04 Thread Ramkumar Ramachandra
From: Nguyễn Thái Ngọc Duy 

Currently, the entire callchain starting from show_ref() parses and
prints immediately.  This inflexibility limits our ability to extend the
parser.  So, convert the entire callchain to accept a strbuf argument to
write to.  Also introduce a show_refs() helper that calls show_ref() in
a loop to avoid cluttering up cmd_for_each_ref() with the task of
initializing/freeing the strbuf.

[rr: commit message]

Signed-off-by: Ramkumar Ramachandra 
---
 builtin/for-each-ref.c | 55 --
 1 file changed, 35 insertions(+), 20 deletions(-)

diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 1d4083c..e2d6c5a 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -864,31 +864,31 @@ static void sort_refs(struct ref_sort *sort, struct 
refinfo **refs, int num_refs
qsort(refs, num_refs, sizeof(struct refinfo *), compare_refs);
 }
 
-static void print_value(struct refinfo *ref, int atom, int quote_style)
+static void print_value(struct strbuf *sb, struct refinfo *ref,
+   int atom, int quote_style)
 {
struct atom_value *v;
-   struct strbuf sb = STRBUF_INIT;
get_value(ref, atom, &v);
switch (quote_style) {
case QUOTE_NONE:
-   fputs(v->s, stdout);
+   strbuf_addstr(sb, v->s);
break;
case QUOTE_SHELL:
-   sq_quote_buf(&sb, v->s);
+   sq_quote_buf(sb, v->s);
break;
case QUOTE_PERL:
-   perl_quote_buf(&sb, v->s);
+   perl_quote_buf(sb, v->s);
break;
case QUOTE_PYTHON:
-   python_quote_buf(&sb, v->s);
+   python_quote_buf(sb, v->s);
break;
case QUOTE_TCL:
-   tcl_quote_buf(&sb, v->s);
+   tcl_quote_buf(sb, v->s);
break;
}
if (quote_style != QUOTE_NONE) {
-   fputs(sb.buf, stdout);
-   strbuf_release(&sb);
+   fputs(sb->buf, stdout);
+   strbuf_release(sb);
}
 }
 
@@ -910,7 +910,7 @@ static int hex2(const char *cp)
return -1;
 }
 
-static void emit(const char *cp, const char *ep)
+static void emit(struct strbuf *sb, const char *cp, const char *ep)
 {
while (*cp && (!ep || cp < ep)) {
if (*cp == '%') {
@@ -919,32 +919,47 @@ static void emit(const char *cp, const char *ep)
else {
int ch = hex2(cp + 1);
if (0 <= ch) {
-   putchar(ch);
+   strbuf_addch(sb, ch);
cp += 3;
continue;
}
}
}
-   putchar(*cp);
+   strbuf_addch(sb, *cp);
cp++;
}
 }
 
-static void show_ref(struct refinfo *info, const char *format, int quote_style)
+static void show_ref(struct strbuf *sb, struct refinfo *info,
+const char *format, int quote_style)
 {
const char *cp, *sp, *ep;
 
for (cp = format; *cp && (sp = find_next(cp)); cp = ep + 1) {
ep = strchr(sp, ')');
if (cp < sp)
-   emit(cp, sp);
-   print_value(info, parse_atom(sp + 2, ep), quote_style);
+   emit(sb, cp, sp);
+   print_value(sb, info, parse_atom(sp + 2, ep), quote_style);
}
if (*cp) {
sp = cp + strlen(cp);
-   emit(cp, sp);
+   emit(sb, cp, sp);
}
-   putchar('\n');
+   strbuf_addch(sb, '\n');
+}
+
+static void show_refs(struct refinfo **refs, int maxcount,
+ const char *format, int quote_style)
+{
+   struct strbuf sb = STRBUF_INIT;
+   int i;
+
+   for (i = 0; i < maxcount; i++) {
+   strbuf_reset(&sb);
+   show_ref(&sb, refs[i], format, quote_style);
+   fputs(sb.buf, stdout);
+   }
+   strbuf_release(&sb);
 }
 
 static struct ref_sort *default_sort(void)
@@ -987,7 +1002,7 @@ static char const * const for_each_ref_usage[] = {
 
 int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
 {
-   int i, num_refs;
+   int num_refs;
const char *format = "%(objectname) %(objecttype)\t%(refname)";
struct ref_sort *sort = NULL, **sort_tail = &sort;
int maxcount = 0, quote_style = 0;
@@ -1041,7 +1056,7 @@ int cmd_for_each_ref(int argc, const char **argv, const 
char *prefix)
 
if (!maxcount || num_refs < maxcount)
maxcount = num_refs;
-   for (i = 0; i < maxcount; i++)
-   show_ref(refs[i], format, quote_style);
+
+   show_refs(refs, maxcount, format, quote_style);
return 0;
 }
--

[PATCH 05/15] pretty: extend pretty_print_context with callback

2013-06-04 Thread Ramkumar Ramachandra
From: Nguyễn Thái Ngọc Duy 

The struct pretty_print_context contains the context in which the
placeholders in format_commit_one() should be parsed.  Although
format_commit_one() primarily acts as a parser, there is no way for a
caller to plug in custom callbacks.  Now, callers can:

1. Parse a custom placeholder that is not supported by
   format_commit_one(), and act on it independently of the pretty
   machinery.

2. Parse a custom placeholder to substitute the custom placeholder with
   a placeholder that format_commit_one() understands.  This is
   especially useful for supporting %>(*), where * is substituted with a
   length computed by the caller.

To support these two usecases, the interface for the function looks
like:

typedef size_t (*format_message_fn)(struct strbuf *sb,
const char *placeholder,
void *format_context,
void *user_data,
struct strbuf *placeholder_subst)

It is exactly like format_commit_one(), except that there are two
additional fields: user_data (to pass custom data to the callback), and
placeholder_subst (to set the substitution).  The callback should return
the length of the original string parsed, and optionally set
placeholder_subst.

[rr: commit message, minor modifications]

Signed-off-by: Ramkumar Ramachandra 
---
 commit.h |  8 
 pretty.c | 25 +
 2 files changed, 33 insertions(+)

diff --git a/commit.h b/commit.h
index 67bd509..04bd935 100644
--- a/commit.h
+++ b/commit.h
@@ -78,6 +78,12 @@ enum cmit_fmt {
CMIT_FMT_UNSPECIFIED
 };
 
+typedef size_t (*format_message_fn)(struct strbuf *sb,
+   const char *placeholder,
+   void *format_context,
+   void *user_data,
+   struct strbuf *placeholder_subst);
+
 struct pretty_print_context {
enum cmit_fmt fmt;
int abbrev;
@@ -92,6 +98,8 @@ struct pretty_print_context {
const char *output_encoding;
struct string_list *mailmap;
int color;
+   format_message_fn format;
+   void *user_data;
 };
 
 struct userformat_want {
diff --git a/pretty.c b/pretty.c
index 9e43154..095e5ba 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1069,6 +1069,31 @@ static size_t format_commit_one(struct strbuf *sb, /* in 
UTF-8 */
struct commit_list *p;
int h1, h2;
 
+   if (c->pretty_ctx->format) {
+   struct strbuf subst = STRBUF_INIT;
+   int ret = c->pretty_ctx->format(sb, placeholder, context,
+   c->pretty_ctx->user_data,
+   &subst);
+   if (ret && subst.len) {
+   /*
+* Something was parsed by format(), and a
+* placeholder-substitution was set.
+* Recursion is required to override the
+* return value of format_commit_one() with
+* ret: the length of the original string
+* before substitution.
+*/
+   ret = format_commit_one(sb, subst.buf, context) ? ret : 
0;
+   strbuf_release(&subst);
+   return ret;
+   } else if (ret)
+   /*
+* Something was parsed by format(), but
+* no placeholder-substitution was set.
+*/
+   return ret;
+   }
+
/* these are independent of the commit */
switch (placeholder[0]) {
case 'C':
-- 
1.8.3.GIT

--
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 11/15] for-each-ref: introduce %(HEAD) marker

2013-06-04 Thread Ramkumar Ramachandra
'git branch' shows which branch you are currently on with an '*', but
'git for-each-ref' misses this feature.  So, extend the format with
%(HEAD) to do exactly the same thing.

Now you can use the following format in for-each-ref:

  %C(red)%(HEAD)%C(reset) %C(green)%(refname:short)%C(reset)

to display a red asterisk next to the current ref.

Signed-off-by: Ramkumar Ramachandra 
---
 Documentation/git-for-each-ref.txt |  4 
 builtin/for-each-ref.c | 13 +++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-for-each-ref.txt 
b/Documentation/git-for-each-ref.txt
index 7d6db7f..d529296 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -120,6 +120,10 @@ upstream::
from the displayed ref. Respects `:short` in the same way as
`refname` above.
 
+HEAD::
+   Useful to indicate the currently checked out branch.  Is '*'
+   if HEAD points to the current ref, and ' ' otherwise.
+
 In addition to the above, for commit and tag objects, the header
 field names (`tree`, `parent`, `object`, `type`, and `tag`) can
 be used to specify the value in the header field.
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 053a622..b0b8236 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -76,6 +76,7 @@ static struct {
{ "upstream" },
{ "symref" },
{ "flag" },
+   { "HEAD" },
 };
 
 /*
@@ -679,8 +680,16 @@ static void populate_value(struct refinfo *ref)
v->s = xstrdup(buf + 1);
}
continue;
-   }
-   else
+   } else if (!strcmp(name, "HEAD")) {
+   const char *head;
+   unsigned char sha1[20];
+   head = resolve_ref_unsafe("HEAD", sha1, 1, NULL);
+   if (!strcmp(ref->refname, head))
+   v->s = "*";
+   else
+   v->s = " ";
+   continue;
+   } else
continue;
 
formatp = strchr(name, ':');
-- 
1.8.3.GIT

--
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


Re: Re: Re: What's cooking in git.git (May 2013, #09; Wed, 29)

2013-06-04 Thread John Keeping
On Tue, Jun 04, 2013 at 09:17:17PM +1000, Heiko Voigt wrote:
> On Tue, Jun 04, 2013 at 09:10:45AM +0100, John Keeping wrote:
> > On Tue, Jun 04, 2013 at 03:29:51PM +1000, Heiko Voigt wrote:
> > > On Mon, Jun 03, 2013 at 11:23:41PM +0100, John Keeping wrote:
> > > > > Sorry, I should have been more specific here. I saw that you did some
> > > > > changes to make "submodule add" do the right thing with relative 
> > > > > paths,
> > > > > but the following change to t7406 does not work like I believe it
> > > > > should but instead makes the test fail:
> > > > > ---8<-
> > > > > diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
> > > > > index a4ffea0..9766b9e 100755
> > > > > --- a/t/t7406-submodule-update.sh
> > > > > +++ b/t/t7406-submodule-update.sh
> > > > > @@ -559,7 +559,9 @@ test_expect_success 'add different submodules to 
> > > > > the same pa
> > > > >  test_expect_success 'submodule add places git-dir in superprojects 
> > > > > git-dir' '
> > > > > (cd super &&
> > > > >  mkdir deeper &&
> > > > > -git submodule add ../submodule deeper/submodule &&
> > > > > +(cd deeper &&
> > > > > + git submodule add ../../submodule submodule
> > > > > +) &&
> > > > >  (cd deeper/submodule &&
> > > > >   git log > ../../expected
> > > > >  ) &&
> > > > > ---8<-
> > > > 
> > > > Ah, ok.  I think this case is problematic because the repository
> > > > argument is either relative to "remote.origin.url" or to the top of the
> > > > working tree if there is no "origin" remote.  I wonder if we should just
> > > > die when a relative path is given for the repository and we're not at
> > > > the top of the working tree.
> > > 
> > > Why not behave as if we are at the top of the working tree for relative
> > > paths? If there is an origin remote thats fine. If there is no origin
> > > remote you could warn that the path used is taken relative from the root
> > > of the superproject during add. What do you think?
> > 
> > That's what the patch currently queued on "pu" does, which Jens wants to
> > change, isn't it?
> 
> True I did not realize this when reading it the first time. But I think
> we should still not die when in a subdirectory. After all this series is
> trying to archive that the submodule command works in subdirectories
> seamlessly right? So you probably want to translate a relative path
> without "origin" remote given from a subdirectory to the superproject
> level and use that. Then you do not have to die.

The problem is that sometimes you do want to adjust the path and
sometimes you don't.  Reading git-submodule(1), it says:

 This may be either an absolute URL, or (if it begins with ./ or
 ../), the location relative to the superproject’s origin
 repository.
 [snip]
 If the superproject doesn’t have an origin configured the
 superproject is its own authoritative upstream and the current
 working directory is used instead.

So I think it's quite reasonable to have a server layout that looks like
this:

project
|- libs
|  |- libA
|  `- libB
|- core.git

and with only core.git on your local system do:

cd core/libs
git submodule add ../libs/libB

expecting that to point to libB.  But if we adjust the path then the
user has to do:

git submodule add ../../libs/libB

However, it is also perfectly reasonable to have no remote configured
and the library next to the repository itself.  In which case we do want
to specify the additional "../" so that shell completion works in the
natural way.

The only way I can see to resolve the ambiguity is to die when we hit
this particular case.  This should be acceptable because people
shouldn't be adding new submodules anywhere near as often as they
perform other submodule operations and it doesn't affect absolute URLs.
--
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


Re: [PATCH 00/15] Towards a more awesome git-branch

2013-06-04 Thread Duy Nguyen
On Tue, Jun 4, 2013 at 7:35 PM, Ramkumar Ramachandra  wrote:
> Hi,
>
> Duy and I have been working on this topic for some time now.  Here's a
> review candidate.

I'm still hung up one the detached HEAD thing. It's a bit quirky to
put in for-each-ref, but for-each-ref can't truly replace branch
--list until it can display detached HEAD. But I think we can finish
this part and get it in first. Should be useful for some people
already.

> Duy is currently writing code to factor out -v[v] and adding --sort,
> --count to git-branch, but I'm having a lot of difficulty working with
> a series of this size.  I'm leaning towards getting this merged before
> tackling branch (who wants to review a 40-part series?).  Especially
> after [14/15] and [15/15], git for-each-ref should be usable in its
> own right.

Agreed (a bit of concern about 14 and 15/15, though). Signed-off-by:
me for the whole series.
--
Duy
--
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


Re: [PATCH v2 0/3] Towards a useable git-branch

2013-06-04 Thread Ramkumar Ramachandra
Duy Nguyen wrote:
> Nobody should ever parse these output
> with scripts. The color can be generated from color.branch.*.

How do we implement color.branch.(current|local|remote|plain)?  In the
current code, we take a crude approach by hand-constructing argc, argv
strings and passing it to cmd_for_each_ref().  There are no
conditionals in the format syntax (and introducing one is probably not
a good idea either): so, I'm guessing these configuration variables
have to be read by for-each-ref?

> A bigger
> problem is show_detached(), --[no-]merged, --with and --contains. We
> need to move some of those code over to for-each-ref.

I saw that you fixed this.

> Another problem
> is the new "branch -v" seems to less responsive than old "branch -v"
> because (I think) of sorting, even if we don't need it.

Does your track-responsiveness patch fix this?

> I checked out
> your branch, made some more updates and pushed out to my
> for-each-ref-pretty again. Changes are:

*pants* Sorry, I'm finding it hard to keep up.
--
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


[no subject]

2013-06-04 Thread Мурад



Отправлено с iPhone

Re: [PATCH 10/15] for-each-ref: introduce format specifier %>(*) and %<(*)

2013-06-04 Thread Duy Nguyen
On Tue, Jun 4, 2013 at 7:35 PM, Ramkumar Ramachandra  wrote:
> +static unsigned int get_atom_width(struct format_one_atom_context *ctx,
> +  const char *start, const char *end)
> +{
> +   struct strbuf sb = STRBUF_INIT;
> +   int i, atom = parse_atom(start, end);
> +   unsigned int len = 0, sb_len;
> +   for (i = 0; i < ctx->maxcount; i++) {
> +   print_value(&sb, ctx->refs[i], atom, ctx->quote_style);
> +   sb_len = utf8_strnwidth(sb.buf, sb.len, 1);
> +   if (sb_len > len)
> +   len = sb_len;
> +   strbuf_reset(&sb);
> +   }
> +   strbuf_release(&sb);
> +   return len;
> +}
> +

I mentioned it before and I do it again. This is not optimal. We
should cache the result of get_atom_width() after the first
calculation. I haven't done it yet because I'm still not sure if it's
worth supporting %<(*)%non-atom at this stage. Caching for atoms only
is much easier because atom is indexed. But I guess it's ok in this
shape unless you run this over hundreds of refs.
--
Duy
--
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


Re: [PATCH 15/15] for-each-ref: use get_pretty_userformat in --pretty

2013-06-04 Thread Duy Nguyen
On Tue, Jun 4, 2013 at 7:35 PM, Ramkumar Ramachandra  wrote:
> Use get_pretty_userformat() to interpret the --pretty string.  This
> means that leading you can now reference a format specified in a pretty.*
> configuration variable as an argument to 'git for-each-ref --pretty='.
> There are two caveats:
>
> 1. A leading "format:" or "tformat:" is automatically stripped and
>ignored.  Separator semantics are not configurable (yet).
>
> 2. No built-in formats are available.  The ones specified in
>pretty-formats (oneline, short etc) don't make sense when displaying
>refs anyway.
>

I spoke too early about the concern with this patch. At first it
looked like you replace default formats with config keys. But nope,
this is brilliant.

> Signed-off-by: Ramkumar Ramachandra 
> ---
>  Documentation/git-for-each-ref.txt |  3 +++
>  builtin/for-each-ref.c | 16 +---
>  2 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/git-for-each-ref.txt 
> b/Documentation/git-for-each-ref.txt
> index 05ff7ba..7f3cba5 100644
> --- a/Documentation/git-for-each-ref.txt
> +++ b/Documentation/git-for-each-ref.txt
> @@ -60,6 +60,9 @@ calculated.
>  +
>  Caveats:
>
> +0. No built-in formats from PRETTY FORMATS (like oneline, short) are
> +   available.
> +
>  1. Many of the placeholders in "PRETTY FORMATS" are designed to work
> specifically on commit objects: when non-commit objects are
> supplied, those placeholders won't work.
> diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
> index edaa6b2..c00ab05 100644
> --- a/builtin/for-each-ref.c
> +++ b/builtin/for-each-ref.c
> @@ -1146,7 +1146,7 @@ int cmd_for_each_ref(int argc, const char **argv, const 
> char *prefix)
> int num_refs;
> const char *default_format = "%(objectname) 
> %(objecttype)\t%(refname)";
> const char *format = default_format;
> -   const char *pretty = NULL;
> +   const char *pretty_raw = NULL, *pretty_userformat = NULL;
> struct ref_sort *sort = NULL, **sort_tail = &sort;
> int maxcount = 0, quote_style = 0;
> struct refinfo **refs;
> @@ -1165,13 +1165,15 @@ int cmd_for_each_ref(int argc, const char **argv, 
> const char *prefix)
> OPT_GROUP(""),
> OPT_INTEGER( 0 , "count", &maxcount, N_("show only  
> matched refs")),
> OPT_STRING(  0 , "format", &format, N_("format"), N_("format 
> to use for the output")),
> -   OPT_STRING(  0 , "pretty", &pretty, N_("format"), 
> N_("alternative format to use for the output")),
> +   OPT_STRING(  0 , "pretty", &pretty_raw, N_("format"), 
> N_("alternative format to use for the output")),
> OPT_CALLBACK(0 , "sort", sort_tail, N_("key"),
> N_("field name to sort on"), &opt_parse_sort),
> OPT_END(),
> };
>
> parse_options(argc, argv, prefix, opts, for_each_ref_usage, 0);
> +   if (pretty_raw)
> +   pretty_userformat = get_pretty_userformat(pretty_raw);
> if (maxcount < 0) {
> error("invalid --count argument: `%d'", maxcount);
> usage_with_options(for_each_ref_usage, opts);
> @@ -1180,10 +1182,10 @@ int cmd_for_each_ref(int argc, const char **argv, 
> const char *prefix)
> error("more than one quoting style?");
> usage_with_options(for_each_ref_usage, opts);
> }
> -   if (format != default_format && pretty)
> +   if (format != default_format && pretty_userformat)
> die("--format and --pretty cannot be used together");
> -   if ((pretty && verify_format(pretty, 1)) ||
> -   (!pretty && verify_format(format, 0)))
> +   if ((pretty_userformat && verify_format(pretty_userformat, 1)) ||
> +   (!pretty_userformat && verify_format(format, 0)))
> usage_with_options(for_each_ref_usage, opts);
>
> if (!sort)
> @@ -1204,8 +1206,8 @@ int cmd_for_each_ref(int argc, const char **argv, const 
> char *prefix)
> if (!maxcount || num_refs < maxcount)
> maxcount = num_refs;
>
> -   if (pretty)
> -   show_pretty_refs(refs, maxcount, pretty, quote_style);
> +   if (pretty_userformat)
> +   show_pretty_refs(refs, maxcount, pretty_userformat, 
> quote_style);
> else
> show_refs(refs, maxcount, format, quote_style);
> return 0;
> --
> 1.8.3.GIT
>



--
Duy
--
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


Re: [PATCH v2 0/3] Towards a useable git-branch

2013-06-04 Thread Duy Nguyen
On Tue, Jun 4, 2013 at 7:52 PM, Ramkumar Ramachandra  wrote:
> Duy Nguyen wrote:
>> Nobody should ever parse these output
>> with scripts. The color can be generated from color.branch.*.
>
> How do we implement color.branch.(current|local|remote|plain)?  In the
> current code, we take a crude approach by hand-constructing argc, argv
> strings and passing it to cmd_for_each_ref().  There are no
> conditionals in the format syntax (and introducing one is probably not
> a good idea either): so, I'm guessing these configuration variables
> have to be read by for-each-ref?

Maybe. I don't really like the idea that for-each-ref reads _branch_
config. We could introduce the same set of keys but in
color.for-each-ref namespace. %C(auto) will take care of the logic and
choose the correct color key. When we replace branch's listing code
with for-each-ref, I think we could somehow override for-each-ref keys
with branch ones in-core. Too hacky?

>> A bigger
>> problem is show_detached(), --[no-]merged, --with and --contains. We
>> need to move some of those code over to for-each-ref.
>
> I saw that you fixed this.

Nope. --[no-]merged and --contains seem easy. show_detached is still
WIP, mostly because detached HEAD may or may not show when you provide
a pattern to git-branch (e.g. git branch --list 'foo*') and because
HEAD is always the first item, regardless of sorting order.
get_head_description also seems more porcelain-ish than a plumbing
feature..

>> Another problem
>> is the new "branch -v" seems to less responsive than old "branch -v"
>> because (I think) of sorting, even if we don't need it.
>
> Does your track-responsiveness patch fix this?

Yes.

>> I checked out
>> your branch, made some more updates and pushed out to my
>> for-each-ref-pretty again. Changes are:
>
> *pants* Sorry, I'm finding it hard to keep up.

Sorry that branch was in a better shape the day I sent my previous
email. Then I kind of used it as a playground with --[no-]merged,
--contains and stuff :-P
--
Duy
--
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


Can `git blame` show the date that each line was merged?

2013-06-04 Thread Matt McClure
Can `git blame` show the date that each line was merged to the current
branch rather than the date it was committed?

Aside: in some trial and error I notice this oddity:

$ git blame --merges
usage: git blame [options] [rev-opts] [rev] [--] file

[rev-opts] are documented in git-rev-list(1)
...

$ git help rev-list | grep -F -e --merges
[ --merges ]
   --merges
   --min-parents=2 is the same as --merges.
--max-parents=0 gives all


-- 
Matt McClure
http://matthewlmcclure.com
http://www.mapmyfitness.com/profile/matthewlmcclure
--
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


git-daemon: needs /root/.config/git/config?

2013-06-04 Thread Ian Kumlien
Hi again, 

Due to the earlier problem I upgraded git on all machines 
and eneded up with a ubunut machine running in to problems.

I started getting errors like:
"fatal: protocol error: bad line length character: fata"

Which after some head scratching caused me to tell xinetd to directly
launch git-daemon, eventually it worked fine, but i did get this error
message:

Jun  4 16:12:05 xyz git-daemon[10246]: unable to access
'/root/.config/git/config': Permission denied

It's not the first time i've seen it but i've been able to ignore it
before. This is running as a local user (as in not root) and this user
shouldn't have access to /root. But i eventually had to do chown o+x
/root to workaround this error.

Now, this must be wrong somehow? Or does --user work in inetd mode now?

So... comments, ideas?
--
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


Re: [PATCH 3/7] unpack-trees: factor out dup_entry

2013-06-04 Thread Peter Krefting

René Scharfe:


While we're add it,


 "add" → "at"

--
\\// Peter - http://www.softwolves.pp.se/
--
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


*** glibc detected *** git: double free or corruption (fasttop): 0x0000000001fab820 ***

2013-06-04 Thread Jason Gross
I get "*** glibc detected *** git: double free or corruption
(fasttop): 0x01fab820 ***" reliably on the following set of
commands.  I'm working on a remote machine where I don't have
administrative privileges, so I can't update from git 1.7.2.5 to a
newer version.  I figured I'd report it, even though I haven't checked
to see if it still happens in a newer version of git.

jgross@dr-wily:/tmp$ uname -a
Linux dr-wily 2.6.32-5-xen-amd64 #1 SMP Mon Feb 25 02:51:39 UTC 2013
x86_64 GNU/Linux
jgross@dr-wily:/tmp$ git --version
git version 1.7.2.5
jgross@dr-wily:/tmp$ git clone git://github.com/JasonGross/barnowl.git
Cloning into barnowl...
remote: Counting objects: 16064, done.
remote: Compressing objects: 100% (8172/8172), done.
remote: Total 16064 (delta 8517), reused 14679 (delta 7321)
Receiving objects: 100% (16064/16064), 8.69 MiB | 3.44 MiB/s, done.
Resolving deltas: 100% (8517/8517), done.
jgross@dr-wily:/tmp$ cd barnowl
jgross@dr-wily:/tmp/barnowl$ git checkout git-bug
Branch git-bug set up to track remote branch git-bug from origin.
Switched to a new branch 'git-bug'
jgross@dr-wily:/tmp/barnowl$ git shortlog | grep : | grep -v '' | less
*** glibc detected *** git: double free or corruption (fasttop):
0x023fa800 ***
=== Backtrace: =
/lib/libc.so.6(+0x71e16)[0x7fe7ed258e16]
/lib/libc.so.6(cfree+0x6c)[0x7fe7ed25db8c]
git[0x48b125]
git[0x4b7e08]
git[0x4577c2]
git[0x458151]
git[0x404671]
git[0x40484d]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7fe7ed205c8d]
git[0x404009]
=== Memory map: 
0040-0050e000 r-xp  ca:01 541613
  /usr/bin/git
0070d000-00714000 rw-p 0010d000 ca:01 541613
  /usr/bin/git
00714000-0076 rw-p  00:00 0
023fa000-025b5000 rw-p  00:00 0  [heap]
7fe7e800-7fe7e8021000 rw-p  00:00 0
7fe7e8021000-7fe7ec00 ---p  00:00 0
7fe7ec721000-7fe7ec737000 r-xp  ca:01 655372
  /lib/libgcc_s.so.1
7fe7ec737000-7fe7ec936000 ---p 00016000 ca:01 655372
  /lib/libgcc_s.so.1
7fe7ec936000-7fe7ec937000 rw-p 00015000 ca:01 655372
  /lib/libgcc_s.so.1
7fe7ec937000-7fe7ed1e7000 r--p  ca:03 136990
  
/tmp/barnowl/.git/objects/pack/pack-67364344f941243318353ed78170fd5d35869d1f.pack
7fe7ed1e7000-7fe7ed34 r-xp  ca:01 659512
  /lib/libc-2.11.3.so
7fe7ed34-7fe7ed53f000 ---p 00159000 ca:01 659512
  /lib/libc-2.11.3.so
7fe7ed53f000-7fe7ed543000 r--p 00158000 ca:01 659512
  /lib/libc-2.11.3.so
7fe7ed543000-7fe7ed544000 rw-p 0015c000 ca:01 659512
  /lib/libc-2.11.3.so
7fe7ed544000-7fe7ed549000 rw-p  00:00 0
7fe7ed549000-7fe7ed56 r-xp  ca:01 659507
  /lib/libpthread-2.11.3.so
7fe7ed56-7fe7ed75f000 ---p 00017000 ca:01 659507
  /lib/libpthread-2.11.3.so
7fe7ed75f000-7fe7ed76 r--p 00016000 ca:01 659507
  /lib/libpthread-2.11.3.so
7fe7ed76-7fe7ed761000 rw-p 00017000 ca:01 659507
  /lib/libpthread-2.11.3.so
7fe7ed761000-7fe7ed765000 rw-p  00:00 0
7fe7ed765000-7fe7ed77c000 r-xp  ca:01 527676
  /usr/lib/libz.so.1.2.3.4
7fe7ed77c000-7fe7ed97b000 ---p 00017000 ca:01 527676
  /usr/lib/libz.so.1.2.3.4
7fe7ed97b000-7fe7ed97c000 rw-p 00016000 ca:01 527676
  /usr/lib/libz.so.1.2.3.4
7fe7ed97c000-7fe7ed99a000 r-xp  ca:01 659508
  /lib/ld-2.11.3.so
7fe7edaef000-7fe7edb5e000 r--p  ca:03 136991
  
/tmp/barnowl/.git/objects/pack/pack-67364344f941243318353ed78170fd5d35869d1f.idx
7fe7edb5e000-7fe7edb61000 rw-p  00:00 0
7fe7edb75000-7fe7edb99000 rw-p  00:00 0
7fe7edb99000-7fe7edb9a000 r--p 0001d000 ca:01 659508
  /lib/ld-2.11.3.so
7fe7edb9a000-7fe7edb9b000 rw-p 0001e000 ca:01 659508
  /lib/ld-2.11.3.so
7fe7edb9b000-7fe7edb9c000 rw-p  00:00 0
7fffd3766000-7fffd377b000 rw-p  00:00 0  [stack]
7fffd37ff000-7fffd380 r-xp  00:00 0  [vdso]
ff60-ff601000 r-xp  00:00 0
  [vsyscall]


-Jason
--
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


Re: Can `git blame` show the date that each line was merged?

2013-06-04 Thread Jeff King
On Tue, Jun 04, 2013 at 09:39:45AM -0400, Matt McClure wrote:

> Can `git blame` show the date that each line was merged to the current
> branch rather than the date it was committed?

Not exactly. Git does not record when a commit entered a particular
branch (or what the "ours" branch was called during a merge).  If you
follow a topic branch workflow in which an integrator merges each branch
into master, then following the first parent of each merge will show the
commits directly on master.

You can see this in action in git.git, which follows such a workflow, by
doing "git log --first-parent", which shows only the commits created
directly on master (mostly merges of topics, with a few trivial fixups
interspersed).

Similarly, you should be able to do "git blame --first-parent foo.c" to
pass blame only along the first-parent lines. Unfortunately, while
"blame" uses the regular revision code to parse its options, it does its
own traversal and does not respect each option. However, the patch to
teach it about --first-parent is pretty trivial:

diff --git a/builtin/blame.c b/builtin/blame.c
index 57a487e..0fb67af 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -1199,6 +1199,8 @@ static int num_scapegoats(struct rev_info *revs, struct 
commit *commit)
 {
int cnt;
struct commit_list *l = first_scapegoat(revs, commit);
+   if (revs->first_parent_only)
+   return l ? 1 : 0;
for (cnt = 0; l; l = l->next)
cnt++;
return cnt;

(though I suspect it would interact oddly with the "--reverse" option,
and we would want to either declare them mutually exclusive or figure
out some sane semantics).

> Aside: in some trial and error I notice this oddity:
> 
> $ git blame --merges
> usage: git blame [options] [rev-opts] [rev] [--] file
> 
> [rev-opts] are documented in git-rev-list(1)
> ...

Your problem is not the presence of "--merges" here, but that you forgot
the necessary "file" argument. Try "git blame --merges foo.c".

However, this suffers from the same problem as --first-parent, in that
it is accepted but not respected. Doing so would not be impossible, but
it is a little more than the two-liner above.

-Peff
--
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


Re: git-daemon: needs /root/.config/git/config?

2013-06-04 Thread Jeff King
On Tue, Jun 04, 2013 at 04:13:14PM +0200, Ian Kumlien wrote:

> Due to the earlier problem I upgraded git on all machines 
> and eneded up with a ubunut machine running in to problems.
> 
> I started getting errors like:
> "fatal: protocol error: bad line length character: fata"
> 
> Which after some head scratching caused me to tell xinetd to directly
> launch git-daemon, eventually it worked fine, but i did get this error
> message:

Looks like your stderr was being redirected to your stdout; this
particular error aside, that is likely to cause weird protocol problems
for any error that git outputs.

> Jun  4 16:12:05 xyz git-daemon[10246]: unable to access
> '/root/.config/git/config': Permission denied
> 
> It's not the first time i've seen it but i've been able to ignore it
> before. This is running as a local user (as in not root) and this user
> shouldn't have access to /root. But i eventually had to do chown o+x
> /root to workaround this error.

The problem is that you have presumably dropped privileges in the daemon
instance, but your $HOME environment variable still points to /root. Git
cannot read all of its config files (nor even find out if they exist),
so it bails rather than continue.

Older versions of git silently ignored errors reading config files, but
it was tightened in v1.8.1.1, as there can be quite serious implications
to failing to read expected config (e.g., imagine transfer.fsckobjects,
or receive.deny* is ignored).

However, since changing user id and leaving $HOME is so common, there is
a patch under consideration to loosen the check only for the case of
EACCES on files in $HOME. That commit is 4698c8f (config: allow
inaccessible configuration under $HOME, 2013-04-12); it's not yet in any
released version of git, though.

In the meantime, the suggested workaround is to set $HOME for the
git-daemon user, rather than loosening /root.

-Peff
--
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


Re: [PATCH] dir.c: fix ignore processing within not-ignored directories

2013-06-04 Thread Karsten Blees
Am 02.06.2013 21:25, schrieb Junio C Hamano:
> Duy Nguyen  writes:
> 
>>> +   then
>>> +   false
>>> +   fi
>>> +'
>>
>> Nit pick, maybe this instead?
>>
>> test_must_fail grep "^one/a.1" output
> 
> Neither.
> 
>   ! grep "^one/a.1" output
> 

Nice. I actually tried "!" but without the space - which didn't work so I took 
the other t3001 tests as example...
--
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


:6/4/2013 5:25:42 PM:

2013-06-04 Thread Matthew Mendell
http://thielois.free.fr/kk/miwrmacrfkhwwidtajnzttpnim.bnopj
--
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


Re: *** glibc detected *** git: double free or corruption (fasttop): 0x0000000001fab820 ***

2013-06-04 Thread Jeff King
On Tue, Jun 04, 2013 at 11:46:55AM -0400, Jason Gross wrote:

> I get "*** glibc detected *** git: double free or corruption
> (fasttop): 0x01fab820 ***" reliably on the following set of
> commands.  I'm working on a remote machine where I don't have
> administrative privileges, so I can't update from git 1.7.2.5 to a
> newer version.  I figured I'd report it, even though I haven't checked
> to see if it still happens in a newer version of git.

Yes, it's fixed. You can test such things even without administrative
access. For example:

  # get git
  git clone git://git.kernel.org/pub/scm/git/git.git
  cd git

  # set up our test case
  git clone git://github.com/JasonGross/barnowl.git
  (cd barnowl && git checkout git-bug)

  # now make an easy-to-run test we can run on each commit; make sure
  # to use bin-wrappers, as it sets up everything to run git out of the
  # current build, overriding anything in your $PATH
  cat >test <<\EOF
  #!/bin/sh
  make -j16 &&
  cd barnowl &&
  ../bin-wrappers/git shortlog >/dev/null &&
  echo OK
  EOF
  chmod +x test

  # now confirm our old version is broken
  git checkout v1.7.2.5
  ./test

  # and check that a new version works
  git checkout v1.8.3
  ./test

You can even use git-bisect to find out which commit fixed it. We have
to "reverse" our test, though, since bisect is usually about finding
regressions, not fixes.

  # create reverse test
  cat >revtest <<\EOF
  #!/bin/sh
  ./test && exit 1
  exit 0
  EOF
  chmod +x revtest

  # set up our bisect; again, our good/bad are reversed because we are
  # treating the fix as a "bug"
  git bisect start
  git bisect good v1.7.2.5
  git bisect bad v1.8.3

  # and now we can let "bisect run" do all the hard work while we drink
  # an ice-cold beverage
  git bisect run ./revtest

If we did everything right, this should yield the commit with the fix.
And it turns up d8d2eb7 (mailmap: fix use of freed memory, 2010-10-11),
which seems likely (and reading the full commit message, details the
exact case you have).

And then we can use "git tag --contains" to find out which releases have
it:

  $ git tag --contains d8d2eb7 | grep ^v | grep -v -- -rc | head -1
  v1.7.10

So you'd need to go to v1.7.10 to fix it.

-Peff
--
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


Re: *** glibc detected *** git: double free or corruption (fasttop): 0x0000000001fab820 ***

2013-06-04 Thread Stefano Lattarini
On 06/04/2013 05:46 PM, Jason Gross wrote:
> I get "*** glibc detected *** git: double free or corruption
> (fasttop): 0x01fab820 ***" reliably on the following set of
> commands.  I'm working on a remote machine where I don't have
> administrative privileges, so I can't update from git 1.7.2.5 to a
> newer version.
>
Sure you can; install from a release tarball.  The page
 links the latest version
(1.8.3) as well as older ones.

As for the issue you reported, I'll leave that to the real git
developers (I'm only a lurker here).

Regards,
  Stefano
--
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


Re: Git status reports untracked on tracked files

2013-06-04 Thread Karsten Blees
Am 04.06.2013 11:05, schrieb Andrey Kiyanovsky:
> I have tried Git 1.8.3 for Windows. Case is fixed. Thank you very much!
> 
> 2013/6/4 Jeff King :
>> On Wed, May 29, 2013 at 11:40:56AM +0300, Andrey Kiyanovsky wrote:
>>
>>> Git version 1.8.1.2. for Windows
>>>
>>> Git config:
>>>
>>> [core]
>>>   repositoryformatversion = 0
>>>   filemode = false
>>>   bare = false
>>>   logallrefupdates = true
>>>   symlinks = false
>>>   ignorecase = true
>>>   hideDotFiles = dotGitOnly
>>>   compression = 1
>>
>> In the past there have been some problems with status listings of
>> untracked files when core.ignorecase is in use. I fixed some cases with
>> a commit that went into v1.7.8, but some problems remained. Karsten
>> Blees (cc'd) did some work that went into git v1.8.1.6, but I do not
>> know off-hand if it would fix your case or not.
>>

Yep, the hash collision bug can definitely cause this with ignorecase=true, 
glad it helped.

Another case in which Git for Windows will report tracked files as untracked is 
if you upgrade from < 1.7.10 with non-ASCII file names in the repository. 
Particularly annoying are hyphens (\u00ad), which look just like ASCII minus 
(\u002d). See [1] for details.

[1] https://github.com/msysgit/msysgit/wiki/Git-for-Windows-Unicode-Support
--
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] t/README: test_must_fail is for testing Git

2013-06-04 Thread Junio C Hamano
When a test wants to make sure there is no  in an output
file, we should just say "! grep string output"; "test_must_fail"
is there only to test Git command and catch unusual deaths we know
about (e.g. segv) as an error, not as an expected failure.

Signed-off-by: Junio C Hamano 
---
 t/README | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/t/README b/t/README
index e669bb3..35b3c5c 100644
--- a/t/README
+++ b/t/README
@@ -324,6 +324,9 @@ Don't:
use 'test_must_fail git cmd'.  This will signal a failure if git
dies in an unexpected way (e.g. segfault).
 
+   On the other hand, don't use test_must_fail for running regular
+   platform commands; just use '! cmd'.
+
  - use perl without spelling it as "$PERL_PATH". This is to help our
friends on Windows where the platform Perl often adds CR before
the end of line, and they bundle Git with a version of Perl that
--
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


Re: [PATCH v2 3/8] cherry-pick: add --skip-empty option

2013-06-04 Thread Felipe Contreras
On Mon, Jun 3, 2013 at 4:45 PM, Junio C Hamano  wrote:
> Felipe Contreras  writes:
>
>> On Mon, Jun 3, 2013 at 1:40 PM, Junio C Hamano  wrote:
>>> Felipe Contreras  writes:
>>>
 Pretty much what it says on the tin.

 Signed-off-by: Felipe Contreras 
 ---
  Documentation/git-cherry-pick.txt   |  3 +++
  builtin/revert.c|  2 ++
  sequencer.c |  6 ++
  sequencer.h |  1 +
  t/t3508-cherry-pick-many-commits.sh | 13 +
  5 files changed, 25 insertions(+)

 diff --git a/Documentation/git-cherry-pick.txt 
 b/Documentation/git-cherry-pick.txt
 index c205d23..fccd936 100644
 --- a/Documentation/git-cherry-pick.txt
 +++ b/Documentation/git-cherry-pick.txt
 @@ -129,6 +129,9 @@ effect to your index in a row.
   redundant commits are ignored.  This option overrides that behavior 
 and
   creates an empty commit object.  Implies `--allow-empty`.

 +--skip-empty::
 + Instead of failing, skip commits that are or become empty.
>>>
>>> Not quite sure.  Is this "instead of recording an empty commit,"
>>> (which may or may not fail depending on the allow-empty settings)?
>>
>> We are explaining --skip-empty, not --allow-empty.
>
> Exactly.  That is why I found the "Instead of failing" questionable.
> It is very easy to read the above as "commits that are or become
> empty usually causes the command to fail, and this is a way to cause
> it not to fail.".
>
> It is true that
>
> cherry-pick A
>
> when A becomes empty, dies.  But
>
> cherry-pick --allow-empty A
>
> when A becomes empty, does not fail, but still does create an empty
> commit.  A large difference with --skip-empty, which applies to use
> scenario different from --allow-empty was meant to address, is that
>
> cherry-pick --skip-empty A
>
> when A becomes empty, does not fail and does not create an empty
> commit, either.

We are not explaining --allow-empty.

What happens when you do --skip-empty --allow-empty? Somebody
suggested a new option, so we could do --foo-empty=skip,allow to
clarify that.

> I think just "Skip commits that are or become empty" without saying
> "Instead of failing," is fine, too.

I think "Instead of failing" makes perfect sense, because it's not our
job to describe what other options do, simply explain what this option
do. If the user is interested in other options, he can read them in
the help for those.

-- 
Felipe Contreras
--
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


Re: SNI (SSL virtual hosts)

2013-06-04 Thread Janusz Harkot
> What makes you suggest that's what's happening? Sure, if it would've sent no  
> or the wrong host name it would probably have that effect.

line:

[36] * Re-using existing connection! (#0) with host (nil)  
> Any chance you can snoop on the network and the SSL handshake to see who's to 
>  
> blame? I can't but to think that is is a very common use case!


I was trying to verify this via command line curl, and GET/POST is working fine.

There is one thing that make me suspicious - this is that message about SSL 
session expiration:
[64] * SSL re-using session ID
[65] * SSL connection using RC4-SHA
[66] * old SSL session ID is stale, removing



So, I've spent last few hours playing with different settings/builds etc.  
I was using sources of curl (7.30.0) and git (1.8.2.3)

curl & git bult with default os-x's openssl (0.9.8) - failed
curl & git bult with '--with-darwin-ssl' + default openssl for git - failed

curl & git both bult with newest openssl (1.0.1e):
error: SSL certificate problem: self signed certificate in certificate chain 
while accessing https://

so it looks promising, I've set GIT_SSL_CAPATH (because bundle config is not 
supported in git - this is a good feature request)

and.. t looks like it is working…
first and second attempt was to correct SNI host!

So, the question is still why it is not working with openssl 0.9.8r - this 
version supports SNI by default.
This looks like an error in openssl (maybe: Only allow one SGC handshake 
restart for SSL/TLS.)

Now is the question, shall this be handled by curl or left alone?
(handling older version of openssl, and force new ssl session?)


kind regards,
Janusz


p.s.
I've tested cur built with polarssl - works and gnutls - works too...





--
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


Re: [PATCH v5 5/7] add tests for rebasing merged history

2013-06-04 Thread Junio C Hamano
Martin von Zweigbergk  writes:

> ---
> +#TODO: make all flavors of rebase use --topo-order
> +test_run_rebase success 'e n o' ''
> +test_run_rebase success 'e n o' -m
> +test_run_rebase success 'n o e' -i

I do not quite follow this TODO.

While I think it would be nice to update "rebase" so that all
variants consider replaying the commits in the same order, in this
history you have:

+# a---b---c
+#  \   \
+#   d---e   \
+#\   \   \
+# n---o---w---v
+#  \
+#   z

as long as o comes after n and e is shown before n or after o, which
all three expected results satisify, it is in --topo-order, isn't it?

The same comment applies to the other TODO that talks about eno/noe
differences.

> +test_expect_success "rebase -p re-creates merge from side branch" "
> + reset_rebase &&
> + git rebase -p z w &&
> + test_cmp_rev z HEAD^ &&
> + test_cmp_rev w^2 HEAD^2
> +"

Hmm, turning the left one to the right one?

+#   d---e   d---e
+#\   \   \   \   
+# n---o---w ===>  n---o   \
+#  \   \   \ 
+#   z   z---W

If w were a merge of o into e (i.e. w^1 were e not o), what should
happen?  Would we get the same topology?

In other words, when asked to replay w on top of z, how would we
decide which parent to keep (in this case, e is kept)?

> +test_expect_success "rebase -p can re-create two branches on onto" "
> + reset_rebase &&
> + git rebase -p --onto c d w &&
> + test_cmp_rev c HEAD~3 &&
> + test_cmp_rev c HEAD^2^ &&
> + test_revision_subjects 'n e o w' HEAD~2 HEAD^2 HEAD^ HEAD
> +"

Nice (so are all the rest).

--
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


Re: Can `git blame` show the date that each line was merged?

2013-06-04 Thread Matt McClure
On Tue, Jun 4, 2013 at 11:56 AM, Jeff King  wrote:
>> Aside: in some trial and error I notice this oddity:
>>
>> $ git blame --merges
>> usage: git blame [options] [rev-opts] [rev] [--] file
>>
>> [rev-opts] are documented in git-rev-list(1)
>> ...
>
> Your problem is not the presence of "--merges" here, but that you forgot
> the necessary "file" argument. Try "git blame --merges foo.c".

Oops. Thanks.


-- 
Matt McClure
http://matthewlmcclure.com
http://www.mapmyfitness.com/profile/matthewlmcclure
--
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


Re: Can `git blame` show the date that each line was merged?

2013-06-04 Thread Junio C Hamano
Jeff King  writes:

> diff --git a/builtin/blame.c b/builtin/blame.c
> index 57a487e..0fb67af 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> @@ -1199,6 +1199,8 @@ static int num_scapegoats(struct rev_info *revs, struct 
> commit *commit)
>  {
>   int cnt;
>   struct commit_list *l = first_scapegoat(revs, commit);
> + if (revs->first_parent_only)
> + return l ? 1 : 0;
>   for (cnt = 0; l; l = l->next)
>   cnt++;
>   return cnt;
>
> (though I suspect it would interact oddly with the "--reverse" option,
> and we would want to either declare them mutually exclusive or figure
> out some sane semantics).

It is entirely unclear who the first child is, so I tend to think
that they have to be mutually exclusive.

>> Aside: in some trial and error I notice this oddity:
>> 
>> $ git blame --merges
>> usage: git blame [options] [rev-opts] [rev] [--] file
>> 
>> [rev-opts] are documented in git-rev-list(1)
>> ...
>
> Your problem is not the presence of "--merges" here, but that you forgot
> the necessary "file" argument. Try "git blame --merges foo.c".
>
> However, this suffers from the same problem as --first-parent, in that
> it is accepted but not respected. Doing so would not be impossible, but
> it is a little more than the two-liner above.

What the command does when it "respects" it is unclear to me.
In a history like this:

---A---B---C
\   \
 E---F---G---H

and starting at H, pretend everything that happened in, B, C, E and
F since A was done by G?  Who gets the blame for what A or H did?
--
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


Re: [PATCH v2 3/8] cherry-pick: add --skip-empty option

2013-06-04 Thread Junio C Hamano
Felipe Contreras  writes:

>> I think just "Skip commits that are or become empty" without saying
>> "Instead of failing," is fine, too.
>
> I think "Instead of failing" makes perfect sense, because it's not our
> job to describe what other options do,...
> ...
> simply explain what this option
> do.

Which means "Skip commits" and nothing else.  Saying "Instead of
failing" explains what would happen if you ran the command without
any option, which is entirely irrelevant, just like the case when
you ran the command without an unrelated option --allow-empty.

We share the same "the --skip-empty option does not have anything to
do with the --allow-empty option, and we do not have to say anything
about what happens when the command is run with that unrelated
option".

But we are viewing it from a different angle.
--
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


Re: [PATCH v2 3/8] cherry-pick: add --skip-empty option

2013-06-04 Thread Felipe Contreras
On Tue, Jun 4, 2013 at 12:35 PM, Junio C Hamano  wrote:
> Felipe Contreras  writes:
>
>>> I think just "Skip commits that are or become empty" without saying
>>> "Instead of failing," is fine, too.
>>
>> I think "Instead of failing" makes perfect sense, because it's not our
>> job to describe what other options do,...
>> ...
>> simply explain what this option
>> do.
>
> Which means "Skip commits" and nothing else.  Saying "Instead of
> failing" explains what would happen if you ran the command without
> any option,

Which *BY FAR* the most widely use-case of cherry-pick. What? 99% of the time?

> which is entirely irrelevant,

It's totally and completely relevant. It couldn't be more relevant.

> We share the same "the --skip-empty option does not have anything to
> do with the --allow-empty option, and we do not have to say anything
> about what happens when the command is run with that unrelated
> option".

You didn't answer, what happens when you run --skip-empty and --allow-empty?

-- 
Felipe Contreras
--
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


Re: [PATCH v3 0/6] git send-email suppress-cc=self fixes

2013-06-04 Thread Junio C Hamano
"Michael S. Tsirkin"  writes:

> This includes bugfixes related to handling of --suppress-cc=self
> flag. Tests are also included.

Hmph, flipped the patches without test-applying first?

2/6 adds two lines to test_suppress_self_quoted helper function, but
that is introduced only at 4/6.

>
> Changes from v2:
>   - add a new test, split patches differently add code comments
>to address comments by Junio
>   - rename example addresses in tests from redhat.com to example.com
> Changes from v1:
> - tweak coding style in tests to address comments by Junio
>
>
> Michael S. Tsirkin (6):
>   send-email: fix suppress-cc=self on cccmd
>   t/send-email: test suppress-cc=self on cccmd
>   send-email: make --suppress-cc=self sanitize input
>   t/send-email: add test with quoted sender
>   t/send-email: test suppress-cc=self with non-ascii
>   test-send-email: test for pre-sanitized self name
>
>  git-send-email.perl   | 23 +++
>  t/t9001-send-email.sh | 34 +-
>  2 files changed, 48 insertions(+), 9 deletions(-)
--
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


Re: Can `git blame` show the date that each line was merged?

2013-06-04 Thread Jeff King
On Tue, Jun 04, 2013 at 10:28:06AM -0700, Junio C Hamano wrote:

> > (though I suspect it would interact oddly with the "--reverse" option,
> > and we would want to either declare them mutually exclusive or figure
> > out some sane semantics).
> 
> It is entirely unclear who the first child is, so I tend to think
> that they have to be mutually exclusive.

That's my thinking, too, but I didn't want to rule out somebody thinking
of something clever.

> > Your problem is not the presence of "--merges" here, but that you forgot
> > the necessary "file" argument. Try "git blame --merges foo.c".
> >
> > However, this suffers from the same problem as --first-parent, in that
> > it is accepted but not respected. Doing so would not be impossible, but
> > it is a little more than the two-liner above.
> 
> What the command does when it "respects" it is unclear to me.
> In a history like this:
> 
> ---A---B---C
> \   \
>  E---F---G---H
> 
> and starting at H, pretend everything that happened in, B, C, E and
> F since A was done by G?  Who gets the blame for what A or H did?

In general, I would expect "git blame" with revision arguments to behave
as if it was fed the history graph (including parent rewriting). So in
this case, I would think it would blame everything before G on G
(assuming there are no merges before A), and everything in H would be
"not yet committed".

That being said, we do not seem to rewrite parents for min/max parent
cases even in "git log". I'm not sure why, nor can I seem to provoke it
with simplification options. So maybe I am missing something clever.

-Peff
--
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/RFC] add --authorship-order flag to git log / rev-list

2013-06-04 Thread elliottcable
This is my first time submitting a patch to this list, so please, let me know if
I'm doing any of this the wrong way! I've striven to follow
`Documentation/SubmittingPatches`. I hope I've succeeded. For that matter, it's
my first time diving into git's sources, so I obviously would love some
commentary on the patch itself, as well. ;)

I've tried herein to add an `--authorship-order` flag to complement git-log's
`--topo-order` and `--date-order` flags; it should operate the same as
`--date-order`, but using the `AUTHOR_DATE` instead of the `COMMITTER_DATE`.

I've sent an e-mail to this list, previously, on this subject; I'd make this
patchset a reply to that, except I have no idea what the in-reply-to should be:
http://www.spinics.net/lists/git/msg208542.html

The original work is all on GitHub:
https://github.com/git/git/pull/40
https://github.com/ELLIOTTCABLE/git/compare/master...author-order+

elliottcable (1):
  rev-list: add --authorship-order alternative ordering

 builtin/log.c  |  2 +-
 builtin/rev-list.c |  1 +
 builtin/rev-parse.c|  1 +
 builtin/show-branch.c  | 12 -
 commit.c   | 83 ++
 commit.h   |  3 +-
 contrib/completion/git-completion.bash |  4 +-
 po/de.po   |  4 +-
 po/git.pot |  2 +-
 po/sv.po   |  4 +-
 po/vi.po   |  4 +-
 po/zh_CN.po|  4 +-
 revision.c | 11 -
 revision.h |  1 +
 14 files changed, 110 insertions(+), 26 deletions(-)

-- 
1.8.1.3

--
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/RFC] rev-list: add --authorship-order alternative ordering

2013-06-04 Thread elliottcable
--date-order is an excellent alternative to --topo-order if you want a feel for
the *actual history*, chronologically, of your project. I use it often, with
--graph as well; it's a great way to get an overview of a project's recent
development history.

However, in a project that rebases various in-development topic-branches often,
it gets hard to demonstrate a *chronological history* of changes to the
codebase, as this always “resets” the COMMITTER_DATE (which --date-order uses)
to the time the rebase happened; which often means ‘last time all of the
topic-branches were rebased on the latest fixes in master.’

Thus, I've added an --authorship-order version of --date-order, which relies
upon the AUTHOR_DATE instead of the COMMITTER_DATE; this means that old commits
will continue to show up chronologically in-order despite rebasing.
---
 builtin/log.c  |  2 +-
 builtin/rev-list.c |  1 +
 builtin/rev-parse.c|  1 +
 builtin/show-branch.c  | 12 -
 commit.c   | 83 ++
 commit.h   |  3 +-
 contrib/completion/git-completion.bash |  4 +-
 po/de.po   |  4 +-
 po/git.pot |  2 +-
 po/sv.po   |  4 +-
 po/vi.po   |  4 +-
 po/zh_CN.po|  4 +-
 revision.c | 11 -
 revision.h |  1 +
 14 files changed, 110 insertions(+), 26 deletions(-)

diff --git a/builtin/log.c b/builtin/log.c
index 9e21232..54d4d7f 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -237,7 +237,7 @@ static void log_show_early(struct rev_info *revs, struct 
commit_list *list)
int i = revs->early_output;
int show_header = 1;
 
-   sort_in_topological_order(&list, revs->lifo);
+   sort_in_topological_order(&list, revs->lifo, revs->use_author);
while (list && i) {
struct commit *commit = list->item;
switch (simplify_commit(revs, commit)) {
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 67701be..cfa5d1f 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -30,6 +30,7 @@ static const char rev_list_usage[] =
 "  ordering output:\n"
 "--topo-order\n"
 "--date-order\n"
+"--authorship-order\n"
 "--reverse\n"
 "  formatting output:\n"
 "--parents\n"
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index f267a1d..d08aebd 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -65,6 +65,7 @@ static int is_rev_argument(const char *arg)
"--tags",
"--topo-order",
"--date-order",
+   "--authorship-order",
"--unpacked",
NULL
};
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 90fc6b1..ac06ac3 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -6,7 +6,7 @@
 #include "parse-options.h"
 
 static const char* show_branch_usage[] = {
-N_("git show-branch [-a|--all] [-r|--remotes] [--topo-order | 
--date-order] [--current] [--color[=] | --no-color] [--sparse] 
[--more= | --list | --independent | --merge-base] [--no-name | --sha1-name] 
[--topics] [( | )...]"),
+N_("git show-branch [-a|--all] [-r|--remotes] [--topo-order | --date-order 
| --authorship-order] [--current] [--color[=] | --no-color] [--sparse] 
[--more= | --list | --independent | --merge-base] [--no-name | --sha1-name] 
[--topics] [( | )...]"),
 N_("git show-branch (-g|--reflog)[=[,]] [--list] []"),
 NULL
 };
@@ -631,6 +631,7 @@ int cmd_show_branch(int ac, const char **av, const char 
*prefix)
int all_heads = 0, all_remotes = 0;
int all_mask, all_revs;
int lifo = 1;
+   int use_author = 0;
char head[128];
const char *head_p;
int head_len;
@@ -667,6 +668,8 @@ int cmd_show_branch(int ac, const char **av, const char 
*prefix)
N_("show refs unreachable from any other ref")),
OPT_BOOLEAN(0, "topo-order", &lifo,
N_("show commits in topological order")),
+   OPT_BOOLEAN(0, "authorship-order", &use_author,
+   N_("like --date-order, but with the *author* 
date")),
OPT_BOOLEAN(0, "topics", &topics,
N_("show only commits not on the first branch")),
OPT_SET_INT(0, "sparse", &dense,
@@ -694,6 +697,11 @@ int cmd_show_branch(int ac, const char **av, const char 
*prefix)
   show_branch_usage, PARSE_OPT_STOP_AT_NON_OPTION);
if (all_heads)
all_remotes = 1;
+   /* I'm having trouble figuring out exactly what `lifo` stores. Why do 
both 'date-order' and
+* 'topo-order' set the same variable!? Aren't they mutually exclusive? 
Since *both* set 

Re: [PATCH] diff: add --ignore-blank-lines option

2013-06-04 Thread Junio C Hamano
Antoine Pelisse  writes:

> +xdchange_t *xdl_get_hunk(xdchange_t **xscr, xdemitconf_t const *xecfg) {
>   xdchange_t *xch, *xchp;
>   long max_common = 2 * xecfg->ctxlen + xecfg->interhunkctxlen;
> + long ignorable_context = max_common / 2 - 1;

Could you explain how this math works?  Also the logic to use it
when either the previous or the current one is "blank only" (as
opposed to having two different settings for "both are blank only"
and "only one of them is, and the other is not", for example)?

The normal case when neither is blank only, we refrain from
collapsing two adjacent xdchanges if the end of xchp (i.e. the
previous one) is before the beginning of xch (i.e. the current one
we are looking at) by more than max_common lines, which makes sense
to me because we count one ctxlen for the trailing context for xchp,
interhunkctxlen to force collapsing, and another ctxlen for the
leading context for xch.

When we have 

- zero or more "blank only" changes, followed by
- a meaningful change A, followed by
- zero or more blank-only changes, followed by
- a meaningful change C,

we may want to have either two hunks (A with context around it, and
C with context around it) or a single hunk (precontext before A, all
the lines from the beginning of A to the end of C, and postcontext
after C).  In either case, we want to discard the leading "blank
only" changes.

I can sort-of see how the leading "blank only" changes are discarded
in the loop (but not quite---you can ignore everything without any
"thresh", until you set "interesting" to true, i.e. seeing A, no?).

It is not clear to me how you are counting the distance between the
end of A and the beginning of C, which I think is all that matters,
to make the decision to coalesce (or not to coalesce) the above into
a single hunk, without looking ahead to find the next xdchange that
is not marked with xch->ignore flag (that is, when looking at A,
find the beginning of C to see if C.begin-A.end is within the usual
max_common).

Confused...

> + int interesting = 0;
>
> - for (xchp = xscr, xch = xscr->next; xch; xchp = xch, xch = xch->next)
> - if (xch->i1 - (xchp->i1 + xchp->chg1) > max_common)
> - break;
> + for (xchp = *xscr, xch = (*xscr)->next; xch; xchp = xch, xch = 
> xch->next) {
> + long thresh;
> + if (xchp->ignore || xch->ignore)
> + thresh = ignorable_context;
> + else
> + thresh = max_common;
> +
> + if (!xchp->ignore)
> + interesting = 1;
> +
> + if (xch->i1 - (xchp->i1 + xchp->chg1) > thresh) {
> + if (interesting)
> + break;
> + else
> + *xscr = xch;
> + }
> + }
> +
> + if (!interesting && xchp->ignore)
> + *xscr = NULL;
>
>   return xchp;
>  }
> @@ -139,7 +159,9 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, 
> xdemitcb_t *ecb,
>   return xdl_emit_common(xe, xscr, ecb, xecfg);
>
>   for (xch = xscr; xch; xch = xche->next) {
> - xche = xdl_get_hunk(xch, xecfg);
> + xche = xdl_get_hunk(&xch, xecfg);
> + if (!xch)
> + break;
>
>   s1 = XDL_MAX(xch->i1 - xecfg->ctxlen, 0);
>   s2 = XDL_MAX(xch->i2 - xecfg->ctxlen, 0);
> diff --git a/xdiff/xemit.h b/xdiff/xemit.h
> index c2e2e83..d297107 100644
> --- a/xdiff/xemit.h
> +++ b/xdiff/xemit.h
> @@ -27,7 +27,7 @@
>  typedef int (*emit_func_t)(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
>  xdemitconf_t const *xecfg);
>
> -xdchange_t *xdl_get_hunk(xdchange_t *xscr, xdemitconf_t const *xecfg);
> +xdchange_t *xdl_get_hunk(xdchange_t **xscr, xdemitconf_t const *xecfg);
>  int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
> xdemitconf_t const *xecfg);
>
> diff --git a/xdiff/xutils.c b/xdiff/xutils.c
> index 9504eae..c047376 100644
> --- a/xdiff/xutils.c
> +++ b/xdiff/xutils.c
> @@ -143,6 +143,19 @@ long xdl_guess_lines(mmfile_t *mf, long sample) {
>   return nl + 1;
>  }
>
> +int xdl_blankline(const char *line, long flags)
> +{
> + long i;
> +
> + if (!(flags & XDF_WHITESPACE_FLAGS))
> + return (*line == '\n');
> +
> + for (i = 0; line[i] != '\n' && XDL_ISSPACE(line[i]); i++)
> + ;
> +
> + return (line[i] == '\n');
> +}
> +
>  int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long 
> flags)
>  {
>   int i1, i2;
> diff --git a/xdiff/xutils.h b/xdiff/xutils.h
> index ad1428e..b9cceff 100644
> --- a/xdiff/xutils.h
> +++ b/xdiff/xutils.h
> @@ -32,6 +32,7 @@ int xdl_cha_init(chastore_t *cha, long isize, long icount);
>  void xdl_cha_free(chastore_t *cha);
>  void *xdl_cha_alloc(chastore_t *cha);
>  long xdl_guess_lines(mmfile_t *mf, long sample);
> +int xdl_blankline(const ch

Re: [PATCH v2 3/8] cherry-pick: add --skip-empty option

2013-06-04 Thread Junio C Hamano
Felipe Contreras  writes:

> You didn't answer, what happens when you run --skip-empty and --allow-empty?

I'll answer to a slightly different question: What should happen?

I think it should error out, because --allow-empty is about
"allowing empty commits to be preserved", and --skip-empty is about
"skipping empty commits (as it says on the package)".
--
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


Re: [PATCH] git-remote-mediawiki: use git.pm functions for credentials

2013-06-04 Thread Junio C Hamano
benoit.per...@gmail.com writes:

> From: Benoit Person 
>
> In 52dce6d, a new credential function was added to git.pm, based on
> git-remote-mediawiki's functions. The logical follow-up is to use
> those functions in git-remote-mediawiki.
>
> Signed-off-by: Benoit Person 
> Signed-off-by: Matthieu Moy 
> ---
>  contrib/mw-to-git/git-remote-mediawiki.perl | 66 
> -
>  1 file changed, 9 insertions(+), 57 deletions(-)

With s/git.pm/Git.pm/, the above looks perfect.

> @@ -217,22 +167,24 @@ sub mw_connect_maybe {
>   $mediawiki = MediaWiki::API->new;
>   $mediawiki->{config}->{api_url} = "$url/api.php";
>   if ($wiki_login) {
> - my %credential = (url => $url);
> - $credential{username} = $wiki_login;
> - $credential{password} = $wiki_passwd;
> - credential_run("fill", \%credential);
> + my %credential = (
> + 'url' => $url,
> + 'username' => $wiki_login,
> + 'password' => $wiki_passwd
> + );
> + Git::credential \%credential;
>   my $request = {lgname => $credential{username},
>  lgpassword => $credential{password},
>  lgdomain => $wiki_domain};
>   if ($mediawiki->login($request)) {
> - credential_run("approve", \%credential);
> + Git::credential \%credential, 'approve';

The example in perl/Git.pm for =item credential shows the subroutine
call without surrounding parentheses, and that is perfectly valid
Perl, but given that the prevalent style of subroutine calls made in
this file seems to be with them, i.e. subr(arg, arg), you might want
to consider being consistent here (and in the implicit 'fill' call
several lines above, and 'reject' call below).

Thanks.

>   print STDERR "Logged in mediawiki user 
> \"$credential{username}\".\n";
>   } else {
>   print STDERR "Failed to log in mediawiki user 
> \"$credential{username}\" on $url\n";
>   print STDERR "  (error " .
>   $mediawiki->{error}->{code} . ': ' .
>   $mediawiki->{error}->{details} . ")\n";
> - credential_run("reject", \%credential);
> + Git::credential \%credential, 'reject';
>   exit 1;
>   }
>   }
--
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


Re: [PATCH/RFC] add --authorship-order flag to git log / rev-list

2013-06-04 Thread Junio C Hamano
elliottcable  writes:

> This is my first time submitting a patch to this list, so please, let me know 
> if
> I'm doing any of this the wrong way! I've striven to follow
> `Documentation/SubmittingPatches`. I hope I've succeeded. For that matter, 
> it's
> my first time diving into git's sources, so I obviously would love some
> commentary on the patch itself, as well. ;)
>
> I've tried herein to add an `--authorship-order` flag to complement git-log's
> `--topo-order` and `--date-order` flags; it should operate the same as
> `--date-order`, but using the `AUTHOR_DATE` instead of the `COMMITTER_DATE`.

After reading the subject alone, my reaction was "is this sorting
commits by the name of the author"?

That is one of the expected natural reactions when people hear about
this option, which is not what you want.

Perhaps naming it --authordate-order (or enhance the command line
parsing to allow --date-order=author|committer) would give us a
better UI.

(the above comment is before reading any of the code in the patch).


--
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


Re: git-daemon: needs /root/.config/git/config?

2013-06-04 Thread Johannes Sixt
Am 04.06.2013 18:08, schrieb Jeff King:
> Older versions of git silently ignored errors reading config files, but
> it was tightened in v1.8.1.1, as there can be quite serious implications
> to failing to read expected config (e.g., imagine transfer.fsckobjects,
> or receive.deny* is ignored).
> 
> However, since changing user id and leaving $HOME is so common, there is
> a patch under consideration to loosen the check only for the case of
> EACCES on files in $HOME. That commit is 4698c8f (config: allow
> inaccessible configuration under $HOME, 2013-04-12); it's not yet in any
> released version of git, though.
> 
> In the meantime, the suggested workaround is to set $HOME for the
> git-daemon user, rather than loosening /root.

I've a PHP script in ~/public_html that runs git. Without the mentioned
patch, the script bails out due to this error. This time it's Apache
that gets me into trouble because at the time the PHP script and git
run, $HOME is still /root, but the user identity is not root anymore.
The patch is direly needed; without it, I need to use 'env
HOME=/home/j6t /usr/local/bin/git' in my script.

-- Hannes

--
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


Re: [PATCH] diff: add --ignore-blank-lines option

2013-06-04 Thread Antoine Pelisse
On Tue, Jun 4, 2013 at 8:26 PM, Junio C Hamano  wrote:
> Antoine Pelisse  writes:
>
>> +xdchange_t *xdl_get_hunk(xdchange_t **xscr, xdemitconf_t const *xecfg) {
>>   xdchange_t *xch, *xchp;
>>   long max_common = 2 * xecfg->ctxlen + xecfg->interhunkctxlen;
>> + long ignorable_context = max_common / 2 - 1;
>
> Could you explain how this math works?

I think it doesn't, mostly because I misinterpreted the "interhunkctxlen".
I will try to think about that and provide a reroll.

Thanks for the review and analysis.
Antoine,
--
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


Re: git-daemon: needs /root/.config/git/config?

2013-06-04 Thread Jonathan Nieder
Johannes Sixt wrote:
> Am 04.06.2013 18:08, schrieb Jeff King:

>> However, since changing user id and leaving $HOME is so common, there is
>> a patch under consideration to loosen the check only for the case of
>> EACCES on files in $HOME. That commit is 4698c8f (config: allow
>> inaccessible configuration under $HOME, 2013-04-12); it's not yet in any
>> released version of git, though.
[...]
> I've a PHP script in ~/public_html that runs git. Without the mentioned
> patch, the script bails out due to this error. This time it's Apache
> that gets me into trouble because at the time the PHP script and git
> run, $HOME is still /root, but the user identity is not root anymore.
> The patch is direly needed; without it, I need to use 'env
> HOME=/home/j6t /usr/local/bin/git' in my script.

I could be remembering wrong, but I thought it was not so much "under
consideration" as "accepted for 1.8.4".  I haven't heard any
compelling reasons not to apply it.

Would it would make sense against earlier releases as well?

Thanks,
Jonathan
--
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


Re: [PATCH/RFC] rev-list: add --authorship-order alternative ordering

2013-06-04 Thread Junio C Hamano
elliottcable  writes:

> --date-order is an excellent alternative to --topo-order if you want a feel 
> for
> the *actual history*, chronologically, of your project. I use it often, with
> --graph as well; it's a great way to get an overview of a project's recent
> development history.
>
> However, in a project that rebases various in-development topic-branches 
> often,
> it gets hard to demonstrate a *chronological history* of changes to the
> codebase, as this always “resets” the COMMITTER_DATE (which --date-order uses)
> to the time the rebase happened; which often means ‘last time all of the
> topic-branches were rebased on the latest fixes in master.’
>
> Thus, I've added an --authorship-order version of --date-order, which relies
> upon the AUTHOR_DATE instead of the COMMITTER_DATE; this means that old 
> commits
> will continue to show up chronologically in-order despite rebasing.
> ---

Missing sign-off.  Please see Documentation/SubmittingPatches.

>  builtin/log.c  |  2 +-
>  builtin/rev-list.c |  1 +
>  builtin/rev-parse.c|  1 +
>  builtin/show-branch.c  | 12 -
>  commit.c   | 83 
> ++
>  commit.h   |  3 +-
>  contrib/completion/git-completion.bash |  4 +-
>  po/de.po   |  4 +-
>  po/git.pot |  2 +-
>  po/sv.po   |  4 +-
>  po/vi.po   |  4 +-
>  po/zh_CN.po|  4 +-

Please drop all the changes to po/ area; it is managed by the i18n
coordinator and generated by an automated tool that extracts these
strings from the code.

People who code should not (and do not have to) touch these files.

>  revision.c | 11 -
>  revision.h |  1 +
>  14 files changed, 110 insertions(+), 26 deletions(-)
>
> diff --git a/builtin/log.c b/builtin/log.c
> index 9e21232..54d4d7f 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -237,7 +237,7 @@ static void log_show_early(struct rev_info *revs, struct 
> commit_list *list)
>   int i = revs->early_output;
>   int show_header = 1;
>  
> - sort_in_topological_order(&list, revs->lifo);
> + sort_in_topological_order(&list, revs->lifo, revs->use_author);

The name "use-author" is a clear sign that the person who added this
code were too narrowly focused to think "author" automatically would
mean "author date" ;-).

It probably makes sense to revamp sort_in_topological_order(), so
that its second parameter is not a boolean 'lifo' that tells too
much about its implementation without telling what it actually
means.  Instead, we can make it an enum sort_order, that tells it to
emit the commits in committer-date order, author-date order, or
graph-traversal order.

And update revs->lifo to use that same enum, without adding
use_author_date bit to rev_info.

> @@ -694,6 +697,11 @@ int cmd_show_branch(int ac, const char **av, const char 
> *prefix)
>  show_branch_usage, PARSE_OPT_STOP_AT_NON_OPTION);
>   if (all_heads)
>   all_remotes = 1;
> + /* I'm having trouble figuring out exactly what `lifo` stores. Why do 
> both 'date-order' and
> +  * 'topo-order' set the same variable!? Aren't they mutually exclusive? 
> Since *both* set it, for
> +  * the moment, I'm going to set it for '--authorship-order'; but that 
> seems counterintuitive. */

Lines that are too wide.

/*
 * Also please format multi-line comments
 * like this, nothing other than slash-asterisk
 * on the first and the last lines.
 */

> @@ -301,7 +328,8 @@ int parse_commit_buffer(struct commit *item, const void 
> *buffer, unsigned long s
>   pptr = &commit_list_insert(new_parent, pptr)->next;
>   }
>   }
> - item->date = parse_commit_date(bufptr, tail);
> + item->date = parse_commit_committer_date(bufptr, tail);
> + item->author_date = parse_commit_author_date(bufptr, tail);
> ...
> diff --git a/commit.h b/commit.h
> index 67bd509..de07525 100644
> --- a/commit.h
> +++ b/commit.h
> @@ -17,6 +17,7 @@ struct commit {
>   void *util;
>   unsigned int indegree;
>   unsigned long date;
> + unsigned long author_date;

While walking we keep many of them in-core, and 8-byte each for each
commit objects add up.  We do not want to make "struct commit" any
larger than it already is.
--
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


Re: git-daemon: needs /root/.config/git/config?

2013-06-04 Thread Junio C Hamano
Jonathan Nieder  writes:

> I could be remembering wrong, but I thought it was not so much "under
> consideration" as "accepted for 1.8.4".  I haven't heard any
> compelling reasons not to apply it.
>
> Would it would make sense against earlier releases as well?

True; the patch is queued on a topic that forks from maint-1.8.2
exactly for this reason.
--
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


Re: [PATCH] t/README: test_must_fail is for testing Git

2013-06-04 Thread Philip Oakley

From: "Junio C Hamano" 
Sent: Tuesday, June 04, 2013 5:50 PM

When a test wants to make sure there is no  in an output
file, we should just say "! grep string output";


Small nit: It took me two readings of the commit message to correctly 
parse this break point. The flowing together of the two parts with the 
semicolon fooled me. Separate them?



 "test_must_fail"
is there only to test Git command and catch unusual deaths we know
about (e.g. segv) as an error, not as an expected failure.

Signed-off-by: Junio C Hamano 
---
t/README | 3 +++
1 file changed, 3 insertions(+)

diff --git a/t/README b/t/README
index e669bb3..35b3c5c 100644
--- a/t/README
+++ b/t/README
@@ -324,6 +324,9 @@ Don't:
   use 'test_must_fail git cmd'.  This will signal a failure if git
   dies in an unexpected way (e.g. segfault).

+   On the other hand, don't use test_must_fail for running regular
+   platform commands; just use '! cmd'.
+
 - use perl without spelling it as "$PERL_PATH". This is to help our
   friends on Windows where the platform Perl often adds CR before
   the end of line, and they bundle Git with a version of Perl that
--


Philip 


--
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


Re: [PATCH] diff: add --ignore-blank-lines option

2013-06-04 Thread Junio C Hamano
Antoine Pelisse  writes:

> On Tue, Jun 4, 2013 at 8:26 PM, Junio C Hamano  wrote:
>> Antoine Pelisse  writes:
>>
>>> +xdchange_t *xdl_get_hunk(xdchange_t **xscr, xdemitconf_t const *xecfg) {
>>>   xdchange_t *xch, *xchp;
>>>   long max_common = 2 * xecfg->ctxlen + xecfg->interhunkctxlen;
>>> + long ignorable_context = max_common / 2 - 1;
>>
>> Could you explain how this math works?
>
> I think it doesn't, mostly because I misinterpreted the "interhunkctxlen".
> I will try to think about that and provide a reroll.

OK.  Thanks.

I think the logic would be more like:

 1. Start from xscr, find the first xchp that is !xchp->ignore;
if there is none, we are done. There is no more to show.

 2. Remember the xchp as the beginning.

 3. Tangle ->next pointer to find the next xch that is !xch->ignore;
if there is none, we are also done.  xdchanges between the
beginning you remembered in the step 2. and your current xchp
are the only things we want to show.

 4. Measure the distance between the end of xchp and the beginning
of xch.

- If it is larger than max_common, xdchanges between the
  beginning you remembered in the step 2. and your current xchp
  are the only things we want to show.  The next iteration will
  start by skipping the blank-only changes between xchp and xch.

- If it is short enough, assign xchp = xch and go back to 3. to
  find more interesting hunks (that is why we remembered the
  real "beginning" in step 2.).

--
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


Re: [PATCH] t/README: test_must_fail is for testing Git

2013-06-04 Thread Junio C Hamano
"Philip Oakley"  writes:

> From: "Junio C Hamano" 
> Sent: Tuesday, June 04, 2013 5:50 PM
>> When a test wants to make sure there is no  in an output
>> file, we should just say "! grep string output";
>
> Small nit: It took me two readings of the commit message to correctly
> parse this break point. The flowing together of the two parts with the
> semicolon fooled me. Separate them?
>
>>  "test_must_fail"
>> is there only to test Git command and catch unusual deaths we know
>> about (e.g. segv) as an error, not as an expected failure.

Thanks.  Does this read better?

t/README: test_must_fail is for testing Git

When a test wants to make sure there is no  in an output
file, we should just say "! grep string output".

"test_must_fail" is there only to test Git command and catch unusual
deaths we know about (e.g. segv) as an error, not as an expected
failure.  "test_must_fail grep string output" is unnecessary, as
we are not making sure the system binaries do not dump core or
anything like that.

Signed-off-by: Junio C Hamano 
--
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


Re: [PATCH] diff: add --ignore-blank-lines option

2013-06-04 Thread Antoine Pelisse
On Tue, Jun 4, 2013 at 10:46 PM, Junio C Hamano  wrote:
> OK.  Thanks.
>
> I think the logic would be more like:
>
>  1. Start from xscr, find the first xchp that is !xchp->ignore;
> if there is none, we are done. There is no more to show.
>
>  2. Remember the xchp as the beginning.
>
>  3. Tangle ->next pointer to find the next xch that is !xch->ignore;
> if there is none, we are also done.  xdchanges between the
> beginning you remembered in the step 2. and your current xchp
> are the only things we want to show.
>
>  4. Measure the distance between the end of xchp and the beginning
> of xch.
>
> - If it is larger than max_common, xdchanges between the
>   beginning you remembered in the step 2. and your current xchp
>   are the only things we want to show.  The next iteration will
>   start by skipping the blank-only changes between xchp and xch.
>
> - If it is short enough, assign xchp = xch and go back to 3. to
>   find more interesting hunks (that is why we remembered the
>   real "beginning" in step 2.).

Yeah, I'm doing something pretty much like that right now (though I
will have to eventually sleep).
I decided that it would indeed be easier to split the logic rather
than do everything in one loop.

Thanks for the help !
--
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


Re: git-daemon: needs /root/.config/git/config?

2013-06-04 Thread Jeff King
On Tue, Jun 04, 2013 at 12:10:25PM -0700, Jonathan Nieder wrote:

> >> However, since changing user id and leaving $HOME is so common, there is
> >> a patch under consideration to loosen the check only for the case of
> >> EACCES on files in $HOME. That commit is 4698c8f (config: allow
> >> inaccessible configuration under $HOME, 2013-04-12); it's not yet in any
> >> released version of git, though.
> [...]
> > I've a PHP script in ~/public_html that runs git. Without the mentioned
> > patch, the script bails out due to this error. This time it's Apache
> > that gets me into trouble because at the time the PHP script and git
> > run, $HOME is still /root, but the user identity is not root anymore.
> > The patch is direly needed; without it, I need to use 'env
> > HOME=/home/j6t /usr/local/bin/git' in my script.
> 
> I could be remembering wrong, but I thought it was not so much "under
> consideration" as "accepted for 1.8.4".  I haven't heard any
> compelling reasons not to apply it.
> 
> Would it would make sense against earlier releases as well?

Yeah, I think it would. I only said "under consideration" because I saw
that it was in "next" and not elsewhere, and did not hunt down the exact
status in "What's Cooking".

-Peff
--
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


Re: [PATCH 05/11] tests: use test_ln_s_add to remove SYMLINKS prerequisite (trivial cases)

2013-06-04 Thread Junio C Hamano
Johannes Sixt  writes:

> There are many instances where the treatment of symbolic links in the
> object model and the algorithms are tested, but where it is not
> necessary to actually have a symbolic link in the worktree. Make
> adjustments to the tests and remove the SYMLINKS prerequisite when
> appropriate in trivial cases, where "trivial" means:
>
> - merely a replacement of 'ln -s a b' to test_ln_s or of
>   'ln -s a b && git add b' to test_ln_s_add is needed;
>
> - a test for symbolic link on the file system can be split off (and
>   remains protected by SYMLINKS);
>
> - existing code is equivalent to test_ln_s[_add].

This is too big to review in one go, so I may have separate messages
later on this same patch.

> diff --git a/t/t2003-checkout-cache-mkdir.sh b/t/t2003-checkout-cache-mkdir.sh
> index ff163cf..bd17ba2 100755
> --- a/t/t2003-checkout-cache-mkdir.sh
> +++ b/t/t2003-checkout-cache-mkdir.sh
> @@ -19,10 +19,10 @@ test_expect_success 'setup' '
>   git update-index --add path0 path1/file1
>  '
>  
> -test_expect_success SYMLINKS 'have symlink in place where dir is expected.' '
> +test_expect_success 'have symlink in place where dir is expected.' '
>   rm -fr path0 path1 &&
>   mkdir path2 &&
> - ln -s path2 path1 &&
> + test_ln_s path2 path1 &&
>   git checkout-index -f -a &&
>   test ! -h path1 && test -d path1 &&
>   test -f path1/file1 && test ! -f path2/file1

I do not think this hunk is correct.

We have two regular files in the index: path0, path1/file1, and we
add a symbolic link path1 that happens to point at directory path2/
in the working tree.

The test is about making sure that checkout-index is not confused by
the symbolic link in the working tree, by attempting to checkout
path1/file1.

Under the precondition checkout-index runs in this test, a casual

echo rezrov >path1/file1

would leave path1 as a symlink without turning it into a real
directory, and we will end up creating path2/file1.  We are making
sure that checkout-index does not behave that way, and it is
essential to have symlink support in the working tree for the "bug"
to trigger.

On a filesystem without symbolic links, the patched test would pass
just fine, but there can be no aliasing between path1 and path2 in
the first place.

> @@ -79,10 +79,10 @@ test_expect_success SYMLINKS 'use --prefix=tmp/orary- 
> where tmp is a symlink' '
>   test -h tmp
>  '
>  
> -test_expect_success SYMLINKS 'use --prefix=tmp- where tmp-path1 is a 
> symlink' '
> +test_expect_success 'use --prefix=tmp- where tmp-path1 is a symlink' '
>   rm -fr path0 path1 path2 tmp* &&
>   mkdir tmp1 &&
> - ln -s tmp1 tmp-path1 &&
> + test_ln_s tmp1 tmp-path1 &&
>   git checkout-index --prefix=tmp- -f -a &&
>   test -f tmp-path0 &&
>   test ! -h tmp-path1 &&

This change has the same issue, I think.  We prepare tmp-path1
symbolic link to trap a casual "echo rezrov >tmp-path1/file1" to be
redirected to tmp1/file1 while leaving tmp-path1 as a symlink,
making sure we do the equivalent of "rm tmp-path1; mkdir tmp-path1"
before "echo rezrov >tmp-path1/file1".



--
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


Re: [PATCH] t/README: test_must_fail is for testing Git

2013-06-04 Thread Philip Oakley

From: "Junio C Hamano" 
Sent: Tuesday, June 04, 2013 9:49 PM

"Philip Oakley"  writes:


From: "Junio C Hamano" 
Sent: Tuesday, June 04, 2013 5:50 PM

When a test wants to make sure there is no  in an output
file, we should just say "! grep string output";


Small nit: It took me two readings of the commit message to correctly
parse this break point. The flowing together of the two parts with 
the

semicolon fooled me. Separate them?


 "test_must_fail"
is there only to test Git command and catch unusual deaths we know
about (e.g. segv) as an error, not as an expected failure.


Thanks.  Does this read better?


Yes.  Thanks.



   t/README: test_must_fail is for testing Git

   When a test wants to make sure there is no  in an output
   file, we should just say "! grep string output".

   "test_must_fail" is there only to test Git command and catch 
unusual

   deaths we know about (e.g. segv) as an error, not as an expected
   failure.  "test_must_fail grep string output" is unnecessary, as
   we are not making sure the system binaries do not dump core or
   anything like that.

   Signed-off-by: Junio C Hamano 
--


Philip 


--
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


Re: [PATCH 08/15] for-each-ref: get --pretty using format_commit_message

2013-06-04 Thread Eric Sunshine
On Tue, Jun 4, 2013 at 8:35 AM, Ramkumar Ramachandra  wrote:
> From: Nguyễn Thái Ngọc Duy 
>
> [rr: documentation]
>
> Signed-off-by: Ramkumar Ramachandra 
> ---
>  Documentation/git-for-each-ref.txt | 22 -
>  builtin/for-each-ref.c | 67 
> --
>  2 files changed, 85 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/git-for-each-ref.txt 
> b/Documentation/git-for-each-ref.txt
> index f2e08d1..6135812 100644
> --- a/Documentation/git-for-each-ref.txt
> +++ b/Documentation/git-for-each-ref.txt
> @@ -47,6 +48,25 @@ OPTIONS
> `xx`; for example `%00` interpolates to `\0` (NUL),
> `%09` to `\t` (TAB) and `%0a` to `\n` (LF).
>
> +::
> +   A format string with supporting placeholders described in the
> +   "PRETTY FORMATS" section in linkgit:git-log[1].  Additionally
> +   supports placeholders from ``
> +   (i.e. `%[*](fieldname)`).
> ++
> +Caveats:
> +
> +1. Many of the placeholders in "PRETTY FORMATS" are designed to work
> +   specifically on commit objects: when non-commit objects are
> +   supplied, those placeholders won't work.

Should "won't work" be expanded upon? It's not clear if this means
that git will outright crash, or if it will abort with an appropriate
error message, or if the directive will be displayed as-is or removed
from the output.

> +2. Does not interpolate `%ab` (where `ab` are hex digits) with the
> +   corresponding hex code.  To print a byte from a hex code, use
> +   `%xab` (from pretty-formats) instead.
> +
> +3. Only the placeholders inherited from `` will respect
> +   quoting settings.
> +
>  ...::
> If one or more patterns are given, only refs are shown that
> match against at least one pattern, either using fnmatch(3) or
--
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


Re: [PATCH 12/15] for-each-ref: introduce %(upstream:track[short])

2013-06-04 Thread Eric Sunshine
On Tue, Jun 4, 2013 at 8:35 AM, Ramkumar Ramachandra  wrote:
> Introduce %(upstream:track) to display "[ahead M, behind N]" and
> %(upstream:trackshort) to display "=", ">", "<", or "<>"
> appropriately (inspired by the contrib/completion/git-prompt.sh).

Bikeshedding: s/trackshort/trackbrief/ perhaps?

> Now you can use the following format in for-each-ref:
>
>   %C(green)%(refname:short)%C(reset)%(upstream:trackshort)
>
> to display refs with terse tracking information.
>
> Note that :track and :trackshort only works with upstream, and errors

s/works/work/
s/errors/error/

> out when used with anything else.
>
> Signed-off-by: Ramkumar Ramachandra 
--
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


Re: [PATCH 15/15] for-each-ref: use get_pretty_userformat in --pretty

2013-06-04 Thread Eric Sunshine
On Tue, Jun 4, 2013 at 8:35 AM, Ramkumar Ramachandra  wrote:
> Use get_pretty_userformat() to interpret the --pretty string.  This
> means that leading you can now reference a format specified in a pretty.*

s/leading// perhaps?

> configuration variable as an argument to 'git for-each-ref --pretty='.
> There are two caveats:
>
> 1. A leading "format:" or "tformat:" is automatically stripped and
>ignored.  Separator semantics are not configurable (yet).
>
> 2. No built-in formats are available.  The ones specified in
>pretty-formats (oneline, short etc) don't make sense when displaying
>refs anyway.
>
> Signed-off-by: Ramkumar Ramachandra 
--
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


Re: SNI (SSL virtual hosts)

2013-06-04 Thread Daniel Stenberg

On Tue, 4 Jun 2013, Janusz Harkot wrote:


What makes you suggest that's what's happening? Sure, if it would've sent no
or the wrong host name it would probably have that effect.


line:

[36] * Re-using existing connection! (#0) with host (nil)


Ah that. Yes, that's a stupid line to show (that bug has been fixed since). 
But if you look further down your log you see that the connection which is 
re-used according to that log line gets closed anyway.



it looks like it is working


Awesome!

So, the question is still why it is not working with openssl 0.9.8r - this 
version supports SNI by default. This looks like an error in openssl (maybe: 
Only allow one SGC handshake restart for SSL/TLS.)


Right. As you can see in the libcurl code it activates SNI for OpenSSL the 
exact same way independently of what version that's used.


Now is the question, shall this be handled by curl or left alone? (handling 
older version of openssl, and force new ssl session?)


I'm not even completely convinced this is "just" an old-OpenSSL-problem. If 
that version you're using is the one Apple has provided, there's the risk that 
the problem is rather caused by their changes!


I'm reluctant to globally switch off session-id caching for OpenSSL 0.9.8 
users since that feature has been used for over 8 years in the code and you're 
the first to have a problem with it! =-/


--

 / daniel.haxx.se
--
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


Re: [PATCH/RFC] rev-list: add --authorship-order alternative ordering

2013-06-04 Thread Junio C Hamano
Junio C Hamano  writes:

>> @@ -301,7 +328,8 @@ int parse_commit_buffer(struct commit *item, const void 
>> *buffer, unsigned long s
>>  pptr = &commit_list_insert(new_parent, pptr)->next;
>>  }
>>  }
>> -item->date = parse_commit_date(bufptr, tail);
>> +item->date = parse_commit_committer_date(bufptr, tail);
>> +item->author_date = parse_commit_author_date(bufptr, tail);
>> ...
>> diff --git a/commit.h b/commit.h
>> index 67bd509..de07525 100644
>> --- a/commit.h
>> +++ b/commit.h
>> @@ -17,6 +17,7 @@ struct commit {
>>  void *util;
>>  unsigned int indegree;
>>  unsigned long date;
>> +unsigned long author_date;
>
> While walking we keep many of them in-core, and 8-byte each for each
> commit objects add up.  We do not want to make "struct commit" any
> larger than it already is.

Having said that, I do not see a reasonable alternative
implementation than adding an author-date field to struct commit
without major restructuring if we were to add this feature.

So please do not take this part of the response as a "patch rejected
because we do not want to add anything to this structure".  We'll
think of something down the road, but as an independent topic after
this gets in (or doesn't).
--
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


Re: [PATCH/RFC] rev-list: add --authorship-order alternative ordering

2013-06-04 Thread Jeff King
On Tue, Jun 04, 2013 at 12:14:21PM -0700, Junio C Hamano wrote:

> > diff --git a/commit.h b/commit.h
> > index 67bd509..de07525 100644
> > --- a/commit.h
> > +++ b/commit.h
> > @@ -17,6 +17,7 @@ struct commit {
> > void *util;
> > unsigned int indegree;
> > unsigned long date;
> > +   unsigned long author_date;
> 
> While walking we keep many of them in-core, and 8-byte each for each
> commit objects add up.  We do not want to make "struct commit" any
> larger than it already is.

Yeah, I had the same thought. Maybe this is a good candidate to build on
top of the jk/commit-info slab experiment. The topo-sort could allocate
an extra slab for author-date (or even expand the indegree slab to hold
both indegree and author date), use it during the sort, and then free it
afterwards.

Elliott: you can see the relevant changes to the topo-sort in commit
96c4f4a (commit: allow associating auxiliary info on-demand,
2013-04-09).

-Peff
--
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


Re: git-daemon: needs /root/.config/git/config?

2013-06-04 Thread Junio C Hamano
Jeff King  writes:

> On Tue, Jun 04, 2013 at 12:10:25PM -0700, Jonathan Nieder wrote:
>
>> >> However, since changing user id and leaving $HOME is so common, there is
>> >> a patch under consideration to loosen the check only for the case of
>> >> EACCES on files in $HOME. That commit is 4698c8f (config: allow
>> >> inaccessible configuration under $HOME, 2013-04-12); it's not yet in any
>> >> released version of git, though.
>> [...]
>> > I've a PHP script in ~/public_html that runs git. Without the mentioned
>> > patch, the script bails out due to this error. This time it's Apache
>> > that gets me into trouble because at the time the PHP script and git
>> > run, $HOME is still /root, but the user identity is not root anymore.
>> > The patch is direly needed; without it, I need to use 'env
>> > HOME=/home/j6t /usr/local/bin/git' in my script.
>> 
>> I could be remembering wrong, but I thought it was not so much "under
>> consideration" as "accepted for 1.8.4".  I haven't heard any
>> compelling reasons not to apply it.
>> 
>> Would it would make sense against earlier releases as well?
>
> Yeah, I think it would. I only said "under consideration" because I saw
> that it was in "next" and not elsewhere, and did not hunt down the exact
> status in "What's Cooking".

Sorry about that; it is in 'master' but "What's cooking" for that
pushout hasn't been published yet (the description of what I did
yesterday will be rolled into today's issue together with the
description of what I did today at the end of day).
--
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


Re: SNI (SSL virtual hosts)

2013-06-04 Thread Janusz Harkot
valid point, but from what you can find on the web, the only solution provided 
everywhere was to
disable certificate checking… so maybe that's not me, but this is first time 
someone spent
some time to check whats going on :)

at least there will be something, maybe this will help someone…

thanks Daniel!


best!
Janusz








On Tuesday, 4 June 2013 at 23:18, Daniel Stenberg wrote:

> On Tue, 4 Jun 2013, Janusz Harkot wrote:
>  
> > > What makes you suggest that's what's happening? Sure, if it would've sent 
> > > no
> > > or the wrong host name it would probably have that effect.
> >  
> >  
> >  
> > line:
> >  
> > [36] * Re-using existing connection! (#0) with host (nil)
>  
> Ah that. Yes, that's a stupid line to show (that bug has been fixed since).  
> But if you look further down your log you see that the connection which is  
> re-used according to that log line gets closed anyway.
>  
> > it looks like it is working
>  
> Awesome!
>  
> > So, the question is still why it is not working with openssl 0.9.8r - this  
> > version supports SNI by default. This looks like an error in openssl 
> > (maybe:  
> > Only allow one SGC handshake restart for SSL/TLS.)
>  
>  
>  
> Right. As you can see in the libcurl code it activates SNI for OpenSSL the  
> exact same way independently of what version that's used.
>  
> > Now is the question, shall this be handled by curl or left alone? (handling 
> >  
> > older version of openssl, and force new ssl session?)
>  
>  
>  
> I'm not even completely convinced this is "just" an old-OpenSSL-problem. If  
> that version you're using is the one Apple has provided, there's the risk 
> that  
> the problem is rather caused by their changes!
>  
> I'm reluctant to globally switch off session-id caching for OpenSSL 0.9.8  
> users since that feature has been used for over 8 years in the code and 
> you're  
> the first to have a problem with it! =-/
>  
> --  
>  
> / daniel.haxx.se (http://daniel.haxx.se)
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majord...@vger.kernel.org 
> (mailto:majord...@vger.kernel.org)
> More majordomo info at http://vger.kernel.org/majordomo-info.html



--
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


Re: What's cooking in git.git (May 2013, #09; Wed, 29)

2013-06-04 Thread Jens Lehmann
Am 04.06.2013 14:48, schrieb John Keeping:
> On Tue, Jun 04, 2013 at 09:17:17PM +1000, Heiko Voigt wrote:
>> On Tue, Jun 04, 2013 at 09:10:45AM +0100, John Keeping wrote:
>>> On Tue, Jun 04, 2013 at 03:29:51PM +1000, Heiko Voigt wrote:
 On Mon, Jun 03, 2013 at 11:23:41PM +0100, John Keeping wrote:
>> Sorry, I should have been more specific here. I saw that you did some
>> changes to make "submodule add" do the right thing with relative paths,
>> but the following change to t7406 does not work like I believe it
>> should but instead makes the test fail:
>> ---8<-
>> diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
>> index a4ffea0..9766b9e 100755
>> --- a/t/t7406-submodule-update.sh
>> +++ b/t/t7406-submodule-update.sh
>> @@ -559,7 +559,9 @@ test_expect_success 'add different submodules to the 
>> same pa
>>  test_expect_success 'submodule add places git-dir in superprojects 
>> git-dir' '
>> (cd super &&
>>  mkdir deeper &&
>> -git submodule add ../submodule deeper/submodule &&
>> +(cd deeper &&
>> + git submodule add ../../submodule submodule
>> +) &&
>>  (cd deeper/submodule &&
>>   git log > ../../expected
>>  ) &&
>> ---8<-
>
> Ah, ok.  I think this case is problematic because the repository
> argument is either relative to "remote.origin.url" or to the top of the
> working tree if there is no "origin" remote.  I wonder if we should just
> die when a relative path is given for the repository and we're not at
> the top of the working tree.

 Why not behave as if we are at the top of the working tree for relative
 paths? If there is an origin remote thats fine. If there is no origin
 remote you could warn that the path used is taken relative from the root
 of the superproject during add. What do you think?
>>>
>>> That's what the patch currently queued on "pu" does, which Jens wants to
>>> change, isn't it?
>>
>> True I did not realize this when reading it the first time. But I think
>> we should still not die when in a subdirectory. After all this series is
>> trying to archive that the submodule command works in subdirectories
>> seamlessly right? So you probably want to translate a relative path
>> without "origin" remote given from a subdirectory to the superproject
>> level and use that. Then you do not have to die.
> 
> The problem is that sometimes you do want to adjust the path and
> sometimes you don't.  Reading git-submodule(1), it says:
> 
>  This may be either an absolute URL, or (if it begins with ./ or
>  ../), the location relative to the superproject’s origin
>  repository.
>  [snip]
>  If the superproject doesn’t have an origin configured the
>  superproject is its own authoritative upstream and the current
>  working directory is used instead.
> 
> So I think it's quite reasonable to have a server layout that looks like
> this:
> 
> project
> |- libs
> |  |- libA
> |  `- libB
> |- core.git
> 
> and with only core.git on your local system do:
> 
> cd core/libs
> git submodule add ../libs/libB
> 
> expecting that to point to libB.  But if we adjust the path then the
> user has to do:
> 
> git submodule add ../../libs/libB
> 
> However, it is also perfectly reasonable to have no remote configured
> and the library next to the repository itself.  In which case we do want
> to specify the additional "../" so that shell completion works in the
> natural way.

Exactly.

> The only way I can see to resolve the ambiguity is to die when we hit
> this particular case.

Hmm, I'm not so sure about that. Don't the first three lines in
resolve_relative_url() show how to distinguish between these two
cases?

resolve_relative_url ()
{
remote=$(get_default_remote)
remoteurl=$(git config "remote.$remote.url") ||
remoteurl=$(pwd) # the repository is its own authoritative 
upstream
...

And this looks like a central place to handle this issue too (but I
admit I only glanced over the call sites of resolve_relative_url(),
so I might be missing something here).
--
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


Re: [PATCH v3 0/6] git send-email suppress-cc=self fixes

2013-06-04 Thread Michael S. Tsirkin
On Tue, Jun 04, 2013 at 10:40:51AM -0700, Junio C Hamano wrote:
> "Michael S. Tsirkin"  writes:
> 
> > This includes bugfixes related to handling of --suppress-cc=self
> > flag. Tests are also included.
> 
> Hmph, flipped the patches without test-applying first?

No, I generated the patches with git format-patch,
then processed with git send-email.

> 2/6 adds two lines to test_suppress_self_quoted helper function, but
> that is introduced only at 4/6.

I don't see it
All I see in 2/6 is this:

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index e1a7f3e..f81e5f5 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -204,13 +204,15 @@ test_suppress_self_unquoted () {

unquoted-$3

+   cccmd--$1 <$2>
+
Cc: $1 <$2>
Signed-off-by: $1 <$2>
EOF
 }

 test_expect_success $PREREQ 'self name is suppressed' "
-   test_suppress_self_unquoted 'A U Thor' 'aut...@redhat.com' \
+   test_suppress_self_unquoted 'A U Thor' 'aut...@example.com' \
'self_name_suppressed'
 "

where's test_suppress_self_quoted here?


> >
> > Changes from v2:
> > - add a new test, split patches differently add code comments
> >  to address comments by Junio
> > - rename example addresses in tests from redhat.com to example.com
> > Changes from v1:
> > - tweak coding style in tests to address comments by Junio
> >
> >
> > Michael S. Tsirkin (6):
> >   send-email: fix suppress-cc=self on cccmd
> >   t/send-email: test suppress-cc=self on cccmd
> >   send-email: make --suppress-cc=self sanitize input
> >   t/send-email: add test with quoted sender
> >   t/send-email: test suppress-cc=self with non-ascii
> >   test-send-email: test for pre-sanitized self name
> >
> >  git-send-email.perl   | 23 +++
> >  t/t9001-send-email.sh | 34 +-
> >  2 files changed, 48 insertions(+), 9 deletions(-)
--
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


Re: [PATCH 05/11] tests: use test_ln_s_add to remove SYMLINKS prerequisite (trivial cases)

2013-06-04 Thread Junio C Hamano
Johannes Sixt  writes:

> There are many instances where the treatment of symbolic links in the
> object model and the algorithms are tested, but where it is not
> necessary to actually have a symbolic link in the worktree.

> diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh
> index 88be904..563ac7f 100755
> --- a/t/t3000-ls-files-others.sh
> +++ b/t/t3000-ls-files-others.sh
> @@ -19,12 +19,7 @@ filesystem.
>  
>  test_expect_success 'setup ' '
>   date >path0 &&
> - if test_have_prereq SYMLINKS
> - then
> - ln -s xyzzy path1
> - else
> - date >path1
> - fi &&
> + test_ln_s xyzzy path1 &&
>   mkdir path2 path3 path4 &&
>   date >path2/file2 &&
>   date >path2-junk &&

This also is not appropriate, but it is not as bad as the one in
t2003 I earlier commented on.

This test wants an untracked symbolic link in the working tree as
path1 and wants to see "ls-files -o" report it as "other".  On a
filesystem that lack symbolic link, we obviously cannot have one,
so as a substitute we just create another regular file to make the
expected output and comparison simpler. 

> diff --git a/t/t3010-ls-files-killed-modified.sh 
> b/t/t3010-ls-files-killed-modified.sh
> index 2d0ff2d..310e0a2 100755
> --- a/t/t3010-ls-files-killed-modified.sh
> +++ b/t/t3010-ls-files-killed-modified.sh
> @@ -39,12 +39,7 @@ modified without reporting path9 and path10.
> ...
> + test_ln_s_add xyzzy path1 &&
> ...
>   date >path2/file2 &&
>   date >path3/file3 &&

This one is correct; the test wants to make sure that path1 would be
checked out as a non-directory, killing any files in path1/ that is
a directory on the filesystem.

> @@ -52,20 +47,14 @@ test_expect_success 'git update-index --add to add 
> various paths.' '
>   date >path8 &&
>   : >path9 &&
>   date >path10 &&
> - git update-index --add -- path0 path1 path?/file? path7 path8 path9 
> path10 &&
> + git update-index --add -- path0 path?/file? path7 path8 path9 path10 &&

And exclusion of path1 here is a logical consequence of the previous
change, so it is good, too.

>  test_expect_success 'git ls-files -k to show killed files.' '
>   date >path2 &&
> - if test_have_prereq SYMLINKS
> - then
> - ln -s frotz path3 &&
> - ln -s nitfol path5
> - else
> - date >path3 &&
> - date >path5
> - fi &&
> + test_ln_s frotz path3 &&
> + test_ln_s nitfol path5 &&

This falls into the same category as the one in t3000 above.  The
only thing that matters in this test is path3 and path5 are non
directories so that the former is killed when path3/file3 needs to
be checked out, while path5 will not appear in "ls-files -k" output.
Ideally we would want to test regular files and symlinks as two
different kinds of "non directory" filesystem entities, but on
platforms that lack symbolic links we cannot do so, hence we punt
and create a regular file.

> diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh
> index f0d5041..3888519 100755
> --- a/t/t4011-diff-symlink.sh
> +++ b/t/t4011-diff-symlink.sh
> @@ -66,12 +69,12 @@ test_expect_success SYMLINKS 'diff removed symlink and 
> file' '
>   compare_diff_patch expected current
>  '
>  
> -test_expect_success SYMLINKS 'diff identical, but newly created symlink and 
> file' '
> +test_expect_success 'diff identical, but newly created symlink and file' '
>   >expected &&
>   rm -f frotz nitfol &&
>   echo xyzzy >nitfol &&
>   test-chmtime +10 nitfol &&
> - ln -s xyzzy frotz &&
> + test_ln_s xyzzy frotz &&
>   git diff-index -M -p $tree >current &&
>   compare_diff_patch expected current &&

As the point of test is to compare $tree that has symlink with
another symlink that is identical but newly created one, I think
this _does_ want the filesystem entity to be a symbolic link, but
the index has frotz as a symlink and the mode propagates to what we
read from the filesystem on !has_symlinks systems, so this
conversion may be a correct one, though it is a bit tricky.

> @@ -80,7 +83,7 @@ test_expect_success SYMLINKS 'diff identical, but newly 
> created symlink and file
>   compare_diff_patch expected current
>  '
>  
> -test_expect_success SYMLINKS 'diff different symlink and file' '
> +test_expect_success 'diff different symlink and file' '
>   cat >expected <<-\EOF &&
>   diff --git a/frotz b/frotz
>   index 7c465af..df1db54 12
> @@ -100,7 +103,7 @@ test_expect_success SYMLINKS 'diff different symlink and 
> file' '
>   +yxyyz
>   EOF
>   rm -f frotz &&
> - ln -s yxyyz frotz &&
> + test_ln_s yxyyz frotz &&
>   echo yxyyz >nitfol &&
>   git diff-index -M -p $tree >current &&
>   compare_diff_patch expected current

Likewise.
--
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.

Re: What's cooking in git.git (May 2013, #09; Wed, 29)

2013-06-04 Thread John Keeping
On Tue, Jun 04, 2013 at 11:39:25PM +0200, Jens Lehmann wrote:
> Am 04.06.2013 14:48, schrieb John Keeping:
> > The problem is that sometimes you do want to adjust the path and
> > sometimes you don't.  Reading git-submodule(1), it says:
> > 
> >  This may be either an absolute URL, or (if it begins with ./ or
> >  ../), the location relative to the superproject’s origin
> >  repository.
> >  [snip]
> >  If the superproject doesn’t have an origin configured the
> >  superproject is its own authoritative upstream and the current
> >  working directory is used instead.
> > 
> > So I think it's quite reasonable to have a server layout that looks like
> > this:
> > 
> > project
> > |- libs
> > |  |- libA
> > |  `- libB
> > |- core.git
> > 
> > and with only core.git on your local system do:
> > 
> > cd core/libs
> > git submodule add ../libs/libB
> > 
> > expecting that to point to libB.  But if we adjust the path then the
> > user has to do:
> > 
> > git submodule add ../../libs/libB
> > 
> > However, it is also perfectly reasonable to have no remote configured
> > and the library next to the repository itself.  In which case we do want
> > to specify the additional "../" so that shell completion works in the
> > natural way.
> 
> Exactly.
> 
> > The only way I can see to resolve the ambiguity is to die when we hit
> > this particular case.
> 
> Hmm, I'm not so sure about that. Don't the first three lines in
> resolve_relative_url() show how to distinguish between these two
> cases?
>
> resolve_relative_url ()
> {
>   remote=$(get_default_remote)
>   remoteurl=$(git config "remote.$remote.url") ||
>   remoteurl=$(pwd) # the repository is its own authoritative 
> upstream
> ...

If it's this simple, yes.  But I think there's also a third possibility
that combines both of these: what if the local directory structure is
the same as that on the "origin" remote?  Then "origin" exists but we
still want to adjust for the subdirectory.

The risk is that I can't see a behaviour that doesn't seem to choose
whether to convert the given path or not arbitrarily.  Even knowing the
rules, I expect that I could end up being surprised by this if I create
a new repository and haven't set up "origin" yet.
--
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


Re: [PATCH 07/11] t2100: use test_ln_s_add to remove SYMLINKS prerequisite

2013-06-04 Thread Junio C Hamano
Johannes Sixt  writes:

> @@ -62,12 +57,7 @@ test_expect_success 'git update-index to add conflicting 
> file path2 should fail'
>  
>  test_expect_success 'git update-index to add conflicting symlink path3 
> should fail' '
>  
> - if test_have_prereq SYMLINKS
> - then
> - ln -s xyzzy path3
> - else
> - date >path3
> - fi &&
> + test_ln_s xyzzy path3 &&
>   test_must_fail git update-index --add -- path3
>  '

This is also borderline questionable.  With path2, we are already
testing that adding a regular file (one variant of "non directory")
at a path that the index expects to see a directory (the index has
path2/file2 in it at this point) fails, and the test about path3 is
to make sure that an attempt to add a symbolic link, the other
variant of "non directory", is rejected the same way.  So it may
make more sense to skip this test when !SYMLINKS.

If we want to really test the equivalent on a filesystem without
symbolic links, it would be a more faithful test to attempt to add
it using "--add --cacheinfo" and see it fail, i.e.

   test_must_fail_to_ln_s_add xyzzy path3

which would be a copy of test_ln_s_add but has test_must_fail before
two calls to git_update_index it makes.

I think all the test_ln_s_add conversion in the series make sense,
but many uses of test_ln_s are questionable, and I suspect it would
invite similar confusion down the road.
--
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


Re: [PATCH v3 0/6] git send-email suppress-cc=self fixes

2013-06-04 Thread Junio C Hamano
"Michael S. Tsirkin"  writes:

> All I see in 2/6 is this:
>
>   diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
>   index e1a7f3e..f81e5f5 100755
>   --- a/t/t9001-send-email.sh
>   +++ b/t/t9001-send-email.sh
>   @@ -204,13 +204,15 @@ test_suppress_self_unquoted () {

After noticing what is after "@@" here...

>
>   unquoted-$3
>
>   +   cccmd--$1 <$2>
>   +
>   Cc: $1 <$2>
>   Signed-off-by: $1 <$2>
>   EOF
>}
>
>test_expect_success $PREREQ 'self name is suppressed' "
>   -   test_suppress_self_unquoted 'A U Thor' 'aut...@redhat.com' \
>   +   test_suppress_self_unquoted 'A U Thor' 'aut...@example.com' \
>   'self_name_suppressed'
>"
>
> where's test_suppress_self_quoted here?

... isn't addition of "cccmd--$1 <$2>" made to that function?

After applying [PATCH v3 1/6] to 'master', I do not see unquoted-$3
that we see in the context, either.

"git grep unquoted- pu t/t9001*" does show us a hit, but that is
coming from your previous round you are replacing with this series,
so

Confused...
--
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


git archive --worktree-attributes doesn't exclude .gitattributes anymore

2013-06-04 Thread Gianfranco Costamagna
git version 1.8.1.2
(please cc me, I'm not subscribed to this list)


Hi Developers, I write here because since my ubuntu update (quantal to raring)
and git update from 1.7.10.4-1ubuntu1 to 1.8.1.2

my export script doesn't work anymore.

I tried to put .gitattributes or .git/info/attributes, the file is the following
http://pastebin.com/irngA1L8

the git is
git clone http://boinc.berkeley.edu/git/boinc-v2.git

and the command is

git archive --prefix boinc-7.1.7+dfsg/ --format tgz -o 
../boinc_7.1.7+dfsg.orig.tar.gz -9  client_release/7.1/7.1.7

The archive gets created, but every file is inside, no exclusions at all.

I suspect a regression between git 1.7 and 1.8

thanks for your time


Gianfranco

--
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


I: git archive --worktree-attributes doesn't exclude .gitattributes anymore

2013-06-04 Thread Gianfranco Costamagna
Forgot to mention, also this command doesn't work


git archive --worktree-attributes  -v --format tgz -o 
../boinc_7.1.7+dfsg.orig.tar.gz -9 --prefix boinc-7.1.7+dfsg/ 
client_release/7.1/7.1.7


Gianfranco



- Messaggio inoltrato -
> Da: Gianfranco Costamagna 
> A: "git@vger.kernel.org" 
> Cc: 
> Inviato: Mercoledì 5 Giugno 2013 0:18
> Oggetto: git archive --worktree-attributes doesn't exclude .gitattributes 
> anymore
> 
>g it version 1.8.1.2
> (please cc me, I'm not subscribed to this list)
> 
> 
> Hi Developers, I write here because since my ubuntu update (quantal to raring)
> and git update from 1.7.10.4-1ubuntu1 to 1.8.1.2
> 
> my export script doesn't work anymore.
> 
> I tried to put .gitattributes or .git/info/attributes, the file is the 
> following
> http://pastebin.com/irngA1L8
> 
> the git is
> git clone http://boinc.berkeley.edu/git/boinc-v2.git
> 
> and the command is
> 
> git archive --prefix boinc-7.1.7+dfsg/ --format tgz -o 
> ../boinc_7.1.7+dfsg.orig.tar.gz -9  client_release/7.1/7.1.7
> 
> The archive gets created, but every file is inside, no exclusions at all.
> 
> I suspect a regression between git 1.7 and 1.8
> 
> thanks for your time
> 
> 
> Gianfranco
> 
--
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


  1   2   >