Git development
 help / color / mirror / Atom feed
* Re: git add -p with new file
From: Ariel @ 2016-12-09 18:26 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Git Mailing List
In-Reply-To: <CACsJy8A_YMyEUgX--1tEfJC4aaYfDbFFL8WEs6CHp4a4=mHRjw@mail.gmail.com>


On Wed, 7 Dec 2016, Duy Nguyen wrote:

> On Wed, Dec 7, 2016 at 8:18 AM, Ariel <asgit@dsgml.com> wrote:

>> If you do git add -p new_file it says:

>> No changes.

>> Which is a rather confusing message. I would expect it to show me the
>> content of the file in patch form, in the normal way that -p works, let me
>> edit it, etc.

> We could improve it a bit, suggesting the user to do git add -N. But
> is there a point of using -p on a new file?

I got into the habit of always using -p as a way of checking my diffs 
before committing, so I ran it out of habit on a new file as well and got 
that confusing message.

It's even worse if you run it on multiple files, some changed, some added 
- the added ones are ignored completely, without any message at all.

> It will be one big chunk, you can't split anything.

That's fine, that's what I would expect.

> Perhaps maybe you want to use 'e' to edit what's added?

I might, but mainly it would show me what it was adding.

 	-Ariel

^ permalink raw reply

* Re: [PATCH 4/5] Make sequencer abort safer
From: Junio C Hamano @ 2016-12-09 18:33 UTC (permalink / raw)
  To: Stephan Beyer
  Cc: Johannes Schindelin, git, Christian Couder, SZEDER Gábor
In-Reply-To: <c02708de-8b47-e490-4a1e-77f5727b1156@gmx.net>

Stephan Beyer <s-beyer@gmx.net> writes:

> However:
>
>> -static void update_curr_file()
>> +static void update_current_file(void)
>
> This function name could lead to the impression that there is some
> current file (defined by a global state or whatever) that is updated.
>
> So I'd rather rename the *file* to one of
>
>  * sequencer/abort-safety (consistent to am, describes its purpose)
>  * sequencer/safety (shorter, still describes the purpose)
>  * sequencer/current-head (describes what it contains)
>  * sequencer/last (a four-letter word, not totally unambiguous though)

OK, so here is a patch that needs to be squashed further on top of
4/5.  I just picked the first one on your list ;-)

Thanks.

 sequencer.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/sequencer.c b/sequencer.c
index 874aaa4cd4..3ac4cb8d3b 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -27,7 +27,7 @@ GIT_PATH_FUNC(git_path_seq_dir, "sequencer")
 static GIT_PATH_FUNC(git_path_todo_file, "sequencer/todo")
 static GIT_PATH_FUNC(git_path_opts_file, "sequencer/opts")
 static GIT_PATH_FUNC(git_path_head_file, "sequencer/head")
-static GIT_PATH_FUNC(git_path_current_file, "sequencer/current")
+static GIT_PATH_FUNC(git_path_abort_safety_file, "sequencer/abort-safety")
 
 /*
  * A script to set the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and
@@ -306,7 +306,7 @@ static int error_dirty_index(struct replay_opts *opts)
 	return -1;
 }
 
-static void update_current_file(void)
+static void update_abort_safety_file(void)
 {
 	struct object_id head;
 
@@ -315,9 +315,9 @@ static void update_current_file(void)
 		return;
 
 	if (!get_oid("HEAD", &head))
-		write_file(git_path_current_file(), "%s", oid_to_hex(&head));
+		write_file(git_path_abort_safety_file(), "%s", oid_to_hex(&head));
 	else
-		write_file(git_path_current_file(), "%s", "");
+		write_file(git_path_abort_safety_file(), "%s", "");
 }
 
 static int fast_forward_to(const unsigned char *to, const unsigned char *from,
@@ -349,7 +349,7 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from,
 	strbuf_release(&sb);
 	strbuf_release(&err);
 	ref_transaction_free(transaction);
-	update_current_file();
+	update_abort_safety_file();
 	return 0;
 }
 
@@ -824,7 +824,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
 
 leave:
 	free_message(commit, &msg);
-	update_current_file();
+	update_abort_safety_file();
 
 	return res;
 }
@@ -1149,18 +1149,18 @@ static int rollback_is_safe(void)
 	struct strbuf sb = STRBUF_INIT;
 	struct object_id expected_head, actual_head;
 
-	if (strbuf_read_file(&sb, git_path_current_file(), 0) >= 0) {
+	if (strbuf_read_file(&sb, git_path_abort_safety_file(), 0) >= 0) {
 		strbuf_trim(&sb);
 		if (get_oid_hex(sb.buf, &expected_head)) {
 			strbuf_release(&sb);
-			die(_("could not parse %s"), git_path_current_file());
+			die(_("could not parse %s"), git_path_abort_safety_file());
 		}
 		strbuf_release(&sb);
 	}
 	else if (errno == ENOENT)
 		oidclr(&expected_head);
 	else
-		die_errno(_("could not read '%s'"), git_path_current_file());
+		die_errno(_("could not read '%s'"), git_path_abort_safety_file());
 
 	if (get_oid("HEAD", &actual_head))
 		oidclr(&actual_head);
@@ -1436,7 +1436,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
 		return -1;
 	if (save_opts(opts))
 		return -1;
-	update_current_file();
+	update_abort_safety_file();
 	res = pick_commits(&todo_list, opts);
 	todo_list_release(&todo_list);
 	return res;

^ permalink raw reply related

* Re: git add -p with new file
From: Ariel @ 2016-12-09 18:43 UTC (permalink / raw)
  To: Jeff King; +Cc: git
In-Reply-To: <20161209141129.r53b4rbtgd76fn2a@sigill.intra.peff.net>


On Fri, 9 Dec 2016, Jeff King wrote:

> On Tue, Dec 06, 2016 at 08:18:59PM -0500, Ariel wrote:

>> If you do git add -p new_file it says:

>> No changes.

>> Which is a rather confusing message. I would expect it to show me the
>> content of the file in patch form, in the normal way that -p works, let me
>> edit it, etc.

> What should:
[git add directory with two new files]
> do?

It should do the exact same thing that git add without -p does: Add the 
directory and both files, but because of the -p also show the diff on the 
screen and ask.

> It's contrary to the rest of git-add for specifying pathspecs to 
> actually make things _more_ inclusive rather than less.

Is it? Because git add without -p is happy to add new files.

> Historically "add -p" has been more like "add -u" in updating tracked
> files.

But it doesn't have to be that way. You could make add -p identical to add 
without options, except the -p prompts to review diffs first.

> We have "-A" for "update everything _and_ new files". It doesn't
> seem unreasonable to me to have a variant of "-p" that is similar.

That seems unnecessarily complex because -p asks about each file, so you 
will never find new files added without realizing it.

> I don't think that variant should just be "add -N everything, and then
> run add -p". As Duy points out, the patch for a new file is just one big
> block. But the decision of "do I want to start tracking this untracked
> file" is potentially an interesting one.

What makes sense to me is a two part question: First ask 'Add new path', 
and then if yes, ask to stage the hunk (where the hunk is the entire 
file).

This makes -p useful on new files, without hurting prior expectations of 
how it works.

 	-Ariel

^ permalink raw reply

* Re: [PATCHv7 4/6] worktree: have a function to check if worktrees are in use
From: Stefan Beller @ 2016-12-09 18:49 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Brandon Williams, git@vger.kernel.org, Junio C Hamano
In-Reply-To: <20161209120006.GA6609@ash>

On Fri, Dec 9, 2016 at 4:00 AM, Duy Nguyen <pclouds@gmail.com> wrote:

> int submodule_uses_worktrees(const char *path)
> {
>         struct strbuf path = STRBUF_INIT;
>         DIR *dir;
>         struct dirent *d;
>         int ret = 0;
>
>         strbuf_addf(&path, "%s/worktrees", path);
>         dir = opendir(path.buf);
>         strbuf_release(&path);
>
>         if (!dir)
>                 return 0;

The submodule may be one of the linked worktrees, which would be
caught if we use the code as I sent it out?

If this is one of the linked worktrees, we'd rather check if a file
"commondir" or "gitdir" exists?

I ask that because I would not know how to relocate such a linked
worktree gitdir?

^ permalink raw reply

* [PATCH v2 1/5] am: Fix filename in safe_to_abort() error message
From: Stephan Beyer @ 2016-12-09 19:01 UTC (permalink / raw)
  To: git; +Cc: Stephan Beyer, Christian Couder, Junio C Hamano,
	SZEDER Gábor
In-Reply-To: <xmqq4m2drlys.fsf@gitster.mtv.corp.google.com>

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---
 builtin/am.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/am.c b/builtin/am.c
index 6981f42ce..7cf40e6f2 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -2124,7 +2124,7 @@ static int safe_to_abort(const struct am_state *state)
 
 	if (read_state_file(&sb, state, "abort-safety", 1) > 0) {
 		if (get_oid_hex(sb.buf, &abort_safety))
-			die(_("could not parse %s"), am_path(state, "abort_safety"));
+			die(_("could not parse %s"), am_path(state, "abort-safety"));
 	} else
 		oidclr(&abort_safety);
 
-- 
2.11.0.27.g74d6bea


^ permalink raw reply related

* [PATCH v2 3/5] Add test that cherry-pick --abort does not unsafely change HEAD
From: Stephan Beyer @ 2016-12-09 19:01 UTC (permalink / raw)
  To: git; +Cc: Stephan Beyer, Christian Couder, Junio C Hamano,
	SZEDER Gábor
In-Reply-To: <xmqq4m2drlys.fsf@gitster.mtv.corp.google.com>

The test expects failure because it is a current breakage
reported by Junio C Hamano.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---
 t/t3510-cherry-pick-sequence.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh
index 7b7a89dbd..efcd4fc48 100755
--- a/t/t3510-cherry-pick-sequence.sh
+++ b/t/t3510-cherry-pick-sequence.sh
@@ -147,6 +147,16 @@ test_expect_success '--abort to cancel single cherry-pick' '
 	git diff-index --exit-code HEAD
 '
 
+test_expect_failure '--abort does not unsafely change HEAD' '
+	pristine_detach initial &&
+	test_must_fail git cherry-pick picked anotherpick &&
+	git reset --hard base &&
+	test_must_fail git cherry-pick picked anotherpick &&
+	git cherry-pick --abort 2>actual &&
+	test_i18ngrep "You seem to have moved HEAD" actual &&
+	test_cmp_rev base HEAD
+'
+
 test_expect_success 'cherry-pick --abort to cancel multiple revert' '
 	pristine_detach anotherpick &&
 	test_expect_code 1 git revert base..picked &&
-- 
2.11.0.27.g74d6bea


^ permalink raw reply related

* [PATCH v2 2/5] am: Change safe_to_abort()'s not rewinding error into a warning
From: Stephan Beyer @ 2016-12-09 19:01 UTC (permalink / raw)
  To: git; +Cc: Stephan Beyer, Christian Couder, Junio C Hamano,
	SZEDER Gábor
In-Reply-To: <xmqq4m2drlys.fsf@gitster.mtv.corp.google.com>

The error message tells the user that something went terribly wrong
and the --abort could not be performed. But the --abort is performed,
only without rewinding. By simply changing the error into a warning,
we indicate the user that she must not try something like
"git am --abort --force", instead she just has to check the HEAD.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---
 builtin/am.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/am.c b/builtin/am.c
index 7cf40e6f2..826f18ba1 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -2134,7 +2134,7 @@ static int safe_to_abort(const struct am_state *state)
 	if (!oidcmp(&head, &abort_safety))
 		return 1;
 
-	error(_("You seem to have moved HEAD since the last 'am' failure.\n"
+	warning(_("You seem to have moved HEAD since the last 'am' failure.\n"
 		"Not rewinding to ORIG_HEAD"));
 
 	return 0;
-- 
2.11.0.27.g74d6bea


^ permalink raw reply related

* [PATCH v2 4/5] Make sequencer abort safer
From: Stephan Beyer @ 2016-12-09 19:01 UTC (permalink / raw)
  To: git; +Cc: Stephan Beyer, Christian Couder, Junio C Hamano,
	SZEDER Gábor
In-Reply-To: <xmqq4m2drlys.fsf@gitster.mtv.corp.google.com>

In contrast to "git am --abort", a sequencer abort did not check
whether the current HEAD is the one that is expected. This can
lead to loss of work (when not spotted and resolved using reflog
before the garbage collector chimes in).

This behavior is now changed by mimicking "git am --abort":
the abortion is done but HEAD is not changed when the current HEAD
is not the expected HEAD.

A new file "sequencer/current" is added to save the expected HEAD.

The new behavior is only active when --abort is invoked on multiple
picks. The problem does not occur for the single-pick case because
it is handled differently.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---
 sequencer.c                     | 48 +++++++++++++++++++++++++++++++++++++++++
 t/t3510-cherry-pick-sequence.sh |  2 +-
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/sequencer.c b/sequencer.c
index 30b10ba14..35c158471 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -27,6 +27,7 @@ GIT_PATH_FUNC(git_path_seq_dir, "sequencer")
 static GIT_PATH_FUNC(git_path_todo_file, "sequencer/todo")
 static GIT_PATH_FUNC(git_path_opts_file, "sequencer/opts")
 static GIT_PATH_FUNC(git_path_head_file, "sequencer/head")
+static GIT_PATH_FUNC(git_path_abort_safety_file, "sequencer/abort-safety")
 
 /*
  * A script to set the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and
@@ -310,6 +311,20 @@ static int error_dirty_index(struct replay_opts *opts)
 	return -1;
 }
 
+static void update_abort_safety_file(void)
+{
+	struct object_id head;
+
+	/* Do nothing on a single-pick */
+	if (!file_exists(git_path_seq_dir()))
+		return;
+
+	if (!get_oid("HEAD", &head))
+		write_file(git_path_abort_safety_file(), "%s", oid_to_hex(&head));
+	else
+		write_file(git_path_abort_safety_file(), "%s", "");
+}
+
 static int fast_forward_to(const unsigned char *to, const unsigned char *from,
 			int unborn, struct replay_opts *opts)
 {
@@ -339,6 +354,7 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from,
 	strbuf_release(&sb);
 	strbuf_release(&err);
 	ref_transaction_free(transaction);
+	update_abort_safety_file();
 	return 0;
 }
 
