Git development
 help / color / mirror / Atom feed
* Re: [PATCH v2] fix pushing to //server/share/dir on Windows
From: Junio C Hamano @ 2016-12-15 17:49 UTC (permalink / raw)
  To: Jeff King
  Cc: Torsten Bögershausen, Johannes Sixt, Johannes Schindelin,
	Git Mailing List
In-Reply-To: <20161215110155.it7ptkbju5etmnpn@sigill.intra.peff.net>

Jeff King <peff@peff.net> writes:

> I don't have an opinion either way on what Windows would want, but note
> that the function already _does_ convert separators to slashes. With
> Johannes's original patch, you'd end up with a mix, like:
>
>   \\server\share/dir1/file
>
> So this conversion is really just retaining the original behavior, and
> making it consistent throughout the path.

>
> Which isn't to say that the function as it currently exists isn't a
> little bit buggy. :)
>
> One of the points of normalizing, though, is that Git can then do
> textual comparisons between the output. So I think there's value in
> having a canonical internal representation, even if the OS could handle
> more exotic ones.

E.g. the log message of d53c2c6738 ("mingw: fix t9700's assumption
about directory separators", 2016-01-27) says the two kinds of
slashes are equivalent over there, but the patch text ends up doing
exactly that normalization.

5ca6b7bb47 ("config --show-origin: report paths with forward
slashes", 2016-03-23) is an example of us trying to normalize in
order to give consistent output to the users.

Having said all that, I do not have an opinion either way on what
Windows would want, either ;-)


^ permalink raw reply

* Re: [PATCHv3 1/3] merge: Add '--continue' option as a synonym for 'git commit'
From: Jeff King @ 2016-12-15 17:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Chris Packham, GIT, Markus Hitter, Jacob Keller
In-Reply-To: <xmqqd1gtw0vi.fsf@gitster.mtv.corp.google.com>

On Thu, Dec 15, 2016 at 09:36:17AM -0800, Junio C Hamano wrote:

> > Did you want me to send a v4 to mark the strings for translation or
> > will you apply a fixup your end?
> 
> I didn't follow the _() discussion (was there any?)

I think the discussion was just "we should do that".

> I do not think lack of _() is a show-stopper and my preference is to
> keep what I queued that does not have _(), and receive a separate
> follow-up patch that changes "msg" to _("msg") and does nothing
> else.

Here's a patch.

-- >8 --
Subject: merge: mark usage error strings for translation

The nearby error messages are already marked for
translation, but these new ones aren't.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin/merge.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin/merge.c b/builtin/merge.c
index 668aaffb8..599d25c4c 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1164,7 +1164,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		const char *nargv[] = {"reset", "--merge", NULL};
 
 		if (orig_argc != 2)
-			usage_msg_opt("--abort expects no arguments",
+			usage_msg_opt(_("--abort expects no arguments"),
 			      builtin_merge_usage, builtin_merge_options);
 
 		if (!file_exists(git_path_merge_head()))
@@ -1180,7 +1180,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		const char *nargv[] = {"commit", NULL};
 
 		if (orig_argc != 2)
-			usage_msg_opt("--continue expects no arguments",
+			usage_msg_opt(_("--continue expects no arguments"),
 			      builtin_merge_usage, builtin_merge_options);
 
 		if (!file_exists(git_path_merge_head()))
-- 
2.11.0.348.g960a0b554


^ permalink raw reply related

* Re: [PATCH v2 3/6] update_unicode.sh: pin the uniset repo to a known good commit
From: Junio C Hamano @ 2016-12-15 17:50 UTC (permalink / raw)
  To: Dennis Kaarsemaker; +Cc: Beat Bolli, git
In-Reply-To: <1481795248.4090.15.camel@kaarsemaker.net>

Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:

> On Wed, 2016-12-14 at 00:31 +0100, Beat Bolli wrote:
>> +       ( cd uniset && git checkout 4b186196dd )
>
> Micronit, but this is perhaps better written as
>
> git -C uniset checkout 4b186196dd
>
> to avoid the subshell and cd.
>
> D.

In the context of this script, I would say that is not even a
micronit.  It is "you could do this if you wanted to".

^ permalink raw reply

* Re: git bug - merging JS / Node.js code with "git merge --squash"
From: Junio C Hamano @ 2016-12-15 18:10 UTC (permalink / raw)
  To: Alexander Mills; +Cc: git
In-Reply-To: <CA+KyZp4HzsSOghKZnKgXEXy_gqw-9oTHveDHn1eRUY-_C6_jww@mail.gmail.com>

Alexander Mills <alexander.d.mills@gmail.com> writes:

> basically it is doing the merge with this line:
>
> git merge --squash -Xtheirs dev -m "squashing" &&

The order of command line parameters are "dashed options and their
arguments first, then refs (and then pathspecs if exists), so you
should make it a habit to move that "dev" at the end of the command
line.  This does not have anything to do with the issue you are
asking for help, though.

I suspect the problem is not in --squash but with -Xtheirs.  It is
"I give up correctly resolving conflicts and blindly take whatever
comes from their side, discarding what I did".

The "git merge" command stops and asks a human to help resolving a
conflict using their brain when it needs to because the command
knows it itself does not have any but the human user has a better
one ;-).  -Xtheirs and -Xours disables this safety/sanity.

If you punt, it is expected that you would get garbage.  

For example, your side may have introduced a new function (or
renamed an existing one) near where their side made a change that
resulted in conflicts.  Naturally, your side also would have added
new callsites to that new function (you wouldn't be adding an unused
function).  Imagine in such a scenario that you asked "discard what
I did in the conflicted section and blindly take whatever they did".
What happens?  They may not have done anything near the places you
added calls to the new function and these sections of the code would
merge cleanly with or without -Xtheirs, but the actual new function
you added may be in the conflicted section that you asked to discard,
taking their changes.



^ permalink raw reply

* Re: [PATCH v2 07/34] sequencer (rebase -i): add support for the 'fixup' and 'squash' commands
From: Junio C Hamano @ 2016-12-15 18:42 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Kevin Daudt, Dennis Kaarsemaker
In-Reply-To: <ae521f75a105c6b9e54595d68bda3c5b62f313b6.1481642927.git.johannes.schindelin@gmx.de>

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

> diff --git a/sequencer.c b/sequencer.c
> index f6e20b142a..271c21581d 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -45,6 +45,35 @@ static GIT_PATH_FUNC(rebase_path_todo, "rebase-merge/git-rebase-todo")
>   */
>  static GIT_PATH_FUNC(rebase_path_done, "rebase-merge/done")
>  /*
> + * The commit message that is planned to be used for any changes that
> + * need to be committed following a user interaction.
> + */
> +static GIT_PATH_FUNC(rebase_path_message, "rebase-merge/message")
> +/*
> + * The file into which is accumulated the suggested commit message for
> + * squash/fixup commands. When the first of a series of squash/fixups

The same comment as 03/34 applies here, regarding blank line to
separate logical unit.

> +static int update_squash_messages(enum todo_command command,
> +		struct commit *commit, struct replay_opts *opts)
> +{
> +	struct strbuf buf = STRBUF_INIT;
> +	int count, res;
> +	const char *message, *body;
> +
> +	if (file_exists(rebase_path_squash_msg())) {
> +		char *p, *p2;
> +
> +		if (strbuf_read_file(&buf, rebase_path_squash_msg(), 2048) <= 0)
> +			return error(_("could not read '%s'"),
> +				rebase_path_squash_msg());
> +
> +		if (buf.buf[0] != comment_line_char ||
> +		    !skip_prefix(buf.buf + 1, " This is a combination of ",
> +				 (const char **)&p))
> +			return error(_("unexpected 1st line of squash message:"
> +				       "\n\n\t%.*s"),
> +				     (int)(strchrnul(buf.buf, '\n') - buf.buf),
> +				     buf.buf);
> +		count = strtol(p, &p2, 10);
> +
> +		if (count < 1 || *p2 != ' ')
> +			return error(_("invalid 1st line of squash message:\n"
> +				       "\n\t%.*s"),
> +				     (int)(strchrnul(buf.buf, '\n') - buf.buf),
> +				     buf.buf);
> +
> +		sprintf((char *)p, "%d", ++count);

Do we know the area pointed at p (which is inside buf) long enough
not to overflow?  If the original were 9 and you incremented to get
10, you would need one extra byte.

> +		if (!*p2)
> +			*p2 = ' ';
> +		else {
> +			*(++p2) = 'c';

p2 points into buf; do we know this increment does not step beyond
its end?  What is the meaning of a letter 'c' here (I do not see a
corresponding one in the scripted update_squash_messages)?

> +			strbuf_insert(&buf, p2 - buf.buf, " ", 1);
> +		}
> +	}
> +	else {

Style: "} else {" (I won't repeat this, as it will become too noisy).

> +		unsigned char head[20];
> +		struct commit *head_commit;
> +		const char *head_message, *body;
> +
> +		if (get_sha1("HEAD", head))
> +			return error(_("need a HEAD to fixup"));
> +		if (!(head_commit = lookup_commit_reference(head)))
> +			return error(_("could not read HEAD"));
> +		if (!(head_message = get_commit_buffer(head_commit, NULL)))
> +			return error(_("could not read HEAD's commit message"));
> +
> +		body = strstr(head_message, "\n\n");
> +		if (!body)
> +			body = "";
> +		else
> +			body = skip_blank_lines(body + 2);

I think I saw you used a helper function find_commit_subject() to do
the above in an earlier patch for "edit" in this series.  Would it
make this part (and another one for "commit" we have after this
if/else) shorter?

>  static int do_pick_commit(enum todo_command command, struct commit *commit,
> -		struct replay_opts *opts)
> +		struct replay_opts *opts, int final_fixup)
>  {
> +	int edit = opts->edit, cleanup_commit_message = 0;
> +	const char *msg_file = edit ? NULL : git_path_merge_msg();
>  	unsigned char head[20];
>  	struct commit *base, *next, *parent;
>  	const char *base_label, *next_label;
>  	struct commit_message msg = { NULL, NULL, NULL, NULL };
>  	struct strbuf msgbuf = STRBUF_INIT;
> -	int res, unborn = 0, allow;
> +	int res, unborn = 0, amend = 0, allow;
>  
>  	if (opts->no_commit) {
>  		/*
> @@ -749,7 +885,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
>  	else
>  		parent = commit->parents->item;
>  
> -	if (opts->allow_ff &&
> +	if (opts->allow_ff && !is_fixup(command) &&
>  	    ((parent && !hashcmp(parent->object.oid.hash, head)) ||
>  	     (!parent && unborn)))
>  		return fast_forward_to(commit->object.oid.hash, head, unborn, opts);
> @@ -813,6 +949,28 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
>  		}
>  	}
>  
> +	if (is_fixup(command)) {
> +		if (update_squash_messages(command, commit, opts))
> +			return -1;
> +		amend = 1;
> +		if (!final_fixup)
> +			msg_file = rebase_path_squash_msg();
> +		else if (file_exists(rebase_path_fixup_msg())) {
> +			cleanup_commit_message = 1;
> +			msg_file = rebase_path_fixup_msg();
> +		}
> +		else {
> +			const char *dest = git_path("SQUASH_MSG");
> +			unlink(dest);
> +			if (copy_file(dest, rebase_path_squash_msg(), 0666))
> +				return error(_("could not rename '%s' to '%s'"),
> +					     rebase_path_squash_msg(), dest);

Perhaps an error from unlink(dest) before copy_file() should also
result in an error return?  After all, that unlink() was added to
mimick the "cp" in the scripted one and copy_file() does not want
to overwrite an existing destination.

> +			unlink(git_path("MERGE_MSG"));

Errors from this and other unlink() that emulates "rm -f" were
unchecked in the scripted original, so not checking for errors is
not a regression.  I would check for an error if I were writing
this, however, because I know I would forget updating these after I
am done with the series.

> +			msg_file = dest;
> +			edit = 1;
> +		}
> +	}
> +
>  	if (!opts->strategy || !strcmp(opts->strategy, "recursive") || command == TODO_REVERT) {
>  		res = do_recursive_merge(base, next, base_label, next_label,
>  					 head, &msgbuf, opts);
> @@ -868,8 +1026,13 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
>  		goto leave;
>  	}
>  	if (!opts->no_commit)
> -		res = run_git_commit(opts->edit ? NULL : git_path_merge_msg(),
> -				     opts, allow, opts->edit, 0, 0);
> +		res = run_git_commit(msg_file, opts, allow, edit, amend,
> +				     cleanup_commit_message);

The introduction of msg_file variable made this call (actually, the
logic to decide which file is affected) much nicer to understand.

> +	if (!res && final_fixup) {
> +		unlink(rebase_path_fixup_msg());
> +		unlink(rebase_path_squash_msg());
> +	}
>  
> @@ -1475,6 +1660,21 @@ static int do_exec(const char *command_line)
>  	return status;
>  }
>  
> +static int is_final_fixup(struct todo_list *todo_list)
> +{
> +	int i = todo_list->current;
> +
> +	if (!is_fixup(todo_list->items[i].command))
> +		return 0;
> +
> +	while (++i < todo_list->nr)
> +		if (is_fixup(todo_list->items[i].command))
> +			return 0;
> +		else if (todo_list->items[i].command < TODO_NOOP)
> +			break;

What follows NOOP are comment and "drop" which is another comment in
disguise, so this one is excluding all the no-op commands in various
shapes, which makes sense but is clear only to a reader who bothered
to go back to "enum todo_command" and checked that fact.  If a check
for "is it one of the no-op commands?" appears only here, a single
liner comment may be sufficient (but necessary) to help readers.
Otherwise a single-liner helper function (similar to is_fixup() you
have) with a descriptive name would be better than a single liner
comment.





^ permalink raw reply

* Re: [PATCH v2 08/34] sequencer (rebase -i): implement the short commands
From: Junio C Hamano @ 2016-12-15 18:43 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Kevin Daudt, Dennis Kaarsemaker
In-Reply-To: <42d43763075f3f2daa2cc06a8afc9bcfd8b20ac2.1481642927.git.johannes.schindelin@gmx.de>

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

> For users' convenience, most rebase commands can be abbreviated, e.g.
> 'p' instead of 'pick' and 'x' instead of 'exec'. Let's teach the
> sequencer to handle those abbreviated commands just fine.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---

Sensible.

^ permalink raw reply

* Re: [PATCH v2 09/34] sequencer (rebase -i): write an author-script file
From: Junio C Hamano @ 2016-12-15 18:50 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Kevin Daudt, Dennis Kaarsemaker
In-Reply-To: <09c2718e119f809093794410ae1a738c1cd122d1.1481642927.git.johannes.schindelin@gmx.de>

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

> +	strbuf_addstr(&buf, "GIT_AUTHOR_NAME='");
> +	while (*message && *message != '\n' && *message != '\r')
> +		if (skip_prefix(message, " <", &message))
> +			break;
> +		else if (*message != '\'')
> +			strbuf_addch(&buf, *(message++));
> +		else
> +			strbuf_addf(&buf, "'\\\\%c'", *(message++));
> +	strbuf_addstr(&buf, "'\nGIT_AUTHOR_EMAIL='");
> +	while (*message && *message != '\n' && *message != '\r')
> +		if (skip_prefix(message, "> ", &message))
> +			break;
> +		else if (*message != '\'')
> +			strbuf_addch(&buf, *(message++));
> +		else
> +			strbuf_addf(&buf, "'\\\\%c'", *(message++));

Aren't these reading from an in-core commit object?  

If so, it should use split_ident_line() for consistency with other
parts of the system to do this parsing.  We should also already have
a helper for simple shell-quoting in quote.c and you would want to
use that instead of open coding like this.

^ permalink raw reply

* Re: [PATCH v2 07/34] sequencer (rebase -i): add support for the 'fixup' and 'squash' commands
From: Jeff King @ 2016-12-15 18:56 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, git, Kevin Daudt, Dennis Kaarsemaker
In-Reply-To: <xmqqlgvhuj82.fsf@gitster.mtv.corp.google.com>

On Thu, Dec 15, 2016 at 10:42:53AM -0800, Junio C Hamano wrote:

> > +		sprintf((char *)p, "%d", ++count);
> 
> Do we know the area pointed at p (which is inside buf) long enough
> not to overflow?  If the original were 9 and you incremented to get
> 10, you would need one extra byte.

Even if it is enough, I'd ask to please use xsnprintf(). In the off
chance that there's a programming error, we'd get a nice die("BUG")
instead of a buffer overflow (and it makes the code base easier to audit
for other overflows).

-Peff

^ permalink raw reply

* Re: [PATCH v2 07/34] sequencer (rebase -i): add support for the 'fixup' and 'squash' commands
From: Jeff King @ 2016-12-15 19:03 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Stefan Beller, git, Junio C Hamano, Kevin Daudt,
	Dennis Kaarsemaker
In-Reply-To: <ae521f75a105c6b9e54595d68bda3c5b62f313b6.1481642927.git.johannes.schindelin@gmx.de>

On Tue, Dec 13, 2016 at 04:30:01PM +0100, Johannes Schindelin wrote:

> +	else {
> +		unsigned char head[20];
> +		struct commit *head_commit;
> +		const char *head_message, *body;
> +
> +		if (get_sha1("HEAD", head))
> +			return error(_("need a HEAD to fixup"));
> +		if (!(head_commit = lookup_commit_reference(head)))
> +			return error(_("could not read HEAD"));
> +		if (!(head_message = get_commit_buffer(head_commit, NULL)))
> +			return error(_("could not read HEAD's commit message"));

This get_commit_buffer() may allocate a fresh buffer...

> +		body = strstr(head_message, "\n\n");
> +		if (!body)
> +			body = "";
> +		else
> +			body = skip_blank_lines(body + 2);
> +		if (write_message(body, strlen(body),
> +				  rebase_path_fixup_msg(), 0))
> +			return error(_("cannot write '%s'"),
> +				     rebase_path_fixup_msg());

...and then this return leaks the result (the other code path hits
unuse_commit_buffer(), and is fine).

This leak was noticed by Coverity. It has a _ton_ of false positives
across the whole project, but it sends out a mail with new ones every
few days, which is usually short enough that I can process it in 30
seconds or so.

I _think_ that email just goes to me and Stefan right now. You can add
yourself at:

  https://scan.coverity.com/projects/git?tab=project_settings

if you already have admin access to the project (which I think you
(Dscho) do).  I wonder if it would be helpful to send that output to the
list.

-Peff

^ permalink raw reply

* Re: [PATCH v2 07/34] sequencer (rebase -i): add support for the 'fixup' and 'squash' commands
From: Stefan Beller @ 2016-12-15 19:07 UTC (permalink / raw)
  To: Jeff King
  Cc: Johannes Schindelin, git@vger.kernel.org, Junio C Hamano,
	Kevin Daudt, Dennis Kaarsemaker
In-Reply-To: <20161215190351.as76panrcz5rgibj@sigill.intra.peff.net>

On Thu, Dec 15, 2016 at 11:03 AM, Jeff King <peff@peff.net> wrote:
> wonder if it would be helpful to send that output to the list.

Sure we can try.

Another project I used to run through coverity (Gerrit), shows
similar characteristics w.r.t. false positives, so people complained
when I was force feeding them the niceties of static analysis.

I'll just try to set it up and see how the mailing list reacts.
(Not sure if you can just add emails there or if the email has
to be verified or such.)

Thanks,
Stefan

^ permalink raw reply

* Re: [PATCH v2 10/34] sequencer (rebase -i): allow continuing with staged changes
From: Junio C Hamano @ 2016-12-15 19:08 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Kevin Daudt, Dennis Kaarsemaker
In-Reply-To: <9978c32139c522c08d5a8f685011829cc830bfc0.1481642927.git.johannes.schindelin@gmx.de>

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

> When an interactive rebase is interrupted, the user may stage changes
> before continuing, and we need to commit those changes in that case.
>
> Please note that the nested "if" added to the sequencer_continue() is
> not combined into a single "if" because it will be extended with an
> "else" clause in a later patch in this patch series.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  sequencer.c | 40 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
>
> diff --git a/sequencer.c b/sequencer.c
> index 80469b6954..855d3ba503 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -1829,6 +1829,42 @@ static int continue_single_pick(void)
>  	return run_command_v_opt(argv, RUN_GIT_CMD);
>  }
>  
> +static int commit_staged_changes(struct replay_opts *opts)
> +{
> +	int amend = 0;
> +
> +	if (has_unstaged_changes(1))
> +		return error(_("cannot rebase: You have unstaged changes."));

The scripted one from 'master' seems to say

	$path_to_the_file: needs update
	You must edit all merge conflicts and then
	mark them as resolved using git add

when editing an existing commit in this case.  The updated message
looks more sensible for the situation, but I wonder if the control
should even reach at this point.  

One bad thing about reviewing this series is that all the comments
are about codepaths that are not exercised, so they cannot be more
than "they look good".  A comment "If the caller does X, this will
be better than the original" (or this will regress, for that matter)
cannot be validated for its relevance because we won't know the what
the caller does in the endgame while reviewing these earlier steps.




^ permalink raw reply

* Re: [PATCH v2 07/34] sequencer (rebase -i): add support for the 'fixup' and 'squash' commands
From: Jeff King @ 2016-12-15 19:20 UTC (permalink / raw)
  To: Stefan Beller
  Cc: Johannes Schindelin, git@vger.kernel.org, Junio C Hamano,
	Kevin Daudt, Dennis Kaarsemaker
In-Reply-To: <CAGZ79kZ3i-eoxMsVMsb+VBtEVQf2-Fovh_YM5NBN2pSOBHajBg@mail.gmail.com>

On Thu, Dec 15, 2016 at 11:07:34AM -0800, Stefan Beller wrote:

> On Thu, Dec 15, 2016 at 11:03 AM, Jeff King <peff@peff.net> wrote:
> > wonder if it would be helpful to send that output to the list.
> 
> Sure we can try.
> 
> Another project I used to run through coverity (Gerrit), shows
> similar characteristics w.r.t. false positives, so people complained
> when I was force feeding them the niceties of static analysis.
> 
> I'll just try to set it up and see how the mailing list reacts.
> (Not sure if you can just add emails there or if the email has
> to be verified or such.)

I see you added it, but I don't see the confirmation email on the list.
I wonder if it was HTML mail and vger ate it.

-Peff

^ permalink raw reply

* Re: [PATCH v2 07/34] sequencer (rebase -i): add support for the 'fixup' and 'squash' commands
From: Stefan Beller @ 2016-12-15 19:27 UTC (permalink / raw)
  To: Jeff King
  Cc: Johannes Schindelin, git@vger.kernel.org, Junio C Hamano,
	Kevin Daudt, Dennis Kaarsemaker
In-Reply-To: <20161215192016.qhbcyo7vb7petuwp@sigill.intra.peff.net>

On Thu, Dec 15, 2016 at 11:20 AM, Jeff King <peff@peff.net> wrote:
> On Thu, Dec 15, 2016 at 11:07:34AM -0800, Stefan Beller wrote:
>
>> On Thu, Dec 15, 2016 at 11:03 AM, Jeff King <peff@peff.net> wrote:
>> > wonder if it would be helpful to send that output to the list.
>>
>> Sure we can try.
>>
>> Another project I used to run through coverity (Gerrit), shows
>> similar characteristics w.r.t. false positives, so people complained
>> when I was force feeding them the niceties of static analysis.
>>
>> I'll just try to set it up and see how the mailing list reacts.
>> (Not sure if you can just add emails there or if the email has
>> to be verified or such.)
>
> I see you added it, but I don't see the confirmation email on the list.
> I wonder if it was HTML mail and vger ate it.
>
> -Peff

I think I'll setup a dummy gmail account to use for subscription
and then I'll configure that to forward all email from coverity to the list.
(the actual complaints about memleaks etc are plain text, so that
forwarding then should work)

^ permalink raw reply

* Is there a way to have local changes in a branch 'bake' while working in different branches?
From: Larry Minton @ 2016-12-15 20:14 UTC (permalink / raw)
  To: git@vger.kernel.org

Lars Schneider recommended I ask you this question.

My question:

Let's say I have a code change that I want to 'bake' for a while locally, just to make sure some edge case doesn't pop up while I am working on other things.  Is there any practical way of doing that? 
I could constantly merge that 'bake me' branch into other branches as I work on them and then remove those changes from the branches before sending them out for code review, but sooner or later pretty much guaranteed to screw that up....

His response:

Good question. Your merging idea would work but I agree it might be cumbersome. In this situation I keep modified files in my tree. That would work for you too, but this would be inconvenient if you have many changed files. I wonder how the Git core guys manage this kind of situation.

Thanks,

Larry Minton
3ds Max Core team
LiveDesign Group
Media & Entertainment, Education Experiences, Impact (MEI)


^ permalink raw reply

* index-pack outside of repository?
From: Jeff King @ 2016-12-15 20:40 UTC (permalink / raw)
  To: git

Running git on 'next', you can trigger a BUG:

  $ cd /some/repo
  $ git pack-objects --all --stdout </dev/null >/tmp/foo.pack
  $ cd /not-a-git-repo
  $ git index-pack --stdin </tmp/foo.pack
  fatal: BUG: setup_git_env called without repository

This obviously comes from my b1ef400eec (setup_git_env: avoid blind
fall-back to ".git", 2016-10-20). What's going on is that index-pack
uses RUN_SETUP_GENTLY, but never actually handles the out-of-repo case.
When we use the internal git_dir to make "objects/pack/pack-xxx.pack",
it barfs.

In older versions of git will just blindly write into
".git/objects/pack", even though there's no repository there.

So I think complaining to the user is the right thing to do here. I
started to write a patch to have index-pack notice when it needs a repo
and doesn't have one, but the logic is actually a bit unclear.  Do we
need to complain early _just_ when --stdin is specified, or does that
miss somes cases?  Likewise, are there cases where --stdin can operate
without a repo? I couldn't think of any.

I'm actually wondering if the way it calls die() in 'next' is a pretty
reasonable way for things to work in general. It happens when we lazily
try to ask for the repository directory. So we don't have to replicate
logic to say "are we going to need a repo"; at the moment we need it, we
notice we don't have it and die. The only problem is that it says "BUG"
and not "this operation must be run in a git repository".

That strategy _might_ be a problem for some programs, which would want
to notice the issue early before doing work. But it seems like a
reasonable outcome for index-pack. Thoughts?

-Peff

^ permalink raw reply

* Re: Allow "git shortlog" to group by committer information
From: Linus Torvalds @ 2016-12-15 21:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <CA+55aFzWkE43rSm-TJNKkHq4F3eOiGR0-Bo9V1=a1s=vQ0KPqQ@mail.gmail.com>

Just a ping on this patch..

On Tue, Oct 11, 2016 at 11:45 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> In some situations you may want to group the commits not by author,
> but by committer instead.
>
> For example, when I just wanted to look up what I'm still missing from
> linux-next in the current merge window [..]

It's another merge window later for the kernel, and I just re-applied
this patch to my git tree because I still want to know teh committer
information rather than the authorship information, and it still seems
to be the simplest way to do that.

Jeff had apparently done something similar as part of a bigger
patch-series, but I don't see that either. I really don't care very
much how this is done, but I do find this very useful, I do things
like

   git shortlog -cnse linus..next |
        head -20 |
        cut -f2 |
        sed 's/$/,/'

to generate a nice list of the top-20 committers that I haven't gotten
pull requests from yet.

Yes, I can just maintain this myself, and maybe nobody else needs it,
but it's pretty simple and straightforward, and there didn't seem to
be any real reason not to have the option..

                 Linus

^ permalink raw reply

* Re: [PATCH] README: replace gmane link with public-inbox
From: Eric Wong @ 2016-12-15 21:57 UTC (permalink / raw)
  To: Jeff King; +Cc: Chiel ten Brinke, git
In-Reply-To: <20161215141719.52peppv5pbjk3nuf@sigill.intra.peff.net>

Jeff King <peff@peff.net> wrote:
> On Thu, Dec 15, 2016 at 02:57:18PM +0100, Chiel ten Brinke wrote:
> 
> > Btw, the link in the README
> > http://news.gmane.org/gmane.comp.version-control.git/ is dead.
> 
> Yes, the status of gmane was up in the air for a while, but I think we
> can give it up as dead now (at least for our purposes).

s/http/nntp/ still works for gmane.

> -- >8 --
> Subject: README: replace gmane link with public-inbox
> 
> The general status and future of gmane is unclear at this
> point, but certainly it does not seem to be carrying
> gmane.comp.version-control.git at all anymore. Let's point
> to public-inbox.org, which seems to be the favored archive
> on the list these days (and which uses message-ids in its
> URLs, making the links somewhat future-proof).

No objections, here.

There's also https://mail-archive.com/git@vger.kernel.org
Where https://mid.mail-archive.com/<Message-ID> also works

^ permalink raw reply

* Re: Is there a way to have local changes in a branch 'bake' while working in different branches?
From: Aaron Schrab @ 2016-12-15 22:44 UTC (permalink / raw)
  To: Larry Minton; +Cc: git@vger.kernel.org
In-Reply-To: <14b481f95c5043aca6cdfddfe4728fa9@BLUPR79MB001.MGDADSK.autodesk.com>

At 20:14 +0000 15 Dec 2016, Larry Minton <larry.minton@autodesk.com> wrote:
>Let's say I have a code change that I want to 'bake' for a while 
>locally, just to make sure some edge case doesn't pop up while I am 
>working on other things.  Is there any practical way of doing that?
>I could constantly merge that 'bake me' branch into other branches as I 
>work on them and then remove those changes from the branches before 
>sending them out for code review, but sooner or later pretty much 
>guaranteed to screw that up....

That sounds like the best way to me. How do you envision screwing it up?

If you anticipate messing up while removing the changes, that's only 
likely if there are conflicts and any other strategy is likely to be 
worse there.

If you suspect you'll forget to remove them before sending for code 
review there may be ways to help with that. Easiest you can add a large 
notice in the commit message(s) and/or comments; this may not prevent 
going for review but reviewers should catch it pretty quickly. To help 
prevent it even getting that far you may be able to add a pre-push hook 
to prevent such commits from being pushed to somewhere other than a 
private fork or a branch with a name that clearly indicates that it 
contains experimental code.

^ permalink raw reply

* [RFC/PATCH] Makefile: suppress some cppcheck false-positives
From: Chris Packham @ 2016-12-15 23:22 UTC (permalink / raw)
  To: git; +Cc: peff, stefan.naewe, gitter.spiros, Chris Packham
In-Reply-To: <20161214112401.mq3n5kui5eeebdtk@sigill.intra.peff.net>

Pass a list of suppressions to cppcheck so that legitimate errors are
more obvious.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---

On Thu, Dec 15, 2016 at 12:24 AM, Jeff King <peff@peff.net> wrote:
> The patch itself is OK to me, I guess. The interesting part will be
> whether people start actually _using_ cppcheck and squelching the false
> positives. I'm not sure how I feel about the in-code annotations. I'd
> have to see a patch first.

So here's a patch that adds supression files. It would work well for
things in contrib/compat that don't change that often. It would be a
nightmare to maintain for high-touch code.

 Makefile       | 7 ++++++-
 nedmalloc.supp | 4 ++++
 regcomp.supp   | 8 ++++++++
 3 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 nedmalloc.supp
 create mode 100644 regcomp.supp

diff --git a/Makefile b/Makefile
index e5c86decf..bb335ca0f 100644
--- a/Makefile
+++ b/Makefile
@@ -2637,7 +2637,12 @@ cover_db_html: cover_db
 
 .PHONY: cppcheck
 
-CPPCHECK_FLAGS = --force --quiet --inline-suppr $(if $(CPPCHECK_ADD),--enable=$(CPPCHECK_ADD))
+CPPCHECK_SUPP = --suppressions-list=nedmalloc.supp \
+	--suppressions-list=regcomp.supp
+
+CPPCHECK_FLAGS = --force --quiet --inline-suppr \
+	$(if $(CPPCHECK_ADD),--enable=$(CPPCHECK_ADD)) \
+	$(CPPCHECK_SUPP)
 
 cppcheck:
 	@cppcheck --version
diff --git a/nedmalloc.supp b/nedmalloc.supp
new file mode 100644
index 000000000..37bd54def
--- /dev/null
+++ b/nedmalloc.supp
@@ -0,0 +1,4 @@
+nullPointer:compat/nedmalloc/malloc.c.h:4093
+nullPointer:compat/nedmalloc/malloc.c.h:4106
+memleak:compat/nedmalloc/malloc.c.h:4646
+
diff --git a/regcomp.supp b/regcomp.supp
new file mode 100644
index 000000000..3ae023c26
--- /dev/null
+++ b/regcomp.supp
@@ -0,0 +1,8 @@
+memleak:compat/regex/regcomp.c:3086
+memleak:compat/regex/regcomp.c:3634
+memleak:compat/regex/regcomp.c:3086
+memleak:compat/regex/regcomp.c:3634
+uninitvar:compat/regex/regcomp.c:2802
+uninitvar:compat/regex/regcomp.c:2805
+memleak:compat/regex/regcomp.c:532
+
-- 
2.11.0.24.ge6920cf


^ permalink raw reply related

* Re: Is there a way to have local changes in a branch 'bake' while working in different branches?
From: Junio C Hamano @ 2016-12-16  0:07 UTC (permalink / raw)
  To: Larry Minton; +Cc: git@vger.kernel.org
In-Reply-To: <14b481f95c5043aca6cdfddfe4728fa9@BLUPR79MB001.MGDADSK.autodesk.com>

Larry Minton <larry.minton@autodesk.com> writes:

> Lars Schneider recommended I ask you this question.
>
> My question:
>
> Let's say I have a code change that I want to 'bake' for a while
> locally, just to make sure some edge case doesn't pop up while I
> am working on other things. Is there any practical way of doing
> that?

That sounds exactly like what I have been doing for the past several
years in public around here ;-)


^ permalink raw reply

* Re: index-pack outside of repository?
From: Junio C Hamano @ 2016-12-16  0:13 UTC (permalink / raw)
  To: Jeff King; +Cc: git
In-Reply-To: <20161215204000.avlcfaqjwstkptu2@sigill.intra.peff.net>

Jeff King <peff@peff.net> writes:

> In older versions of git will just blindly write into
> ".git/objects/pack", even though there's no repository there.
>
> So I think complaining to the user is the right thing to do here. I
> started to write a patch to have index-pack notice when it needs a repo
> and doesn't have one, but the logic is actually a bit unclear.  Do we
> need to complain early _just_ when --stdin is specified, or does that
> miss somes cases?  Likewise, are there cases where --stdin can operate
> without a repo? I couldn't think of any.

I think there are two and only two major modes; --stdin wants to put
the result in the repository it is working on, while the other mode
takes a filename to deposit the result in, so the latter does not
technically need a repository.

> I'm actually wondering if the way it calls die() in 'next' is a pretty
> reasonable way for things to work in general. It happens when we lazily
> try to ask for the repository directory. So we don't have to replicate
> logic to say "are we going to need a repo"; at the moment we need it, we
> notice we don't have it and die. The only problem is that it says "BUG"
> and not "this operation must be run in a git repository".

Isn't what we currently have is a good way to discover which
codepaths we missed to add a check to issue the latter error?

> That strategy _might_ be a problem for some programs, which would want
> to notice the issue early before doing work. But it seems like a
> reasonable outcome for index-pack. Thoughts?

That is, once we know which codepaths should require a repository, I
think it is reasonable to add a check that is done earlier than the
place where we currently try to see where we have one (which could
be deep in the callchain).  But we are all human and can miss things,
so the BUG() thing is probably fine.  We are cooking it exactly because
we would want to find such corner cases we missed, no?

^ permalink raw reply

* Re: Allow "git shortlog" to group by committer information
From: Junio C Hamano @ 2016-12-16  0:19 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <CA+55aFxSQ2wxU3cA+8uqS-W8mbobF35dVCZow2BcixGOOvGVFQ@mail.gmail.com>

Linus Torvalds <torvalds@linux-foundation.org> writes:

> Just a ping on this patch..
> 
> Jeff had apparently done something similar as part of a bigger
> patch-series, but I don't see that either. I really don't care very
> much how this is done, but I do find this very useful, ...
>
> Yes, I can just maintain this myself, and maybe nobody else needs it,
> but it's pretty simple and straightforward, and there didn't seem to
> be any real reason not to have the option..

This fell off the radar partly because of the distractions like
"there are other attempts and other ways", and also because the
message was not a text-plain that can be reviewed inline.  Let me
try to dig it up from the mail archive to see if I can find it.

^ permalink raw reply

* Re: index-pack outside of repository?
From: Jeff King @ 2016-12-16  1:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <xmqqshpou3wt.fsf@gitster.mtv.corp.google.com>

On Thu, Dec 15, 2016 at 04:13:38PM -0800, Junio C Hamano wrote:

> > So I think complaining to the user is the right thing to do here. I
> > started to write a patch to have index-pack notice when it needs a repo
> > and doesn't have one, but the logic is actually a bit unclear.  Do we
> > need to complain early _just_ when --stdin is specified, or does that
> > miss somes cases?  Likewise, are there cases where --stdin can operate
> > without a repo? I couldn't think of any.
> 
> I think there are two and only two major modes; --stdin wants to put
> the result in the repository it is working on, while the other mode
> takes a filename to deposit the result in, so the latter does not
> technically need a repository.

OK. That's easy to check for, then.  Reverse-engineering that logic from
the actual calls in index-pack.c:final() is complicated.  But certainly
basing it on --stdin is what I would have expected.

> > That strategy _might_ be a problem for some programs, which would want
> > to notice the issue early before doing work. But it seems like a
> > reasonable outcome for index-pack. Thoughts?
> 
> That is, once we know which codepaths should require a repository, I
> think it is reasonable to add a check that is done earlier than the
> place where we currently try to see where we have one (which could
> be deep in the callchain).  But we are all human and can miss things,
> so the BUG() thing is probably fine.  We are cooking it exactly because
> we would want to find such corner cases we missed, no?

Right, that was my original intent in adding the BUG(): to catch
unhandled cases, and then do the appropriate thing earlier. I was just
questioning whether the appropriate thing in some cases might be dying
at the BUG(), just with a more friendly message. That has the benefit of
being very easy to implement, and never wrong (e.g., forbidding a case
that actually _doesn't_ need to look at the repo).

But if this case really is just "if (from_stdin)" that's quite easy,
too.

-Peff

^ permalink raw reply

* Re: Allow "git shortlog" to group by committer information
From: Linus Torvalds @ 2016-12-16  1:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <xmqqoa0cu3nn.fsf@gitster.mtv.corp.google.com>

On Thu, Dec 15, 2016 at 4:19 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
> This fell off the radar partly because of the distractions like
> "there are other attempts and other ways", and also because the
> message was not a text-plain that can be reviewed inline.  Let me
> try to dig it up from the mail archive to see if I can find it.

Sorry, I'll just re-send it without the attachment. I prefer inline
myself, but I thought you didn't care (and gmail makes it
unnecessarily hard).

                Linus

^ permalink raw reply

* [PATCH 1/1] Allow "git shortlog" to group by committer information
From: Linus Torvalds @ 2016-12-16  1:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <xmqqoa0cu3nn.fsf@gitster.mtv.corp.google.com>


From: Linus Torvalds <torvalds@linux-foundation.org>
Subject: Allow "git shortlog" to group by committer information
Date: Tue, 11 Oct 2016 11:45:58 -0700

In some situations you may want to group the commits not by author, but by 
committer instead.

For example, when I just wanted to look up what I'm still missing from 
linux-next in the current merge window, I don't care so much about who 
wrote a patch, as what git tree it came from, which generally boils down 
to "who committed it".

So make git shortlog take a "-c" or "--committer" option to switch 
grouping to that. During the merge window this allows me to do things like

   git shortlog -cnse linus..next |
        head -20 |
        cut -f2 |
        sed 's/$/,/'

to easily create a list of the top-20 committers that I haven't gotten 
pull requests from yet (the committer is not necessarily the person who 
will send the pull request, but it's a reasonably good approximation).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 builtin/shortlog.c | 15 ++++++++++++---
 shortlog.h         |  1 +
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index ba0e1154a..c9585d475 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -117,11 +117,15 @@ static void read_from_stdin(struct shortlog *log)
 {
 	struct strbuf author = STRBUF_INIT;
 	struct strbuf oneline = STRBUF_INIT;
+	static const char *author_match[2] = { "Author: ", "author " };
+	static const char *committer_match[2] = { "Commit: ", "committer " };
+	const char **match;
 
+	match = log->committer ? committer_match : author_match;
 	while (strbuf_getline_lf(&author, stdin) != EOF) {
 		const char *v;
-		if (!skip_prefix(author.buf, "Author: ", &v) &&
-		    !skip_prefix(author.buf, "author ", &v))
+		if (!skip_prefix(author.buf, match[0], &v) &&
+		    !skip_prefix(author.buf, match[1], &v))
 			continue;
 		while (strbuf_getline_lf(&oneline, stdin) != EOF &&
 		       oneline.len)
@@ -140,6 +144,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
 	struct strbuf author = STRBUF_INIT;
 	struct strbuf oneline = STRBUF_INIT;
 	struct pretty_print_context ctx = {0};
+	const char *fmt;
 
 	ctx.fmt = CMIT_FMT_USERFORMAT;
 	ctx.abbrev = log->abbrev;
@@ -148,7 +153,9 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
 	ctx.date_mode.type = DATE_NORMAL;
 	ctx.output_encoding = get_log_output_encoding();
 
-	format_commit_message(commit, "%an <%ae>", &author, &ctx);
+	fmt = log->committer ? "%cn <%ce>" : "%an <%ae>";
+
+	format_commit_message(commit, fmt, &author, &ctx);
 	if (!log->summary) {
 		if (log->user_format)
 			pretty_print_commit(&ctx, commit, &oneline);
@@ -238,6 +245,8 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
 	int nongit = !startup_info->have_repository;
 
 	const struct option options[] = {
+		OPT_BOOL('c', "committer", &log.committer,
+			 N_("Group by committer rather than author")),
 		OPT_BOOL('n', "numbered", &log.sort_by_number,
 			 N_("sort output according to the number of commits per author")),
 		OPT_BOOL('s', "summary", &log.summary,
diff --git a/shortlog.h b/shortlog.h
index 5a326c686..5d64cfe92 100644
--- a/shortlog.h
+++ b/shortlog.h
@@ -13,6 +13,7 @@ struct shortlog {
 	int in2;
 	int user_format;
 	int abbrev;
+	int committer;
 
 	char *common_repo_prefix;
 	int email;

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox