gitk pull request // was: Re: gitk: "lime" color incompatible with older Tk versions

2017-01-14 Thread David Aguilar
On Fri, Jan 13, 2017 at 03:20:43AM -0800, David Aguilar wrote:
> 
> Ping.. it would be nice to get this patch applied.

Sorry for the noise, and thank you Paul for the fix.
This was already fixed by Paul in gitk@22a713c72df.

I'm sure Junio will merge gitk.git into git.git soon enough so I
can sit tight until then, but while I'm here I might as well
send out a pull request:

The following changes since commit 22a713c72df8b6799c59287c50cee44c4a6db51e:

  gitk: Follow themed bgcolor in help dialogs (2016-03-19 14:12:21 +1100)

are available in the git repository at:

  git://ozlabs.org/~paulus/gitk.git 

for you to fetch changes up to fbf426478e540f4737860dae622603cc0daba3d2:

  gitk: Update copyright notice to 2016 (2016-12-12 20:46:42 +1100)


Markus Hitter (3):
  gitk: Turn off undo manager in the text widget
  gitk: Remove closed file descriptors from $blobdifffd
  gitk: Clear array 'commitinfo' on reload

Paul Mackerras (2):
  gitk: Use explicit RGB green instead of "lime"
  gitk: Update copyright notice to 2016

Rogier Goossens (3):
  gitk: Add a 'rename' option to the branch context menu
  gitk: Allow checking out a remote branch
  gitk: Include commit title in branch dialog

Satoshi Yasushima (1):
  gitk: Fix Japanese translation for "marked commit"

Stefan Dotterweich (1):
  gitk: Fix missing commits when using -S or -G

Vasco Almeida (2):
  gitk: Makefile: create install bin directory
  gitk: Add Portuguese translation

 Makefile|1 +
 gitk|  166 +--
 po/bg.po|4 +-
 po/ca.po|6 +-
 po/de.po|4 +-
 po/es.po|4 +-
 po/fr.po|4 +-
 po/hu.po|4 +-
 po/it.po|4 +-
 po/ja.po|   13 +-
 po/pt_br.po |4 +-
 po/pt_pt.po | 1376 +++
 po/ru.po|4 +-
 po/sv.po|8 +-
 po/vi.po|4 +-
 15 files changed, 1549 insertions(+), 57 deletions(-)
 create mode 100644 po/pt_pt.po

Thanks,
-- 
David


Re: [PATCH v10 19/20] branch: use ref-filter printing APIs

2017-01-14 Thread Karthik Nayak
Hello,

On Thu, Jan 12, 2017 at 5:17 AM, Jacob Keller  wrote:
> On Tue, Jan 10, 2017 at 12:49 AM, Karthik Nayak  wrote:
>> diff --git a/builtin/branch.c b/builtin/branch.c
>> index 34cd61cd9..f293ee5b0 100644
>> --- a/builtin/branch.c
>> +++ b/builtin/branch.c
>> @@ -37,11 +37,11 @@ static unsigned char head_sha1[20];
>>  static int branch_use_color = -1;
>>  static char branch_colors[][COLOR_MAXLEN] = {
>> GIT_COLOR_RESET,
>> -   GIT_COLOR_NORMAL,   /* PLAIN */
>> -   GIT_COLOR_RED,  /* REMOTE */
>> -   GIT_COLOR_NORMAL,   /* LOCAL */
>> -   GIT_COLOR_GREEN,/* CURRENT */
>> -   GIT_COLOR_BLUE, /* UPSTREAM */
>> +   GIT_COLOR_NORMAL,   /* PLAIN */
>> +   GIT_COLOR_RED,  /* REMOTE */
>> +   GIT_COLOR_NORMAL,   /* LOCAL */
>> +   GIT_COLOR_GREEN,/* CURRENT */
>> +   GIT_COLOR_BLUE, /* UPSTREAM */
>>  };
>
>
> What's... actually changing here? It looks like just white space? Is
> there a strong reason for why this is changing?
>
> Thanks,
> Jake

None, I'm not sure how this ended up being added too.

-- 
Regards,
Karthik Nayak


Re: [PATCH v10 03/20] ref-filter: implement %(if:equals=) and %(if:notequals=)

2017-01-14 Thread Karthik Nayak
Hello,

On Wed, Jan 11, 2017 at 2:15 AM, Junio C Hamano  wrote:
> Karthik Nayak  writes:
>
>> + if_then_else->condition_satisfied = 1;
>> + } else  if (if_then_else->cmp_status == COMPARE_UNEQUAL) {
>
> Please, no space before tabs (locally fixed--no need to resend).

Thanks.

-- 
Regards,
Karthik Nayak


Re: [PATCH v10 00/20] port branch.c to use ref-filter's printing options

2017-01-14 Thread Karthik Nayak
On Wed, Jan 11, 2017 at 2:21 AM, Junio C Hamano  wrote:
> Karthik Nayak  writes:
>
>> index 81db67d74..08be8462c 100644
>> --- a/Documentation/git-for-each-ref.txt
>> +++ b/Documentation/git-for-each-ref.txt
>> @@ -95,13 +95,17 @@ refname::
>>   The name of the ref (the part after $GIT_DIR/).
>>   For a non-ambiguous short name of the ref append `:short`.
>>   The option core.warnAmbiguousRefs is used to select the strict
>> + abbreviation mode. If `lstrip=` is appended, strips ``
>> + slash-separated path components from the front of the refname
>> + (e.g., `%(refname:lstrip=2)` turns `refs/tags/foo` into `foo` and
>> + `%(refname:rstrip=2)` turns `refs/tags/foo` into `refs`).
>
> I hiccupped while reading this, as the (e.g.) example talks about rstrip
> that is not mentioned in the main text that is enhanced by the
> example.
>
> If `lstrip=` (`rstrip=`) is appended, strips ``
> slash-separated path components from the front (tail) of the
> refname (e.g. `%(refname:lstrip=2)` ...
>
> perhaps?
>
>> + if `` is a negative number, then only `` path components
>> + are left behind.
>
> Begin the sentence with cap?  I'd rephrase it a bit while at it if I
> were doing this:
>
> If `` is a negative number, strip as many path components
> as necessary from the specified end to leave `-` path
> components.
>
> Other than the above, looks very good to me.
>
> Thanks.

I like how you rephrased it.
So apart form this and the other change suggested by you and Jacob,
nothing to be added.
Should I re-roll?

-- 
Regards,
Karthik Nayak


Re: [PATCH 2/2] Use 'env' to find perl instead of fixed path

2017-01-14 Thread Eric Wong
Jeff King  wrote:
> Just as a devil's advocate, why do we care about warnings in third-party
> modules? Or more specifically, why do _users_ who are running Git care
> about them? We cannot fix them in Git. A user may report the error to
> the module author, but the module author may not be responsive, or even
> may not be inclined to fix the problem (because they have a particular
> opinion on that warning).

Every user is a potential developer(*).  And I do feel
we (git developers) should be at least somewhat responsible
for helping maintain and fix the projects we depend on;
or moving to alternatives if we can't fix them.

There is a chance a newly-introduced warning in a 3rd-party
module points to a real problem with the way git uses it, too.
Having that warning would help us fix or workaround the bug
(either in git or the module).

I doubt any module author would be unresponsive to having a
localized "no warnings" for special cases.  AFAIK, "-w" is
widespread amongst Perl users (unlike Ruby in my experience).


(*) I feel that more strongly in the git case, and even more so
for the Perl bits since the source is already on the user's
machine.

> In the meantime, the user is stuck with an annoying warning message
> until Git is updated as you showed above. Why not just start there
> preemptively, and let module authors worry about their own warnings?

I'm not saying we blindly start using '-w' everywhere today.
But we may at least try it and see if it introduces new
warnings, first, and only enable '-w' when it it looks quiet
(and perhaps start working with module authors to fix warnings
 if not).

As a user, I'd rather have some indication of where something
might be wrong, than no warning at all when something does go
wrong.


[ANNOUNCE] Git for Windows 2.11.0(3)

2017-01-14 Thread Johannes Schindelin
MIME-Version: 1.0

Fcc: Sent

Dear Git users,

It is my pleasure to announce that Git for Windows 2.11.0(3) is available from:

https://git-for-windows.github.io/

Changes since Git for Windows v2.11.0(2) (January 13th 2017)

Bug Fixes

  • Fixed an off-by-two bug in the POSIX emulation layer that possibly
affected third-party Perl scripts that load native libraries
dynamically.
  • A regression in rebase -i, introduced into v2.11.0(2), which caused
commit attribution to be mishandled after resolving conflicts, was
fixed.
Filename | SHA-256
 | ---
Git-2.11.0.3-64-bit.exe | 
c3897e078cd7f7f496b0e4ab736ce144c64696d3dbee1e5db417ae047ca3e27f
Git-2.11.0.3-32-bit.exe | 
dff9bec9c4e21eaba5556fe4a7b1071d1f18e3a8b9645bffb48fda9eaee37e62
PortableGit-2.11.0.3-64-bit.7z.exe | 
41a4ab3a1f0c88a3254b5a30d49c0c6e4ef06c204ddce53e23fc15d6e56f8d24
PortableGit-2.11.0.3-32-bit.7z.exe | 
8bf3769c37945e991903dd1b988c6b1d97bbf0f3afc9851508974f38bf94dc01
MinGit-2.11.0.3-64-bit.zip | 
bf3714e04bcbafb464353235a27c328c43d40568d6b2e9064f1a63444b8236c5
MinGit-2.11.0.3-32-bit.zip | 
db05d5e98ef1017dd07f27fa4641dc8c0d66ba09da5a196ef656e7f1d7c078e2
Git-2.11.0.3-64-bit.tar.bz2 | 
65296c54f0b8294374547cc6a169d6ea95178e12dee04cd2d4632f39d8fe7852
Git-2.11.0.3-32-bit.tar.bz2 | 
0f0e2f78fc9b91d6c860eb7de742f3601b0ccd13c5c61444c7cf55b00bcb4ed4
Ciao,
Johannes
















Re: [PATCHv3 2/2] builtin/commit.c: switch to xstrfmt(), instead of snprintf,

2017-01-14 Thread Elia Pinto
Ok. I agree. But  is it strictly necessary to resend for this ?

Thanks

2017-01-13 19:33 GMT+01:00 Brandon Williams :
> On 01/13, Elia Pinto wrote:
>> In this patch, instead of using xnprintf instead of snprintf, which asserts
>> that we don't truncate, we are switching to dynamic allocation with  
>> xstrfmt(),
>> , so we can avoid dealing with magic numbers in the code and reduce the 
>> cognitive burden from
>> the programmers, because they no longer have to count bytes needed for 
>> static allocation.
>> As a side effect of this patch we have also reduced the snprintf() calls, 
>> that may silently truncate
>> results if the programmer is not careful.
>>
>> Helped-by: Junio C Hamano 
>> Helped-by: Jeff King 
>> Signed-off-by: Elia Pinto 
>
> Small nit's with the commit message:
> * Stray comma ',' of on its own
> * lines are longer than 80 characters
>
>> ---
>> This is the third  version of the patch.
>>
>> Changes from the first version: I have split the original commit in two, as 
>> discussed here
>> http://public-inbox.org/git/20161213132717.42965-1-gitter.spi...@gmail.com/.
>>
>> Changes from the second version:
>> - Changed the commit message to clarify the purpose of the patch (
>> as suggested by Junio)
>> https://public-inbox.org/git/xmqqtw95mfo3@gitster.mtv.corp.google.com/T/#m2e6405a8a78a8ca1ed770614c91398290574c4a1
>>
>>
>>
>>  builtin/commit.c | 10 --
>>  1 file changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/builtin/commit.c b/builtin/commit.c
>> index 09bcc0f13..37228330c 100644
>> --- a/builtin/commit.c
>> +++ b/builtin/commit.c
>> @@ -1526,12 +1526,10 @@ static int git_commit_config(const char *k, const 
>> char *v, void *cb)
>>  static int run_rewrite_hook(const unsigned char *oldsha1,
>>   const unsigned char *newsha1)
>>  {
>> - /* oldsha1 SP newsha1 LF NUL */
>> - static char buf[2*40 + 3];
>> + char *buf;
>>   struct child_process proc = CHILD_PROCESS_INIT;
>>   const char *argv[3];
>>   int code;
>> - size_t n;
>>
>>   argv[0] = find_hook("post-rewrite");
>>   if (!argv[0])
>> @@ -1547,11 +1545,11 @@ static int run_rewrite_hook(const unsigned char 
>> *oldsha1,
>>   code = start_command(&proc);
>>   if (code)
>>   return code;
>> - n = snprintf(buf, sizeof(buf), "%s %s\n",
>> -  sha1_to_hex(oldsha1), sha1_to_hex(newsha1));
>> + buf = xstrfmt("%s %s\n", sha1_to_hex(oldsha1), sha1_to_hex(newsha1));
>>   sigchain_push(SIGPIPE, SIG_IGN);
>> - write_in_full(proc.in, buf, n);
>> + write_in_full(proc.in, buf, strlen(buf));
>>   close(proc.in);
>> + free(buf);
>>   sigchain_pop(SIGPIPE);
>>   return finish_command(&proc);
>>  }
>> --
>> 2.11.0.154.g5f5f154
>>
>
> --
> Brandon Williams


Re: [PATCH 2/3] xdiff: -W: include immediately preceding non-empty lines in context

2017-01-14 Thread René Scharfe

Am 14.01.2017 um 00:56 schrieb Junio C Hamano:

Vegard Nossum  writes:


The patch will work as intended and as expected for 95% of the users out
there (javadoc, Doxygen, kerneldoc, etc. all have the comment
immediately preceding the function) and fixes a very real problem for me
(and I expect many others) _today_; for the remaining 5% (who put a
blank line between their comment and the start of the function) it will
revert back to the current behaviour, so there should be no regression
for them.


I notice your 95% are all programming languages, but I am more
worried about the contents written in non programming languages
(René gave HTML an an example--there may be other types of contents
that we programmer types do not deal with every day, but Git users
depend on).

I am also more focused on keeping the codebase maintainable in good
health by making sure that we made an effort to find a solution that
is general-enough before solving a single specific problem you have
today.  We may end up deciding that a blank-line heuristics gives us
good enough tradeoff, but I do not want us to make a decision before
thinking.


How about extending the context upward only up to and excluding a line 
that is either empty *or* a function line?  That would limit the extra 
context to a single function in the worst case.


Reducing context at the bottom with the aim to remove comments for the 
next section is more tricky as it could remove part of the function that 
we'd like to show if we get the boundary wrong.  How bad would it be to 
keep the southern border unchanged?


René



Re: [PATCHv3 2/2] builtin/commit.c: switch to xstrfmt(), instead of snprintf,

2017-01-14 Thread René Scharfe
Am 13.01.2017 um 18:58 schrieb Elia Pinto:
> In this patch, instead of using xnprintf instead of snprintf, which asserts
> that we don't truncate, we are switching to dynamic allocation with  
> xstrfmt(),
> , so we can avoid dealing with magic numbers in the code and reduce the 
> cognitive burden from
> the programmers, because they no longer have to count bytes needed for static 
> allocation.
> As a side effect of this patch we have also reduced the snprintf() calls, 
> that may silently truncate 
> results if the programmer is not careful.
> 
> Helped-by: Junio C Hamano 
> Helped-by: Jeff King  
> Signed-off-by: Elia Pinto 
> ---
> This is the third  version of the patch.
> 
> Changes from the first version: I have split the original commit in two, as 
> discussed here
> http://public-inbox.org/git/20161213132717.42965-1-gitter.spi...@gmail.com/.
> 
> Changes from the second version:
> - Changed the commit message to clarify the purpose of the patch (
> as suggested by Junio)
> https://public-inbox.org/git/xmqqtw95mfo3@gitster.mtv.corp.google.com/T/#m2e6405a8a78a8ca1ed770614c91398290574c4a1
> 
> 
> 
>  builtin/commit.c | 10 --
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 09bcc0f13..37228330c 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -1526,12 +1526,10 @@ static int git_commit_config(const char *k, const 
> char *v, void *cb)
>  static int run_rewrite_hook(const unsigned char *oldsha1,
>   const unsigned char *newsha1)
>  {
> - /* oldsha1 SP newsha1 LF NUL */
> - static char buf[2*40 + 3];
> + char *buf;
>   struct child_process proc = CHILD_PROCESS_INIT;
>   const char *argv[3];
>   int code;
> - size_t n;
>  
>   argv[0] = find_hook("post-rewrite");
>   if (!argv[0])
> @@ -1547,11 +1545,11 @@ static int run_rewrite_hook(const unsigned char 
> *oldsha1,
>   code = start_command(&proc);
>   if (code)
>   return code;
> - n = snprintf(buf, sizeof(buf), "%s %s\n",
> -  sha1_to_hex(oldsha1), sha1_to_hex(newsha1));
> + buf = xstrfmt("%s %s\n", sha1_to_hex(oldsha1), sha1_to_hex(newsha1));
>   sigchain_push(SIGPIPE, SIG_IGN);
> - write_in_full(proc.in, buf, n);
> + write_in_full(proc.in, buf, strlen(buf));
>   close(proc.in);
> + free(buf);
>   sigchain_pop(SIGPIPE);
>   return finish_command(&proc);
>  }
> 

Perhaps I missed it from the discussion, but why not use strbuf?  It
would avoid counting the generated string's length.  That's probably
not going to make a measurable difference performance-wise, but it's
easy to avoid and doesn't even take up more lines:
---
 builtin/commit.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 711f96cc43..73bb72016f 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1525,12 +1525,10 @@ static int git_commit_config(const char *k, const char 
*v, void *cb)
 static int run_rewrite_hook(const unsigned char *oldsha1,
const unsigned char *newsha1)
 {
-   /* oldsha1 SP newsha1 LF NUL */
-   static char buf[2*40 + 3];
+   struct strbuf sb = STRBUF_INIT;
struct child_process proc = CHILD_PROCESS_INIT;
const char *argv[3];
int code;
-   size_t n;
 
argv[0] = find_hook("post-rewrite");
if (!argv[0])
@@ -1546,11 +1544,11 @@ static int run_rewrite_hook(const unsigned char 
*oldsha1,
code = start_command(&proc);
if (code)
return code;
-   n = snprintf(buf, sizeof(buf), "%s %s\n",
-sha1_to_hex(oldsha1), sha1_to_hex(newsha1));
+   strbuf_addf(&sb, "%s %s\n", sha1_to_hex(oldsha1), sha1_to_hex(newsha1));
sigchain_push(SIGPIPE, SIG_IGN);
-   write_in_full(proc.in, buf, n);
+   write_in_full(proc.in, sb.buf, sb.len);
close(proc.in);
+   strbuf_release(&sb);
sigchain_pop(SIGPIPE);
return finish_command(&proc);
 }
-- 
2.11.0



Re: [PATCH v3 06/38] sequencer (rebase -i): implement the 'edit' command

2017-01-14 Thread Johannes Schindelin
Hi Junio,

On Thu, 12 Jan 2017, Junio C Hamano wrote:

> Johannes Schindelin  writes:
> 
> > +static int make_patch(struct commit *commit, struct replay_opts *opts)
> > +{
> > +   struct strbuf buf = STRBUF_INIT;
> > +   struct rev_info log_tree_opt;
> > +   const char *subject, *p;
> > +   int res = 0;
> > +
> > +   p = short_commit_name(commit);
> > +   if (write_message(p, strlen(p), rebase_path_stopped_sha(), 1) < 0)
> > +   return -1;
> > +
> > +   strbuf_addf(&buf, "%s/patch", get_dir(opts));
> > +   memset(&log_tree_opt, 0, sizeof(log_tree_opt));
> > +   init_revisions(&log_tree_opt, NULL);
> > +   log_tree_opt.abbrev = 0;
> > +   log_tree_opt.diff = 1;
> > +   log_tree_opt.diffopt.output_format = DIFF_FORMAT_PATCH;
> > +   log_tree_opt.disable_stdin = 1;
> > +   log_tree_opt.no_commit_id = 1;
> > +   log_tree_opt.diffopt.file = fopen(buf.buf, "w");
> > +   log_tree_opt.diffopt.use_color = GIT_COLOR_NEVER;
> > +   if (!log_tree_opt.diffopt.file)
> > +   res |= error_errno(_("could not open '%s'"), buf.buf);
> > +   else {
> > +   res |= log_tree_commit(&log_tree_opt, commit);
> > +   fclose(log_tree_opt.diffopt.file);
> > +   }
> > +   strbuf_reset(&buf);
> > +
> > +   strbuf_addf(&buf, "%s/message", get_dir(opts));
> > +   if (!file_exists(buf.buf)) {
> > +   const char *commit_buffer = get_commit_buffer(commit, NULL);
> > +   find_commit_subject(commit_buffer, &subject);
> > +   res |= write_message(subject, strlen(subject), buf.buf, 1);
> > +   unuse_commit_buffer(commit, commit_buffer);
> > +   }
> > +   strbuf_release(&buf);
> > +
> > +   return res;
> > +}
> 
> Unlike the scripted version, where a merge is shown with "diff --cc"
> and a root commit is shown as "Root commit", this only deals with a
> single-parent commit.

Indeed. The reason is that we never encounter a merge commit (as we
explicitly do not handle --preserve-merges) nor root commits (as we
explicitly do not handle --root)

Ciao,
Johannes


Re: [PATCH v3 01/38] sequencer: avoid unnecessary curly braces

2017-01-14 Thread Johannes Schindelin
Hi Junio,

On Thu, 12 Jan 2017, Junio C Hamano wrote:

> Johannes Schindelin  writes:
> 
> >  
> > -   if (!commit->parents) {
> > +   if (!commit->parents)
> > parent = NULL;
> > -   }
> > else if (commit->parents->next) {
> > /* Reverting or cherry-picking a merge commit */
> > int cnt;
> 
> The result becomes
> 
>   if (...)
>   single statement;
>   else if (...) {
>   multiple;
> statements;
> }
> 
> which is not quite an improvement.  

Yet, this used to be the coding style of Git, and your statement comes
quite as a surprise to me.

Ciao,
Johannes


Re: [PATCH v3 00/38] Teach the sequencer to act as rebase -i's backend

2017-01-14 Thread Johannes Schindelin
Hi Junio,

On Mon, 9 Jan 2017, Junio C Hamano wrote:

> Johannes Schindelin  writes:
> 
> > Changes since v2:
> >
> > - fixed a TRANSLATORS: comment
> > ...
> > - replaced a spawned `diff-tree` command by code using the diff functions
> >   directly
> 
> I just finished skimming the interdiff (the difference between the
> result of merging the v2 into 'master' and the result of applying
> this series on 'master').

I wish you would not have skimmed it, but provided a thorough review.
There was a rather serious bug in this (not the first problem introduced
into one of my patch series *because of* code review, unhidden-git and
mmap-regexec are also very recent examples, I really should learn to
resist the prodding to replace well-tested code with code of unknown
correctness).

The problem in this instance was that the authorship is no longer retained
when continuing after resolving a conflict. Let me stress again that this
has not been a problem with v1 of sequencer-i, nor with v2. The regression
was caused by changes required by the code review.

In case you wonder: Yes, I am upset by this.

The required fixup patch is:

-- snipsnap --
Subject: [PATCH] fixup! sequencer: make reading author-script more elegant

An unfortunate regression of formerly battle-tested code sadly crept
into Git for Windows v2.11.0(2): authorship was not retained in case of
conflicts during picks.

Signed-off-by: Johannes Schindelin 
---
 sequencer.c   |  2 +-
 t/t3404-rebase-interactive.sh | 16 
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/sequencer.c b/sequencer.c
index 73b2ec6894..8ecab02291 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -612,7 +612,7 @@ static int read_env_script(struct argv_array *env)
count++;
}
 
-   for (i = 0; i < count; i++) {
+   for (i = 0, p = script.buf; i < count; i++) {
argv_array_push(env, p);
p += strlen(p) + 1;
}
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 71b9c8ef8b..61113be08a 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -237,6 +237,22 @@ test_expect_success 'retain authorship' '
git show HEAD | grep "^Author: Twerp Snog"
 '
 
+test_expect_success 'retain authorship w/ conflicts' '
+   git reset --hard twerp &&
+   test_commit a conflict a conflict-a &&
+   git reset --hard twerp &&
+   GIT_AUTHOR_NAME=AttributeMe \
+   test_commit b conflict b conflict-b &&
+   set_fake_editor &&
+   test_must_fail git rebase -i conflict-a &&
+   echo resolved >conflict &&
+   git add conflict &&
+   git rebase --continue &&
+   test $(git rev-parse conflict-a^0) = $(git rev-parse HEAD^) &&
+   git show >out &&
+   grep AttributeMe out
+'
+
 test_expect_success 'squash' '
git reset --hard twerp &&
echo B > file7 &&
-- 
2.11.0.windows.3



Re: [PATCH v3 01/38] sequencer: avoid unnecessary curly braces

2017-01-14 Thread Jeff King
On Sat, Jan 14, 2017 at 06:57:13PM +0100, Johannes Schindelin wrote:

> On Thu, 12 Jan 2017, Junio C Hamano wrote:
> 
> > Johannes Schindelin  writes:
> > 
> > >  
> > > - if (!commit->parents) {
> > > + if (!commit->parents)
> > >   parent = NULL;
> > > - }
> > >   else if (commit->parents->next) {
> > >   /* Reverting or cherry-picking a merge commit */
> > >   int cnt;
> > 
> > The result becomes
> > 
> > if (...)
> > single statement;
> > else if (...) {
> > multiple;
> > statements;
> > }
> > 
> > which is not quite an improvement.  
> 
> Yet, this used to be the coding style of Git, and your statement comes
> quite as a surprise to me.

Yeah, I thought we were OK with:

  if (cond)
single statement;
  else {
multiple;
statements;
  }

but not the other way around:

  if (cond) {
multiple;
statements;
  } else
single statement;

I don't know if the "else if" changes that or not, but I certainly have
written things like your patch does.

-Peff


Re: [PATCHv3 2/2] builtin/commit.c: switch to xstrfmt(), instead of snprintf,

2017-01-14 Thread Jeff King
On Sat, Jan 14, 2017 at 05:31:39PM +0100, René Scharfe wrote:

> Perhaps I missed it from the discussion, but why not use strbuf?  It
> would avoid counting the generated string's length.  That's probably
> not going to make a measurable difference performance-wise, but it's
> easy to avoid and doesn't even take up more lines:

It was mentioned in the review of the very first patch, but I think it
just got dropped. I agree the strbuf way is nicer (not because of
efficiency, but because it's simply easier to read and follow).

-Peff


Re: [PATCH v3 00/38] Teach the sequencer to act as rebase -i's backend

2017-01-14 Thread Johannes Schindelin
Hi Junio,

On Mon, 9 Jan 2017, Junio C Hamano wrote:

> I however think that the renaming of read_author_script() is totally
> backwards from maintainability's point of view.  

You stated elsewhere that converting a script into a builtin should focus
on a faithful conversion.

The original code is:

. "$author_script"

Granted, this *cannot* be converted faithfully without reimplementing a
shell interpreter. So I did the next best thing: I converted it into code
that reads a block of environment variable settings.

What you asked for is totally unreasonable: you ask me to make this
conversion *even less faithful*.

What is worse: you argue from the "maintainability point of view", when it
is pretty obvious that *adding validation that was not there before* can
in no way make the code more maintainable, as it *adds new logic*.

And what is the worst: over all these discussions about a nothingburger
(you simply cannot convince me that I should introduce validating code
that has not been there before in the same patch series that simply tries
to recreate existing functionality), the most important part of a code
review was forgotten: to make sure that the changes are correct.

The worst direction a code review can take is to introduce regressions,
and that is exactly what happened.

Ciao,
Johannes


Re: problem with insider build for windows and git

2017-01-14 Thread Johannes Schindelin
Hi Michael,

On Thu, 12 Jan 2017, Michael Gooch wrote:

> when running commands like pull and clone I get the following message:
> 
> Cygwin WARNING:
>   Couldn't compute FAST_CWD pointer.  This typically occurs if you're using
>   an older Cygwin version on a newer Windows.  Please update to the latest
>   available Cygwin version from https://cygwin.com/.  If the problem 
> persists,
>   please see https://cygwin.com/problems.html
> 
> Windows build is version 1607, OS BUILD 15002.1001
> 
> I assume they broke something that cygwin was depending on.

This is not only a known problem, we already have a fix for it, too.

Please note that the recommended way [*1*] to report bugs in Git for
Windows would have led you to this ticket:

https://github.com/git-for-windows/git/issues/1029

Please also note that this is only a warning, not an error. Even so, the
problem has been reported independently several times...

There have been enough real fixes have been accumulated in Git for
Windows' `master` branch, and the next official Git version is far enough
in the future [*2*] that it was time for a Git for Windows version,
including the fix for the FAST_CWD warning.

Ciao,
Johannes

Footnote *1*: https://git-for-windows.github.io/#contribute

Footnote *2*: http://tinyurl.com/gitCal suggests that Git v2.12.0 will be
released early February soon after Git Merge (and Git for Windows v2.12.0
will follow soon thereafter), and with no patches applied to the `maint`
branch since v2.11.0, I do actually not expect any v2.11.1 to happen
before v2.12.0 comes out.


Re: [PATCH 2/2] Use 'env' to find perl instead of fixed path

2017-01-14 Thread brian m. carlson
On Sat, Jan 14, 2017 at 10:31:34AM +, Eric Wong wrote:
> Jeff King  wrote:
> > Just as a devil's advocate, why do we care about warnings in third-party
> > modules? Or more specifically, why do _users_ who are running Git care
> > about them? We cannot fix them in Git. A user may report the error to
> > the module author, but the module author may not be responsive, or even
> > may not be inclined to fix the problem (because they have a particular
> > opinion on that warning).
> 
> Every user is a potential developer(*).  And I do feel
> we (git developers) should be at least somewhat responsible
> for helping maintain and fix the projects we depend on;
> or moving to alternatives if we can't fix them.
> 
> There is a chance a newly-introduced warning in a 3rd-party
> module points to a real problem with the way git uses it, too.
> Having that warning would help us fix or workaround the bug
> (either in git or the module).
> 
> I doubt any module author would be unresponsive to having a
> localized "no warnings" for special cases.  AFAIK, "-w" is
> widespread amongst Perl users (unlike Ruby in my experience).

My experience is that using strict and warnings is so common in Perl
code that absent a compelling documented reason, most Perl developers
would consider it a bug not to use them.  Consequently, using -w, while
a good practice, is unlikely to have any practical effect on external
modules.

What is more likely to occur is that as newer versions of Perl come out,
we'll get warnings about questionable constructs that Perl, in its
extensive flexibility, has permitted for a long time, but should really
be fixed.  Most distributors of Git will have fixed any affected
third-party modules as part of the Perl upgrade,

> I'm not saying we blindly start using '-w' everywhere today.
> But we may at least try it and see if it introduces new
> warnings, first, and only enable '-w' when it it looks quiet
> (and perhaps start working with module authors to fix warnings
>  if not).
> 
> As a user, I'd rather have some indication of where something
> might be wrong, than no warning at all when something does go
> wrong.

I'm working on patches for USE_ASCIIDOCTOR=Yes and I found at least two
bugs by enabling warnings.
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204


signature.asc
Description: PGP signature


Re: gitk pull request // was: Re: gitk: "lime" color incompatible with older Tk versions

2017-01-14 Thread Junio C Hamano
David Aguilar  writes:

> On Fri, Jan 13, 2017 at 03:20:43AM -0800, David Aguilar wrote:
>> 
>> Ping.. it would be nice to get this patch applied.
>
> Sorry for the noise, and thank you Paul for the fix.
> This was already fixed by Paul in gitk@22a713c72df.
>
> I'm sure Junio will merge gitk.git into git.git soon enough so I
> can sit tight until then, but while I'm here I might as well
> send out a pull request:
>
> The following changes since commit 22a713c72df8b6799c59287c50cee44c4a6db51e:
>
>   gitk: Follow themed bgcolor in help dialogs (2016-03-19 14:12:21 +1100)
>
> are available in the git repository at:
>
>   git://ozlabs.org/~paulus/gitk.git 
>
> for you to fetch changes up to fbf426478e540f4737860dae622603cc0daba3d2:
>
>   gitk: Update copyright notice to 2016 (2016-12-12 20:46:42 +1100)

Pinging Paul to signal me that his tree is ready to pull from is
appreciated, and asking Paul if his tree is ready to be pulled and
then relaying his answer to me is also fine, but I am sensing that
this message is neither.  So let me double check.

Paul, is it a good time to pull, or do you still have something not
published yet that should go together with what you have already
queued?

Thanks.

>
> 
> Markus Hitter (3):
>   gitk: Turn off undo manager in the text widget
>   gitk: Remove closed file descriptors from $blobdifffd
>   gitk: Clear array 'commitinfo' on reload
>
> Paul Mackerras (2):
>   gitk: Use explicit RGB green instead of "lime"
>   gitk: Update copyright notice to 2016
>
> Rogier Goossens (3):
>   gitk: Add a 'rename' option to the branch context menu
>   gitk: Allow checking out a remote branch
>   gitk: Include commit title in branch dialog
>
> Satoshi Yasushima (1):
>   gitk: Fix Japanese translation for "marked commit"
>
> Stefan Dotterweich (1):
>   gitk: Fix missing commits when using -S or -G
>
> Vasco Almeida (2):
>   gitk: Makefile: create install bin directory
>   gitk: Add Portuguese translation
>
>  Makefile|1 +
>  gitk|  166 +--
>  po/bg.po|4 +-
>  po/ca.po|6 +-
>  po/de.po|4 +-
>  po/es.po|4 +-
>  po/fr.po|4 +-
>  po/hu.po|4 +-
>  po/it.po|4 +-
>  po/ja.po|   13 +-
>  po/pt_br.po |4 +-
>  po/pt_pt.po | 1376 
> +++
>  po/ru.po|4 +-
>  po/sv.po|8 +-
>  po/vi.po|4 +-
>  15 files changed, 1549 insertions(+), 57 deletions(-)
>  create mode 100644 po/pt_pt.po
>
> Thanks,


Re: [PATCH 2/3] xdiff: -W: include immediately preceding non-empty lines in context

2017-01-14 Thread Junio C Hamano
René Scharfe  writes:

>> I am also more focused on keeping the codebase maintainable in good
>> health by making sure that we made an effort to find a solution that
>> is general-enough before solving a single specific problem you have
>> today.  We may end up deciding that a blank-line heuristics gives us
>> good enough tradeoff, but I do not want us to make a decision before
>> thinking.
>
> How about extending the context upward only up to and excluding a line
> that is either empty *or* a function line?  That would limit the extra
> context to a single function in the worst case.
>
> Reducing context at the bottom with the aim to remove comments for the
> next section is more tricky as it could remove part of the function
> that we'd like to show if we get the boundary wrong.  How bad would it
> be to keep the southern border unchanged?

I personally do not think there is any robust heuristic other than
Vegard's "a blank line may be a signal enough that lines before that
are not part of the beginning of the function", and I think your
"hence we look for a blank line but if there is a line that matches
the function header, stop there as we know we came too far back"
will be a good-enough safety measure.

I also agree with you that we probably do not want to futz with the
southern border.

Thanks.


Re: [PATCHv3 2/2] builtin/commit.c: switch to xstrfmt(), instead of snprintf,

2017-01-14 Thread Junio C Hamano
Elia Pinto  writes:

> Ok. I agree. But  is it strictly necessary to resend for this ?

FWIW, the attacched is what I queued locally, after complaining
"both have the same title?  They need to be explained better."

In any case, I sense that 2/2 will be redone using strbuf, from the
looks of what is discussed in a subthread nearby?

Thanks.

commit 8d7aa4ba6a00b3ff69261e88b4842c0df5662125
Author: Elia Pinto 
Date:   Fri Jan 13 17:58:00 2017 +

builtin/commit.c: remove the PATH_MAX limitation via dynamic allocation

Remove the PATH_MAX limitation from the environment setting that
points to a filename by switching to dynamic allocation.

As a side effect of this change, we also reduce the snprintf()
calls, that may silently truncate results if the programmer is not
careful.

Helped-by: Junio C Hamano 
Helped-by: Jeff King 
Signed-off-by: Elia Pinto 
Signed-off-by: Junio C Hamano 

commit 2a7e328877982557d921a398af9442093290c613
Author: Elia Pinto 
Date:   Fri Jan 13 17:58:01 2017 +

builtin/commit.c: switch to xstrfmt(), instead of snprintf()

Switch to dynamic allocation with xstrfmt(), so we can avoid dealing
with magic numbers in the code and reduce the cognitive burden from
the programmers.  The original code is correct, but programmers no
longer have to count bytes needed for static allocation to know that.

As a side effect of this change, we also reduce the snprintf()
calls, that may silently truncate results if the programmer is not
careful.

Helped-by: Junio C Hamano 
Helped-by: Jeff King 
Signed-off-by: Elia Pinto 
Signed-off-by: Junio C Hamano 


Re: [PATCH v3 00/38] Teach the sequencer to act as rebase -i's backend

2017-01-14 Thread Junio C Hamano
Johannes Schindelin  writes:

> The problem in this instance was that the authorship is no longer retained
> when continuing after resolving a conflict. Let me stress again that this
> has not been a problem with v1 of sequencer-i, nor with v2. The regression
> was caused by changes required by the code review.
>
> In case you wonder: Yes, I am upset by this.
>
> -- snipsnap --
> Subject: [PATCH] fixup! sequencer: make reading author-script more elegant

I do not think anybody asked to make the code "more elegant".  Quite
frankly, I do not expect elegance in your code (or any of the code
in our codebase, for that matter).  What we want is readable code
that does not make the overall codebase less maintainable that is
correct.  Not reinveting a new codepath when there is already code
that does the thing is one of the things that we may need to do, but
that was not done between these rerolls.

Of course, when trying to share code, the existing code we have that
the new codepath needs to borrow would have to be refactored and
extended, and a new bug can sneak in during the process.  If that
were what happened, I would be a bit more sympathetic, but I suspect
that this "more elegant" thing that needed fix-up is not that.

You may be upset, but I cannot quite bring myself to feel sympathy
in this particular case.







Re: [PATCH v10 19/20] branch: use ref-filter printing APIs

2017-01-14 Thread Jacob Keller
On Sat, Jan 14, 2017 at 2:01 AM, Karthik Nayak  wrote:
> Hello,
>
> On Thu, Jan 12, 2017 at 5:17 AM, Jacob Keller  wrote:
>> On Tue, Jan 10, 2017 at 12:49 AM, Karthik Nayak  
>> wrote:
>>> diff --git a/builtin/branch.c b/builtin/branch.c
>>> index 34cd61cd9..f293ee5b0 100644
>>> --- a/builtin/branch.c
>>> +++ b/builtin/branch.c
>>> @@ -37,11 +37,11 @@ static unsigned char head_sha1[20];
>>>  static int branch_use_color = -1;
>>>  static char branch_colors[][COLOR_MAXLEN] = {
>>> GIT_COLOR_RESET,
>>> -   GIT_COLOR_NORMAL,   /* PLAIN */
>>> -   GIT_COLOR_RED,  /* REMOTE */
>>> -   GIT_COLOR_NORMAL,   /* LOCAL */
>>> -   GIT_COLOR_GREEN,/* CURRENT */
>>> -   GIT_COLOR_BLUE, /* UPSTREAM */
>>> +   GIT_COLOR_NORMAL,   /* PLAIN */
>>> +   GIT_COLOR_RED,  /* REMOTE */
>>> +   GIT_COLOR_NORMAL,   /* LOCAL */
>>> +   GIT_COLOR_GREEN,/* CURRENT */
>>> +   GIT_COLOR_BLUE, /* UPSTREAM */
>>>  };
>>
>>
>> What's... actually changing here? It looks like just white space? Is
>> there a strong reason for why this is changing?
>>
>> Thanks,
>> Jake
>
> None, I'm not sure how this ended up being added too.
>
> --
> Regards,
> Karthik Nayak

It looks like it might just be reformatting of some spaces or stray
end-spaces or something. Hard to see in an email.

Thanks,
Jake


Re: merge maintaining history

2017-01-14 Thread Jacob Keller
On Fri, Jan 13, 2017 at 6:01 PM, David J. Bakeman  wrote:
> History
>
> git cloned a remote repository and made many changes pushing them all to
> said repository over many months.
>
> The powers that be then required me to move project to new repository
> server did so by pushing local version to new remote saving all history!
>
> Now have to merge back to original repository(which has undergone many
> changes since I split off) but how do I do that without loosing the
> history of all the commits since the original move?  Note I need to push
> changes to files that are already in existence.  I found on the web a
> bunch of ways to insert a whole new directory structure into an existing
> repository but as I said I need to do it on top of existing files.  Of
> course I can copy all the files from my local working repository to the
> cloned remote repository and commit any changes but I loose all the
> history that way.
>
> Thanks.

If I understand it.. you have two remotes now:

The "origin" remote, which was the original remote you started with.

You have now a "new" remote which you created and pushed to.

So you want to merge the "new" history into the original tree now, so
you checkout the original tree, then "git merge /"
and then fix up any conflicts, and then git commit to create a merge
commit that has the new history. Then you could push that to both
trees.

I would want a bit more information about your setup before providing
actual commands.

Thanks,
Jake


Re: [PATCH v3 00/38] Teach the sequencer to act as rebase -i's backend

2017-01-14 Thread Junio C Hamano
Johannes Schindelin  writes:

> You stated elsewhere that converting a script into a builtin should focus
> on a faithful conversion.
>
> The original code is:
>
>   . "$author_script"
>
> Granted, this *cannot* be converted faithfully without reimplementing a
> shell interpreter. So I did the next best thing: I converted it into code
> that reads a block of environment variable settings.

It is unfortunate that you took "faithful" too literally.  While I
do appreciate it if your conversion aims to faithfully replicate the
original, even to be bug-to-bug compatible, but obviously we cannot
replicate everything the above original _could_ do.  

By "a faithful conversion", I meant that the behaviour of the
reimplementation should be as faithful to the original's intent as
possible.  Nothing more.

The intent of the above original is to read back what we wrote to
preserve the author identity we learned earlier when we wrote the
file.  We read the "author" line from the commit object header, and
write assignments to GIT_AUTHOR_{NAME,EMAIL,DATE} variables.  Nothing
more is intended.

The end-users COULD abuse the original code to cause it to do a lot
more than that, e.g. by adding "export FOO=BAR" at the end and have
the value of the new environment variable propagate throughout the
code and even down to subprocesses.  They can even assign to some
variables we use internally for bookkeeping and break "rebase -i"
machinery.  But that is outside the intent of the original code--we
do not need to or want to replicate that faithfully.

I also need to react to the "environment variable settings" at the
end of the quoted paragraph.

If the code in the sequencer.c reads things other than the three
variables we ourselves set, and make them into environment variables
and propagate to subprocesses (hooks and editors), it would be a
bug.  The original did not intend to do that (the dot-sourcing is
overly loose than reading three known variables and nothing else,
but is OK because we do not support the case where end users muck
with the file).  Also, writing FOO=BAR alone (not "export FOO=BAR"
or "FOO=BAR; export FOO") to the file wouldn't have exported FOO to
subprocesses anyway.