@@ -813,6 +829,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
 
 leave:
 	free_message(commit, &msg);
+	update_abort_safety_file();
 
 	return res;
 }
@@ -1132,6 +1149,30 @@ static int save_head(const char *head)
 	return 0;
 }
 
+static int rollback_is_safe(void)
+{
+	struct strbuf sb = STRBUF_INIT;
+	struct object_id expected_head, actual_head;
+
+	if (strbuf_read_file(&sb, git_path_abort_safety_file(), 0) >= 0) {
+		strbuf_trim(&sb);
+		if (get_oid_hex(sb.buf, &expected_head)) {
+			strbuf_release(&sb);
+			die(_("could not parse %s"), git_path_abort_safety_file());
+		}
+		strbuf_release(&sb);
+	}
+	else if (errno == ENOENT)
+		oidclr(&expected_head);
+	else
+		die_errno(_("could not read '%s'"), git_path_abort_safety_file());
+
+	if (get_oid("HEAD", &actual_head))
+		oidclr(&actual_head);
+
+	return !oidcmp(&actual_head, &expected_head);
+}
+
 static int reset_for_rollback(const unsigned char *sha1)
 {
 	const char *argv[4];	/* reset --merge <arg> + NULL */
@@ -1189,6 +1230,12 @@ int sequencer_rollback(struct replay_opts *opts)
 		error(_("cannot abort from a branch yet to be born"));
 		goto fail;
 	}
+
+	if (!rollback_is_safe()) {
+		/* Do not error, just do not rollback */
+		warning(_("You seem to have moved HEAD. "
+			  "Not rewinding, check your HEAD!"));
+	} else
 	if (reset_for_rollback(sha1))
 		goto fail;
 	strbuf_release(&buf);
@@ -1393,6 +1440,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
 		return -1;
 	if (save_opts(opts))
 		return -1;
+	update_abort_safety_file();
 	res = pick_commits(&todo_list, opts);
 	todo_list_release(&todo_list);
 	return res;
diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh
index efcd4fc48..372307c21 100755
--- a/t/t3510-cherry-pick-sequence.sh
+++ b/t/t3510-cherry-pick-sequence.sh
@@ -147,7 +147,7 @@ test_expect_success '--abort to cancel single cherry-pick' '
 	git diff-index --exit-code HEAD
 '
 
-test_expect_failure '--abort does not unsafely change HEAD' '
+test_expect_success '--abort does not unsafely change HEAD' '
 	pristine_detach initial &&
 	test_must_fail git cherry-pick picked anotherpick &&
 	git reset --hard base &&
-- 
2.11.0.27.g74d6bea


^ permalink raw reply related

* [PATCH v2 5/5] sequencer: Remove useless get_dir() function
From: Stephan Beyer @ 2016-12-09 19:01 UTC (permalink / raw)
  To: git; +Cc: Stephan Beyer, Christian Couder, Junio C Hamano,
	SZEDER Gábor
In-Reply-To: <xmqq4m2drlys.fsf@gitster.mtv.corp.google.com>

This function is used only once, for the removal of the
directory. It is not used for the creation of the directory
nor anywhere else.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---
 sequencer.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/sequencer.c b/sequencer.c
index 35c158471..aba096a0a 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -47,11 +47,6 @@ static inline int is_rebase_i(const struct replay_opts *opts)
 	return 0;
 }
 
-static const char *get_dir(const struct replay_opts *opts)
-{
-	return git_path_seq_dir();
-}
-
 static const char *get_todo_path(const struct replay_opts *opts)
 {
 	return git_path_todo_file();
@@ -160,7 +155,7 @@ int sequencer_remove_state(struct replay_opts *opts)
 		free(opts->xopts[i]);
 	free(opts->xopts);
 
-	strbuf_addf(&dir, "%s", get_dir(opts));
+	strbuf_addf(&dir, "%s", git_path_seq_dir());
 	remove_dir_recursively(&dir, 0);
 	strbuf_release(&dir);
 
-- 
2.11.0.27.g74d6bea


^ permalink raw reply related

* Re: [PATCH v2 00/16] pathspec cleanup
From: Brandon Williams @ 2016-12-09 19:03 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, sbeller, pclouds
In-Reply-To: <xmqqk2barls5.fsf@gitster.mtv.corp.google.com>

On 12/08, Junio C Hamano wrote:
> Will queue, but with fixes on issues spotted by my pre-acceptance
> mechanical filter squashed in, to fix style issues in the
> destination of code movements.

Is this pre-acceptance filter you use something that I could run
locally?

-- 
Brandon Williams

^ permalink raw reply

* Re: [BUG] Colon in remote urls
From: Junio C Hamano @ 2016-12-09 19:07 UTC (permalink / raw)
  To: Jeff King; +Cc: Klaus Ethgen, git
In-Reply-To: <20161209152219.ehfk475vdg4levop@sigill.intra.peff.net>

Jeff King <peff@peff.net> writes:

> (One other option is to just declare that the quarantine feature doesn't
> work with colons in the pathname, but stop turning it on by default. I'm
> not sure I like that, though).

I think we long time ago in 2005 have declared that a colon in a
directory name would not work for Git repositories because of things
like GIT_CEILING_DIRECTORIES, GIT_ALTERNATE_OBJECT_DIRECTORIES; so I
do not think we terribly mind that direction.

> Here's a rough idea of what the quoting solution could look like. It
> should make your case work, but I'm not sure what we want to do about
> backwards-compatibility, if anything.

Yes, obviously it robs from those with backslash in their pathnames
to please those with colons; we've never catered to the latter, so I
am not sure if the trade-off is worth it.

I can see how adding a new environment variable could work, though.
A naive way would be to add GIT_ALT_OBJ_DIRS that uses your quoting
when splitting its elements, give it precedence over the existing
one (or allow to use both and take union as the set of alternate
object stores) and make sure that the codepaths we use internally
uses the new variable.  But if the quarantine codepath will stay to
be the only user of this mechanism (and I strongly suspect that will
be the case), the new environment could just be pointing at a single
directory, i.e. GIT_OBJECT_QUARANTINE_DIRECTORY, whose value is
added without splitting to the list of alternate object stores, and
the quarantine codepath can export that instead.

^ permalink raw reply

* Re: Any interest in 'git merge --continue' as a command
From: Junio C Hamano @ 2016-12-09 19:16 UTC (permalink / raw)
  To: Jeff King; +Cc: Chris Packham, GIT
In-Reply-To: <20161209091127.sxxczhfslrqsqs3m@sigill.intra.peff.net>

Jeff King <peff@peff.net> writes:

>> They knew about git rebase --continue (and git am and git cherry-pick)
>> but they were unsure how to "continue" a merge (it didn't help that
>> the advice saying to use 'git commit' was scrolling off the top of the
>> terminal). I know that using 'git commit' has been the standard way to
>> complete a merge but given other commands have a --continue should
>> merge have it as well?
>
> It seems like that would be in line with 35d2fffdb (Provide 'git merge
> --abort' as a synonym to 'git reset --merge', 2010-11-09), whose stated
> goal was providing consistency with other multi-command operations.
>
> I assume it would _just_ run a vanilla "git commit", and not try to do
> any trickery with updating the index (which could be disastrous).

If we were to have "merge --continue", I agree that it would be the
logical implementation.

There is nothing to "continue" in a stopped merge where Git asked
for help from the user, and because of that, I view the final "git
commit" as "concluding the merge", not "continuing".  "continue"
makes quite a lot of sense with rebase and cherry-pick A..B that
stopped; it concludes the current step and let it continue to
process the remainder.  So from that point of view, it somewhat
feels strange to call it "merge --continue", but it probably is just
me.




^ permalink raw reply

* [PATCH 14/16] pathspec: create strip submodule slash helpers
From: Brandon Williams @ 2016-12-09 19:18 UTC (permalink / raw)
  To: git; +Cc: Brandon Williams, sbeller, pclouds, gitster
In-Reply-To: <CACsJy8AX6C8Tux9_8ZynBMNS2EW2pKQOGK8k0hVmbWvbZ8pa=Q@mail.gmail.com>

Factor out the logic responsible for stripping the trailing slash on
pathspecs referencing submodules into its own function.

Change-Id: Icad62647c04b4195309def0e3db416203d14f9e4
Signed-off-by: Brandon Williams <bmwill@google.com>
---
 pathspec.c | 68 ++++++++++++++++++++++++++++++++++++++------------------------
 1 file changed, 42 insertions(+), 26 deletions(-)

diff --git a/pathspec.c b/pathspec.c
index 84a57cf..4d9a6a0 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -258,6 +258,44 @@ static const char *parse_element_magic(unsigned *magic, int *prefix_len,
 		return parse_short_magic(magic, elem);
 }
 
+static void strip_submodule_slash_cheap(struct pathspec_item *item)
+{
+	if (item->len >= 1 && item->match[item->len - 1] == '/') {
+		int i = cache_name_pos(item->match, item->len - 1);
+
+		if (i >= 0 && S_ISGITLINK(active_cache[i]->ce_mode)) {
+			item->len--;
+			item->match[item->len] = '\0';
+		}
+	}
+}
+
+static void strip_submodule_slash_expensive(struct pathspec_item *item)
+{
+	int i;
+
+	for (i = 0; i < active_nr; i++) {
+		struct cache_entry *ce = active_cache[i];
+		int ce_len = ce_namelen(ce);
+
+		if (!S_ISGITLINK(ce->ce_mode))
+			continue;
+
+		if (item->len <= ce_len || item->match[ce_len] != '/' ||
+		    memcmp(ce->name, item->match, ce_len))
+			continue;
+
+		if (item->len == ce_len + 1) {
+			/* strip trailing slash */
+			item->len--;
+			item->match[item->len] = '\0';
+		} else {
+			die(_("Pathspec '%s' is in submodule '%.*s'"),
+			    item->original, ce_len, ce->name);
+		}
+	}
+}
+
 /*
  * Take an element of a pathspec and check for magic signatures.
  * Append the result to the prefix. Return the magic bitmap.
@@ -278,7 +316,7 @@ static unsigned prefix_pathspec(struct pathspec_item *item, unsigned flags,
 	unsigned magic = 0, element_magic = 0;
 	const char *copyfrom = elt;
 	char *match;
-	int i, pathspec_prefix = -1;
+	int pathspec_prefix = -1;
 
 	/* PATHSPEC_LITERAL_PATH ignores magic */
 	if (flags & PATHSPEC_LITERAL_PATH) {
@@ -329,33 +367,11 @@ static unsigned prefix_pathspec(struct pathspec_item *item, unsigned flags,
 	item->len = strlen(item->match);
 	item->prefix = prefixlen;
 
-	if ((flags & PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP) &&
-	    (item->len >= 1 && item->match[item->len - 1] == '/') &&
-	    (i = cache_name_pos(item->match, item->len - 1)) >= 0 &&
-	    S_ISGITLINK(active_cache[i]->ce_mode)) {
-		item->len--;
-		match[item->len] = '\0';
-	}
+	if (flags & PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP)
+		strip_submodule_slash_cheap(item);
 
 	if (flags & PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE)
-		for (i = 0; i < active_nr; i++) {
-			struct cache_entry *ce = active_cache[i];
-			int ce_len = ce_namelen(ce);
-
-			if (!S_ISGITLINK(ce->ce_mode))
-				continue;
-
-			if (item->len <= ce_len || match[ce_len] != '/' ||
-			    memcmp(ce->name, match, ce_len))
-				continue;
-			if (item->len == ce_len + 1) {
-				/* strip trailing slash */
-				item->len--;
-				match[item->len] = '\0';
-			} else
-				die (_("Pathspec '%s' is in submodule '%.*s'"),
-				     elt, ce_len, ce->name);
-		}
+		strip_submodule_slash_expensive(item);
 
 	if (magic & PATHSPEC_LITERAL)
 		item->nowildcard_len = item->len;
-- 
2.8.0.rc3.226.g39d4020


^ permalink raw reply related

* Re: [PATCH 02/17] dir: convert create_simplify to use the pathspec struct interface
From: Brandon Williams @ 2016-12-09 19:23 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Git Mailing List, Stefan Beller, Junio C Hamano
In-Reply-To: <CACsJy8Cc6hE1Rbqjrc93xDMc0UUm0yMh0A-fyu3dfJ2G1jhENQ@mail.gmail.com>

On 12/09, Duy Nguyen wrote:
> On Fri, Dec 9, 2016 at 1:19 AM, Brandon Williams <bmwill@google.com> wrote:
> > On 12/08, Duy Nguyen wrote:
> >> On Thu, Dec 8, 2016 at 7:03 AM, Brandon Williams <bmwill@google.com> wrote:
> >> > On 12/07, Duy Nguyen wrote:
> >> >> On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams <bmwill@google.com> wrote:
> >> >> > Convert 'create_simplify()' to use the pathspec struct interface from
> >> >> > using the '_raw' entry in the pathspec.
> >> >>
> >> >> It would be even better to kill this create_simplify() and let
> >> >> simplify_away() handle struct pathspec directly.
> >> >>
> >> >> There is a bug in this code, that might have been found if we
> >> >> simpify_away() handled pathspec directly: the memcmp() in
> >> >> simplify_away() will not play well with :(icase) magic. My bad. If
> >> >> :(icase) is used, the easiest/safe way is simplify nothing. Later on
> >> >> maybe we can teach simplify_away() to do strncasecmp instead. We could
> >> >> ignore exclude patterns there too (although not excluding is not a
> >> >> bug).
> >> >
> >> > So are you implying that the simplify struct needs to be killed?  That
> >> > way the pathspec struct itself is being passed around instead?
> >>
> >> Yes. simplify struct was a thing when pathspec was an array of char *.
> >> At this point I think it can retire (when we have time to retire it)
> >
> > Alright, then for now I can leave this change as is and have a follow up
> > series that kills the simplify struct.
> 
> Do let me know if you decide to drop it, so I can put it back in my backlog.

K will do

-- 
Brandon Williams

^ permalink raw reply

* Re: BUG: "cherry-pick A..B || git reset --hard OTHER"
From: Stephan Beyer @ 2016-12-09 19:24 UTC (permalink / raw)
  To: Junio C Hamano, Duy Nguyen
  Cc: Git Mailing List, Christian Couder, SZEDER Gábor
In-Reply-To: <xmqq8trprn7f.fsf@gitster.mtv.corp.google.com>

Hi Junio,

On 12/09/2016 07:07 PM, Junio C Hamano wrote:
> Duy Nguyen <pclouds@gmail.com> writes:
>> Having the same operation with different names only increases git
>> reputation of bad/inconsistent UI. Either forget is renamed to quit,
>> or vice versa. I prefer forget, but the decision is yours and the
>> community's. So I'm sending two patches to rename in either direction.
>> You can pick one.
> 
> I actually was advocating to remove both by making --abort saner.
> With an updated --abort that behaves saner, is "rebase --forget"
> still necessary?

A quick change in t3407 of the "rebase --forget" test to use "rebase
--abort" failed.  That's because it checks the use-case of
forgetting/aborting without changing the HEAD.  So --abort makes a
rollback, --forget just keeps the current head.  I am not sure if that
tested use-case is a real use-case though.

A quick change in the pristine_detach function in t3510 and t3511 from
"cherry-pick --quit" to "cherry-pick --abort" works when one ignores the
return value of "cherry-pick --abort". The "--quit" is used here to
ensure a clean cherry-pick state, and --quit always succeeds, even if no
cherry-pick is in progress.  That may be a real use-case somehow that
could also be used for "rebase --forget"

t3510 also shows another use-case for --quit: the title says it all:
"cherry-pick --quit" to "cherry-pick --abort"

With this additional information, I'd vote to keep --quit/--forget and
just make it consistent.

~Stephan


^ permalink raw reply

* Re: BUG: "cherry-pick A..B || git reset --hard OTHER"
From: Stephan Beyer @ 2016-12-09 19:28 UTC (permalink / raw)
  To: Junio C Hamano, Duy Nguyen
  Cc: Git Mailing List, Christian Couder, SZEDER Gábor
In-Reply-To: <e0780f7c-ccb4-29fe-3d72-80e45a202f65@gmx.net>

On 12/09/2016 08:24 PM, Stephan Beyer wrote:
> t3510 also shows another use-case for --quit: the title says it all:
> "cherry-pick --quit" to "cherry-pick --abort"

I should've read what I actually pasted.
I wanted to paste: '--quit keeps HEAD and conflicted index intact'

Sorry for making no sense ;)

> With this additional information, I'd vote to keep --quit/--forget and
> just make it consistent.

Now!

~Stephan

^ permalink raw reply

* Re: [REGRESSION 2.10.2] problematic "empty auth" changes
From: Junio C Hamano @ 2016-12-09 19:31 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: David Turner, git
In-Reply-To: <alpine.DEB.2.20.1612091048540.23160@virtualbox>

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

> It would be different, of course, if http.emptyAuth would *not* allow the
> user to type their credentials when accessing something like
> https://github.com/dscho/shhh-secret-repository, *only* trying the login
> credentials. But that is not the case, with http.emptyAuth=true, login
> credentials are attempted first, and when they fail, the user is still
> asked interactively for their credentials.
>
> All I can see is that this would be *an improvement*: corporate users
> trying to access a Git repository that requires their login credentials
> would now not even need to enter empty user name/password.

Yup, my thought process after seeing your first message to David
exactly mirrored the above two paragraphs.  It sounds like you two
have a good plan ;-)

Thanks.

> This alone would be already a good reason to change the default, IMHO.
>
> So here is my plan:
>
> - change the default of http.emptyAuth to true in the next Git for Windows
>   version
>
> - publish a prerelease for early adopters to test
>
> - contribute this patch here on the Git mailing list, in the hope that it
>   will make it into the next major version
>
> Ciao,
> Dscho

^ permalink raw reply

* Re: [PATCH 14/16] pathspec: create strip submodule slash helpers
From: Stefan Beller @ 2016-12-09 19:40 UTC (permalink / raw)
  To: Brandon Williams; +Cc: git@vger.kernel.org, Duy Nguyen, Junio C Hamano
In-Reply-To: <1481311118-174146-1-git-send-email-bmwill@google.com>

On Fri, Dec 9, 2016 at 11:18 AM, Brandon Williams <bmwill@google.com> wrote:
> Factor out the logic responsible for stripping the trailing slash on
> pathspecs referencing submodules into its own function.
>
> Change-Id: Icad62647c04b4195309def0e3db416203d14f9e4

I think we should come up with a solution to wipe out change ids
before sending emails. ;)

> Signed-off-by: Brandon Williams <bmwill@google.com>
> ---
>  pathspec.c | 68 ++++++++++++++++++++++++++++++++++++++------------------------
>  1 file changed, 42 insertions(+), 26 deletions(-)
>
> diff --git a/pathspec.c b/pathspec.c
> index 84a57cf..4d9a6a0 100644
> --- a/pathspec.c
> +++ b/pathspec.c
> @@ -258,6 +258,44 @@ static const char *parse_element_magic(unsigned *magic, int *prefix_len,
>                 return parse_short_magic(magic, elem);
>  }
>
> +static void strip_submodule_slash_cheap(struct pathspec_item *item)
> +{
> +       if (item->len >= 1 && item->match[item->len - 1] == '/') {
> +               int i = cache_name_pos(item->match, item->len - 1);
> +
> +               if (i >= 0 && S_ISGITLINK(active_cache[i]->ce_mode)) {
> +                       item->len--;
> +                       item->match[item->len] = '\0';
> +               }
> +       }
> +}
> +
> +static void strip_submodule_slash_expensive(struct pathspec_item *item)
> +{
> +       int i;
> +
> +       for (i = 0; i < active_nr; i++) {
> +               struct cache_entry *ce = active_cache[i];
> +               int ce_len = ce_namelen(ce);
> +
> +               if (!S_ISGITLINK(ce->ce_mode))
> +                       continue;
> +
> +               if (item->len <= ce_len || item->match[ce_len] != '/' ||
> +                   memcmp(ce->name, item->match, ce_len))
> +                       continue;
> +
> +               if (item->len == ce_len + 1) {
> +                       /* strip trailing slash */
> +                       item->len--;
> +                       item->match[item->len] = '\0';
> +               } else {
> +                       die(_("Pathspec '%s' is in submodule '%.*s'"),
> +                           item->original, ce_len, ce->name);
> +               }
> +       }
> +}
> +
>  /*
>   * Take an element of a pathspec and check for magic signatures.
>   * Append the result to the prefix. Return the magic bitmap.
> @@ -278,7 +316,7 @@ static unsigned prefix_pathspec(struct pathspec_item *item, unsigned flags,
>         unsigned magic = 0, element_magic = 0;
>         const char *copyfrom = elt;
>         char *match;
> -       int i, pathspec_prefix = -1;
> +       int pathspec_prefix = -1;
>
>         /* PATHSPEC_LITERAL_PATH ignores magic */
>         if (flags & PATHSPEC_LITERAL_PATH) {
> @@ -329,33 +367,11 @@ static unsigned prefix_pathspec(struct pathspec_item *item, unsigned flags,
>         item->len = strlen(item->match);
>         item->prefix = prefixlen;
>
> -       if ((flags & PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP) &&
> -           (item->len >= 1 && item->match[item->len - 1] == '/') &&
> -           (i = cache_name_pos(item->match, item->len - 1)) >= 0 &&
> -           S_ISGITLINK(active_cache[i]->ce_mode)) {
> -               item->len--;
> -               match[item->len] = '\0';
> -       }
> +       if (flags & PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP)
> +               strip_submodule_slash_cheap(item);
>
>         if (flags & PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE)
> -               for (i = 0; i < active_nr; i++) {
> -                       struct cache_entry *ce = active_cache[i];
> -                       int ce_len = ce_namelen(ce);
> -
> -                       if (!S_ISGITLINK(ce->ce_mode))
> -                               continue;
> -
> -                       if (item->len <= ce_len || match[ce_len] != '/' ||
> -                           memcmp(ce->name, match, ce_len))
> -                               continue;
> -                       if (item->len == ce_len + 1) {
> -                               /* strip trailing slash */
> -                               item->len--;
> -                               match[item->len] = '\0';
> -                       } else
> -                               die (_("Pathspec '%s' is in submodule '%.*s'"),
> -                                    elt, ce_len, ce->name);
> -               }
> +               strip_submodule_slash_expensive(item);
>
>         if (magic & PATHSPEC_LITERAL)
>                 item->nowildcard_len = item->len;
> --
> 2.8.0.rc3.226.g39d4020
>

^ permalink raw reply

* Re: [PATCH v2 0/4] road to reentrant real_path
From: Brandon Williams @ 2016-12-09 19:42 UTC (permalink / raw)
  To: Duy Nguyen
  Cc: Git Mailing List, Stefan Beller, Jeff King, Jacob Keller,
	Junio C Hamano, Ramsay Jones, Torsten Bögershausen,
	Johannes Sixt
In-Reply-To: <CACsJy8A2M_G34MeHh6vGsrf5ePOOduM6u=n17_EZLtu31uDAYg@mail.gmail.com>

On 12/09, Duy Nguyen wrote:
> On Fri, Dec 9, 2016 at 6:58 AM, Brandon Williams <bmwill@google.com> wrote:
> > diff --git a/setup.c b/setup.c
> > index fe572b8..0d9fdd0 100644
> > --- a/setup.c
> > +++ b/setup.c
> > @@ -254,10 +254,12 @@ int get_common_dir_noenv(struct strbuf *sb, const char *gitdir)
> >                 if (!is_absolute_path(data.buf))
> >                         strbuf_addf(&path, "%s/", gitdir);
> >                 strbuf_addbuf(&path, &data);
> > -               strbuf_addstr(sb, real_path(path.buf));
> > +               strbuf_realpath(sb, path.buf, 1);
> 
> This is not the same because of this hunk in strbuf_realpath()

Then perhaps I shouldn't make this change (and just leave it as is)
since the way real_path_internal/strbuf_realpath is written requires
that the strbuf being used for the resolved path only contains the
resolved path (see the lstat(resolved->buf &st) call).  Sidenote it
looks like strbuf_getcwd() also does a reset, though more subtlety,
since it just passes its buffer to getcwd().

> 
> > @@ -81,17 +73,18 @@ static const char *real_path_internal(const char *path, int die_on_error)
> >                         goto error_out;
> >         }
> >
> > -       strbuf_reset(&resolved);
> > +       strbuf_reset(resolved);
> >
> >         if (is_absolute_path(path)) {
> 
> But if you you remove that, then all (old) callers of
> strbuf_realpath() must do a strbuf_reset() in advance if needed
> (probably just real_path does) which sounds reasonable to me. You're
> probably want to be careful about the strbuf_reset() at the end of the
> function too.
> 
> Other than that, I think this diff looks nice.
> -- 
> Duy

-- 
Brandon Williams

^ permalink raw reply

* Re: [PATCH v2 1/4] real_path: resolve symlinks by hand
From: Brandon Williams @ 2016-12-09 20:04 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: git, sbeller, peff, jacob.keller, gitster, ramsay, tboegi,
	pclouds
In-Reply-To: <944a3e91-934a-7923-2b2a-639af81e707d@kdbg.org>

On 12/09, Johannes Sixt wrote:
> Am 09.12.2016 um 00:58 schrieb Brandon Williams:
> >The current implementation of real_path uses chdir() in order to resolve
> >symlinks.  Unfortunately this isn't thread-safe as chdir() affects a
> >process as a whole and not just an individual thread.  Instead perform
> >the symlink resolution by hand so that the calls to chdir() can be
> >removed, making real_path one step closer to being reentrant.
> >
> >Signed-off-by: Brandon Williams <bmwill@google.com>
> >---
> > abspath.c | 183 +++++++++++++++++++++++++++++++++++++++++---------------------
> > 1 file changed, 122 insertions(+), 61 deletions(-)
> >
> >diff --git a/abspath.c b/abspath.c
> >index 2825de8..92f2a29 100644
> >--- a/abspath.c
> >+++ b/abspath.c
> >@@ -11,8 +11,38 @@ int is_directory(const char *path)
> > 	return (!stat(path, &st) && S_ISDIR(st.st_mode));
> > }
> >
> >+/* removes the last path component from 'path' except if 'path' is root */
> >+static void strip_last_component(struct strbuf *path)
> >+{
> >+	if (path->len > offset_1st_component(path->buf)) {
> >+		char *last_slash = find_last_dir_sep(path->buf);
> >+		strbuf_setlen(path, last_slash - path->buf);
> >+	}
> >+}
> 
> This implementation is not correct because when the input is "/foo",
> the result is "" when it should be "/". Also, can the input be a
> non-normalized path? When the input is "foo///bar", should the
> result be "foo" or would "foo//" be an acceptable result? I think it
> should be the former. find_last_dir_sep() returns the last of the
> three slashes, not the first one. Therefore, I've rewritten the
> function thusly:
> 
> static void strip_last_component(struct strbuf *path)
> {
> 	size_t offset = offset_1st_component(path->buf);
> 	size_t len = path->len;
> 	while (offset < len && !is_dir_sep(path->buf[len - 1]))
> 		len--;
> 	while (offset < len && is_dir_sep(path->buf[len - 1]))
> 		len--;
> 	strbuf_setlen(path, len);
> }
> 

Thanks for that catch.  So your rewrite takes the offset of the 1st
component and ensures that we don't cut that part off.  It first strips
all non directory separators and then all directory separators.  This
way "/foo////bar" becomes "/foo" and as you pointed out "/foo" would
become "/".  The offset would also take care of windows drive letters
and the like.  Looks good.  Thanks!

> >+		strbuf_addbuf(&resolved, &next);
> >+
> >+		if (lstat(resolved.buf, &st)) {
> >+			/* error out unless this was the last component */
> >+			if (!(errno == ENOENT && !remaining.len)) {
> 
> Perhaps it was easier to _write_ the condition in this way, but I
> would have an easier time to _read_ it when it is
> 
> 			if (errno != ENOENT || remaining.len) {
> 

Yes I did write it out weird, mostly because it made the most sense for
what I was trying to accomplish (add path components must exist, except
for the very last one).  I'm fine applying DeMorgan's since it looks a
little cleaner.

> >+
> >+			if (is_absolute_path(symlink.buf)) {
> >+				/* absolute symlink; set resolved to root */
> >+				int offset = offset_1st_component(symlink.buf);
> >+				strbuf_reset(&resolved);
> >+				strbuf_add(&resolved, symlink.buf, offset);
> >+				strbuf_remove(&symlink, 0, offset);
> 
> Good. I would have expected some kind of "goto repeat;" because when
> we encounter a symlink to an absolute path, most, if not all, work
> done so far is obsoleted. But I haven't thought too deeply about
> this.

It made the most sense to just reuse the same looping condition that
I already had in place.  Resetting the resolved string to be the root
component of the absolute symlink made it easy to "throw away" all the
old work to allow us to start from scratch again.

-- 
Brandon Williams

^ permalink raw reply

* Re: [PATCH 14/16] pathspec: create strip submodule slash helpers
From: Brandon Williams @ 2016-12-09 20:30 UTC (permalink / raw)
  To: Stefan Beller; +Cc: git@vger.kernel.org, Duy Nguyen, Junio C Hamano
In-Reply-To: <CAGZ79kYVumubF58fdwejE2hvCLfgdVqTxn_w=S-CBFY-NdgqQg@mail.gmail.com>

On 12/09, Stefan Beller wrote:
> On Fri, Dec 9, 2016 at 11:18 AM, Brandon Williams <bmwill@google.com> wrote:
> > Factor out the logic responsible for stripping the trailing slash on
> > pathspecs referencing submodules into its own function.
> >
> > Change-Id: Icad62647c04b4195309def0e3db416203d14f9e4
> 
> I think we should come up with a solution to wipe out change ids
> before sending emails. ;)

Darn! Yeah maybe a hook or something :D

-- 
Brandon Williams

^ permalink raw reply

* [RFC PATCH] send-email: allow a custom hook to prevent sending email
From: Stefan Beller @ 2016-12-09 20:34 UTC (permalink / raw)
  To: bmwill, peff; +Cc: git, Stefan Beller

This custom hook could be used to prevent sending out e.g. patches
with change ids or other information that upstream doesn't like to see
or is not supposed to see.

Signed-off-by: Stefan Beller <sbeller@google.com>
---

My first perl contribution to Git. :)

Marked as RFC to gauge general interest before writing tests and documentation.

Thanks,
Stefan

 git-send-email.perl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/git-send-email.perl b/git-send-email.perl
index da81be40cb..d3ebf666c3 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -815,6 +815,15 @@ if (!$force) {
 				. "Pass --force if you really want to send.\n";
 		}
 	}
+	my @hook = ( $ENV{GIT_DIR}.'hooks/send-email', $f )
+	if( -x $hook[0] ) {
+		unless( system( @hook ) == 0 )
+		{
+			die "Refusing to send because the patch\n\t$f\n"
+				. "was refused by the send-email hook."
+				. "Pass --force if you really want to send.\n";
+		}
+	}
 }
 
 if (defined $sender) {
-- 
2.11.0.rc2.49.ge1f3b0c.dirty


^ permalink raw reply related

* Re: [BUG] Colon in remote urls
From: Johannes Sixt @ 2016-12-09 21:32 UTC (permalink / raw)
  To: Jeff King; +Cc: Klaus Ethgen, git
In-Reply-To: <20161209152219.ehfk475vdg4levop@sigill.intra.peff.net>

Am 09.12.2016 um 16:22 schrieb Jeff King:
> +const char *parse_alt_odb_entry(const char *string, int sep,
> +				struct strbuf *out)
> +{
> +	const char *p;
> +	int literal = 0;
> +
> +	strbuf_reset(out);
> +
> +	for (p = string; *p; p++) {
> +		if (literal) {
> +			strbuf_addch(out, *p);
> +			literal = 0;
> +		} else {
> +			if (*p == '\\')
> +				literal = 1;

There are too many systems out there that use a backslash in path names. 
I don't think it is wise to use it also as the quoting character.

> +			else if (*p == sep)
> +				return p + 1;
> +			else
> +				strbuf_addch(out, *p);
> +		}
> +	}
> +	return p;
> +}

-- Hannes


^ permalink raw reply

* Re: [REGRESSION 2.10.2] problematic "empty auth" changes
From: brian m. carlson @ 2016-12-09 22:19 UTC (permalink / raw)
  To: David Turner; +Cc: Johannes Schindelin, git
In-Reply-To: <1481231552.20894.20.camel@frank>

[-- Attachment #1: Type: text/plain, Size: 1040 bytes --]

On Thu, Dec 08, 2016 at 04:12:32PM -0500, David Turner wrote:
> I know of no reason that shouldn't work.  Indeed, it's what we use do
> internally.  So far, nobody has reported problems.  That said, we have
> exactly three sets of git servers that most users talk to (two different
> internal; and occasionally github.com for external stuff).  So our
> coverage is not very broad.
> 
> If you're going to do it, tho, don't just do it for Windows users -- do
> it for everyone.  Plenty of Unix clients connect to Windows-based auth
> systems.

Let me echo this.  This would make Kerberos (and probably other forms of
SPNEGO) work out of the box, which would reduce a lot of confusion that
people have.

I can confirm enabling http.emptyAuth works properly with Kerberos,
including with fallback to Basic, so I see no reason why we shouldn't do
it.
-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 868 bytes --]

^ permalink raw reply

* Re: [PATCH v6 01/16] Git.pm: add subroutines for commenting lines
From: Junio C Hamano @ 2016-12-09 22:23 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Vasco Almeida, git, Jiang Xin,
	Ævar Arnfjörð Bjarmason, Jean-Noël AVILA,
	Jakub Narębski, David Aguilar
In-Reply-To: <alpine.DEB.2.20.1612091832310.23160@virtualbox>

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

> Hi Vasco,
>
> On Fri, 9 Dec 2016, Vasco Almeida wrote:
>
>> A Ter, 22-11-2016 às 09:42 -0800, Junio C Hamano escreveu:
>> > The incremental update below looks sensible. We'd also want to
>> > protect this codepath from a misconfigured two-or-more byte sequence
>> > in core.commentchar, I would suspect, to be consistent.
>> 
>> Are the below changes alright for what you propose? It just checks if
>> the length of core.commentchar's value is 1, otherwise use '#' as the
>> comment_line_char.
>> As a note, when I set core.commentchar with "git config
>> core.commentChar 'batata'", I get the following error message when I
>> issue "git add -i":
>> 
>> error: core.commentChar should only be one character
>> fatal: bad config variable 'core.commentchar' in file '.git/config' at line 6
>
> This is exactly the same issue I fixed for rebase -i recently.

Yes, but the patch we see here punts "core.commentChar is not a
single-byte single-letter--panic!" case differently.  I think you
did "just take the first one" in "rebase -i", which I think is more
in line with the rest of the system, and this addition to Git.pm
should do the same, I think.

^ permalink raw reply


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