* Re: [PATCH] daemon: return "access denied" if a service is not allowed
From: Jeff King @ 2011-10-12 20:09 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy
Cc: git, Ilari Liusvaara, Junio C Hamano, Johannes Sixt,
Jonathan Nieder
In-Reply-To: <1317678909-19383-1-git-send-email-pclouds@gmail.com>
On Tue, Oct 04, 2011 at 08:55:09AM +1100, Nguyen Thai Ngoc Duy wrote:
> The message is chosen to avoid leaking information, yet let users know
> that they are deliberately not allowed to use the service, not a fault
> in service configuration or the service itself.
I do think this is an improvement, but I wonder if the verbosity should
be configurable. Then open sites like kernel.org could be friendlier to
their users. Something like this instead:
---
daemon.c | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/daemon.c b/daemon.c
index 4c8346d..ec88fd0 100644
--- a/daemon.c
+++ b/daemon.c
@@ -20,6 +20,7 @@
static int log_syslog;
static int verbose;
static int reuseaddr;
+static int informative_errors;
static const char daemon_usage[] =
"git daemon [--verbose] [--syslog] [--export-all]\n"
@@ -247,6 +248,14 @@ static int git_daemon_config(const char *var, const char *value, void *cb)
return 0;
}
+static int daemon_error(const char *dir, const char *msg)
+{
+ if (!informative_errors)
+ msg = "access denied";
+ packet_write(1, "ERR %s: %s", dir, msg);
+ return -1;
+}
+
static int run_service(char *dir, struct daemon_service *service)
{
const char *path;
@@ -257,11 +266,11 @@ static int run_service(char *dir, struct daemon_service *service)
if (!enabled && !service->overridable) {
logerror("'%s': service not enabled.", service->name);
errno = EACCES;
- return -1;
+ return daemon_error(dir, "service not enabled");
}
if (!(path = path_ok(dir)))
- return -1;
+ return daemon_error(dir, "no such repository");
/*
* Security on the cheap.
@@ -277,7 +286,7 @@ static int run_service(char *dir, struct daemon_service *service)
if (!export_all_trees && access("git-daemon-export-ok", F_OK)) {
logerror("'%s': repository not exported.", path);
errno = EACCES;
- return -1;
+ return daemon_error(dir, "repository not exported");
}
if (service->overridable) {
@@ -291,7 +300,7 @@ static int run_service(char *dir, struct daemon_service *service)
logerror("'%s': service not enabled for '%s'",
service->name, path);
errno = EACCES;
- return -1;
+ return daemon_error(dir, "service not enabled");
}
/*
@@ -1167,6 +1176,10 @@ int main(int argc, char **argv)
make_service_overridable(arg + 18, 0);
continue;
}
+ if (!prefixcmp(arg, "--informative-errors")) {
+ informative_errors = 1;
+ continue;
+ }
if (!strcmp(arg, "--")) {
ok_paths = &argv[i+1];
break;
--
1.7.7.rc2.21.gb9948
^ permalink raw reply related
* Re: [PATCH] Makefile: add a knob to turn off hardlinks within same directory
From: Jonathan Nieder @ 2011-10-12 19:57 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Bastian Blank, Cedric Staniewski
In-Reply-To: <7vaa969go4.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> Wouldn't your use case be better served with
>
> $ tar zcf dist.tar.gz --hard-dereference $list_of_files_to_tar_up
>
> instead?
No, because that duplicates the files instead of making symlinks.
^ permalink raw reply
* Re: [PATCH] Make is_gitfile a non-static generic function
From: Phil Hord @ 2011-10-12 19:47 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Phil Hord, git@vger.kernel.org
In-Reply-To: <7vmxd69j72.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> sez:
> Phil Hord <phil.hord@gmail.com> writes:
>
>> On Tue, Oct 11, 2011 at 7:45 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> After looking at this patch and the way the other caller in transport.c
>>> uses it, I am more and more convinced that "is_gitfile()" is a stupid and
>>> horrible mistake.
>>
>> I think I misunderstood your objection before. Now I think I
>> understand. Tell me if I am right.
>>
>>
>> I think you mean that instead of this:
>> } else if (is_local(url) && is_file(url) && !is_gitfile(url)) {
>>
>> you would like to see this:
>> } else if (is_local(url) && is_file(url) && is_bundle(url)) {
>>
>> Or maybe even this:
>> } else if (is_bundle(url)) {
>
> Exactly.
I tried to refactor read_bundle_header, but it was too ugly and I don't quite
understand all the error paths. Plus, the whole is_bundle part can be just
10 lines of code. Maybe read_bundle_header() should be shortened slightly to
use is_bundle() for code duplication avoidance.
-- >8 --
Subject: [PATCH] transport: Add/use is_bundle() to identify a url
Transport currently decides that any local url which is a file
must be a bundle. This is wrong now if the local url is a
gitfile, and it will be wrong in the future when some other
exception shows up. Teach transport to verify the file is
really a bundle instead of just assuming it is so.
---
bundle.c | 16 ++++++++++++++++
bundle.h | 1 +
transport.c | 10 +---------
3 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/bundle.c b/bundle.c
index f82baae..3a64a43 100644
--- a/bundle.c
+++ b/bundle.c
@@ -23,6 +23,22 @@ static void add_to_ref_list(const unsigned char *sha1, const char *name,
list->nr++;
}
+int is_bundle(const char *path)
+{
+ char buffer[100];
+ FILE *ffd = fopen(path, "rb");
+ int ret=1;
+
+ if (!ffd)
+ return 0;
+
+ if (!fgets(buffer, sizeof(buffer), ffd) ||
+ strcmp(buffer, bundle_signature))
+ ret=0;
+ fclose(ffd);
+ return ret;
+}
+
/* returns an fd */
int read_bundle_header(const char *path, struct bundle_header *header)
{
diff --git a/bundle.h b/bundle.h
index c5a22c8..35aa0eb 100644
--- a/bundle.h
+++ b/bundle.h
@@ -14,6 +14,7 @@ struct bundle_header {
struct ref_list references;
};
+int is_bundle(const char *path);
int read_bundle_header(const char *path, struct bundle_header *header);
int create_bundle(struct bundle_header *header, const char *path,
int argc, const char **argv);
diff --git a/transport.c b/transport.c
index f3195c0..bcd9b74 100644
--- a/transport.c
+++ b/transport.c
@@ -881,14 +881,6 @@ static int is_gitfile(const char *url)
return !prefixcmp(buf, "gitdir: ");
}
-static int is_file(const char *url)
-{
- struct stat buf;
- if (stat(url, &buf))
- return 0;
- return S_ISREG(buf.st_mode);
-}
-
static int external_specification_len(const char *url)
{
return strchr(url, ':') - url;
@@ -929,7 +921,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
ret->fetch = fetch_objs_via_rsync;
ret->push = rsync_transport_push;
ret->smart_options = NULL;
- } else if (is_local(url) && is_file(url) && !is_gitfile(url)) {
+ } else if (is_local(url) && is_bundle(url)) {
struct bundle_transport_data *data = xcalloc(1, sizeof(*data));
ret->data = data;
ret->get_refs_list = get_refs_from_bundle;
--
1.7.7.334.g311c9.dirty
^ permalink raw reply related
* Re: [PATCH v3 0/7] Provide API to invalidate refs cache
From: Junio C Hamano @ 2011-10-12 19:28 UTC (permalink / raw)
To: Michael Haggerty
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips
In-Reply-To: <1318445067-19279-1-git-send-email-mhagger@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
> These patches are re-rolled onto master.
Thanks.
^ permalink raw reply
* Re: Re* [PATCH v3 19/22] resolve_ref(): emit warnings for improperly-formatted references
From: Jeff King @ 2011-10-12 19:26 UTC (permalink / raw)
To: Junio C Hamano
Cc: Michael Haggerty, git, cmn, A Large Angry SCM, Daniel Barkalow,
Sverre Rabbelier
In-Reply-To: <7vipnu81al.fsf@alter.siamese.dyndns.org>
On Wed, Oct 12, 2011 at 12:20:18PM -0700, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > We also look at ref_rev_parse_rules in shorten_unambiguous_ref. So even
> > with your patch, I still get the warning with:
> >
> > $ git branch config
> > $ git for-each-ref --format='%(refname:short)' refs/heads/
> >
> > It looks like we also use it in remote.c:count_refspec_match, but I
> > haven't figured out if that can trigger a warning or not.
>
> I do not think this is "do not trigger a warning" exercise. This is "we no
> longer consider names outside refs/ as potential magic refs unless they
> are all uppercase".
>
> If the updated dwim_ref() says $GIT_DIR/frotz will no longer create
> ambiguity with $GIT_DIR/refs/heads/frotz, then refname_match() needs to
> know about it, and cause count_refspec_match() to say that "frotz"
> uniquely names "refs/heads/frotz".
>
> The same stands for shorten_unambiguous_ref(). If $GIT_DIR/frotz no longer
> is ambiguous with $GIT_DIR/refs/heads/frotz, then %(refname:shrot) for
> refs/heads/frotz should yield "frotz", and we should not have to qualify
> it as "heads/frotz".
Absolutely. I was lazy in how I woreded it, but I meant that the warning
was the indicator that we were doing something buggy, not that it was
the bug itself. It just happened to be a convenient way to test. :)
Your most recent patch looks right.
-Peff
^ permalink raw reply
* Re: Re* [PATCH v3 19/22] resolve_ref(): emit warnings for improperly-formatted references
From: Junio C Hamano @ 2011-10-12 19:20 UTC (permalink / raw)
To: Jeff King
Cc: Michael Haggerty, git, cmn, A Large Angry SCM, Daniel Barkalow,
Sverre Rabbelier
In-Reply-To: <20111011230749.GA29785@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> We also look at ref_rev_parse_rules in shorten_unambiguous_ref. So even
> with your patch, I still get the warning with:
>
> $ git branch config
> $ git for-each-ref --format='%(refname:short)' refs/heads/
>
> It looks like we also use it in remote.c:count_refspec_match, but I
> haven't figured out if that can trigger a warning or not.
I do not think this is "do not trigger a warning" exercise. This is "we no
longer consider names outside refs/ as potential magic refs unless they
are all uppercase".
If the updated dwim_ref() says $GIT_DIR/frotz will no longer create
ambiguity with $GIT_DIR/refs/heads/frotz, then refname_match() needs to
know about it, and cause count_refspec_match() to say that "frotz"
uniquely names "refs/heads/frotz".
The same stands for shorten_unambiguous_ref(). If $GIT_DIR/frotz no longer
is ambiguous with $GIT_DIR/refs/heads/frotz, then %(refname:shrot) for
refs/heads/frotz should yield "frotz", and we should not have to qualify
it as "heads/frotz".
^ permalink raw reply
* Re: [PATCH 2/2] t1300: test mixed-case variable retrieval
From: Junio C Hamano @ 2011-10-12 19:19 UTC (permalink / raw)
To: Jeff King; +Cc: Carlos Martín Nieto, git
In-Reply-To: <20111012183002.GB18948@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> I was surprised this wasn't tested anywhere, but I couldn't find any
> such place. I think it makes sense to document the desired behavior in
> the form of a few tests.
Thanks. The patch looks good.
But oh boy the original test in the old style was ugly....
^ permalink raw reply
* Re: [PATCH v3 2/7] invalidate_ref_cache(): take the submodule as parameter
From: Junio C Hamano @ 2011-10-12 19:19 UTC (permalink / raw)
To: Michael Haggerty
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips
In-Reply-To: <1318445067-19279-3-git-send-email-mhagger@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
> Instead of invalidating the ref cache on an all-or-nothing basis,
> allow the cache for individual submodules to be invalidated.
That "allow" does not seem to describe what this patch does. It disallows
the wholesale invalidation and forces the caller to invalidate ref cache
individually.
Probably that is what all the existing callers want, but I would have
expected that an existing feature would be kept, perhaps like this
instead:
if (!submodule) {
struct ref_cache *c;
for (c = ref_cache; c; c = c->next)
clear_ref_cache(c);
} else {
clear_ref_cache(get_ref_cache(submodule);
}
Not a major "vetoing" objection, just a comment.
> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
> ---
> refs.c | 12 ++++--------
> 1 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index 120b8e4..cc72609 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -202,13 +202,9 @@ static struct cached_refs *get_cached_refs(const char *submodule)
> return refs;
> }
>
> -static void invalidate_ref_cache(void)
> +static void invalidate_ref_cache(const char *submodule)
> {
> - struct cached_refs *refs = cached_refs;
> - while (refs) {
> - clear_cached_refs(refs);
> - refs = refs->next;
> - }
> + clear_cached_refs(get_cached_refs(submodule));
> }
^ permalink raw reply
* Re: [PATCH v3 1/7] invalidate_ref_cache(): rename function from invalidate_cached_refs()
From: Junio C Hamano @ 2011-10-12 19:14 UTC (permalink / raw)
To: Michael Haggerty
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips
In-Reply-To: <1318445067-19279-2-git-send-email-mhagger@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
> It is the cache that is being invalidated, not the references.
>
> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
> ---
> diff --git a/refs.c b/refs.c
> index 9911c97..120b8e4 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -202,7 +202,7 @@ static struct cached_refs *get_cached_refs(const char *submodule)
> return refs;
> }
>
> -static void invalidate_cached_refs(void)
> +static void invalidate_ref_cache(void)
> {
> struct cached_refs *refs = cached_refs;
> while (refs) {
If you call the operation "invalidate ref_cache", shouldn't the data
structure that holds that cache also be renamed to "struct ref_cache" from
"struct "cached_refs" at the same time?
^ permalink raw reply
* Re: What's cooking in git.git (Oct 2011, #04; Wed, 12)
From: Junio C Hamano @ 2011-10-12 19:05 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20111012190213.GA19578@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> On Wed, Oct 12, 2011 at 11:48:48AM -0700, Junio C Hamano wrote:
>
>> * jk/name-hash-dirent (2011-10-07) 1 commit
>> (merged to 'next' on 2011-10-11 at e2ea68b)
>> + fix phantom untracked files when core.ignorecase is set
>
> I didn't see any comment on the original patch, so I assume you're OK
> with the few extra bytes added to each cache entry? Otherwise, I can try
> to retool it to keep the directory entries in a separate hash, so only
> case-insensitive people pay the extra price.
>
> I did a few trivial timings, and the extra bytes didn't seem to make any
> difference.
I tend to agree with you that 8 extra bytes per cache entry wouldn't hurt.
I also suspected that the cost of code complexity coming from both
maintaining and conditionally looking up a separate hash would outweigh
the benefit.
^ permalink raw reply
* Re: [PATCH] Makefile: add a knob to turn off hardlinks within same directory
From: Junio C Hamano @ 2011-10-12 19:02 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: git, Bastian Blank, Cedric Staniewski
In-Reply-To: <20111012083842.GA21969@elie.hsd1.il.comcast.net>
Jonathan Nieder <jrnieder@gmail.com> writes:
> Typically someone using this setting would want to set
> NO_CROSS_DIRECTORY_HARDLINKS, too, but that is not enforced, so you
> can make $(bindir)/git and $(gitexecdir)/git into hardlinks to the
> same inode and still make sure your tarball avoids the btrfs limits if
> you want.
>
> Requested-by: Bastian Blank <waldi@debian.org>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> ---
> Hi,
>
> See <http://bugs.debian.org/642603> for context. Sane?
>
> Makefile | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 9afdcf2a..ab64ff4c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -226,6 +226,10 @@ all::
> # Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
> # programs as a tar, where bin/ and libexec/ might be on different file systems.
> #
> +# Define NO_HARDLINKS if you plan to distribute the installed programs as a tar
> +# that might be extracted on a filesystem like btrfs that does not cope well
> +# with many links to one inode in one directory.
> +#
Hmm.... I would understand if the change were to eventually remove these
"git-foo" anywhere from the filesystem perhaps after a large version bump
in Git 2.0, but that is not what you are trying to do.
Wouldn't your use case be better served with
$ tar zcf dist.tar.gz --hard-dereference $list_of_files_to_tar_up
instead?
^ permalink raw reply
* Re: What's cooking in git.git (Oct 2011, #04; Wed, 12)
From: Jeff King @ 2011-10-12 19:02 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vipnu9hbj.fsf@alter.siamese.dyndns.org>
On Wed, Oct 12, 2011 at 11:48:48AM -0700, Junio C Hamano wrote:
> * jk/name-hash-dirent (2011-10-07) 1 commit
> (merged to 'next' on 2011-10-11 at e2ea68b)
> + fix phantom untracked files when core.ignorecase is set
I didn't see any comment on the original patch, so I assume you're OK
with the few extra bytes added to each cache entry? Otherwise, I can try
to retool it to keep the directory entries in a separate hash, so only
case-insensitive people pay the extra price.
I did a few trivial timings, and the extra bytes didn't seem to make any
difference.
-Peff
^ permalink raw reply
* [PATCH v3 6/7] write_ref_sha1(): only invalidate the loose ref cache
From: Michael Haggerty @ 2011-10-12 18:44 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips, Michael Haggerty
In-Reply-To: <1318445067-19279-1-git-send-email-mhagger@alum.mit.edu>
Since write_ref_sha1() can only write loose refs and cannot write
symbolic refs, there is no need for it to invalidate the packed ref
cache.
Suggested by: Martin Fick <mfick@codeaurora.org>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/refs.c b/refs.c
index 9d962bd..9e9edf7 100644
--- a/refs.c
+++ b/refs.c
@@ -1534,7 +1534,7 @@ int write_ref_sha1(struct ref_lock *lock,
unlock_ref(lock);
return -1;
}
- invalidate_ref_cache(NULL);
+ clear_cached_loose_refs(get_cached_refs(NULL));
if (log_ref_write(lock->ref_name, lock->old_sha1, sha1, logmsg) < 0 ||
(strcmp(lock->ref_name, lock->orig_ref_name) &&
log_ref_write(lock->orig_ref_name, lock->old_sha1, sha1, logmsg) < 0)) {
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v3 7/7] clear_cached_refs(): inline function
From: Michael Haggerty @ 2011-10-12 18:44 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips, Michael Haggerty
In-Reply-To: <1318445067-19279-1-git-send-email-mhagger@alum.mit.edu>
clear_cached_refs() was only called from one place, so inline it
there.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/refs.c b/refs.c
index 9e9edf7..409314d 100644
--- a/refs.c
+++ b/refs.c
@@ -172,12 +172,6 @@ static void clear_cached_loose_refs(struct cached_refs *refs)
refs->did_loose = 0;
}
-static void clear_cached_refs(struct cached_refs *refs)
-{
- clear_cached_packed_refs(refs);
- clear_cached_loose_refs(refs);
-}
-
static struct cached_refs *create_cached_refs(const char *submodule)
{
int len;
@@ -215,7 +209,9 @@ static struct cached_refs *get_cached_refs(const char *submodule)
void invalidate_ref_cache(const char *submodule)
{
- clear_cached_refs(get_cached_refs(submodule));
+ struct cached_refs *refs = get_cached_refs(submodule);
+ clear_cached_packed_refs(refs);
+ clear_cached_loose_refs(refs);
}
static void read_packed_refs(FILE *f, struct ref_array *array)
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v3 5/7] clear_cached_refs(): extract two new functions
From: Michael Haggerty @ 2011-10-12 18:44 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips, Michael Haggerty
In-Reply-To: <1318445067-19279-1-git-send-email-mhagger@alum.mit.edu>
Extract two new functions from clear_cached_refs():
clear_loose_ref_cache() and clear_packed_ref_cache().
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/refs.c b/refs.c
index 79e3576..9d962bd 100644
--- a/refs.c
+++ b/refs.c
@@ -158,13 +158,24 @@ static void free_ref_array(struct ref_array *array)
array->refs = NULL;
}
-static void clear_cached_refs(struct cached_refs *refs)
+static void clear_cached_packed_refs(struct cached_refs *refs)
{
- if (refs->did_loose)
- free_ref_array(&refs->loose);
if (refs->did_packed)
free_ref_array(&refs->packed);
- refs->did_loose = refs->did_packed = 0;
+ refs->did_packed = 0;
+}
+
+static void clear_cached_loose_refs(struct cached_refs *refs)
+{
+ if (refs->did_loose)
+ free_ref_array(&refs->loose);
+ refs->did_loose = 0;
+}
+
+static void clear_cached_refs(struct cached_refs *refs)
+{
+ clear_cached_packed_refs(refs);
+ clear_cached_loose_refs(refs);
}
static struct cached_refs *create_cached_refs(const char *submodule)
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v3 4/7] clear_cached_refs(): rename parameter
From: Michael Haggerty @ 2011-10-12 18:44 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips, Michael Haggerty
In-Reply-To: <1318445067-19279-1-git-send-email-mhagger@alum.mit.edu>
...for consistency with the rest of this module.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/refs.c b/refs.c
index b08d476..79e3576 100644
--- a/refs.c
+++ b/refs.c
@@ -158,13 +158,13 @@ static void free_ref_array(struct ref_array *array)
array->refs = NULL;
}
-static void clear_cached_refs(struct cached_refs *ca)
+static void clear_cached_refs(struct cached_refs *refs)
{
- if (ca->did_loose)
- free_ref_array(&ca->loose);
- if (ca->did_packed)
- free_ref_array(&ca->packed);
- ca->did_loose = ca->did_packed = 0;
+ if (refs->did_loose)
+ free_ref_array(&refs->loose);
+ if (refs->did_packed)
+ free_ref_array(&refs->packed);
+ refs->did_loose = refs->did_packed = 0;
}
static struct cached_refs *create_cached_refs(const char *submodule)
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v3 0/7] Provide API to invalidate refs cache
From: Michael Haggerty @ 2011-10-12 18:44 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips, Michael Haggerty
In-Reply-To: <7vty7ggzum.fsf@alter.siamese.dyndns.org>
These patches are re-rolled onto master.
This patch series provides an API for external code to invalidate the
ref cache that is used internally to refs.c. It also allows code
*within* refs.c to invalidate only the packed or only the loose refs
for a module/submodule.
IMPORTANT:
I won't myself have time to figure out who, outside of refs.c, has to
*call* invalidate_ref_cache(). The candidates that I know off the top
of my head are git-clone, git-submodule [1], and git-pack-refs. It
would be great if experts in those areas would insert calls to
invalidate_ref_cache() where needed.
Even better would be if the meddlesome code were changed to use the
refs API. I'd be happy to help expanding the refs API if needed to
accommodate your needs.
This is why the API for invalidating only packed or loose refs is
private. After code outside refs.c is changed to use the refs API, it
will get the optimal behavior for free (and at that time
invalidate_ref_cache() can be removed again).
[1] http://marc.info/?l=git&m=131827641227965&w=2
In this mailing list thread, Heiko Voigt stated that git-submodule
does not modify any references, so it should not have to use the
API.
Michael Haggerty (7):
invalidate_ref_cache(): rename function from invalidate_cached_refs()
invalidate_ref_cache(): take the submodule as parameter
invalidate_ref_cache(): expose this function in refs API
clear_cached_refs(): rename parameter
clear_cached_refs(): extract two new functions
write_ref_sha1(): only invalidate the loose ref cache
clear_cached_refs(): inline function
refs.c | 31 +++++++++++++++++--------------
refs.h | 8 ++++++++
2 files changed, 25 insertions(+), 14 deletions(-)
--
1.7.7.rc2
^ permalink raw reply
* [PATCH v3 2/7] invalidate_ref_cache(): take the submodule as parameter
From: Michael Haggerty @ 2011-10-12 18:44 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips, Michael Haggerty
In-Reply-To: <1318445067-19279-1-git-send-email-mhagger@alum.mit.edu>
Instead of invalidating the ref cache on an all-or-nothing basis,
allow the cache for individual submodules to be invalidated.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/refs.c b/refs.c
index 120b8e4..cc72609 100644
--- a/refs.c
+++ b/refs.c
@@ -202,13 +202,9 @@ static struct cached_refs *get_cached_refs(const char *submodule)
return refs;
}
-static void invalidate_ref_cache(void)
+static void invalidate_ref_cache(const char *submodule)
{
- struct cached_refs *refs = cached_refs;
- while (refs) {
- clear_cached_refs(refs);
- refs = refs->next;
- }
+ clear_cached_refs(get_cached_refs(submodule));
}
static void read_packed_refs(FILE *f, struct ref_array *array)
@@ -1228,7 +1224,7 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
ret |= repack_without_ref(refname);
unlink_or_warn(git_path("logs/%s", lock->ref_name));
- invalidate_ref_cache();
+ invalidate_ref_cache(NULL);
unlock_ref(lock);
return ret;
}
@@ -1527,7 +1523,7 @@ int write_ref_sha1(struct ref_lock *lock,
unlock_ref(lock);
return -1;
}
- invalidate_ref_cache();
+ invalidate_ref_cache(NULL);
if (log_ref_write(lock->ref_name, lock->old_sha1, sha1, logmsg) < 0 ||
(strcmp(lock->ref_name, lock->orig_ref_name) &&
log_ref_write(lock->orig_ref_name, lock->old_sha1, sha1, logmsg) < 0)) {
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v3 3/7] invalidate_ref_cache(): expose this function in refs API
From: Michael Haggerty @ 2011-10-12 18:44 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips, Michael Haggerty
In-Reply-To: <1318445067-19279-1-git-send-email-mhagger@alum.mit.edu>
Make invalidate_ref_cache() an official part of the refs API. It is
currently a fact of life that code outside of refs.c mucks about with
references. This change gives such code a way of informing the refs
module that it should no longer trust its cache.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 2 +-
refs.h | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/refs.c b/refs.c
index cc72609..b08d476 100644
--- a/refs.c
+++ b/refs.c
@@ -202,7 +202,7 @@ static struct cached_refs *get_cached_refs(const char *submodule)
return refs;
}
-static void invalidate_ref_cache(const char *submodule)
+void invalidate_ref_cache(const char *submodule)
{
clear_cached_refs(get_cached_refs(submodule));
}
diff --git a/refs.h b/refs.h
index 0229c57..f439c54 100644
--- a/refs.h
+++ b/refs.h
@@ -80,6 +80,14 @@ extern void unlock_ref(struct ref_lock *lock);
/** Writes sha1 into the ref specified by the lock. **/
extern int write_ref_sha1(struct ref_lock *lock, const unsigned char *sha1, const char *msg);
+/*
+ * Invalidate the reference cache for the specified submodule. Use
+ * submodule=NULL to invalidate the cache for the main module. This
+ * function must be called if references are changed via a mechanism
+ * other than the refs API.
+ */
+extern void invalidate_ref_cache(const char *submodule);
+
/** Setup reflog before using. **/
int log_ref_setup(const char *ref_name, char *logfile, int bufsize);
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v3 1/7] invalidate_ref_cache(): rename function from invalidate_cached_refs()
From: Michael Haggerty @ 2011-10-12 18:44 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips, Michael Haggerty
In-Reply-To: <1318445067-19279-1-git-send-email-mhagger@alum.mit.edu>
It is the cache that is being invalidated, not the references.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/refs.c b/refs.c
index 9911c97..120b8e4 100644
--- a/refs.c
+++ b/refs.c
@@ -202,7 +202,7 @@ static struct cached_refs *get_cached_refs(const char *submodule)
return refs;
}
-static void invalidate_cached_refs(void)
+static void invalidate_ref_cache(void)
{
struct cached_refs *refs = cached_refs;
while (refs) {
@@ -1228,7 +1228,7 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
ret |= repack_without_ref(refname);
unlink_or_warn(git_path("logs/%s", lock->ref_name));
- invalidate_cached_refs();
+ invalidate_ref_cache();
unlock_ref(lock);
return ret;
}
@@ -1527,7 +1527,7 @@ int write_ref_sha1(struct ref_lock *lock,
unlock_ref(lock);
return -1;
}
- invalidate_cached_refs();
+ invalidate_ref_cache();
if (log_ref_write(lock->ref_name, lock->old_sha1, sha1, logmsg) < 0 ||
(strcmp(lock->ref_name, lock->orig_ref_name) &&
log_ref_write(lock->orig_ref_name, lock->old_sha1, sha1, logmsg) < 0)) {
--
1.7.7.rc2
^ permalink raw reply related
* What's cooking in git.git (Oct 2011, #04; Wed, 12)
From: Junio C Hamano @ 2011-10-12 18:48 UTC (permalink / raw)
To: git
Here are the topics that have been cooking. Commits prefixed with '-' are
only in 'pu' (proposed updates) while commits prefixed with '+' are in 'next'.
As reported earlier, 'next' has been rebuilt with some topics kicked back
to 'pu'. Also, k.org is back.
The second wave of topics are starting to graduate to 'master'.
Here are the repositories that have my integration branches:
With maint, master, next, pu, todo, html and man:
git://git.kernel.org/pub/scm/git/git.git
git://repo.or.cz/alt-git.git
https://code.google.com/p/git-core/
https://github.com/git/git
With only maint, master, html and man:
git://git.sourceforge.jp/gitroot/git-core/git.git
git://git-core.git.sourceforge.net/gitroot/git-core/git-core
With all the topics and integration branches but not todo, html or man:
https://github.com/gitster/git
--------------------------------------------------
[New Topics]
* cn/fetch-prune (2011-10-07) 4 commits
- fetch: treat --tags like refs/tags/*:refs/tags/* when pruning
- fetch: honor the user-provided refspecs when pruning refs
- t5510: add tests for fetch --prune
- fetch: free all the additional refspecs
* ef/mingw-syslog (2011-10-07) 1 commit
(merged to 'next' on 2011-10-11 at d5d6945)
+ mingw: avoid using strbuf in syslog
* jk/name-hash-dirent (2011-10-07) 1 commit
(merged to 'next' on 2011-10-11 at e2ea68b)
+ fix phantom untracked files when core.ignorecase is set
* jn/gitweb-manpages (2011-10-10) 6 commits
. gitweb: Add gitweb manpages to 'gitweb' package in git.spec
. Documentation: Add gitweb config variables to git-config(1)
. Documentation: Link to gitweb(1) and gitweb.conf(5) in other manpages
. gitweb: Add manpage for gitweb
. gitweb: Add manpage for gitweb configuration files
. Documentation: Preparation for gitweb manpages
A re-roll already being discussed.
* js/merge-edit-option (2011-10-10) 2 commits
- fixup! 0f6adfe2a26287c5c13366975f621c818bb3214d
- Teach merge the '[-e|--edit]' option
The part to tweak builtin/merge.c in the fix-up should be removed but
otherwise ready to be squashed into one and merged to 'next'.
* mm/maint-config-explicit-bool-display (2011-10-10) 1 commit
(merged to 'next' on 2011-10-11 at 795939f)
+ config: display key_delim for config --bool --get-regexp
* rr/revert-cherry-pick (2011-10-10) 7 commits
- fixup! 82d520bd
- revert: Simplify passing command-line arguments around
- revert: Allow mixed pick and revert instructions
- revert: Make commit descriptions in insn sheet optional
- revert: Fix buffer overflow in insn sheet parser
- revert: Simplify getting commit subject
- revert: Free memory after get_message call
Probably needs a little bit more polish.
* rs/diff-whole-function (2011-10-10) 2 commits
(merged to 'next' on 2011-10-11 at 6196752)
+ diff: add option to show whole functions as context
+ xdiff: factor out get_func_line()
* rs/pickaxe (2011-10-07) 7 commits
(merged to 'next' on 2011-10-11 at 27d02b2)
+ pickaxe: factor out pickaxe
+ pickaxe: give diff_grep the same signature as has_changes
+ pickaxe: pass diff_options to contains and has_changes
+ pickaxe: factor out has_changes
+ pickaxe: plug regex/kws leak
+ pickaxe: plug regex leak
+ pickaxe: plug diff filespec leak with empty needle
* sc/difftool-skip (2011-10-10) 1 commit
(merged to 'next' on 2011-10-11 at 38d7e84)
+ git-difftool: allow skipping file by typing 'n' at prompt
* sg/completion (2011-10-10) 2 commits
(merged to 'next' on 2011-10-11 at 4724640)
+ completion: unite --format and --pretty for 'log' and 'show'
+ completion: unite --reuse-message and --reedit-message for 'notes'
(this branch uses tm/completion-commit-fixup-squash.)
* tc/fetch-leak (2011-10-07) 1 commit
(merged to 'next' on 2011-10-11 at d867153)
+ fetch: plug two leaks on error exit in store_updated_refs
* jc/check-ref-format-fixup (2011-10-12) 2 commits
- Restrict ref-like names immediately below $GIT_DIR
- refs.c: move dwim_ref()/dwim_log() from sha1_name.c
An attempt to fix-up unfortunate side effect of mh/check-ref-format-3
topic. "git show -s config" is never meant to refer to $GIT_DIR/config
and treat it as a file that records an object name.
* jc/maint-remove-renamed-ref (2011-10-12) 1 commit
- branch -m/-M: remove undocumented RENAMED-REF
--------------------------------------------------
[Graduated to "master"]
* cb/common-prefix-unification (2011-09-12) 3 commits
(merged to 'next' on 2011-10-06 at 8349bca)
+ rename pathspec_prefix() to common_prefix() and move to dir.[ch]
+ consolidate pathspec_prefix and common_prefix
+ remove prefix argument from pathspec_prefix
Originally merged to 'next' on 2011-09-14.
* dm/tree-walk (2011-09-28) 2 commits
(merged to 'next' on 2011-10-06 at 76e90c3)
+ tree-walk: micro-optimization in tree_entry_interesting
+ tree-walk: drop unused parameter from match_dir_prefix
Originally merged to 'next' on 2011-10-05.
* fg/submodule-git-file-git-dir (2011-08-22) 2 commits
(merged to 'next' on 2011-10-06 at 3526bb9)
+ Move git-dir for submodules
+ rev-parse: add option --resolve-git-dir <path>
Originally merged to 'next' on 2011-08-23.
* hv/submodule-update-none (2011-08-11) 2 commits
(merged to 'next' on 2011-10-06 at 4c105df)
+ add update 'none' flag to disable update of submodule by default
+ submodule: move update configuration variable further up
Originally merged to 'next' on 2011-08-24.
* jc/maint-diffstat-numstat-context (2011-09-22) 1 commit
(merged to 'next' on 2011-10-06 at 36c972d)
+ diff: teach --stat/--numstat to honor -U$num
"diff" is allowed to match the common lines differently depending on how
many context lines it is showing, so running --(num)stat with 0 lines of
context internally gives a result that may be surprising to some people.
Originally merged to 'next' on 2011-09-26.
* jm/mergetool-pathspec (2011-09-26) 2 commits
(merged to 'next' on 2011-10-06 at b8e830f)
+ mergetool: no longer need to save standard input
+ mergetool: Use args as pathspec to unmerged files
Originally merged to 'next' on 2011-09-26.
* jn/maint-http-error-message (2011-09-06) 2 commits
(merged to 'next' on 2011-10-06 at 668a706)
+ http: avoid empty error messages for some curl errors
+ http: remove extra newline in error message
Originally merged to 'next' on 2011-09-12.
* jp/get-ref-dir-unsorted (2011-09-30) 2 commits
(merged to 'next' on 2011-10-06 at 69fe65d)
+ refs: Use binary search to lookup refs faster
+ Don't sort ref_list too early
* mh/check-ref-format-3 (2011-10-05) 23 commits
(merged to 'next' on 2011-10-06 at c277498)
+ add_ref(): verify that the refname is formatted correctly
+ resolve_ref(): expand documentation
+ resolve_ref(): also treat a too-long SHA1 as invalid
+ resolve_ref(): emit warnings for improperly-formatted references
+ resolve_ref(): verify that the input refname has the right format
+ remote: avoid passing NULL to read_ref()
+ remote: use xstrdup() instead of strdup()
+ resolve_ref(): do not follow incorrectly-formatted symbolic refs
+ resolve_ref(): extract a function get_packed_ref()
+ resolve_ref(): turn buffer into a proper string as soon as possible
+ resolve_ref(): only follow a symlink that contains a valid, normalized refname
+ resolve_ref(): use prefixcmp()
+ resolve_ref(): explicitly fail if a symlink is not readable
+ Change check_refname_format() to reject unnormalized refnames
+ Inline function refname_format_print()
+ Make collapse_slashes() allocate memory for its result
+ Do not allow ".lock" at the end of any refname component
+ Refactor check_refname_format()
+ Change check_ref_format() to take a flags argument
+ Change bad_ref_char() to return a boolean value
+ git check-ref-format: add options --allow-onelevel and --refspec-pattern
+ t1402: add some more tests
+ get_sha1_hex(): do not read past a NUL character
An unpleasant minor side effect was discovered with this one. If you try
"git show -s config", the code warns that $GIT_DIR/config is not formatted
correctly as a ref, which is technically correct but totally unwarranted.
* mh/iterate-refs (2011-09-11) 7 commits
(merged to 'next' on 2011-10-06 at c7a33e5)
+ refs.c: make create_cached_refs() static
+ Retain caches of submodule refs
+ Store the submodule name in struct cached_refs
+ Allocate cached_refs objects dynamically
+ Change the signature of read_packed_refs()
+ Access reference caches only through new function get_cached_refs()
+ Extract a function clear_cached_refs()
Originally merged to 'next' on 2011-09-27.
* mh/maint-notes-merge-pathbuf-fix (2011-09-27) 1 commit
(merged to 'next' on 2011-10-06 at 0af69bb)
+ notes_merge_commit(): do not pass temporary buffer to other function
Originally merged to 'next' on 2011-10-05.
* mz/remote-rename (2011-09-11) 4 commits
(merged to 'next' on 2011-10-06 at 96db20d)
+ remote: only update remote-tracking branch if updating refspec
+ remote rename: warn when refspec was not updated
+ remote: "rename o foo" should not rename ref "origin/bar"
+ remote: write correct fetch spec when renaming remote 'remote'
Originally merged to 'next' on 2011-09-26.
* nd/sparse-doc (2011-09-26) 1 commit
(merged to 'next' on 2011-10-06 at f6b8355)
+ git-read-tree.txt: update sparse checkout examples
Originally merged to 'next' on 2011-10-05.
* ps/gitweb-js-with-lineno (2011-09-27) 1 commit
(merged to 'next' on 2011-10-06 at 9236f5e)
+ gitweb: Fix links to lines in blobs when javascript-actions are enabled
Originally merged to 'next' on 2011-10-05.
--------------------------------------------------
[Stalled]
* jk/http-auth-keyring (2011-09-28) 22 commits
- credential-cache: don't cache items without context
- check_expirations: don't copy over same element
- t0300: add missing EOF terminator for <<
- credential-store: use a better storage format
- t0300: make alternate username tests more robust
- t0300: make askpass tests a little more robust
- credential-cache: fix expiration calculation corner cases
- docs: minor tweaks to credentials API
- credentials: make credential_fill_gently() static
- credentials: add "getpass" helper
- credentials: add "store" helper
- credentials: add "cache" helper
- docs: end-user documentation for the credential subsystem
- http: use hostname in credential description
- allow the user to configure credential helpers
- look for credentials in config before prompting
- http: use credential API to get passwords
- introduce credentials API
- http: retry authentication failures for all http requests
- remote-curl: don't retry auth failures with dumb protocol
- improve httpd auth tests
- url: decode buffers that are not NUL-terminated
(this branch is used by js/cred-macos-x-keychain-2.)
Kicked back to 'pu' to allow design level discussions to continue.
* js/cred-macos-x-keychain-2 (2011-10-06) 1 commit
- contrib: add a pair of credential helpers for Mac OS X's keychain
(this branch uses jk/http-auth-keyring.)
Kicked back to 'pu' to allow design level discussions to continue.
* hv/submodule-merge-search (2011-08-26) 5 commits
- submodule: Search for merges only at end of recursive merge
- allow multiple calls to submodule merge search for the same path
- submodule: Demonstrate known breakage during recursive merge
- push: Don't push a repository with unpushed submodules
- push: teach --recurse-submodules the on-demand option
(this branch is tangled with fg/submodule-auto-push.)
The second from the bottom one needs to be replaced with a properly
written commit log message.
* fg/submodule-auto-push (2011-09-11) 2 commits
- submodule.c: make two functions static
- push: teach --recurse-submodules the on-demand option
(this branch is tangled with hv/submodule-merge-search.)
What the topic aims to achieve may make sense, but the implementation
looked somewhat suboptimal.
* sr/transport-helper-fix-rfc (2011-07-19) 2 commits
- t5800: point out that deleting branches does not work
- t5800: document inability to push new branch with old content
Perhaps 281eee4 (revision: keep track of the end-user input from the
command line, 2011-08-25) would help.
--------------------------------------------------
[Cooking]
* jc/signed-commit (2011-10-05) 4 commits
- commit: teach --gpg-sign option
- Split GPG interface into its own helper library
- rename "match_refs()" to "match_push_refs()"
- send-pack: typofix error message
This is to replace the earlier "signed push" experiments.
* js/maint-merge-one-file-osx-expr (2011-10-06) 1 commit
(merged to 'next' on 2011-10-07 at fbb28a2)
+ merge-one-file: fix "expr: non-numeric argument"
Will merge to 'master' in the third wave.
* tm/completion-commit-fixup-squash (2011-10-06) 2 commits
(merged to 'next' on 2011-10-11 at 6bb192e)
+ completion: commit --fixup and --squash
+ completion: unite --reuse-message and --reedit-message handling
(this branch is used by sg/completion.)
* tm/completion-push-set-upstream (2011-10-06) 1 commit
(merged to 'next' on 2011-10-11 at 85544e5)
+ completion: push --set-upstream
* js/no-cherry-pick-head-after-punted (2011-10-06) 1 commit
(merged to 'next' on 2011-10-10 at acb29ee)
+ Merge branch 'js/maint-no-cherry-pick-head-after-punted' into js/no-cherry-pick-head-after-punted
(this branch uses js/maint-no-cherry-pick-head-after-punted.)
Will merge to 'master' in the third wave.
* js/maint-no-cherry-pick-head-after-punted (2011-10-06) 2 commits
+ cherry-pick: do not give irrelevant advice when cherry-pick punted
+ revert.c: defer writing CHERRY_PICK_HEAD till it is safe to do so
(this branch is used by js/no-cherry-pick-head-after-punted.)
Will merge to 'maint' later.
* sp/smart-http-failure (2011-10-04) 1 commit
(merged to 'next' on 2011-10-06 at 02f9982)
+ remote-curl: Fix warning after HTTP failure
Will merge to 'master' in the second wave.
* cb/do-not-pretend-to-hijack-long-help (2011-10-05) 1 commit
(merged to 'next' on 2011-10-06 at 46851fe)
+ use -h for synopsis and --help for manpage consistently
Will merge to 'master' in the second wave.
* cp/git-web-browse-browsers (2011-10-03) 1 commit
(merged to 'next' on 2011-10-06 at da42ad0)
+ git-web--browse: avoid the use of eval
Will merge to 'master' in the third wave.
* il/archive-err-signal (2011-10-05) 1 commit
(merged to 'next' on 2011-10-06 at 7e3083f)
+ Support ERR in remote archive like in fetch/push
Will merge to 'master' in the third wave.
* nd/daemon-log-sock-errors (2011-10-03) 1 commit
(merged to 'next' on 2011-10-06 at 5f3630f)
+ daemon: log errors if we could not use some sockets
Will merge to 'master' in the third wave.
* nd/document-err-packet (2011-10-03) 1 commit
(merged to 'next' on 2011-10-06 at 0c5f5d0)
+ pack-protocol: document "ERR" line
Will merge to 'master' in the second wave.
* nd/git-daemon-error-msgs (2011-10-03) 1 commit
(merged to 'next' on 2011-10-06 at 209126d)
+ daemon: return "access denied" if a service is not allowed
Will merge to 'master' in the third wave.
* jc/is-url-simplify (2011-10-03) 1 commit
(merged to 'next' on 2011-10-06 at d6c6741)
+ url.c: simplify is_url()
Will merge to 'master' in the third wave.
* jn/ident-from-etc-mailname (2011-10-06) 2 commits
(merged to 'next' on 2011-10-06 at a68770d)
+ ident: do not retrieve default ident when unnecessary
+ ident: check /etc/mailname if email is unknown
Will merge to 'master' in the third wave.
* jn/no-g-plus-s-on-bsd (2011-10-03) 1 commit
(merged to 'next' on 2011-10-06 at 3d85674)
+ Makefile: do not set setgid bit on directories on GNU/kFreeBSD
Will merge to 'master' in the third wave.
* js/log-show-children (2011-10-04) 1 commit
(merged to 'next' on 2011-10-06 at de8f6f2)
+ log --children
Will merge to 'master' in the third wave.
* rs/name-rev-usage (2011-10-03) 1 commit
(merged to 'next' on 2011-10-06 at e51878e)
+ name-rev: split usage string
Originally merged to 'next' on 2011-10-05.
Will merge to 'master' in the second wave.
* rs/test-ctype (2011-10-03) 2 commits
(merged to 'next' on 2011-10-06 at b8c26d2)
+ test-ctype: add test for is_pathspec_magic
+ test-ctype: macrofy
Originally merged to 'next' on 2011-10-05.
Will merge to 'master' in the second wave.
* rs/pending (2011-10-03) 8 commits
(merged to 'next' on 2011-10-06 at 998462b)
+ commit: factor out clear_commit_marks_for_object_array
+ checkout: use leak_pending flag
+ bundle: use leak_pending flag
+ bisect: use leak_pending flag
+ revision: add leak_pending flag
+ checkout: use add_pending_{object,sha1} in orphan check
+ revision: factor out add_pending_sha1
+ checkout: check for "Previous HEAD" notice in t2020
Will merge to 'master' in the third wave.
* ph/transport-with-gitfile (2011-10-11) 5 commits
(merged to 'next' on 2011-10-12 at 6d58417)
+ Fix is_gitfile() for files too small or larger than PATH_MAX to be a gitfile
(merged to 'next' on 2011-10-06 at 891b8b6)
+ Add test showing git-fetch groks gitfiles
+ Teach transport about the gitfile mechanism
+ Learn to handle gitfiles in enter_repo
+ enter_repo: do not modify input
Will merge to 'master' in the third wave.
* jc/grep-untracked-exclude (2011-10-04) 1 commit
(merged to 'next' on 2011-10-06 at b16cffe)
+ Merge branch 'jc/maint-grep-untracked-exclude' into jc/grep-untracked-exclude
(this branch uses bw/grep-no-index-no-exclude and jc/maint-grep-untracked-exclude.)
Will merge to 'master' in the third wave.
* jc/maint-grep-untracked-exclude (2011-10-04) 1 commit
+ grep: teach --untracked and --exclude-standard options
(this branch is used by jc/grep-untracked-exclude; uses bw/grep-no-index-no-exclude.)
Will merge to 'maint' later.
* cs/perl-config-path-send-email (2011-09-30) 2 commits
(merged to 'next' on 2011-10-06 at 93c00f0)
+ use new Git::config_path() for aliasesfile
+ Add Git::config_path()
Originally merged to 'next' on 2011-10-05.
Will merge to 'master' in the second wave.
* jc/checkout-from-tree-keep-local-changes (2011-09-30) 1 commit
(merged to 'next' on 2011-10-06 at 64061aa)
+ checkout $tree $path: do not clobber local changes in $path not in $tree
Originally merged to 'next' on 2011-10-05.
Will merge to 'master' in the fourth wave.
* jc/apply-blank-at-eof-fix (2011-09-26) 1 commit
(merged to 'next' on 2011-10-06 at a9dfd8f)
+ apply --whitespace=error: correctly report new blank lines at end
Originally merged to 'next' on 2011-10-05.
Will merge to 'master' in the third wave.
* jc/parse-options-boolean (2011-09-28) 5 commits
(merged to 'next' on 2011-10-06 at dd4936c)
+ apply: use OPT_NOOP_NOARG
+ revert: use OPT_NOOP_NOARG
+ parseopt: add OPT_NOOP_NOARG
+ archive.c: use OPT_BOOL()
+ parse-options: deprecate OPT_BOOLEAN
Will merge to 'master' in the second wave.
* ph/push-to-delete-nothing (2011-09-30) 1 commit
(merged to 'next' on 2011-10-06 at 33ac777)
+ receive-pack: don't pass non-existent refs to post-{receive,update} hooks
Will merge to 'master' in the fourth wave.
* zj/send-email-authen-sasl (2011-09-29) 1 commit
(merged to 'next' on 2011-10-06 at 78b31cd)
+ send-email: auth plain/login fix
Originally merged to 'next' on 2011-10-05.
Will merge to 'master' in the second wave.
* nd/maint-sparse-errors (2011-09-22) 2 commits
(merged to 'next' on 2011-10-06 at e3cbb90)
+ Add explanation why we do not allow to sparse checkout to empty working tree
+ sparse checkout: show error messages when worktree shaping fails
Originally merged to 'next' on 2011-09-22.
Will merge to 'master' in the third wave.
* rs/diff-cleanup-records-fix (2011-10-03) 2 commits
(merged to 'next' on 2011-10-06 at 91f035f)
+ diff: resurrect XDF_NEED_MINIMAL with --minimal
+ Revert removal of multi-match discard heuristic in 27af01
Will merge to 'master' in the third wave.
* di/fast-import-empty-tag-note-fix (2011-09-22) 2 commits
(merged to 'next' on 2011-10-06 at 3a01ef1)
+ fast-import: don't allow to note on empty branch
+ fast-import: don't allow to tag empty branch
Originally merged to 'next' on 2011-10-05.
Will merge to 'master' in the fourth wave.
* bw/grep-no-index-no-exclude (2011-09-15) 2 commits
(merged to 'next' on 2011-10-06 at 325270b)
+ grep --no-index: don't use git standard exclusions
+ grep: do not use --index in the short usage output
(this branch is used by jc/grep-untracked-exclude and jc/maint-grep-untracked-exclude.)
Originally merged to 'next' on 2011-09-26.
Will merge to 'master' in the third wave.
* js/bisect-no-checkout (2011-09-21) 1 commit
(merged to 'next' on 2011-10-06 at 0354e94)
+ bisect: fix exiting when checkout failed in bisect_start()
Originally merged to 'next' on 2011-09-21.
Will merge to 'master' in the third wave.
* jc/request-pull-show-head-4 (2011-10-09) 10 commits
(merged to 'next' on 2011-10-10 at 092175e)
+ environment.c: Fix an sparse "symbol not declared" warning
+ builtin/log.c: Fix an "Using plain integer as NULL pointer" warning
(merged to 'next' on 2011-10-07 at fcaeca0)
+ fmt-merge-msg: use branch.$name.description
(merged to 'next' on 2011-10-06 at fa5e0fe)
+ request-pull: use the branch description
+ request-pull: state what commit to expect
+ request-pull: modernize style
+ branch: teach --edit-description option
+ format-patch: use branch description in cover letter
+ branch: add read_branch_desc() helper function
+ Merge branch 'bk/ancestry-path' into jc/branch-desc
Will merge to 'master' in the fourth wave.
* nd/maint-autofix-tag-in-head (2011-09-18) 4 commits
(merged to 'next' on 2011-10-06 at c083e69)
+ Accept tags in HEAD or MERGE_HEAD
+ merge: remove global variable head[]
+ merge: use return value of resolve_ref() to determine if HEAD is invalid
+ merge: keep stash[] a local variable
Originally merged to 'next' on 2011-09-27.
Will merge to 'master' in the third wave.
* bc/attr-ignore-case (2011-10-11) 5 commits
(merged to 'next' on 2011-10-11 at daa6b51)
+ attr.c: respect core.ignorecase when matching attribute patterns
+ attr: read core.attributesfile from git_default_core_config
+ builtin/mv.c: plug miniscule memory leak
+ cleanup: use internal memory allocation wrapper functions everywhere
+ attr.c: avoid inappropriate access to strbuf "buf" member
Re-rolled.
* jc/lookup-object-hash (2011-08-11) 6 commits
- object hash: replace linear probing with 4-way cuckoo hashing
- object hash: we know the table size is a power of two
- object hash: next_size() helper for readability
- pack-objects --count-only
- object.c: remove duplicated code for object hashing
- object.c: code movement for readability
I do not think there is anything fundamentally wrong with this series, but
the risk of breakage far outweighs observed performance gain in one
particular workload. Will keep it in 'next' at least for one cycle.
^ permalink raw reply
* Re: [PATCH] Documentation: update [section.subsection] to reflect what git does
From: Jeff King @ 2011-10-12 18:34 UTC (permalink / raw)
To: Carlos Martín Nieto; +Cc: git, Junio C Hamano
In-Reply-To: <1318434726-5556-1-git-send-email-cmn@elego.de>
On Wed, Oct 12, 2011 at 05:52:06PM +0200, Carlos Martín Nieto wrote:
> -There is also a case insensitive alternative `[section.subsection]` syntax.
> -In this syntax, subsection names follow the same restrictions as for section
> -names.
> +There is also a deprecated `[section.subsection]` syntax. With this
> +syntax, the subsection name is converted to lower-case and is also
> +compared case sensitively. These subsection names follow the same
> +restrictions as section names.
OK, now having looked thoroughly at the problem again, I agree that your
documentation update is much better than the one I posted earlier
(technically we could still talk about canonicalizing the subsection
earlier in git-config(1), but section.foo names are the deprecated
minority, so it's probably not worth cluttering the page with
explanations).
I do think the "compared case sensitively" bit is a little confusing
here, because it's not clear what is being compared here (as we're quite
deep into a discussion of the file format, and away from the git-config
usage). It might be more clear to say:
With this syntax, the subsection name is converted to lower-case, and
the result is compared case sensitively against the subsection name
provided to git-config.
or something like that.
-Peff
^ permalink raw reply
* [PATCH 2/2] t1300: test mixed-case variable retrieval
From: Jeff King @ 2011-10-12 18:30 UTC (permalink / raw)
To: Carlos Martín Nieto; +Cc: Junio C Hamano, git
In-Reply-To: <20111012182742.GA14543@sigill.intra.peff.net>
We should be able to ask for a config value both by its
canonical all-lowercase name (as git does internally), as
well as by random mixed-case (which will be canonicalized by
git-config for us).
Subsections are a tricky point, though. Since we have both
[section "Foo"]
and
[section.Foo]
you might want git-config to canonicalize the subsection or
not, depending on which you are expecting. But there's no
way to communicate this; git-config sees only the key, and
doesn't know which type of section name will be in the
config file.
So it must leave the subsection intact, and it is up to the
caller to provide a canonical version of the subsection if
they want to match the latter form.
Signed-off-by: Jeff King <peff@peff.net>
---
I was surprised this wasn't tested anywhere, but I couldn't find any
such place. I think it makes sense to document the desired behavior in
the form of a few tests.
t/t1300-repo-config.sh | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index cf508af..8a37f96 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -73,6 +73,33 @@ EOF
test_expect_success 'non-match result' 'test_cmp expect .git/config'
+test_expect_success 'find mixed-case key by canonical name' '
+ echo Second >expect &&
+ git config cores.whatever >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'find mixed-case key by non-canonical name' '
+ echo Second >expect &&
+ git config CoReS.WhAtEvEr >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'subsections are not canonicalized by git-config' '
+ cat >>.git/config <<-\EOF &&
+ [section.SubSection]
+ key = one
+ [section "SubSection"]
+ key = two
+ EOF
+ echo one >expect &&
+ git config section.subsection.key >actual &&
+ test_cmp expect actual &&
+ echo two >expect &&
+ git config section.SubSection.key >actual &&
+ test_cmp expect actual
+'
+
cat > .git/config <<\EOF
[alpha]
bar = foo
--
1.7.7.rc2.21.gb9948
^ permalink raw reply related
* [PATCH 1/2] t1300: put git invocations inside test function
From: Jeff King @ 2011-10-12 18:29 UTC (permalink / raw)
To: Carlos Martín Nieto; +Cc: Junio C Hamano, git
In-Reply-To: <20111012182742.GA14543@sigill.intra.peff.net>
This is a very old script, and did a lot of:
echo whatever >expect
git config foo bar
test_expect_success 'cmp .git/config expect'
which meant that we didn't actually check that the call to
git-config succeeded. Fix this, and while we're at it,
modernize the style to use test_cmp.
Signed-off-by: Jeff King <peff@peff.net>
---
There are still a few 'cp' and 'rm' calls outside of the test functions,
but we can generally expect those to work (as we do with the 'cat'
calls).
t/t1300-repo-config.sh | 176 +++++++++++++++++++++++++-----------------------
1 files changed, 93 insertions(+), 83 deletions(-)
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 3e140c1..cf508af 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -7,28 +7,28 @@ test_description='Test git config in different settings'
. ./test-lib.sh
-test -f .git/config && rm .git/config
-
-git config core.penguin "little blue"
+test_expect_success 'clear default config' '
+ rm -f .git/config
+'
cat > expect << EOF
[core]
penguin = little blue
EOF
-
-test_expect_success 'initial' 'cmp .git/config expect'
-
-git config Core.Movie BadPhysics
+test_expect_success 'initial' '
+ git config core.penguin "little blue" &&
+ test_cmp expect .git/config
+'
cat > expect << EOF
[core]
penguin = little blue
Movie = BadPhysics
EOF
-
-test_expect_success 'mixed case' 'cmp .git/config expect'
-
-git config Cores.WhatEver Second
+test_expect_success 'mixed case' '
+ git config Core.Movie BadPhysics &&
+ test_cmp expect .git/config
+'
cat > expect << EOF
[core]
@@ -37,10 +37,10 @@ cat > expect << EOF
[Cores]
WhatEver = Second
EOF
-
-test_expect_success 'similar section' 'cmp .git/config expect'
-
-git config CORE.UPPERCASE true
+test_expect_success 'similar section' '
+ git config Cores.WhatEver Second
+ test_cmp expect .git/config
+'
cat > expect << EOF
[core]
@@ -50,8 +50,10 @@ cat > expect << EOF
[Cores]
WhatEver = Second
EOF
-
-test_expect_success 'similar section' 'cmp .git/config expect'
+test_expect_success 'uppercase section' '
+ git config CORE.UPPERCASE true &&
+ test_cmp expect .git/config
+'
test_expect_success 'replace with non-match' \
'git config core.penguin kingpin !blue'
@@ -69,7 +71,7 @@ cat > expect << EOF
WhatEver = Second
EOF
-test_expect_success 'non-match result' 'cmp .git/config expect'
+test_expect_success 'non-match result' 'test_cmp expect .git/config'
cat > .git/config <<\EOF
[alpha]
@@ -88,7 +90,7 @@ bar = foo
[beta]
EOF
-test_expect_success 'unset with cont. lines is correct' 'cmp .git/config expect'
+test_expect_success 'unset with cont. lines is correct' 'test_cmp expect .git/config'
cat > .git/config << EOF
[beta] ; silly comment # another comment
@@ -116,7 +118,7 @@ noIndent= sillyValue ; 'nother silly comment
[nextSection] noNewline = ouch
EOF
-test_expect_success 'multiple unset is correct' 'cmp .git/config expect'
+test_expect_success 'multiple unset is correct' 'test_cmp expect .git/config'
cp .git/config2 .git/config
@@ -140,9 +142,7 @@ noIndent= sillyValue ; 'nother silly comment
[nextSection] noNewline = ouch
EOF
-test_expect_success 'all replaced' 'cmp .git/config expect'
-
-git config beta.haha alpha
+test_expect_success 'all replaced' 'test_cmp expect .git/config'
cat > expect << EOF
[beta] ; silly comment # another comment
@@ -153,10 +153,10 @@ noIndent= sillyValue ; 'nother silly comment
haha = alpha
[nextSection] noNewline = ouch
EOF
-
-test_expect_success 'really mean test' 'cmp .git/config expect'
-
-git config nextsection.nonewline wow
+test_expect_success 'really mean test' '
+ git config beta.haha alpha &&
+ test_cmp expect .git/config
+'
cat > expect << EOF
[beta] ; silly comment # another comment
@@ -168,11 +168,12 @@ noIndent= sillyValue ; 'nother silly comment
[nextSection]
nonewline = wow
EOF
-
-test_expect_success 'really really mean test' 'cmp .git/config expect'
+test_expect_success 'really really mean test' '
+ git config nextsection.nonewline wow &&
+ test_cmp expect .git/config
+'
test_expect_success 'get value' 'test alpha = $(git config beta.haha)'
-git config --unset beta.haha
cat > expect << EOF
[beta] ; silly comment # another comment
@@ -183,10 +184,10 @@ noIndent= sillyValue ; 'nother silly comment
[nextSection]
nonewline = wow
EOF
-
-test_expect_success 'unset' 'cmp .git/config expect'
-
-git config nextsection.NoNewLine "wow2 for me" "for me$"
+test_expect_success 'unset' '
+ git config --unset beta.haha &&
+ test_cmp expect .git/config
+'
cat > expect << EOF
[beta] ; silly comment # another comment
@@ -198,8 +199,10 @@ noIndent= sillyValue ; 'nother silly comment
nonewline = wow
NoNewLine = wow2 for me
EOF
-
-test_expect_success 'multivar' 'cmp .git/config expect'
+test_expect_success 'multivar' '
+ git config nextsection.NoNewLine "wow2 for me" "for me$" &&
+ test_cmp expect .git/config
+'
test_expect_success 'non-match' \
'git config --get nextsection.nonewline !for'
@@ -214,8 +217,6 @@ test_expect_success 'ambiguous get' '
test_expect_success 'get multivar' \
'git config --get-all nextsection.nonewline'
-git config nextsection.nonewline "wow3" "wow$"
-
cat > expect << EOF
[beta] ; silly comment # another comment
noIndent= sillyValue ; 'nother silly comment
@@ -226,8 +227,10 @@ noIndent= sillyValue ; 'nother silly comment
nonewline = wow3
NoNewLine = wow2 for me
EOF
-
-test_expect_success 'multivar replace' 'cmp .git/config expect'
+test_expect_success 'multivar replace' '
+ git config nextsection.nonewline "wow3" "wow$" &&
+ test_cmp expect .git/config
+'
test_expect_success 'ambiguous value' '
test_must_fail git config nextsection.nonewline
@@ -241,8 +244,6 @@ test_expect_success 'invalid unset' '
test_must_fail git config --unset somesection.nonewline
'
-git config --unset nextsection.nonewline "wow3$"
-
cat > expect << EOF
[beta] ; silly comment # another comment
noIndent= sillyValue ; 'nother silly comment
@@ -253,7 +254,10 @@ noIndent= sillyValue ; 'nother silly comment
NoNewLine = wow2 for me
EOF
-test_expect_success 'multivar unset' 'cmp .git/config expect'
+test_expect_success 'multivar unset' '
+ git config --unset nextsection.nonewline "wow3$" &&
+ test_cmp expect .git/config
+'
test_expect_success 'invalid key' 'test_must_fail git config inval.2key blabla'
@@ -276,7 +280,7 @@ noIndent= sillyValue ; 'nother silly comment
Alpha = beta
EOF
-test_expect_success 'hierarchical section value' 'cmp .git/config expect'
+test_expect_success 'hierarchical section value' 'test_cmp expect .git/config'
cat > expect << EOF
beta.noindent=sillyValue
@@ -304,15 +308,16 @@ EOF
test_expect_success '--get-regexp' \
'git config --get-regexp in > output && cmp output expect'
-git config --add nextsection.nonewline "wow4 for you"
-
cat > expect << EOF
wow2 for me
wow4 for you
EOF
-test_expect_success '--add' \
- 'git config --get-all nextsection.nonewline > output && cmp output expect'
+test_expect_success '--add' '
+ git config --add nextsection.nonewline "wow4 for you" &&
+ git config --get-all nextsection.nonewline > output &&
+ test_cmp expect output
+'
cat > .git/config << EOF
[novalue]
@@ -361,8 +366,6 @@ cat > .git/config << EOF
c = d
EOF
-git config a.x y
-
cat > expect << EOF
[a.b]
c = d
@@ -370,10 +373,10 @@ cat > expect << EOF
x = y
EOF
-test_expect_success 'new section is partial match of another' 'cmp .git/config expect'
-
-git config b.x y
-git config a.b c
+test_expect_success 'new section is partial match of another' '
+ git config a.x y &&
+ test_cmp expect .git/config
+'
cat > expect << EOF
[a.b]
@@ -385,7 +388,11 @@ cat > expect << EOF
x = y
EOF
-test_expect_success 'new variable inserts into proper section' 'cmp .git/config expect'
+test_expect_success 'new variable inserts into proper section' '
+ git config b.x y &&
+ git config a.b c &&
+ test_cmp expect .git/config
+'
test_expect_success 'alternative GIT_CONFIG (non-existing file should fail)' \
'test_must_fail git config --file non-existing-config -l'
@@ -399,9 +406,10 @@ cat > expect << EOF
ein.bahn=strasse
EOF
-GIT_CONFIG=other-config git config -l > output
-
-test_expect_success 'alternative GIT_CONFIG' 'cmp output expect'
+test_expect_success 'alternative GIT_CONFIG' '
+ GIT_CONFIG=other-config git config -l >output &&
+ test_cmp expect output
+'
test_expect_success 'alternative GIT_CONFIG (--file)' \
'git config --file other-config -l > output && cmp output expect'
@@ -417,8 +425,6 @@ test_expect_success 'refer config from subdirectory' '
'
-GIT_CONFIG=other-config git config anwohner.park ausweis
-
cat > expect << EOF
[ein]
bahn = strasse
@@ -426,7 +432,10 @@ cat > expect << EOF
park = ausweis
EOF
-test_expect_success '--set in alternative GIT_CONFIG' 'cmp other-config expect'
+test_expect_success '--set in alternative GIT_CONFIG' '
+ GIT_CONFIG=other-config git config anwohner.park ausweis &&
+ test_cmp expect other-config
+'
cat > .git/config << EOF
# Hallo
@@ -531,7 +540,7 @@ test_expect_success 'section ending' '
git config gitcvs.enabled true &&
git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
- cmp .git/config expect
+ test_cmp expect .git/config
'
@@ -750,13 +759,6 @@ test_expect_success NOT_MINGW 'get --path copes with unset $HOME' '
test_cmp expect result
'
-rm .git/config
-
-git config quote.leading " test"
-git config quote.ending "test "
-git config quote.semicolon "test;test"
-git config quote.hash "test#test"
-
cat > expect << EOF
[quote]
leading = " test"
@@ -764,8 +766,14 @@ cat > expect << EOF
semicolon = "test;test"
hash = "test#test"
EOF
-
-test_expect_success 'quoting' 'cmp .git/config expect'
+test_expect_success 'quoting' '
+ rm .git/config &&
+ git config quote.leading " test" &&
+ git config quote.ending "test " &&
+ git config quote.semicolon "test;test" &&
+ git config quote.hash "test#test" &&
+ test_cmp expect .git/config
+'
test_expect_success 'key with newline' '
test_must_fail git config "key.with
@@ -790,9 +798,10 @@ section.noncont=not continued
section.quotecont=cont;inued
EOF
-git config --list > result
-
-test_expect_success 'value continued on next line' 'cmp result expect'
+test_expect_success 'value continued on next line' '
+ git config --list > result &&
+ cmp result expect
+'
cat > .git/config <<\EOF
[section "sub=section"]
@@ -813,16 +822,17 @@ barQsection.sub=section.val3
Qsection.sub=section.val4
Qsection.sub=section.val5Q
EOF
+test_expect_success '--null --list' '
+ git config --null --list | nul_to_q >result &&
+ echo >>result &&
+ test_cmp expect result
+'
-git config --null --list | perl -pe 'y/\000/Q/' > result
-echo >>result
-
-test_expect_success '--null --list' 'cmp result expect'
-
-git config --null --get-regexp 'val[0-9]' | perl -pe 'y/\000/Q/' > result
-echo >>result
-
-test_expect_success '--null --get-regexp' 'cmp result expect'
+test_expect_success '--null --get-regexp' '
+ git config --null --get-regexp "val[0-9]" | nul_to_q >result &&
+ echo >>result &&
+ test_cmp expect result
+'
test_expect_success 'inner whitespace kept verbatim' '
git config section.val "foo bar" &&
--
1.7.7.rc2.21.gb9948
^ permalink raw reply related
* Re: [PATCH] Documentation: update [section.subsection] to reflect what git does
From: Jeff King @ 2011-10-12 18:27 UTC (permalink / raw)
To: Carlos Martín Nieto; +Cc: git, Junio C Hamano
In-Reply-To: <20111012174643.GA14336@sigill.intra.peff.net>
On Wed, Oct 12, 2011 at 01:46:43PM -0400, Jeff King wrote:
> On Wed, Oct 12, 2011 at 12:29:39PM -0400, Jeff King wrote:
>
> > The explanation matches what we do now, but it did end up a bit longer
> > than I had hoped. We could make it a lot shorter by:
> >
> > 1. Canonicalizing the section and key names that the caller gives to
> > git-config.
>
> Hmm. Scratch that. We seem to do this already in my tests. I'll look
> further and try to make a better documentation patch.
OK, I was all set to do a patch to git-config for this, but it seems the
code is already there. It's only the subsections which are the sticking
point, and those can't be canonicalized, because in most cases we need
to match them exactly.
In the process, I did some cleanup and added some new tests to t1300,
which I think are probably worth applying anyway.
[1/2]: t1300: put git invocations inside test function
[2/2]: t1300: test mixed-case variable retrieval
-Peff
^ 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