* Re: SubmittingPatches: drop temporal reference for PGP signing
From: Philip Oakley @ 2017-01-25 6:54 UTC (permalink / raw)
To: Stefan Beller, cornelius.weig
Cc: j6t, bitte.keine.werbung.einwerfen, git, gitster, thomas.braun,
john, Stefan Beller
In-Reply-To: <20170125002116.22111-1-sbeller@google.com>
From: "Stefan Beller" <sbeller@google.com>
>>
>>> Do not PGP sign your patch, at least *for now*. (...)
>>
>
> And maybe these 2 small words are the bug in the documentation?
> Shall we drop the "at least for now" part, like so:
>
> ---8<---
> From 2c4fe0e67451892186ff6257b20c53e088c9ec67 Mon Sep 17 00:00:00 2001
> From: Stefan Beller <sbeller@google.com>
> Date: Tue, 24 Jan 2017 16:19:13 -0800
> Subject: [PATCH] SubmittingPatches: drop temporal reference for PGP
> signing
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> Documentation/SubmittingPatches | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/SubmittingPatches
> b/Documentation/SubmittingPatches
> index 08352deaae..28da4ad2d4 100644
> --- a/Documentation/SubmittingPatches
> +++ b/Documentation/SubmittingPatches
> @@ -216,12 +216,12 @@ that it will be postponed.
> Exception: If your mailer is mangling patches then someone may ask
> you to re-send them using MIME, that is OK.
>
> -Do not PGP sign your patch, at least for now. Most likely, your
> -maintainer or other people on the list would not have your PGP
> -key and would not bother obtaining it anyway. Your patch is not
> -judged by who you are; a good patch from an unknown origin has a
> -far better chance of being accepted than a patch from a known,
> -respected origin that is done poorly or does incorrect things.
> +Do not PGP sign your patch. Most likely, your maintainer or other
> +people on the list would not have your PGP key and would not bother
> +obtaining it anyway. Your patch is not judged by who you are; a good
> +patch from an unknown origin has a far better chance of being accepted
> +than a patch from a known, respected origin that is done poorly or
> +does incorrect things.
Wouldn't this also benefit from a forward reference to the section 5 on the
DOC signining? This would avoid Cornelius's case where he felt that section
5 no longer applied.
> If you really really really really want to do a PGP signed
> patch, format it as "multipart/signed", not a text/plain message
> --
> 2.11.0.495.g04f60290a0.dirty
--
Philip
^ permalink raw reply
* Re: submodule network operations [WAS: Re: [RFC/PATCH 0/4] working tree operations: support superprefix]
From: Brian J. Davis @ 2017-01-25 7:14 UTC (permalink / raw)
To: Stefan Beller; +Cc: Brandon Williams, git@vger.kernel.org, David Turner
In-Reply-To: <CAGZ79kZzekMc=pUN3Q2+zmaSNo-BLJ6TxaQPN8ik1B2+ACy9dw@mail.gmail.com>
On 1/24/2017 12:49 PM, Stefan Beller wrote:
> On Sat, Jan 21, 2017 at 7:53 AM, Brian J. Davis <bitminer@gmail.com> wrote:
>> On 1/19/2017 7:22 PM, Stefan Beller wrote:
>>>>> Between the init and the update step you can modify the URLs.
>>>>> These commands are just a repetition from the first email, but the
>>>>> git commands can be viewed as moving from one state to another
>>>>> for submodules; submodules itself can be seen as a state machine
>>>>> according to that proposed documentation. Maybe such a state machine
>>>>> makes it easier to understand for some people.
>>>>
>>>> "Between the init and the update step you can modify the URLs." Yes I
>>>> can
>>>> and have to... wish it was not this way.
>>> So how would yo u rather want to do it?
>>> look at the .gitmodules file beforehand and then run a "submodule update"
>>> ?
>>> Or a thing like
>>>
>>> git -c url.https://internal.insteadOf git://github.com/ \
>>> -c submodule.record-rewritten-urls submodule update
>>>
>>> (no need for init there as theoretically there is not
>>> need for such an intermediate step)
>>>
>> "Yes please and thank you" ... both.
>>
>> My thought was to simply allow addition to .gitmodules. If I understand
>> correctly you are proposing, to override these at the command line and
>> possibly rewrite them on submodule update, but maybe not save or add to
>> .gitmodules. I would then propose both.
>> 1) allow user to add to .gitmodules for those who do not care that
>> "outsiders" know the internal dev server
>> and
>> 2) allow to rewrite while not saving to .gitmodules on fresh clone and
>> submodule update for thoes that do not want ousiders to known internal dev
>> server.
>> and possibly:
>> 3) allow at command line to add remote to .gitmodules on submodule commands
>> (note add optoin in -c <name> = <value> pair)
>>
>> .gitmodules before:
>>
>> [submodule "subprojects/wrangler"]
>> path = subprojects/wrangler
>> url = git://github.com/
>>
>> Then your adapted command:
>>
>> git -c url.https://internal.insteadOf git://github.com/ \
>> -c submodule.record-rewritten-urls=add,internal --add submodule
>> update
>>
>> would produce
>>
>> [submodule "subprojects/projname"]
>> path = subprojects/projname
>> remote.origin.url = git://github.com/
>> remote.internal.url =https://internal.insteadOf
>>
>> Or similar support.
> I think this was avoided until now as it would rewrite/add history.
> So what if you want ot "just mirror" a large project with a lot
> of submodules? You would want to do that without touching
> the history, hence we'd need to do such a configuration in a separate
> place. IIRC there was a proposal to have a ref e.g.
> "refs/submodule/config", that can overwrite/extend the .gitmodules
> file with your own configuration. It is a ref, such that mirroring would
> work, but not part of the main history, such that yoiu can still change it.
How would this handle the hashes for the submodules tracked in the super
project. This gets to my earlier statement that git submodules is not
really that well thought out. When/if /refs/submodule/config
overwrites/extends .gitmoduels what does git checkout for a hash code
(version) for the subproject? Maybe there are some simple ways of doing
this, but it really seems to me that git submodules needs an overhaul to
support multiple remotes. Would the refs/submodule/config also include
the versions hashes for the submodule for both remotes? When switching
between remotes would the git submodule update pull the correct hash
version for the subproject and pull the correct version of the subproject?
> I think to get it right we need to enable a workflow that allows easy
> "multi-step" mirroring, e.g. A (source of truth) can be mirrored to B,
> who can overlay the .gitmodules to point to server-B, which then can
> be mirrored by C, who can have its own serverC.
>
> When C forgot to configure all the submodules, it should fall back to
> serverB as that was closest, and if that is unconfigured it should
> fallback to A IMO.
>
>
>
>>>>> [remote "origin"]
>>>>> url = https://github.com/..
>>>>> [remote "inhouse"]
>>>>> url = https://inhouse.corp/..
>>>>>
>>>>> But where do we clone it from?
>>>>> (Or do we just do a "git init" on that submodule and fetch
>>>>> from both remotes? in which order?)
>>>> origin by default and inhouse if specified. There is already a implied
>>>> default (origin). The idea was not to do both but rather what is
>>>> specified.
>>>> Origin and inhouse are just names for remotes. If one wanted a
>>>> "--all-remotes" could pull from everywhere in the Ether if feature was to
>>>> be
>>>> implemented.
>>> How is origin implied to be the default?
>>> Should there be an order (e.g. if you cannot find it at inhouse get it
>>> from github,
>>> if they are down, get it from kernel.org)
>> As it is in the Highlander series... "there can be only one" (remote). So
>> that is what I mean by origin. The only remote allowed is the "origin"
>> unless changed by the user... but there can still only be one *currently*.
>> Though I see your point as it is not labeled "origin". It is not labeled at
>> all. Apologies for confusion there.
> "origin" is just a common name for a remote, like "master" is a common name
> for branches. There is nothing inherently special about these except for
> their automatic setup after cloning/initializing a repo.
Origin is the remote from where all was derived and yes it can certainly
be renamed or deleted (provided another remote name exists) in git.
Sadly "master" is a term used in git which always implies another term.
I thought term "master" was long since killed in the computer world with
the USB 1.1 to 2.0 debate, ... but here it still lives in git. What is
wrong with the term trunk? Trees don't have masters... they have
trunks... but i digress on the term "master". I will try and get my git
terms right even if IMO they are at times the wrong terms.
> So you can delete the master branch (which I did in a project
> that I am not the authoritative maintainer of; I only have feature
> branches), and
> the repository just works fine.
I too have deleted the "master" branches in previous projects.
^ permalink raw reply
* [PATCH v2] git-p4: Fix git-p4.mapUser on Windows
From: George Vanburgh @ 2017-01-25 9:17 UTC (permalink / raw)
To: git
In-Reply-To: <01020159c0e82598-e373cf0d-2bad-41bb-b455-6896ad183e22-000000@eu-west-1.amazonses.com>
From: George Vanburgh <gvanburgh@bloomberg.net>
When running git-p4 on Windows, with multiple git-p4.mapUser entries in
git config - no user mappings are applied to the generated repository.
Reproduction Steps:
1. Add multiple git-p4.mapUser entries to git config on a Windows
machine
2. Attempt to clone a p4 repository
None of the user mappings will be applied.
This issue is actually caused by gitConfigList, using
split(os.linesep) to convert the output of git config --get-all into
a list. On Windows, os.linesep is equal to '\r\n' - however git.exe
returns configuration with a line seperator of '\n'. This leads to
the list returned by gitConfigList containing only one element - which
contains the full output of git config --get-all in string form, which
causes problems for the code introduced to getUserMapFromPerforceServer
in 10d08a1.
This issue should be caught by the test introduced in 10d08a1, however
would require running on Windows to reproduce.
Using splitlines solves this issue, by splitting config on all
typical delimiters ('\n', '\r\n' etc.)
Signed-off-by: George Vanburgh <gvanburgh@bloomberg.net>
---
git-p4.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git-p4.py b/git-p4.py
index f427bf6..b66f68b 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -656,7 +656,7 @@ def gitConfigInt(key):
def gitConfigList(key):
if not _gitConfig.has_key(key):
s = read_pipe(["git", "config", "--get-all", key], ignore_error=True)
- _gitConfig[key] = s.strip().split(os.linesep)
+ _gitConfig[key] = s.strip().splitlines()
if _gitConfig[key] == ['']:
_gitConfig[key] = []
return _gitConfig[key]
--
https://github.com/git/git/pull/319
^ permalink raw reply related
* [PATCH v3 2/4] urlmatch: enable normalization of URLs with globs
From: Patrick Steinhardt @ 2017-01-25 9:56 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt, Junio C Hamano, Patrick Steinhardt,
Philip Oakley
In-Reply-To: <20170123130635.29577-1-patrick.steinhardt@elego.de>
The `url_normalize` function is used to validate and normalize URLs. As
such, it does not allow for some special characters to be part of the
URLs that are to be normalized. As we want to allow using globs in some
configuration keys making use of URLs, namely `http.<url>.<key>`, but
still normalize them, we need to somehow enable some additional allowed
characters.
To do this without having to change all callers of `url_normalize`,
where most do not actually want globbing at all, we split off another
function `url_normalize_1`. This function accepts an additional
parameter `allow_globs`, which is subsequently called by `url_normalize`
with `allow_globs=0`.
As of now, this function is not used with globbing enabled. A caller
will be added in the following commit.
Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
---
urlmatch.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/urlmatch.c b/urlmatch.c
index 132d342bc..d350478c0 100644
--- a/urlmatch.c
+++ b/urlmatch.c
@@ -63,7 +63,7 @@ static int append_normalized_escapes(struct strbuf *buf,
return 1;
}
-char *url_normalize(const char *url, struct url_info *out_info)
+static char *url_normalize_1(const char *url, struct url_info *out_info, char allow_globs)
{
/*
* Normalize NUL-terminated url using the following rules:
@@ -191,7 +191,12 @@ char *url_normalize(const char *url, struct url_info *out_info)
strbuf_release(&norm);
return NULL;
}
- spanned = strspn(url, URL_HOST_CHARS);
+
+ if (allow_globs)
+ spanned = strspn(url, URL_HOST_CHARS "*");
+ else
+ spanned = strspn(url, URL_HOST_CHARS);
+
if (spanned < colon_ptr - url) {
/* Host name has invalid characters */
if (out_info) {
@@ -380,6 +385,11 @@ char *url_normalize(const char *url, struct url_info *out_info)
return result;
}
+char *url_normalize(const char *url, struct url_info *out_info)
+{
+ return url_normalize_1(url, out_info, 0);
+}
+
static size_t url_match_prefix(const char *url,
const char *url_prefix,
size_t url_prefix_len)
--
2.11.0
^ permalink raw reply related
* [PATCH v3 0/4] urlmatch: allow regexp-based matches
From: Patrick Steinhardt @ 2017-01-25 9:56 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt, Junio C Hamano, Patrick Steinhardt,
Philip Oakley
In-Reply-To: <20170123130635.29577-1-patrick.steinhardt@elego.de>
Hi,
This is version three of my patch series. The previous version
can be found at [1]. The use case is to be able to configure an
HTTP proxy for all subdomains of a domain where there are
hundreds of subdomains.
This version addresses a comment by Philip Oakley regarding the
documentation. You can find the interdiff below.
Regards
Patrick
[1]: http://public-inbox.org/git/20170124170031.18069-1-patrick.steinhardt@elego.de/T/#u
Patrick Steinhardt (4):
mailmap: add Patrick Steinhardt's work address
urlmatch: enable normalization of URLs with globs
urlmatch: split host and port fields in `struct url_info`
urlmatch: allow globbing for the URL host part
.mailmap | 1 +
Documentation/config.txt | 5 +++-
t/t1300-repo-config.sh | 36 +++++++++++++++++++++++++
urlmatch.c | 68 +++++++++++++++++++++++++++++++++++++++++-------
urlmatch.h | 9 ++++---
5 files changed, 104 insertions(+), 15 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index a78921c2b..078e9b490 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1915,9 +1915,9 @@ http.<url>.*::
. Host/domain name (e.g., `example.com` in `https://example.com/`).
This field must match between the config key and the URL. It is
- possible to use globs in the config key to match all subdomains, e.g.
- `https://*.example.com/` to match all subdomains of `example.com`. Note
- that a glob only every matches a single part of the hostname.
+ possible to specify a `*` as part of the host name to match all subdomains
+ at this level. `https://*.example.com/` for example would match
+ `https://foo.example.com/`, but not `https://foo.bar.example.com/`.
. Port number (e.g., `8080` in `http://example.com:8080/`).
This field must match exactly between the config key and the URL.
--
2.11.0
^ permalink raw reply related
* [PATCH v3 4/4] urlmatch: allow globbing for the URL host part
From: Patrick Steinhardt @ 2017-01-25 9:56 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt, Junio C Hamano, Patrick Steinhardt,
Philip Oakley
In-Reply-To: <20170123130635.29577-1-patrick.steinhardt@elego.de>
The URL matching function computes for two URLs whether they match not.
The match is performed by splitting up the URL into different parts and
then doing an exact comparison with the to-be-matched URL.
The main user of `urlmatch` is the configuration subsystem. It allows to
set certain configurations based on the URL which is being connected to
via keys like `http.<url>.*`. A common use case for this is to set
proxies for only some remotes which match the given URL. Unfortunately,
having exact matches for all parts of the URL can become quite tedious
in some setups. Imagine for example a corporate network where there are
dozens or even hundreds of subdomains, which would have to be configured
individually.
This commit introduces the ability to use globbing in the host-part of
the URLs. A user can simply specify a `*` as part of the host name to
match all subdomains at this level. For example adding a configuration
key `http.https://*.example.com.proxy` will match all subdomains of
`https://example.com`.
Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
---
Documentation/config.txt | 5 ++++-
t/t1300-repo-config.sh | 36 ++++++++++++++++++++++++++++++++++++
urlmatch.c | 38 ++++++++++++++++++++++++++++++++++----
3 files changed, 74 insertions(+), 5 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 506431267..078e9b490 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1914,7 +1914,10 @@ http.<url>.*::
must match exactly between the config key and the URL.
. Host/domain name (e.g., `example.com` in `https://example.com/`).
- This field must match exactly between the config key and the URL.
+ This field must match between the config key and the URL. It is
+ possible to specify a `*` as part of the host name to match all subdomains
+ at this level. `https://*.example.com/` for example would match
+ `https://foo.example.com/`, but not `https://foo.bar.example.com/`.
. Port number (e.g., `8080` in `http://example.com:8080/`).
This field must match exactly between the config key and the URL.
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 923bfc5a2..ec545e092 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -1177,6 +1177,42 @@ test_expect_success 'urlmatch' '
test_cmp expect actual
'
+test_expect_success 'glob-based urlmatch' '
+ cat >.git/config <<-\EOF &&
+ [http]
+ sslVerify
+ [http "https://*.example.com"]
+ sslVerify = false
+ cookieFile = /tmp/cookie.txt
+ EOF
+
+ test_expect_code 1 git config --bool --get-urlmatch doesnt.exist https://good.example.com >actual &&
+ test_must_be_empty actual &&
+
+ echo true >expect &&
+ git config --bool --get-urlmatch http.SSLverify https://example.com >actual &&
+ test_cmp expect actual &&
+
+ echo true >expect &&
+ git config --bool --get-urlmatch http.SSLverify https://good-example.com >actual &&
+ test_cmp expect actual &&
+
+ echo true >expect &&
+ git config --bool --get-urlmatch http.sslverify https://deep.nested.example.com >actual &&
+ test_cmp expect actual &&
+
+ echo false >expect &&
+ git config --bool --get-urlmatch http.sslverify https://good.example.com >actual &&
+ test_cmp expect actual &&
+
+ {
+ echo http.cookiefile /tmp/cookie.txt &&
+ echo http.sslverify false
+ } >expect &&
+ git config --get-urlmatch HTTP https://good.example.com >actual &&
+ test_cmp expect actual
+'
+
# good section hygiene
test_expect_failure 'unsetting the last key in a section removes header' '
cat >.git/config <<-\EOF &&
diff --git a/urlmatch.c b/urlmatch.c
index e328905eb..53ff972a6 100644
--- a/urlmatch.c
+++ b/urlmatch.c
@@ -63,6 +63,38 @@ static int append_normalized_escapes(struct strbuf *buf,
return 1;
}
+static int match_host(const struct url_info *url_info,
+ const struct url_info *pattern_info)
+{
+ char *url = xmemdupz(url_info->url + url_info->host_off, url_info->host_len);
+ char *pat = xmemdupz(pattern_info->url + pattern_info->host_off, pattern_info->host_len);
+ char *url_tok, *pat_tok, *url_save, *pat_save;
+ int matching;
+
+ url_tok = strtok_r(url, ".", &url_save);
+ pat_tok = strtok_r(pat, ".", &pat_save);
+
+ for (; url_tok && pat_tok; url_tok = strtok_r(NULL, ".", &url_save),
+ pat_tok = strtok_r(NULL, ".", &pat_save)) {
+ if (!strcmp(pat_tok, "*"))
+ continue; /* a simple glob matches everything */
+
+ if (strcmp(url_tok, pat_tok)) {
+ /* subdomains do not match */
+ matching = 0;
+ break;
+ }
+ }
+
+ /* matching if both URL and pattern are at their ends */
+ matching = (url_tok == NULL && pat_tok == NULL);
+
+ free(url);
+ free(pat);
+
+ return matching;
+}
+
static char *url_normalize_1(const char *url, struct url_info *out_info, char allow_globs)
{
/*
@@ -467,9 +499,7 @@ static int match_urls(const struct url_info *url,
}
/* check the host */
- if (url_prefix->host_len != url->host_len ||
- strncmp(url->url + url->host_off,
- url_prefix->url + url_prefix->host_off, url->host_len))
+ if (!match_host(url, url_prefix))
return 0; /* host names do not match */
/* check the port */
@@ -512,7 +542,7 @@ int urlmatch_config_entry(const char *var, const char *value, void *cb)
struct url_info norm_info;
config_url = xmemdupz(key, dot - key);
- norm_url = url_normalize(config_url, &norm_info);
+ norm_url = url_normalize_1(config_url, &norm_info, 1);
free(config_url);
if (!norm_url)
return 0;
--
2.11.0
^ permalink raw reply related
* [PATCH v3 1/4] mailmap: add Patrick Steinhardt's work address
From: Patrick Steinhardt @ 2017-01-25 9:56 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt, Junio C Hamano, Patrick Steinhardt,
Philip Oakley
In-Reply-To: <20170123130635.29577-1-patrick.steinhardt@elego.de>
Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
---
.mailmap | 1 +
1 file changed, 1 insertion(+)
diff --git a/.mailmap b/.mailmap
index 9c87a3840..ea59205b9 100644
--- a/.mailmap
+++ b/.mailmap
@@ -177,6 +177,7 @@ Paolo Bonzini <bonzini@gnu.org> <paolo.bonzini@lu.unisi.ch>
Pascal Obry <pascal@obry.net> <pascal.obry@gmail.com>
Pascal Obry <pascal@obry.net> <pascal.obry@wanadoo.fr>
Pat Notz <patnotz@gmail.com> <pknotz@sandia.gov>
+Patrick Steinhardt <ps@pks.im> <patrick.steinhardt@elego.de>
Paul Mackerras <paulus@samba.org> <paulus@dorrigo.(none)>
Paul Mackerras <paulus@samba.org> <paulus@pogo.(none)>
Peter Baumann <waste.manager@gmx.de> <Peter.B.Baumann@stud.informatik.uni-erlangen.de>
--
2.11.0
^ permalink raw reply related
* [PATCH v3 3/4] urlmatch: split host and port fields in `struct url_info`
From: Patrick Steinhardt @ 2017-01-25 9:56 UTC (permalink / raw)
To: git; +Cc: Patrick Steinhardt, Junio C Hamano, Patrick Steinhardt,
Philip Oakley
In-Reply-To: <20170123130635.29577-1-patrick.steinhardt@elego.de>
The `url_info` structure contains information about a normalized URL
with the URL's components being represented by different fields. The
host and port part though are to be accessed by the same `host` field,
so that getting the host and/or port separately becomes more involved
than really necessary.
To make the port more readily accessible, split up the host and port
fields. Namely, the `host_len` will not include the port length anymore
and a new `port_off` field has been added which includes the offset to
the port, if available.
The only user of these fields is `url_normalize_1`. This change makes it
easier later on to treat host and port differently when introducing
globs for domains.
Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
---
urlmatch.c | 16 ++++++++++++----
urlmatch.h | 9 +++++----
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/urlmatch.c b/urlmatch.c
index d350478c0..e328905eb 100644
--- a/urlmatch.c
+++ b/urlmatch.c
@@ -104,7 +104,7 @@ static char *url_normalize_1(const char *url, struct url_info *out_info, char al
struct strbuf norm;
size_t spanned;
size_t scheme_len, user_off=0, user_len=0, passwd_off=0, passwd_len=0;
- size_t host_off=0, host_len=0, port_len=0, path_off, path_len, result_len;
+ size_t host_off=0, host_len=0, port_off=0, port_len=0, path_off, path_len, result_len;
const char *slash_ptr, *at_ptr, *colon_ptr, *path_start;
char *result;
@@ -263,6 +263,7 @@ static char *url_normalize_1(const char *url, struct url_info *out_info, char al
return NULL;
}
strbuf_addch(&norm, ':');
+ port_off = norm.len;
strbuf_add(&norm, url, slash_ptr - url);
port_len = slash_ptr - url;
}
@@ -270,7 +271,7 @@ static char *url_normalize_1(const char *url, struct url_info *out_info, char al
url = slash_ptr;
}
if (host_off)
- host_len = norm.len - host_off;
+ host_len = norm.len - host_off - (port_len ? port_len + 1 : 0);
/*
@@ -378,6 +379,7 @@ static char *url_normalize_1(const char *url, struct url_info *out_info, char al
out_info->passwd_len = passwd_len;
out_info->host_off = host_off;
out_info->host_len = host_len;
+ out_info->port_off = port_off;
out_info->port_len = port_len;
out_info->path_off = path_off;
out_info->path_len = path_len;
@@ -464,11 +466,17 @@ static int match_urls(const struct url_info *url,
usermatched = 1;
}
- /* check the host and port */
+ /* check the host */
if (url_prefix->host_len != url->host_len ||
strncmp(url->url + url->host_off,
url_prefix->url + url_prefix->host_off, url->host_len))
- return 0; /* host names and/or ports do not match */
+ return 0; /* host names do not match */
+
+ /* check the port */
+ if (url_prefix->port_len != url->port_len ||
+ strncmp(url->url + url->port_off,
+ url_prefix->url + url_prefix->port_off, url->port_len))
+ return 0; /* ports do not match */
/* check the path */
pathmatchlen = url_match_prefix(
diff --git a/urlmatch.h b/urlmatch.h
index 528862adc..0ea812b03 100644
--- a/urlmatch.h
+++ b/urlmatch.h
@@ -18,11 +18,12 @@ struct url_info {
size_t passwd_len; /* length of passwd; if passwd_off != 0 but
passwd_len == 0, an empty passwd was given */
size_t host_off; /* offset into url to start of host name (0 => none) */
- size_t host_len; /* length of host name; this INCLUDES any ':portnum';
+ size_t host_len; /* length of host name;
* file urls may have host_len == 0 */
- size_t port_len; /* if a portnum is present (port_len != 0), it has
- * this length (excluding the leading ':') at the
- * end of the host name (always 0 for file urls) */
+ size_t port_off; /* offset into url to start of port number (0 => none) */
+ size_t port_len; /* if a portnum is present (port_off != 0), it has
+ * this length (excluding the leading ':') starting
+ * from port_off (always 0 for file urls) */
size_t path_off; /* offset into url to the start of the url path;
* this will always point to a '/' character
* after the url has been normalized */
--
2.11.0
^ permalink raw reply related
* Re: [PATCH v2 4/4] urlmatch: allow globbing for the URL host part
From: Patrick Steinhardt @ 2017-01-25 9:57 UTC (permalink / raw)
To: Philip Oakley; +Cc: git, Patrick Steinhardt, Junio C Hamano
In-Reply-To: <5BF60E6DF2C04DF081466BC3BD3F954F@PhilipOakley>
[-- Attachment #1: Type: text/plain, Size: 2827 bytes --]
On Tue, Jan 24, 2017 at 05:52:39PM -0000, Philip Oakley wrote:
> From: "Patrick Steinhardt" <patrick.steinhardt@elego.de>
>
> a quick comment on the documentation part ..
>
> > The URL matching function computes for two URLs whether they match not.
> > The match is performed by splitting up the URL into different parts and
> > then doing an exact comparison with the to-be-matched URL.
> >
> > The main user of `urlmatch` is the configuration subsystem. It allows to
> > set certain configurations based on the URL which is being connected to
> > via keys like `http.<url>.*`. A common use case for this is to set
> > proxies for only some remotes which match the given URL. Unfortunately,
> > having exact matches for all parts of the URL can become quite tedious
> > in some setups. Imagine for example a corporate network where there are
> > dozens or even hundreds of subdomains, which would have to be configured
> > individually.
> >
> > This commit introduces the ability to use globbing in the host-part of
> > the URLs. A user can simply specify a `*` as part of the host name to
> > match all subdomains at this level. For example adding a configuration
> > key `http.https://*.example.com.proxy` will match all subdomains of
> > `https://example.com`.
> >
> > Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
> > ---
> > Documentation/config.txt | 5 ++++-
> > t/t1300-repo-config.sh | 36 ++++++++++++++++++++++++++++++++++++
> > urlmatch.c | 38 ++++++++++++++++++++++++++++++++++----
> > 3 files changed, 74 insertions(+), 5 deletions(-)
> >
> > diff --git a/Documentation/config.txt b/Documentation/config.txt
> > index 506431267..a78921c2b 100644
> > --- a/Documentation/config.txt
> > +++ b/Documentation/config.txt
> > @@ -1914,7 +1914,10 @@ http.<url>.*::
> > must match exactly between the config key and the URL.
> >
> > . Host/domain name (e.g., `example.com` in `https://example.com/`).
> > - This field must match exactly between the config key and the URL.
> > + This field must match between the config key and the URL. It is
> > + possible to use globs in the config key to match all subdomains, e.g.
> > + `https://*.example.com/` to match all subdomains of `example.com`. Note
> > + that a glob only every matches a single part of the hostname.
>
> [s/every/ever/ ?]
>
> the "match all subdomains" appears to contradict the "a glob only ever
> matches a single part ".
>
> Maybe borrow the example from the 0/4 cover letter
> "so for example `https://foo.bar.example.com` would not match in the case of
> `http.https://*.example.com` " (If I understood it correctly.
>
> A simple example often clarifies much better than more words.
Thanks! (Hopefully) improved this in v3.
Regards
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Fixing the warning about warning(""); was: Re: [PATCH] difftool.c: mark a file-local symbol with static
From: Johannes Schindelin @ 2017-01-25 10:36 UTC (permalink / raw)
To: Jeff King; +Cc: Junio C Hamano, David Aguilar, Ramsay Jones, GIT Mailing-list
In-Reply-To: <20170124230500.h3fasbvutjkkke5h@sigill.intra.peff.net>
Hi Peff,
On Tue, 24 Jan 2017, Jeff King wrote:
> On Tue, Jan 24, 2017 at 01:52:13PM -0800, Junio C Hamano wrote:
>
> > > I dunno. As ugly as the "%s" thing is in the source, at least it
> > > doesn't change the output. Not that an extra space is the end of the
> > > world, but it seems like it's letting the problem escape from the
> > > source code.
> > >
> > > Do people still care about resolving this? -Wno-format-zero-length
> > > is in the DEVELOPER options. It wasn't clear to me if that was
> > > sufficient, or if we're going to get a bunch of reports from people
> > > that need to be directed to the right compiler options.
> >
> > I view both as ugly, but probably "%s", "" is lessor of the two evils.
> >
> > Perhaps
> >
> > #define JUST_SHOW_EMPTY_LINE "%s", ""
> >
> > ...
> > warning(JUST_SHOW_EMPTY_LINE);
> > ...
> >
> > or something silly like that?
>
> Gross, but at least it's self documenting. :)
>
> I guess a less horrible version of that is:
>
> static inline warning_blank_line(void)
> {
> warning("%s", "");
> }
>
> We'd potentially need a matching one for error(), but at last it avoids
> macro trickery.
I fail to see how this function, or this definition, makes the code better
than simply calling `warning("%s", "");` and be done with it.
Ciao,
Johannes
^ permalink raw reply
* Re: [PATCH] connect: handle putty/plink also in GIT_SSH_COMMAND
From: Johannes Schindelin @ 2017-01-25 12:34 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Segev Finer
In-Reply-To: <xmqqmvf0wc2h.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On Mon, 9 Jan 2017, Junio C Hamano wrote:
> IOW, "give an escape hatch to override auto-detected tortoiseplink and
> plink variables" suggestion should be taken as an "in addition to"
> suggestion (as opposed to an "instead of" suggestion). I was not clear
> in my very first message, and I thought in my second and my third
> message I clarified it as such, but probably I wasn't explicit enough.
While you may not have been explicit enough, I was not smart enough.
That escape-hatch exists *already*. And it is exactly the thing that you
mentioned earlier as a potential source of mis-identification.
Let's assume that you want to use a script for the GIT_SSH_COMMAND that
eventually uses PuTTY, and you call this script "junio-is-a-superstar.sh".
All plausible so far ;-)
Now, with the patch in question (without the follow-up, which I would like
to ask you to ignore, just like you did so far), Git would not figure out
that your script calls PuTTY eventually. The work-around? Easy:
DUMMY=/plink.exe /path/to/junio-is-a-superstar.sh
In other words: the thing that we thought may be a problem is actually a
feature.
Likewise, if your GIT_SSH_COMMAND looks like this:
THIS_IS_NOT_ACTUALLY_PUTTY=/my/window/needs/putty my-ssh.sh
... you can easily change Git's mind by prefixing
DUMMY=blubber
If you want to use a script that decides itself whether to call OpenSSH or
PuTTY, Git should "stay dumb" about it, as it will not be able to tell
beforehand whether a port argument should be passed via `-p` or `-P`
anyway.
Of course, given our discussion I think all of this should be documented
in the commit message as well as in the man page.
Do you agree this is a good direction to take?
Ciao,
Johannes
^ permalink raw reply
* [PATCH 1/5] rev-list-options.txt: delete an empty line
From: Nguyễn Thái Ngọc Duy @ 2017-01-25 12:50 UTC (permalink / raw)
To: git; +Cc: Jeff King, jacob.keller, Nguyễn Thái Ngọc Duy
In-Reply-To: <20170125125054.7422-1-pclouds@gmail.com>
The convention has been option name is followed immediately by its
description without a line break.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
Documentation/rev-list-options.txt | 1 -
1 file changed, 1 deletion(-)
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 5da7cf5a8d..1f948cfb13 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -161,7 +161,6 @@ parents) and `--max-parents=-1` (negative numbers denote no upper limit).
or '[', '/{asterisk}' at the end is implied.
--exclude=<glob-pattern>::
-
Do not include refs matching '<glob-pattern>' that the next `--all`,
`--branches`, `--tags`, `--remotes`, or `--glob` would otherwise
consider. Repetitions of this option accumulate exclusion patterns
--
2.11.0.157.gd943d85
^ permalink raw reply related
* [PATCH 0/5] Prep steps for --decorate-reflog
From: Nguyễn Thái Ngọc Duy @ 2017-01-25 12:50 UTC (permalink / raw)
To: git; +Cc: Jeff King, jacob.keller, Nguyễn Thái Ngọc Duy
In-Reply-To: <20170121140806.tjs6wad3x4srdv3q@sigill.intra.peff.net>
I'm still half way through implementing --decorate-reflog that can
select what refs to decorate using --branches, --remotes, --tags...
But I want to make sure I'm heading the right direction first since
I'm not really sure if this is the right way (implementation wise).
This series does not really implement --decorate-reflog. It shuffles
revision.c code around a bit so thay the option can be implemented
later. The most controversal patch would be 4/5 where --exclude
behavior is changed slighly.
Good? Bad? Horror hooorrrible?
Nguyễn Thái Ngọc Duy (5):
rev-list-options.txt: delete an empty line
revision.c: group ref selection options together
revision.c: allow to change pseudo opt parsing function
revision.c: refactor ref selection handler after --exclude
revision.c: add --decorate-reflog
Documentation/rev-list-options.txt | 1 -
revision.c | 206 ++++++++++++++++++++++++++++++-------
revision.h | 4 +
3 files changed, 173 insertions(+), 38 deletions(-)
--
2.11.0.157.gd943d85
^ permalink raw reply
* [PATCH 2/5] revision.c: group ref selection options together
From: Nguyễn Thái Ngọc Duy @ 2017-01-25 12:50 UTC (permalink / raw)
To: git; +Cc: Jeff King, jacob.keller, Nguyễn Thái Ngọc Duy
In-Reply-To: <20170125125054.7422-1-pclouds@gmail.com>
These options have on thing in common: when specified right after
--exclude, they will de-select refs instead of selecting them by
default.
This change makes it possible to introduce new options that use these
options in the same way as --exclude. Such an option would just
implement something like handle_refs_pseudo_opt().
parse_ref_selector_option() is taken out of handle_refs_pseudo_opt() so
that similar functions like handle_refs_pseudo_opt() are forced to
handle all ref selector options, not skipping some by mistake, which may
revert the option back to default behavior (rev selection).
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
revision.c | 134 +++++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 100 insertions(+), 34 deletions(-)
diff --git a/revision.c b/revision.c
index b37dbec378..6ebd38d1c8 100644
--- a/revision.c
+++ b/revision.c
@@ -2059,6 +2059,103 @@ static int for_each_good_bisect_ref(const char *submodule, each_ref_fn fn, void
return for_each_bisect_ref(submodule, fn, cb_data, term_good);
}
+enum ref_selector {
+ REF_SELECT_NONE,
+ REF_SELECT_ALL,
+ REF_SELECT_BRANCHES,
+ REF_SELECT_TAGS,
+ REF_SELECT_REMOTES,
+ REF_SELECT_BY_GLOB
+};
+
+static enum ref_selector parse_ref_selector_option(int argc, const char **argv,
+ const char **optarg,
+ int *argcount)
+{
+ const char *arg = argv[0];
+
+ *optarg = NULL;
+
+ if (!strcmp(arg, "--all"))
+ return REF_SELECT_ALL;
+ else if (!strcmp(arg, "--branches") ||
+ skip_prefix(arg, "--branches=", optarg))
+ return REF_SELECT_BRANCHES;
+ else if (!strcmp(arg, "--tags") ||
+ skip_prefix(arg, "--tags=", optarg))
+ return REF_SELECT_TAGS;
+ else if (!strcmp(arg, "--remotes") ||
+ skip_prefix(arg, "--remotes=", optarg))
+ return REF_SELECT_REMOTES;
+ else if ((*argcount = parse_long_opt("glob", argv, optarg)))
+ return REF_SELECT_BY_GLOB;
+
+ return REF_SELECT_NONE;
+}
+
+static int handle_refs_pseudo_opt(const char *submodule,
+ struct rev_info *revs,
+ int argc, const char **argv,
+ int *flags, int *ret)
+{
+ struct all_refs_cb cb;
+ const char *optarg = NULL;
+ int argcount;
+ enum ref_selector selector;
+
+ selector = parse_ref_selector_option(argc, argv, &optarg, &argcount);
+
+ if (optarg)
+ init_all_refs_cb(&cb, revs, *flags);
+ *ret = 1;
+
+ switch (selector) {
+ case REF_SELECT_ALL:
+ handle_refs(submodule, revs, *flags, for_each_ref_submodule);
+ handle_refs(submodule, revs, *flags, head_ref_submodule);
+ break;
+
+ case REF_SELECT_BRANCHES:
+ if (optarg)
+ for_each_glob_ref_in(handle_one_ref, optarg,
+ "refs/heads/", &cb);
+ else
+ handle_refs(submodule, revs, *flags,
+ for_each_branch_ref_submodule);
+ break;
+
+ case REF_SELECT_TAGS:
+ if (optarg)
+ for_each_glob_ref_in(handle_one_ref, optarg,
+ "refs/tags/", &cb);
+ else
+ handle_refs(submodule, revs, *flags,
+ for_each_tag_ref_submodule);
+ break;
+
+ case REF_SELECT_REMOTES:
+ if (optarg)
+ for_each_glob_ref_in(handle_one_ref, optarg,
+ "refs/remotes/", &cb);
+ else
+ handle_refs(submodule, revs, *flags,
+ for_each_remote_ref_submodule);
+ break;
+
+ case REF_SELECT_BY_GLOB:
+ init_all_refs_cb(&cb, revs, *flags);
+ for_each_glob_ref(handle_one_ref, optarg, &cb);
+ *ret = argcount;
+ break;
+
+ case REF_SELECT_NONE:
+ return 0;
+ }
+
+ clear_ref_exclusion(&revs->ref_excludes);
+ return 1;
+}
+
static int handle_revision_pseudo_opt(const char *submodule,
struct rev_info *revs,
int argc, const char **argv, int *flags)
@@ -2066,6 +2163,7 @@ static int handle_revision_pseudo_opt(const char *submodule,
const char *arg = argv[0];
const char *optarg;
int argcount;
+ int ret;
/*
* NOTE!
@@ -2077,48 +2175,16 @@ static int handle_revision_pseudo_opt(const char *submodule,
* When implementing your new pseudo-option, remember to
* register it in the list at the top of handle_revision_opt.
*/
- if (!strcmp(arg, "--all")) {
- handle_refs(submodule, revs, *flags, for_each_ref_submodule);
- handle_refs(submodule, revs, *flags, head_ref_submodule);
- clear_ref_exclusion(&revs->ref_excludes);
- } else if (!strcmp(arg, "--branches")) {
- handle_refs(submodule, revs, *flags, for_each_branch_ref_submodule);
- clear_ref_exclusion(&revs->ref_excludes);
+ if (handle_refs_pseudo_opt(submodule, revs, argc, argv, flags, &ret)) {
+ return ret;
} else if (!strcmp(arg, "--bisect")) {
read_bisect_terms(&term_bad, &term_good);
handle_refs(submodule, revs, *flags, for_each_bad_bisect_ref);
handle_refs(submodule, revs, *flags ^ (UNINTERESTING | BOTTOM), for_each_good_bisect_ref);
revs->bisect = 1;
- } else if (!strcmp(arg, "--tags")) {
- handle_refs(submodule, revs, *flags, for_each_tag_ref_submodule);
- clear_ref_exclusion(&revs->ref_excludes);
- } else if (!strcmp(arg, "--remotes")) {
- handle_refs(submodule, revs, *flags, for_each_remote_ref_submodule);
- clear_ref_exclusion(&revs->ref_excludes);
- } else if ((argcount = parse_long_opt("glob", argv, &optarg))) {
- struct all_refs_cb cb;
- init_all_refs_cb(&cb, revs, *flags);
- for_each_glob_ref(handle_one_ref, optarg, &cb);
- clear_ref_exclusion(&revs->ref_excludes);
- return argcount;
} else if ((argcount = parse_long_opt("exclude", argv, &optarg))) {
add_ref_exclusion(&revs->ref_excludes, optarg);
return argcount;
- } else if (starts_with(arg, "--branches=")) {
- struct all_refs_cb cb;
- init_all_refs_cb(&cb, revs, *flags);
- for_each_glob_ref_in(handle_one_ref, arg + 11, "refs/heads/", &cb);
- clear_ref_exclusion(&revs->ref_excludes);
- } else if (starts_with(arg, "--tags=")) {
- struct all_refs_cb cb;
- init_all_refs_cb(&cb, revs, *flags);
- for_each_glob_ref_in(handle_one_ref, arg + 7, "refs/tags/", &cb);
- clear_ref_exclusion(&revs->ref_excludes);
- } else if (starts_with(arg, "--remotes=")) {
- struct all_refs_cb cb;
- init_all_refs_cb(&cb, revs, *flags);
- for_each_glob_ref_in(handle_one_ref, arg + 10, "refs/remotes/", &cb);
- clear_ref_exclusion(&revs->ref_excludes);
} else if (!strcmp(arg, "--reflog")) {
add_reflogs_to_pending(revs, *flags);
} else if (!strcmp(arg, "--indexed-objects")) {
--
2.11.0.157.gd943d85
^ permalink raw reply related
* [PATCH 3/5] revision.c: allow to change pseudo opt parsing function
From: Nguyễn Thái Ngọc Duy @ 2017-01-25 12:50 UTC (permalink / raw)
To: git; +Cc: Jeff King, jacob.keller, Nguyễn Thái Ngọc Duy
In-Reply-To: <20170125125054.7422-1-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
revision.c | 11 ++++++++---
revision.h | 4 ++++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/revision.c b/revision.c
index 6ebd38d1c8..cda2606c66 100644
--- a/revision.c
+++ b/revision.c
@@ -2273,10 +2273,15 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
const char *arg = argv[i];
if (*arg == '-') {
int opts;
+ handle_pseudo_opt_cb handle_pseudo_opt =
+ handle_revision_pseudo_opt;
- opts = handle_revision_pseudo_opt(submodule,
- revs, argc - i, argv + i,
- &flags);
+ if (revs->handle_pseudo_opt)
+ handle_pseudo_opt = revs->handle_pseudo_opt;
+
+ opts = handle_pseudo_opt(submodule,
+ revs, argc - i, argv + i,
+ &flags);
if (opts > 0) {
i += opts - 1;
continue;
diff --git a/revision.h b/revision.h
index 9fac1a607d..9080eaf381 100644
--- a/revision.h
+++ b/revision.h
@@ -52,6 +52,8 @@ struct rev_cmdline_info {
#define REVISION_WALK_NO_WALK_SORTED 1
#define REVISION_WALK_NO_WALK_UNSORTED 2
+typedef int (*handle_pseudo_opt_cb)(const char *, struct rev_info *, int, const char **, int *);
+
struct rev_info {
/* Starting list */
struct commit_list *commits;
@@ -213,6 +215,8 @@ struct rev_info {
struct commit_list *previous_parents;
const char *break_bar;
+
+ handle_pseudo_opt_cb handle_pseudo_opt;
};
extern int ref_excluded(struct string_list *, const char *path);
--
2.11.0.157.gd943d85
^ permalink raw reply related
* [PATCH 5/5] revision.c: add --decorate-reflog
From: Nguyễn Thái Ngọc Duy @ 2017-01-25 12:50 UTC (permalink / raw)
To: git; +Cc: Jeff King, jacob.keller, Nguyễn Thái Ngọc Duy
In-Reply-To: <20170125125054.7422-1-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
revision.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/revision.c b/revision.c
index 45cffcab44..b77face513 100644
--- a/revision.c
+++ b/revision.c
@@ -2157,6 +2157,49 @@ static int handle_refs_pseudo_opt(const char *submodule,
static int handle_revision_pseudo_opt(const char *, struct rev_info *, int, const char **, int *);
+static int handle_revision_pseudo_opt_after_decorate_reflog(
+ const char *submodule, struct rev_info *revs,
+ int argc, const char **argv, int *flags)
+{
+ struct all_refs_cb cb;
+ const char *optarg = NULL;
+ int argcount;
+ enum ref_selector selector;
+
+ selector = parse_ref_selector_option(argc, argv, &optarg, &argcount);
+
+ if (optarg)
+ init_all_refs_cb(&cb, revs, *flags);
+
+ switch (selector) {
+ case REF_SELECT_ALL:
+ /* keep the info for load_ref_decorations() later */
+ return 1;
+
+ case REF_SELECT_BRANCHES:
+ /* keep the info for load_ref_decorations() later */
+ return 1;
+
+ case REF_SELECT_TAGS:
+ /* keep the info for load_ref_decorations() later */
+ return 1;
+
+ case REF_SELECT_REMOTES:
+ /* keep the info for load_ref_decorations() later */
+ return 1;
+
+ case REF_SELECT_BY_GLOB:
+ /* keep the info for load_ref_decorations() later */
+ return 1;
+
+ case REF_SELECT_NONE:
+ break;
+ }
+
+ revs->handle_pseudo_opt = NULL;
+ return handle_revision_pseudo_opt(submodule, revs, argc, argv, flags);
+}
+
static int handle_revision_pseudo_opt_after_exclude(const char *submodule,
struct rev_info *revs,
int argc, const char **argv,
@@ -2200,6 +2243,9 @@ static int handle_revision_pseudo_opt(const char *submodule,
add_ref_exclusion(&revs->ref_excludes, optarg);
revs->handle_pseudo_opt = handle_revision_pseudo_opt_after_exclude;
return argcount;
+ } else if ((argcount = parse_long_opt("decorate-reflog", argv, &optarg))) {
+ revs->handle_pseudo_opt = handle_revision_pseudo_opt_after_decorate_reflog;
+ return argcount;
} else if (!strcmp(arg, "--reflog")) {
add_reflogs_to_pending(revs, *flags);
} else if (!strcmp(arg, "--indexed-objects")) {
--
2.11.0.157.gd943d85
^ permalink raw reply related
* [PATCH 4/5] revision.c: refactor ref selection handler after --exclude
From: Nguyễn Thái Ngọc Duy @ 2017-01-25 12:50 UTC (permalink / raw)
To: git; +Cc: Jeff King, jacob.keller, Nguyễn Thái Ngọc Duy
In-Reply-To: <20170125125054.7422-1-pclouds@gmail.com>
Behavior change: "--exclude --blah --remotes" will not exclude remote
branches any more. Only "--exclude --remotes" does.
This is because --exclude is going to have a new friend --decorate-reflog
who haves the same way. When you allow a distant --remotes to complement
a previous option, things get complicated. In
--exclude .. --decorate-reflog ... --remotes
Does it mean decorate remote reflogs, or does it mean exclude remotes
from the selected revisions?
Granted, there may be valid use cases for such a combination (e.g.
"decorate all reflogs except remote ones") but I feel option order is
not a good fit to express them.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
revision.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/revision.c b/revision.c
index cda2606c66..45cffcab44 100644
--- a/revision.c
+++ b/revision.c
@@ -2152,10 +2152,24 @@ static int handle_refs_pseudo_opt(const char *submodule,
return 0;
}
- clear_ref_exclusion(&revs->ref_excludes);
return 1;
}
+static int handle_revision_pseudo_opt(const char *, struct rev_info *, int, const char **, int *);
+
+static int handle_revision_pseudo_opt_after_exclude(const char *submodule,
+ struct rev_info *revs,
+ int argc, const char **argv,
+ int *flags)
+{
+ int ret;
+
+ ret = handle_revision_pseudo_opt(submodule, revs, argc, argv, flags);
+ clear_ref_exclusion(&revs->ref_excludes);
+ revs->handle_pseudo_opt = NULL;
+ return ret;
+}
+
static int handle_revision_pseudo_opt(const char *submodule,
struct rev_info *revs,
int argc, const char **argv, int *flags)
@@ -2184,6 +2198,7 @@ static int handle_revision_pseudo_opt(const char *submodule,
revs->bisect = 1;
} else if ((argcount = parse_long_opt("exclude", argv, &optarg))) {
add_ref_exclusion(&revs->ref_excludes, optarg);
+ revs->handle_pseudo_opt = handle_revision_pseudo_opt_after_exclude;
return argcount;
} else if (!strcmp(arg, "--reflog")) {
add_reflogs_to_pending(revs, *flags);
--
2.11.0.157.gd943d85
^ permalink raw reply related
* Re: [PATCH 1/3] Documentation/stash: remove mention of git reset --hard
From: Jakub Narębski @ 2017-01-25 13:02 UTC (permalink / raw)
To: Jeff King, Thomas Gummerer
Cc: git, Stephan Beyer, Junio C Hamano, Marc Strapetz,
Johannes Schindelin
In-Reply-To: <20170124201415.zzyg4vt35vflwjnb@sigill.intra.peff.net>
W dniu 24.01.2017 o 21:14, Jeff King pisze:
> On Sat, Jan 21, 2017 at 08:08:02PM +0000, Thomas Gummerer wrote:
>
>> diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
>> index 2e9cef06e6..0ad5335a3e 100644
>> --- a/Documentation/git-stash.txt
>> +++ b/Documentation/git-stash.txt
>> @@ -47,8 +47,9 @@ OPTIONS
>>
>> save [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]::
>>
>> - Save your local modifications to a new 'stash', and run `git reset
>> - --hard` to revert them. The <message> part is optional and gives
>> + Save your local modifications to a new 'stash', and revert the
>> + the changes in the working tree to match the index.
>> + The <message> part is optional and gives
>
> Hrm. "git reset --hard" doesn't just make the working tree match the
> index. It also resets the index to HEAD. So either the original or your
> new description is wrong.
>
> I think it's the latter. We really do reset the index unless
> --keep-index is specified.
I wonder if it is worth mentioning that "saving local modifications"
in 'git stash' means storing both the state of the worktree (of tracked
files in it) _and_ the state of the index, before both get set to
state of HEAD.
Best,
--
Jakub Narębski
^ permalink raw reply
* [PATCH] fixup! worktree move: new command
From: Johannes Schindelin @ 2017-01-25 13:04 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy
This is required for the test to pass on Windows, where $TRASH_DIRECTORY
is a POSIX path, while Git works with Windows paths instead. Using
`$(pwd)` is the common workaround: it reports a Windows path (while `$PWD`
would report the POSIX equivalent which, however, would only be understood
by shell and Perl scripts).
Duy, if you re-roll the `worktree-move` patch series, would you terribly
mind squashing this in?
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Based-On: pu at https://github.com/dscho/git
Fetch-Base-Via: git fetch https://github.com/dscho/git pu
Published-As: https://github.com/dscho/git/releases/tag/nd/worktree-move-fixup-v1
Fetch-It-Via: git fetch https://github.com/dscho/git nd/worktree-move-fixup-v1
t/t2028-worktree-move.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/t/t2028-worktree-move.sh b/t/t2028-worktree-move.sh
index 084acc6c6d..b3105eaaed 100755
--- a/t/t2028-worktree-move.sh
+++ b/t/t2028-worktree-move.sh
@@ -71,13 +71,14 @@ test_expect_success 'move locked worktree' '
'
test_expect_success 'move worktree' '
+ toplevel="$(pwd)" &&
git worktree move source destination &&
test_path_is_missing source &&
git worktree list --porcelain | grep "^worktree" >actual &&
cat <<-EOF >expected &&
- worktree $TRASH_DIRECTORY
- worktree $TRASH_DIRECTORY/destination
- worktree $TRASH_DIRECTORY/elsewhere
+ worktree $toplevel
+ worktree $toplevel/destination
+ worktree $toplevel/elsewhere
EOF
test_cmp expected actual &&
git -C destination log --format=%s >actual2 &&
base-commit: 8ef3497bf10296c74058e87d9c5b93372cad5137
--
2.11.0.windows.3.498.g86d49cc
^ permalink raw reply related
* Re: [PATCH v2 0/7] Macros for Asciidoctor support
From: Johannes Schindelin @ 2017-01-25 13:28 UTC (permalink / raw)
To: brian m. carlson; +Cc: git, Jeff King
In-Reply-To: <20170122024156.284180-1-sandals@crustytoothpaste.net>
Hi Brian,
On Sun, 22 Jan 2017, brian m. carlson wrote:
> There are two major processors of AsciiDoc: AsciiDoc itself, and
> Asciidoctor. Both have advantages and disadvantages, but traditionally
> the documentation has been built with AsciiDoc, leading to some
> surprising breakage when building with Asciidoctor. Partially, this is
> due to the need to specify a significant number of macros on the command
> line when building with Asciidoctor.
>
> This series cleans up some issues building the documentation with
> Asciidoctor and provides two knobs, USE_ASCIIDOCTOR, which controls
> building with Asciidoctor, and ASCIIDOCTOR_EXTENSIONS_LAB, which
> controls the location of the Asciidoctor Extensions Lab, which is
> necessary to expand the linkgit macro.
I like it.
I reviewed all the patches and think they are good (except the XSLT patch,
which made me just feel incompetent because I do not know enough to have
an opinion about it).
> The need for the extensions could be replaced with a small amount of
> Ruby code, if that's considered desirable. Previous opinions on doing
> so were negative, however.
Quite frankly, it is annoying to be forced to install the extensions. I
would much rather have the small amount of Ruby code in Git's repository.
Thanks,
Johannes
^ permalink raw reply
* Re: [PATCH v3 14/21] read-cache: touch shared index files when used
From: Christian Couder @ 2017-01-25 14:35 UTC (permalink / raw)
To: Junio C Hamano
Cc: Duy Nguyen, git, Ævar Arnfjörð Bjarmason,
Christian Couder
In-Reply-To: <xmqqefztsj4c.fsf@gitster.mtv.corp.google.com>
On Mon, Jan 23, 2017 at 7:53 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Christian Couder <christian.couder@gmail.com> writes:
>
>> Also in general the split-index mode is useful when you often write
>> new indexes, and in this case shared index files that are used will
>> often be freshened, so the risk of deleting interesting shared index
>> files should be low.
>> ...
>>> Not that I think freshening would actually fail in a repository
>>> where you can actually write into to update the index or its refs to
>>> make a difference (iow, even if we make it die() loudly when shared
>>> index cannot be "touched" because we are paranoid, no real life
>>> usage will trigger that die(), and if a repository does trigger the
>>> die(), I think you would really want to know about it).
>>
>> As I wrote above, I think if we can actually write the shared index
>> file but its freshening fails, it probably means that the shared index
>> file has been removed behind us, and this case is equivalent as when
>> loose files have been removed behind us.
>
> OK, so it is unlikely to happen, and when it happens it leads to a
> catastrophic failure---do we just ignore or do we report an error?
Well, when we cannot freshen a loose file (with
freshen_loose_object()), we don't warn or die, we just write the loose
file. But here we cannot write the shared index file.
And this doesn't lead to a catastrophic failure right away. There
could be a catastrophic failure if the shared index file is needed
again later, but we are not sure that it's going to be needed later.
In fact it may have just been removed because it won't be needed
later.
So I am not sure it's a good idea to anticipate a catastrophic failure
that may not happen. Perhaps we could just warn, but I am not sure it
will help the user. If the catastrophic failure doesn't happen because
the shared index file is not needed, I can't see how the warning could
help. And if there is a catastrophic failure, the following will be
displayed:
fatal: .git/sharedindex.cbfe41352a4623d4d3e9757861fed53f3094e0ac:
index file open failed: No such file or directory
and I don't see how the warning could help on top of that. It could at
most repeat the same thing.
^ permalink raw reply
* [PATCH] mingw: allow hooks to be .exe files
From: Johannes Schindelin @ 2017-01-25 16:58 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
This change is necessary to allow the files in .git/hooks/ to optionally
have the file extension `.exe` on Windows, as the file names are
hardcoded otherwise.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
Published-As: https://github.com/dscho/git/releases/tag/exe-as-hook-v1
Fetch-It-Via: git fetch https://github.com/dscho/git exe-as-hook-v1
run-command.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/run-command.c b/run-command.c
index 73bfba7ef9..45229ef052 100644
--- a/run-command.c
+++ b/run-command.c
@@ -871,8 +871,14 @@ const char *find_hook(const char *name)
strbuf_reset(&path);
strbuf_git_path(&path, "hooks/%s", name);
- if (access(path.buf, X_OK) < 0)
+ if (access(path.buf, X_OK) < 0) {
+#ifdef STRIP_EXTENSION
+ strbuf_addstr(&path, ".exe");
+ if (access(path.buf, X_OK) >= 0)
+ return path.buf;
+#endif
return NULL;
+ }
return path.buf;
}
base-commit: 4e59582ff70d299f5a88449891e78d15b4b3fabe
--
2.11.1.windows.prerelease.2.3.g7f3eb74
^ permalink raw reply related
* [PATCH] Retire the `relink` command
From: Johannes Schindelin @ 2017-01-25 16:58 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
Back in the olden days, when all objects were loose and rubber boots were
made out of wood, it made sense to try to share (immutable) objects
between repositories.
Ever since the arrival of pack files, it is but an anachronism.
Let's move the script to the contrib/examples/ directory and no longer
offer it.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Published-As: https://github.com/dscho/git/releases/tag/retire-relink-v1
Fetch-It-Via: git fetch https://github.com/dscho/git retire-relink-v1
.gitignore | 1 -
Makefile | 1 -
command-list.txt | 1 -
git-relink.perl => contrib/examples/git-relink.perl | 0
{Documentation => contrib/examples}/git-relink.txt | 0
5 files changed, 3 deletions(-)
rename git-relink.perl => contrib/examples/git-relink.perl (100%)
rename {Documentation => contrib/examples}/git-relink.txt (100%)
diff --git a/.gitignore b/.gitignore
index 6722f78f9a..b1020b875f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -118,7 +118,6 @@
/git-rebase--merge
/git-receive-pack
/git-reflog
-/git-relink
/git-remote
/git-remote-http
/git-remote-https
diff --git a/Makefile b/Makefile
index 27afd0f378..658ac19247 100644
--- a/Makefile
+++ b/Makefile
@@ -527,7 +527,6 @@ SCRIPT_PERL += git-archimport.perl
SCRIPT_PERL += git-cvsexportcommit.perl
SCRIPT_PERL += git-cvsimport.perl
SCRIPT_PERL += git-cvsserver.perl
-SCRIPT_PERL += git-relink.perl
SCRIPT_PERL += git-send-email.perl
SCRIPT_PERL += git-svn.perl
diff --git a/command-list.txt b/command-list.txt
index 2a94137bbb..a1fad28fd8 100644
--- a/command-list.txt
+++ b/command-list.txt
@@ -107,7 +107,6 @@ git-read-tree plumbingmanipulators
git-rebase mainporcelain history
git-receive-pack synchelpers
git-reflog ancillarymanipulators
-git-relink ancillarymanipulators
git-remote ancillarymanipulators
git-repack ancillarymanipulators
git-replace ancillarymanipulators
diff --git a/git-relink.perl b/contrib/examples/git-relink.perl
similarity index 100%
rename from git-relink.perl
rename to contrib/examples/git-relink.perl
diff --git a/Documentation/git-relink.txt b/contrib/examples/git-relink.txt
similarity index 100%
rename from Documentation/git-relink.txt
rename to contrib/examples/git-relink.txt
base-commit: 4e59582ff70d299f5a88449891e78d15b4b3fabe
--
2.11.1.windows.prerelease.2.3.g7f3eb74
^ permalink raw reply related
* git clone problem
From: Jordi Durban @ 2017-01-25 16:58 UTC (permalink / raw)
To: git
Hi all! Not sure if that will reach the goal, but let's it a try.
I have a problem with the git clone command: when I try to clone a
remote repository with the following:
git clone --recursive https://github.com/whatever.git
what I actually obtain is a copy of my own files in the current directory.
I mean:
In the current directory:
$ls
-rwxr-xr-x 1 1,6K oct 24 17:29 get_fasta.pl
-rwxr-xr-x 1 1,6K set 5 13:05 script_clus_miRNA_c95.pl
$git clone --recursive https://github.com/whatever.git WHATEVER
$ls
-rwxr-xr-x 1 1,6K oct 24 17:29 get_fasta.pl
-rwxr-xr-x 1 1,6K set 5 13:05 script_clus_miRNA_c95.pl
-rwxr-xr-x 1 1,6K set 5 13:05 WHATEVER
$ls WHATEVER
-rwxr-xr-x 1 1,6K oct 24 17:29 get_fasta.pl
-rwxr-xr-x 1 1,6K set 5 13:05 script_clus_miRNA_c95.pl
I am really confused with that.
Any help will be appreciated. Thank you
^ permalink raw reply
* Re: What's cooking in git.git (Jan 2017, #04; Mon, 23)
From: Johannes Schindelin @ 2017-01-25 17:01 UTC (permalink / raw)
To: Jeff King; +Cc: Lars Schneider, Junio C Hamano, git
In-Reply-To: <20170124132749.l3ezupyitvxe4t2l@sigill.intra.peff.net>
Hi Peff,
On Tue, 24 Jan 2017, Jeff King wrote:
> On Tue, Jan 24, 2017 at 11:04:21AM +0100, Lars Schneider wrote:
>
> > "fsck: prepare dummy objects for --connectivity-check" seems to
> > make t1450-fsck.sh fail on macOS with TravisCI:
> >
> > Initialized empty Git repository in /Users/travis/build/git/git/t/trash directory.t1450-fsck/connectivity-only/.git/
> > [master (root-commit) 86520b7] empty
> > Author: A U Thor <author@example.com>
> > 2 files changed, 1 insertion(+)
> > create mode 100644 empty
> > create mode 100644 empty.t
> > override r--r--r-- travis/staff for .git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391? (y/n [n]) not overwritten
> > dangling blob c21c9352f7526e9576892a6631e0e8cf1fccd34d
>
> Looks like "mv" prompts and then fails to move the file (so we get the
> dangling blob for the source blob, and fsck doesn't report failure
> because we didn't actually corrupt the destination blob).
IIRC I had similar problems years ago, on a machine where the
administrator defined mandatory aliases, including mv="mv -i".
Ciao,
Johannes
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox