Re: [PATCH] Allow to control the namespace for replace refs

2015-06-10 Thread Mike Hommey
On Wed, Jun 10, 2015 at 09:55:30PM -0700, Junio C Hamano wrote: Mike Hommey m...@glandium.org writes: It can be useful to have grafts or replace refs for specific use-cases while keeping the default view of the repository pristine (or with a different set of grafts/replace refs

suboptimal behavior of fast-import in some cases with from

2015-07-06 Thread Mike Hommey
Hi, I did something stupid with a script using fast-import, and that made the whole process ~20% slower on Linux and 400~500% slower on Mac. The reason this happened is that the script was essentially adding a from to every commit command, even when the from commit is the current head of the

Re: git status doesn't ignore GIT_DIR directory?

2015-05-22 Thread Mike Hommey
On Sat, May 23, 2015 at 09:22:56AM +0700, Duy Nguyen wrote: On Fri, May 22, 2015 at 07:03:48PM -0700, Junio C Hamano wrote: As far as I know, GIT_DIR was prepared as a mechanism to point at another .git directory that does not live inside the working tree, not as a mechanism to rename it to

Re: Occasional wrong behavior of rev-walking (rev-list, log, etc.)

2015-05-21 Thread Mike Hommey
On Thu, May 21, 2015 at 09:41:55AM -0700, Junio C Hamano wrote: Mike Hommey m...@glandium.org writes: My guess is that rev-walking is tripping on the fact that this repository has commit dates in random order. Yeah, that is well known (look for SLOP both in the code and list archive

Re: Occasional wrong behavior of rev-walking (rev-list, log, etc.)

2015-05-21 Thread Mike Hommey
On Thu, May 21, 2015 at 03:59:48PM -0700, Junio C Hamano wrote: Depends on why you are running rev-list. If you want to know if one commit is contained in another, the way that should work the most reliably is to use merge-base, as the traversal engine of that command was written not to

Re: fetching from an hg remote fails with bare git repositories

2015-08-04 Thread Mike Hommey
On Tue, Aug 04, 2015 at 05:27:13PM -0400, Taylor Braun-Jones wrote: On Tue, Aug 4, 2015 at 2:56 PM, Stefan Beller sbel...@google.com wrote: On Tue, Aug 4, 2015 at 10:45 AM, Taylor Braun-Jones tay...@braun-jones.org wrote: Fetching from an hg remote fails with bare git repositories. Non-bare

Re: [PATCH] notes: Allow treeish expressions as notes ref

2015-07-13 Thread Mike Hommey
On Mon, Jul 13, 2015 at 09:35:40AM -0700, Junio C Hamano wrote: Mike Hommey m...@glandium.org writes: init_notes() is the main point of entry to the notes API. It is an arbitrary restriction that all it allows as input is a strict ref name, when callers may want to give an arbitrary

Re: Feature request: commit count in git-describe should use a different method

2015-11-03 Thread Mike Hommey
On Wed, Nov 04, 2015 at 12:11:27PM +0700, Robin Munn wrote: > Several people (including me) seem to expect git-describe's commit > count to be calculated differently than how it's actually calculated. > For example, see the following three Stack Overflow questions: > >

[PATCH v6] notes: allow treeish expressions as notes ref

2015-10-07 Thread Mike Hommey
, or will be updated. With this change, operations that use notes read-only can be fed any notes-shaped tree-ish can be used, e.g. git log --notes=notes@{1}. Signed-off-by: Mike Hommey <m...@glandium.org> --- I'm really not satisfied with the documentation change, but I don't have a better id

Re: [PATCH] notes: Allow treeish expressions as notes ref

2015-10-07 Thread Mike Hommey
stinction: $ ./git-log --notes=fdsfgsfdg HEAD^! --pretty=short warning: notes ref refs/notes/fdsfgsfdg is invalid commit e5b68b2e879608d881c2e3600ce84962fcdefc88 Author: Mike Hommey <m...@glandium.org> notes: allow treeish expressions as notes ref $ ./git-log --notes=foo HEAD

[PATCH v2 - RFH] notes: Allow committish expressions as notes ref

2015-07-08 Thread Mike Hommey
effect of enabling the use of committish as notes refs in commands allowing them, e.g. git log --notes=foo@{1}. Signed-off-by: Mike Hommey m...@glandium.org --- The die() message in init_notes is left to be desired. But I don't have a better idea at the moment. Note that die()ing in an API

[PATCH v4] notes: Allow treeish expressions as notes ref

2015-07-09 Thread Mike Hommey
of enabling the use of treeish as notes refs in commands allowing them, e.g. git log --notes=foo@{1}. Signed-off-by: Mike Hommey m...@glandium.org Reviewed-by: Johan Herland jo...@herland.net --- builtin/notes.c | 29 - notes-cache.c | 11 ++- notes-utils.c

[PATCH] notes: Allow treeish expressions as notes ref

2015-07-10 Thread Mike Hommey
of enabling the use of treeish as notes refs in commands allowing them, e.g. git log --notes=foo@{1}. Signed-off-by: Mike Hommey m...@glandium.org --- builtin/notes.c | 29 - notes-cache.c| 11 ++- notes-utils.c| 6 +++--- notes.c | 11

Re: [PATCH v4] notes: Allow treeish expressions as notes ref

2015-07-10 Thread Mike Hommey
On Fri, Jul 10, 2015 at 09:16:16AM +0200, Johan Herland wrote: On Fri, Jul 10, 2015 at 3:28 AM, Mike Hommey m...@glandium.org wrote: init_notes() is the main point of entry to the notes API. It is an arbitrary restriction that all it allows as input is a strict ref name, when callers may

Re: suboptimal behavior of fast-import in some cases with from

2015-07-08 Thread Mike Hommey
On Mon, Jul 06, 2015 at 03:54:35PM -0700, Junio C Hamano wrote: Mike Hommey m...@glandium.org writes: One of the first things parse_from does is unconditionally throw away the tree for the given branch, and then the from tree is loaded. So when the from commit is the current head

[PATCH v3] notes: Allow committish expressions as notes ref

2015-07-08 Thread Mike Hommey
effect of enabling the use of committish as notes refs in commands allowing them, e.g. git log --notes=foo@{1}. Signed-off-by: Mike Hommey m...@glandium.org --- builtin/notes.c | 29 - notes-cache.c | 11 ++- notes-utils.c | 6 +++--- notes.c | 11

Re: suboptimal behavior of fast-import in some cases with from

2015-07-08 Thread Mike Hommey
On Thu, Jul 09, 2015 at 02:03:15PM +0900, Mike Hommey wrote: On Mon, Jul 06, 2015 at 03:54:35PM -0700, Junio C Hamano wrote: Mike Hommey m...@glandium.org writes: One of the first things parse_from does is unconditionally throw away the tree for the given branch, and then the from tree

[PATCH] fast-import: Do less work when given from matches current branch head

2015-07-09 Thread Mike Hommey
the tree when it's unmodified, and avoid calling gfi_unpack_entry when the given mark points to the same commit as the current branch head. Signed-off-by: Mike Hommey m...@glandium.org --- fast-import.c | 29 + 1 file changed, 17 insertions(+), 12 deletions(-) diff

Re: [PATCH] fast-import: Do less work when given from matches current branch head

2015-07-09 Thread Mike Hommey
On Thu, Jul 09, 2015 at 01:37:02PM -0700, Junio C Hamano wrote: Mike Hommey m...@glandium.org writes: Cc'ed a few people who appear at the top of shortlog --no-merges; I think the end result is not incorrect, but I want to hear second opinions on this one. I do not know Shawn still

Re: [PATCH 0/2] notes: allow read only notes actions on refs outside of refs/notes

2015-09-16 Thread Mike Hommey
On Wed, Sep 16, 2015 at 03:06:32PM -0700, Jacob Keller wrote: > This topic depends on mh/notes-allow-reading-treeish and actually > expands what this topic allowed before. Previously, treeishes such as > notes@{1} were made allowable, but the ref still had to be found under > refs/notes. I

Re: RefTree: Alternate ref backend

2015-12-17 Thread Mike Hommey
On Thu, Dec 17, 2015 at 02:28:01PM -0800, Shawn Pearce wrote: > On Thu, Dec 17, 2015 at 2:10 PM, Jeff King wrote: > > On Thu, Dec 17, 2015 at 01:02:50PM -0800, Shawn Pearce wrote: > > > >> I started playing around with the idea of storing references directly > >> in Git. Exploiting

Re: What's cooking in git.git (Jun 2016, #01; Thu, 2)

2016-06-04 Thread Mike Hommey
On Sat, Jun 04, 2016 at 04:51:28PM +0200, Torsten Bögershausen wrote: > On 2016-06-04 07.14, Mike Hommey wrote: > > On Fri, Jun 03, 2016 at 04:47:33PM -0700, Junio C Hamano wrote: > >> Mike Hommey <m...@glandium.org> writes: > >> > >>> In

Re: What's cooking in git.git (Jun 2016, #01; Thu, 2)

2016-06-02 Thread Mike Hommey
On Thu, Jun 02, 2016 at 03:52:41PM -0700, Junio C Hamano wrote: > * mh/connect (2016-06-01) 9 commits > - connect: move ssh command line preparation to a separate function > - connect: actively reject git:// urls with a user part > - connect: change the --diag-url output to separate user and

Re: What's cooking in git.git (Jun 2016, #02; Mon, 6)

2016-06-07 Thread Mike Hommey
On Mon, Jun 06, 2016 at 10:58:44PM -0700, Junio C Hamano wrote: > * mh/connect (2016-06-06) 10 commits > - connect: [host:port] is legacy for ssh > - connect: move ssh command line preparation to a separate function > - connect: actively reject git:// urls with a user part > - connect: change

Re: [PATCH v2 4/4] bundle v3: the beginning

2016-06-07 Thread Mike Hommey
On Tue, Jun 07, 2016 at 10:46:07AM +0200, Christian Couder wrote: > The high level overview of the patch series I would like to send > really soon now could go like this: > > --- > Git can store its objects only in the form of loose objects in > separate files or packed objects in a pack file. >

Re: What's cooking in git.git (Jun 2016, #01; Thu, 2)

2016-06-03 Thread Mike Hommey
On Fri, Jun 03, 2016 at 04:47:33PM -0700, Junio C Hamano wrote: > Mike Hommey <m...@glandium.org> writes: > > > In fact, the parser doesn't even reject the one that is considered > > invalid (the first). > > My question was what the desired behaviour is, and if your

Re: What's cooking in git.git (Jun 2016, #01; Thu, 2)

2016-06-03 Thread Mike Hommey
On Fri, Jun 03, 2016 at 08:59:46AM -0700, Junio C Hamano wrote: > Torsten Bögershausen writes: > > > There where 2 comments in the review. > > The most important thing is that now > > git://[example.com:123]/path/to/repo is valid, but it shouldn't. > > This patch fixes it: > > > >

Re: [PATCH v7 1/9] connect: document why we sometimes call get_port after get_host_and_port

2016-05-25 Thread Mike Hommey
On Tue, May 24, 2016 at 06:44:26AM +0200, Torsten Bögershausen wrote: > On 05/23/2016 11:30 PM, Junio C Hamano wrote: > > Torsten Bögershausen writes: > > > > > > > > get_host_and_port(_host, ); > > > > > >+/* get_host_and_port may

Re: [PATCH v8 0/9] connect: various cleanups

2016-05-27 Thread Mike Hommey
On Sat, May 28, 2016 at 07:02:01AM +0200, Torsten Bögershausen wrote: > On 27.05.16 23:59, Mike Hommey wrote: > > On Fri, May 27, 2016 at 04:24:20PM +0200, Torsten Bögershausen wrote: > >> On 27.05.16 04:27, Mike Hommey wrote: > >>> Changes from v7: > >>>

Re: [PATCH v8 0/9] connect: various cleanups

2016-05-28 Thread Mike Hommey
On Sat, May 28, 2016 at 10:17:19AM +0200, Torsten Bögershausen wrote: > On 28.05.16 07:33, Mike Hommey wrote: > > On Sat, May 28, 2016 at 07:02:01AM +0200, Torsten Bögershausen wrote: > >> On 27.05.16 23:59, Mike Hommey wrote: > >>> On Fri, May 27, 2016 at 04:24:20

Re: What's cooking in git.git (Jun 2016, #04; Tue, 14)

2016-06-14 Thread Mike Hommey
On Tue, Jun 14, 2016 at 03:08:04PM -0700, Junio C Hamano wrote: > Here are the topics that have been cooking. Commits prefixed with > '-' are only in 'pu' (proposed updates) while commits prefixed with > '+' are in 'next'. The ones marked with '.' do not appear in any of > the integration

Re: [PATCH 2/2] strbuf: allow to use preallocated memory

2016-05-30 Thread Mike Hommey
> struct strbuf { > + unsigned int flags; > size_t alloc; > size_t len; > char *buf; > }; Depending whether the size of strbuf matters, it /might/ be worth considering some packing here. malloc() usually returns buffers that can contain more data than what is requested.

Re: [PATCH 2/2] strbuf: allow to use preallocated memory

2016-05-30 Thread Mike Hommey
On Tue, May 31, 2016 at 12:46:23AM +0200, William Duclot wrote: > Mike Hommey <m...@glandium.org> writes: > >> struct strbuf { > >> + unsigned int flags; > >>size_t alloc; > >>size_t len; > >>char *buf; > >> }; &

Re: [PATCH v8 0/9] connect: various cleanups

2016-05-27 Thread Mike Hommey
On Fri, May 27, 2016 at 04:24:20PM +0200, Torsten Bögershausen wrote: > On 27.05.16 04:27, Mike Hommey wrote: > > Changes from v7: > > - Fixed comments. > > > > Mike Hommey (9): > > connect: document why we sometimes call get_port after > >

Re: [PATCH] add: add --chmod=+x / --chmod=-x options

2016-05-26 Thread Mike Hommey
On Thu, May 26, 2016 at 11:41:12PM -0500, Edward Thomson wrote: > On Wed, May 25, 2016 at 12:36:55AM -0700, Junio C Hamano wrote: > > > > At the design level, I have a few comments. > > Thanks, I will submit a new patch that incorporates your (and dscho's) > comments. > > > * This is about a

[PATCH v8 0/9] connect: various cleanups

2016-05-26 Thread Mike Hommey
Changes from v7: - Fixed comments. Mike Hommey (9): connect: document why we sometimes call get_port after get_host_and_port connect: call get_host_and_port() earlier connect: re-derive a host:port string from the separate host and port variables connect: make parse_connect_url

[PATCH v8 4/9] connect: make parse_connect_url() return separated host and port

2016-05-26 Thread Mike Hommey
the "user@" part of the host, in order to pick the port properly. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 47 --- t/t5500-fetch-pack.sh | 32 +--- 2 files changed, 49 insertions

[PATCH v8 9/9] connect: move ssh command line preparation to a separate function

2016-05-26 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 108 +- 1 file changed, 58 insertions(+), 50 deletions(-) diff --git a/connect.c b/connect.c index 9aea3cd..076ae09 100644 --- a/connect.c +++ b/connect.c @@ -684,6 +

[PATCH v8 8/9] connect: actively reject git:// urls with a user part

2016-05-26 Thread Mike Hommey
Currently, urls of the for git://user@host don't work because user@host is not resolving at the DNS level, but we shouldn't be relying on it being an invalid host name, and actively reject it for containing a username in the first place. Signed-off-by: Mike Hommey <m...@glandium.

[PATCH v8 6/9] connect: make parse_connect_url() return the user part of the url as a separate value

2016-05-26 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 54 -- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/connect.c b/connect.c index 4be06f4..0819c25 100644 --- a/connect.c +++ b/connect.c @@ -588,11 +

[PATCH v8 2/9] connect: call get_host_and_port() earlier

2016-05-26 Thread Mike Hommey
however preserve hostandport, at least for now. Note that in git_tcp_connect_sock, the port was set to "" in a case that never can happen, so that code path was removed. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 47 +++

[PATCH v8 3/9] connect: re-derive a host:port string from the separate host and port variables

2016-05-26 Thread Mike Hommey
-derive one from the host and port variables. This will allow to refactor parse_connect_url() to return separate host and port strings. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff

[PATCH v8 7/9] connect: change the --diag-url output to separate user and host

2016-05-26 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 6 ++ t/t5500-fetch-pack.sh | 14 -- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/connect.c b/connect.c index 0819c25..0c4d23b 100644 --- a/connect.c +++ b/connect.c @@ -714,10

[PATCH v8 1/9] connect: document why we sometimes call get_port after get_host_and_port

2016-05-26 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/connect.c b/connect.c index c53f3f1..6e520c3 100644 --- a/connect.c +++ b/connect.c @@ -742,6 +742,13 @@ struct child_process *git_connect(int fd[2], const char

[PATCH v8 5/9] connect: group CONNECT_DIAG_URL handling code

2016-05-26 Thread Mike Hommey
Previous changes made both branches handling CONNECT_DIAG_URL identical. We can now remove one of those branches and have CONNECT_DIAG_URL be handled in one place. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 16 +--- 1 file changed, 1 insertion(+), 15 del

Re: [PATCH v4 2/2] rev-parse: fix some options when executed from subpath of main tree

2016-05-26 Thread Mike Hommey
On Thu, May 26, 2016 at 07:19:16AM -0400, Michael Rappazzo wrote: > Executing `git-rev-parse` with `--git-common-dir`, `--git-path `, > or `--shared-index-path` from the root of the main worktree results in > a relative path to the git dir. > > When executed from a subdirectory of the main tree,

Re: What's cooking in git.git (Jun 2016, #04; Tue, 14)

2016-06-15 Thread Mike Hommey
On Wed, Jun 15, 2016 at 11:32:39AM -0700, Junio C Hamano wrote: > Mike Hommey <m...@glandium.org> writes: > > > On Tue, Jun 14, 2016 at 03:08:04PM -0700, Junio C Hamano wrote: > > >> * mh/connect (2016-06-06) 10 commits > >> - connect: [host:port] is

`git rev-parse --git-common-dir` doesn't work in a subdirectory of the main work tree

2016-02-11 Thread Mike Hommey
Hi, In a worktree, git rev-parse --git-common-dir returns the non worktree-specific git directory. e.g. .git instead of .git/worktrees/name. The problem is that while it returns the right thing from a subdirectory of a worktree, it doesn't from a subdirectory of the "main" work tree. In the

parse_object does check_sha1_signature but not parse_object_buffer?

2016-02-01 Thread Mike Hommey
Hi, You might or might not be aware of this thread: https://groups.google.com/forum/#!topic/binary-transparency/f-BI4o8HZW0 Anyways, this got me to take a look around, and I noticed that parse_object does SHA-1 validation through check_sha1_signature. What surprised me is that

Re: parse_object does check_sha1_signature but not parse_object_buffer?

2016-02-01 Thread Mike Hommey
On Tue, Feb 02, 2016 at 10:57:01AM +0900, Mike Hommey wrote: > Hi, > > You might or might not be aware of this thread: > https://groups.google.com/forum/#!topic/binary-transparency/f-BI4o8HZW0 > > Anyways, this got me to take a look around, and I noticed that > parse_object

Re: Bug: Branch Deletion Doesn't Clean Up

2016-02-04 Thread Mike Hommey
On Thu, Feb 04, 2016 at 02:55:00AM -0500, Jeff King wrote: > [resend; sorry, I forgot to cc Michael on the first one] > > On Thu, Jan 07, 2016 at 02:24:41PM -0500, Karl Moskowski wrote: > > > The problem is, deleting a branch whose name contains slashes doesn’t > > delete the directories in

Re: Bug: Branch Deletion Doesn't Clean Up

2016-02-04 Thread Mike Hommey
On Thu, Feb 04, 2016 at 03:17:59AM -0500, Jeff King wrote: > On Thu, Feb 04, 2016 at 05:12:20PM +0900, Mike Hommey wrote: > > > > > It seems like git branch -d ascend the hierarchy (up to > > > > .git/refs/heads/), deleting any empty directories. > > > &

Re: parse_object does check_sha1_signature but not parse_object_buffer?

2016-02-01 Thread Mike Hommey
On Mon, Feb 01, 2016 at 07:10:04PM -0800, Junio C Hamano wrote: > Mike Hommey <m...@glandium.org> writes: > > > Shouldn't parse_object_buffer also do check_sha1_signature? > > In general, it shouldn't; its callers are supposed to do it as > additional check when/if ne

Re: Is there interest in a n-sect tool?

2016-01-20 Thread Mike Hommey
On Wed, Jan 20, 2016 at 02:05:22PM -0800, Junio C Hamano wrote: > Mike Hommey <m...@glandium.org> writes: > > > On Mon, Jan 18, 2016 at 07:54:21PM -0800, Junio C Hamano wrote: > > > >> Hmm, sorry. For the two-trait example I gave (that can be extended > &

Re: [PATCH][Outreachy] branch: allow - as abbreviation of '@{-1}'

2016-03-19 Thread Mike Hommey
On Fri, Mar 18, 2016 at 09:10:37AM -0700, Junio C Hamano wrote: > * We forbid declaration-after-statement in our codebase. By the way, why not enforce it with -Werror=declaration-after-statement? If people patching git get an error when they do it, they won't submit a patch with it, and you

[PATCH] Fix memory leak in git_connect with CONNECT_DIAG_URL

2016-04-28 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 1 + 1 file changed, 1 insertion(+) diff --git a/connect.c b/connect.c index c53f3f1..dccf673 100644 --- a/connect.c +++ b/connect.c @@ -755,6 +755,7 @@ struct child_process *git_connect(int fd[2], const char

[PATCH 1/4] git_connect: extend to take a pseudo format string for the program to run

2016-04-28 Thread Mike Hommey
. With this change, when the program/command passed to git_connect() contains a "%s", that "%s" is replaced with the path from the url, allowing the path to be at a different position than last on the executed command line. Signed-off-by: Mike Hommey <m...@glandium.o

[PATCH 4/4] git_connect: add a flag to consider the path part of ssh urls relative

2016-04-28 Thread Mike Hommey
In Mercurial ssh urls, the path part of the url is relative to the home directory of the account being logged to instead of being absolute. Add a flag allowing git_connect() to handle this kind of usecase. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 10 +++--- con

[RFC PATCH 0/4] git_connect: add some flexibility

2016-04-28 Thread Mike Hommey
could be done in sq_quote_buf instead, arguably. I'm certainly open to any better ideas as long as they can make it to mainline :). Mike Hommey (4): git_connect: extend to take a pseudo format string for the program to run git_connect: avoid quoting the path on the command line when it's n

[PATCH 3/4] git_connect: allow a file descriptor to be allocated for stderr

2016-04-28 Thread Mike Hommey
It can be useful to the caller of git_connect() to get access to stderr, so add a flag that makes start_command allocate a file descriptor for it. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 2 ++ connect.h | 1 + 2 files changed, 3 insertions(+) diff --git a/conne

[PATCH 2/4] git_connect: avoid quoting the path on the command line when it's not necessary

2016-04-28 Thread Mike Hommey
o the list. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/connect.c b/connect.c index 96c8c1d..919bf9e 100644 --- a/connect.c +++ b/connect.c @@ -668,6 +668,17 @@ static void prepare_connect_command(struct strbuf *

Announcing git-cinnabar 0.3.2

2016-04-27 Thread Mike Hommey
Git-cinnabar is a git remote helper to interact with mercurial repositories. It allows to clone, pull and push from/to mercurial remote repositories, using git. Code on https://github.com/glandium/git-cinnabar [ Previous announcements: http://marc.info/?l=git=145294370431454

[PATCH 5/6] connect: don't xstrdup target_host

2016-05-01 Thread Mike Hommey
Now that hostandport is left unmodified in git_connect (we don't pass it to get_host_and_port() anymore), we can avoid xstrdup'ing it. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/connect.c b/connect.c

[PATCH 2/6] connect: uniformize and group CONNECT_DIAG_URL handling code

2016-05-01 Thread Mike Hommey
() is used further down the line. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 28 +--- t/t5500-fetch-pack.sh | 25 +++-- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/connect.c b/connect.c index 45308ef..9

[PATCH v3 0/6] connect: various cleanups

2016-05-01 Thread Mike Hommey
er in which the changes have been done in this new series is debatable, but I thought the split in smaller parts made things easier to review, even if they could have been done in different orders. I'm leaving the optional follows-up for now. I'll work around the functions being static somehow on my

[PATCH 4/6] connect: pass separate host and port to git_tcp_connect and git_proxy_connect

2016-05-01 Thread Mike Hommey
, the port was set to "" in a case that never can happen, so that code path was removed. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 31 ++- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/connect.c b/connect.c index 1c8ed6b

[PATCH 1/6] connect: remove get_port()

2016-05-01 Thread Mike Hommey
get_host_and_port(), works on a modified host string that has square brackes removed if there were any. I cannot think of any legal host:port string that would not have a port returned by get_host_and_port() *and* have one returned by get_port(). So just remove get_port(). Signed-off-by: Mike Hommey &l

[PATCH 3/6] connect: only match the host with core.gitProxy

2016-05-01 Thread Mike Hommey
This per-port behavior seems like an oversight rather than a deliberate choice, so, make git://kernel.org:port/path call the gitProxy script in the case described above. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --g

[PATCH 6/6] connect: move ssh command line preparation to a separate function

2016-05-01 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 101 ++ 1 file changed, 55 insertions(+), 46 deletions(-) diff --git a/connect.c b/connect.c index e2b976e..db78eb2 100644 --- a/connect.c +++ b/connect.c @@ -639,6 +

Re: [RFC PATCH 0/4] git_connect: add some flexibility

2016-04-28 Thread Mike Hommey
On Thu, Apr 28, 2016 at 10:41:12AM -0700, Junio C Hamano wrote: > Mike Hommey <m...@glandium.org> writes: > > > As you may be aware, I'm working on a git remote helper to access > > mercurial repositories (https://github.com/glandium/git-cinnabar/). > > > > At

[RFC PATCH 1/3] connect: make parse_connect_url public

2016-04-28 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 11 ++- connect.h | 9 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/connect.c b/connect.c index c53f3f1..29569b3 100644 --- a/connect.c +++ b/connect.c @@ -231,13 +231,6 @@ int server_su

[RFC PATCH 2/3] connect: group CONNECT_DIAG_URL handling code

2016-04-28 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 27 --- 1 file changed, 12 insertions(+), 15 deletions(-) Note this makes http://marc.info/?l=git=146183714532394 irrelevant. diff --git a/connect.c b/connect.c index 29569b3..ce216cb 100644 --- a/con

[RFC PATCH 3/3] connect: move ssh command line preparation to a separate (public) function

2016-04-28 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 108 +- connect.h | 2 ++ 2 files changed, 60 insertions(+), 50 deletions(-) diff --git a/connect.c b/connect.c index ce216cb..c71563f 100644 --- a/connect.c

Re: [PATCH] rev-parse: fix --git-common-dir when executed from subpath of main tree

2016-05-19 Thread Mike Hommey
On Sun, Apr 03, 2016 at 09:42:23PM -0400, Michael Rappazzo wrote: > Executing `git-rev-parse --git-common-dir` from the root of the main > worktree results in '.git', which is the relative path to the git dir. > When executed from a subpath of the main tree it returned somthing like: >

Re: [PATCH v7 1/9] connect: document why we sometimes call get_port after get_host_and_port

2016-05-23 Thread Mike Hommey
On Mon, May 23, 2016 at 02:30:57PM -0700, Junio C Hamano wrote: > Torsten Bögershausen writes: > > get_host_and_port(_host, ); > + /* get_host_and_port may not return a port > even when > +

Re: [PATCH v6 1/9] connect: call get_host_and_port() earlier

2016-05-20 Thread Mike Hommey
On Fri, May 20, 2016 at 01:58:26PM -0700, Junio C Hamano wrote: > Mike Hommey <m...@glandium.org> writes: > > > Currently, get_host_and_port() is called in git_connect() for the ssh > > protocol, and in git_tcp_connect_sock() for the git protocol. Instead > > of

[PATCH v7 7/9] connect: change the --diag-url output to separate user and host

2016-05-21 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 6 ++ t/t5500-fetch-pack.sh | 14 -- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/connect.c b/connect.c index 48d9cd2..52d34c7 100644 --- a/connect.c +++ b/connect.c @@ -710,10

[PATCH v7 2/9] connect: call get_host_and_port() earlier

2016-05-21 Thread Mike Hommey
however preserve hostandport, at least for now. Note that in git_tcp_connect_sock, the port was set to "" in a case that never can happen, so that code path was removed. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 47 +++

[PATCH v7 4/9] connect: make parse_connect_url() return separated host and port

2016-05-21 Thread Mike Hommey
the "user@" part of the host, in order to pick the port properly. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 43 +-- t/t5500-fetch-pack.sh | 32 +--- 2 files changed, 46 insertions

[PATCH v7 9/9] connect: move ssh command line preparation to a separate function

2016-05-21 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 108 +- 1 file changed, 58 insertions(+), 50 deletions(-) diff --git a/connect.c b/connect.c index 04ce210..ddfda4e 100644 --- a/connect.c +++ b/connect.c @@ -680,6 +

[PATCH v7 6/9] connect: make parse_connect_url() return the user part of the url as a separate value

2016-05-21 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 51 ++- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/connect.c b/connect.c index c0fad4f..48d9cd2 100644 --- a/connect.c +++ b/connect.c @@ -588,11 +588,13 @@

[PATCH v7 0/9] connect: various cleanups

2016-05-21 Thread Mike Hommey
Difference with v6: - Dropped the core.gitProxy change as per discussion. - Added a comment about the extra get_port. Note that after this series, parse_connect_url can be further refactored to avoid the kind of back-and-forth with host_end, get_host_and_port and get_port. Mike Hommey (9

[PATCH v7 1/9] connect: document why we sometimes call get_port after get_host_and_port

2016-05-21 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/connect.c b/connect.c index c53f3f1..caa2a3c 100644 --- a/connect.c +++ b/connect.c @@ -742,6 +742,12 @@ struct child_process *git_connect(int fd[2], const char

[PATCH v7 3/9] connect: re-derive a host:port string from the separate host and port variables

2016-05-21 Thread Mike Hommey
-derive one from the host and port variables. This will allow to refactor parse_connect_url() to return separate host and port strings. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff

[PATCH v7 8/9] connect: actively reject git:// urls with a user part

2016-05-21 Thread Mike Hommey
Currently, urls of the for git://user@host don't work because user@host is not resolving at the DNS level, but we shouldn't be relying on it being an invalid host name, and actively reject it for containing a username in the first place. Signed-off-by: Mike Hommey <m...@glandium.

[PATCH v7 5/9] connect: group CONNECT_DIAG_URL handling code

2016-05-21 Thread Mike Hommey
Previous changes made both branches handling CONNECT_DIAG_URL identical. We can now remove one of those branches and have CONNECT_DIAG_URL be handled in one place. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 16 +--- 1 file changed, 1 insertion(+), 15 del

Re: [PATCH v7 1/9] connect: document why we sometimes call get_port after get_host_and_port

2016-05-22 Thread Mike Hommey
On Sun, May 22, 2016 at 08:07:05AM +0200, Torsten Bögershausen wrote: > On 22.05.16 01:17, Mike Hommey wrote: > > Signed-off-by: Mike Hommey <m...@glandium.org> > > --- > > connect.c | 6 ++ > > 1 file changed, 6 insertions(+) > > > > diff --

Re: [PATCH v6 2/9] connect: only match the host with core.gitProxy

2016-05-20 Thread Mike Hommey
On Fri, May 20, 2016 at 02:48:28PM -0700, Junio C Hamano wrote: > So, even if we agree that per-port behaviour is not something we > would use if we were building the system without any existing users > today, I do not think we want "git now fails with an error" at all. > It goes against the

Re: [PATCH v6 1/9] connect: call get_host_and_port() earlier

2016-05-20 Thread Mike Hommey
On Fri, May 20, 2016 at 03:20:23PM -0700, Junio C Hamano wrote: > Mike Hommey <m...@glandium.org> writes: > > >> Can never happen because? > >> > >> !*port means get_host_and_port() made the "port" pointer point at > >> a

Re: [PATCH] rev-parse: fix --git-common-dir when executed from subpath of main tree

2016-05-19 Thread Mike Hommey
On Fri, Apr 08, 2016 at 08:35:51AM -0400, Mike Rappazzo wrote: > On Fri, Apr 8, 2016 at 7:47 AM, Duy Nguyen wrote: > > On Mon, Apr 4, 2016 at 8:42 AM, Michael Rappazzo wrote: > >> Executing `git-rev-parse --git-common-dir` from the root of the main > >>

Re: [PATCH v5 4/9] connect: make parse_connect_url() return separated host and port

2016-05-16 Thread Mike Hommey
On Mon, May 16, 2016 at 03:39:08PM -0700, Junio C Hamano wrote: > Mike Hommey <m...@glandium.org> writes: > > > + get_host_and_port(, ); > > + > > + if (*host && !port) { > > + /* The host might contain a user:password string, ignore it &g

[PATCH v6 2/9] connect: only match the host with core.gitProxy

2016-05-16 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 20 +--- t/t5532-fetch-proxy.sh | 8 +++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/connect.c b/connect.c index d3448c2..0f48cde 100644 --- a/connect.c +++ b/connect.c

[PATCH v6 1/9] connect: call get_host_and_port() earlier

2016-05-16 Thread Mike Hommey
however preserve hostandport, at least for now. Note that in git_tcp_connect_sock, the port was set to "" in a case that never can happen, so that code path was removed. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 47 +++

[PATCH v6 3/9] connect: fill the host header in the git protocol with the host and port variables

2016-05-16 Thread Mike Hommey
. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 27 --- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/connect.c b/connect.c index 0f48cde..0676ee0 100644 --- a/connect.c +++ b/connect.c @@ -709,11 +709,24 @@ struct child_process *git_c

[PATCH v6 7/9] connect: change the --diag-url output to separate user and host

2016-05-16 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 6 ++ t/t5500-fetch-pack.sh | 14 -- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/connect.c b/connect.c index 2659b40..dcaf32f 100644 --- a/connect.c +++ b/connect.c @@ -720,10

[PATCH v6 4/9] connect: make parse_connect_url() return separated host and port

2016-05-16 Thread Mike Hommey
the "user@" part of the host, in order to pick the port properly. Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 33 + t/t5500-fetch-pack.sh | 32 +--- 2 files changed, 42 insertions(+), 2

[PATCH v6 9/9] connect: move ssh command line preparation to a separate function

2016-05-16 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 108 +- 1 file changed, 58 insertions(+), 50 deletions(-) diff --git a/connect.c b/connect.c index 7360d57..38cdffc 100644 --- a/connect.c +++ b/connect.c @@ -690,6 +

[PATCH v6 6/9] connect: make parse_connect_url() return the user part of the url as a separate value

2016-05-16 Thread Mike Hommey
Signed-off-by: Mike Hommey <m...@glandium.org> --- connect.c | 33 + 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/connect.c b/connect.c index 3a77b2f..2659b40 100644 --- a/connect.c +++ b/connect.c @@ -602,11 +602,13 @@ static char *get_por

[PATCH v6 8/9] connect: actively reject git:// urls with a user part

2016-05-16 Thread Mike Hommey
Currently, urls of the for git://user@host don't work because user@host is not resolving at the DNS level, but we shouldn't be relying on it being an invalid host name, and actively reject it for containing a username in the first place. Signed-off-by: Mike Hommey <m...@glandium.

[PATCH v6 0/9] connect: various cleanups

2016-05-16 Thread Mike Hommey
The main difference here is patch 2/9 now throwing an error in user's face when they have a core.gitProxy configuration with a port number. There might be some bikeshedding to do on the content of the error message. Mike Hommey (9): connect: call get_host_and_port() earlier connect: only

<    1   2   3   4   >