* Re: [PATCH/RFC] gitweb: add the ability to show side-by-side diff on commitdiff.
From: Kato Kazuyoshi @ 2011-10-17 1:15 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vobxgpixo.fsf@alter.siamese.dyndns.org>
On Mon, Oct 17, 2011 at 9:20 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
> What are these changes for, except perhaps to make the patch larger than
> necesssary to make it harder to review?
>
> It would leave an unnecessary SP like 'class="diff "' when all the arms of
> if/elsif cascade fall off and $diff_class is left empty. It isn't a major
> issue (I suspect that such a case might even be an error), and I even
> think the code after the above patch would be easier to read and more
> sensible, but shouldn't that kind of "style fix" be in a separate clean-up
> patch that does not introduce any new feature?
>
Sorry. I will separate my patch into two or three commits. Probably like:
- format_diff_line returns a class with an line.
- remove trailing space from the class.
- add side-by-side feature and CSS.
- add form.
Thank you for your correction!
--
Kato Kazuyoshi
^ permalink raw reply
* Re: regression in git-gui since 2c5c66b... Merge branch 'jp/get-ref-dir-unsorted
From: Mark Levedahl @ 2011-10-17 1:38 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vfwispi8u.fsf@alter.siamese.dyndns.org>
On 10/16/2011 08:35 PM, Junio C Hamano wrote:
> Mark Levedahl<mlevedahl@gmail.com> writes:
>
>> I have a project organized as a number of nested git modules (not
>> using git-submodule), and frequently use git-new-workdir to create the
>> nested modules.
>>
>> Since the above merge-commit, git-gui is confused by this arrangement
>> and reports every file in every nested module as being an untracked
>> file in the top-level (super) project.
> Could you come up with a simple reproduction recipe that prepares a
> superproject that has no file of its own, a submodule with a single file
> tracked, and attaches another workdir? If running git-gui in the resulting
> directory makes it misbehave, we could then isolate what git command that
> is invoked by git-gui has changed its behaviour.
>
> Thanks.
>
The following shows the problem for me:
#!/bin/bash
mkdir super sub
cd sub
git init
touch a
git add a
git commit -m 'file' a
git pack-refs --all
cd ../super
git init
git new-workdir ../sub sub
git-gui
git-gui shows "sub/a" in the list of Unstaged Changes. Note that the
"git pack-refs" call is needed to get the failure.
Mark
^ permalink raw reply
* Re: [PATCH/RFC] gitweb: add the ability to show side-by-side diff on commitdiff.
From: Junio C Hamano @ 2011-10-17 1:51 UTC (permalink / raw)
To: Kato Kazuyoshi; +Cc: git
In-Reply-To: <CAFo4x0+_Uy=yjbO61qj8krS0-iovzC5WnBE8-1n5OzxgGeg6JA@mail.gmail.com>
Kato Kazuyoshi <kato.kazuyoshi@gmail.com> writes:
> Probably like:
>
> - format_diff_line returns a class with an line.
> - remove trailing space from the class.
> - add side-by-side feature and CSS.
> - add form.
>
> Thank you for your correction!
My wording came out a bit too strong; I didn't mean to "correct" anything.
I think a better organization would be
[1/2] change code so that $diff_class does not have leading SP
optionally catch a case where $diff_class stays empty as an error?
[2/2] add side-by-side feature, which would involve:
- making format_diff_line() to return $diff_class separately;
- necessary addition of CSS;
- addition of form to trigger the feature.
I do not think splitting the second patch into pieces smaller than that
makes sense.
Thanks.
^ permalink raw reply
* Re: [PATCH 1/2] daemon: add tests
From: Jeff King @ 2011-10-17 2:01 UTC (permalink / raw)
To: Clemens Buchacher; +Cc: git, Junio C Hamano
In-Reply-To: <1318803076-4229-1-git-send-email-drizzd@aon.at>
On Mon, Oct 17, 2011 at 12:11:15AM +0200, Clemens Buchacher wrote:
> The semantics of the git daemon tests are similar to the http
> transport tests. In fact, they are only a slightly modified copy
> of t5550, plus the newly added remote error tests.
>
> All daemon tests will be skipped unless the environment variable
> GIT_TEST_DAEMON is set.
Thanks, it's nice to have some tests. Overall, some of the tests feel a
little silly, because the results should be exactly the same as fetching
or pushing a local repository (so the "set-head" thing, for example,
really has little to do with git-daemon). At the same time, maybe it's a
good thing to re-confirm that the results really are the same. :)
> diff --git a/t/lib-daemon.sh b/t/lib-daemon.sh
> new file mode 100644
> index 0000000..30a89ea
> --- /dev/null
> +++ b/t/lib-daemon.sh
> @@ -0,0 +1,52 @@
> +#!/bin/sh
> +
> +if test -z "$GIT_TEST_DAEMON"
> +then
> + skip_all="Daemon testing disabled (define GIT_TEST_DAEMON to enable)"
> + test_done
> +fi
> +
> +LIB_DAEMON_PORT=${LIB_DAEMON_PORT-'8121'}
I assume you picked this arbitrarily to be LIB_HTTPD_PORT+10. It's fine
to have a default, but note that each of the httpd tests actually
defaults the port to their test number, so they can be run in parallel.
So that would be:
> --- /dev/null
> +++ b/t/t5570-git-daemon.sh
> @@ -0,0 +1,148 @@
> +#!/bin/sh
> +
> +test_description='test fetching over git protocol'
> +. ./test-lib.sh
> +
> +. "$TEST_DIRECTORY"/lib-daemon.sh
> +start_daemon
LIB_DAEMON_PORT=${LIB_DAEMON_PORT-'5570'}
here.
^ permalink raw reply
* Re: [PATCH 2/2] daemon: report permission denied error to clients
From: Jeff King @ 2011-10-17 2:09 UTC (permalink / raw)
To: Clemens Buchacher; +Cc: git, Junio C Hamano
In-Reply-To: <1318803076-4229-2-git-send-email-drizzd@aon.at>
On Mon, Oct 17, 2011 at 12:11:16AM +0200, Clemens Buchacher wrote:
> If passed an inaccessible url, git daemon returns the
> following error:
>
> $ git clone git://host/repo
> fatal: remote error: no such repository: /repo
>
> In case of a permission denied error, return the following
> instead:
>
> fatal: remote error: permission denied: /repo
>
> Signed-off-by: Clemens Buchacher <drizzd@aon.at>
> ---
I like the intent. This actually does leak a little more information
than the existing --informative-errors, as before you couldn't tell the
difference between "not found" and "not exported". But I think the
spirit of --informative-errors is to let that information leak, and this
is a good change.
> -static char *path_ok(char *directory)
> +static int path_ok(char *directory, const char **return_path)
> {
> static char rpath[PATH_MAX];
> static char interp_path[PATH_MAX];
> @@ -120,13 +120,13 @@ static char *path_ok(char *directory)
>
> if (daemon_avoid_alias(dir)) {
> logerror("'%s': aliased", dir);
> - return NULL;
> + return -1;
> }
>
> if (*dir == '~') {
> if (!user_path) {
> logerror("'%s': User-path not allowed", dir);
> - return NULL;
> + return EACCES;
The new calling conventions for this function seem a little weird. I
would expect either "return negative, and set errno" for usual library
code, or possibly "return negative error value". But "return -1, or a
positive error code" seems unusual to me.
One of:
errno = EACCESS;
return -1;
or
return -EACCESS;
would be more idiomatic, I think.
-Peff
^ permalink raw reply
* Re: [PATCH/RFC] gitweb: add the ability to show side-by-side diff on commitdiff.
From: Kato Kazuyoshi @ 2011-10-17 2:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vbotgper8.fsf@alter.siamese.dyndns.org>
On Mon, Oct 17, 2011 at 10:51 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
> I think a better organization would be
>
> [1/2] change code so that $diff_class does not have leading SP
> optionally catch a case where $diff_class stays empty as an error?
>
I think we don't have to treat empty $diff_class as an error because
$diff_class will be an empty when $line is around modification
(ex. foo or quux).
foo
- bar
+ baz
quuz
And class attributes are CDATA. "diff[SP]" and "diff" have same
meanings.
http://www.w3.org/TR/html401/struct/global.html#h-7.5.2
http://www.w3.org/TR/html401/types.html#type-cdata
--
Kato Kazuyoshi
^ permalink raw reply
* [PATCH v4 1/7] invalidate_ref_cache(): rename function from invalidate_cached_refs()
From: mhagger @ 2011-10-17 2:38 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: <1318819091-7066-1-git-send-email-mhagger@alum.mit.edu>
From: Michael Haggerty <mhagger@alum.mit.edu>
It is the cache that is being invalidated, not the references, and the
new name makes this unambiguous. Rename other items analogously:
* struct cached_refs -> struct ref_cache
* cached_refs (the variable) -> ref_cache
* clear_cached_refs() -> clear_ref_cache()
* create_cached_refs() -> create_ref_cache()
* get_cached_refs() -> get_ref_cache()
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
refs.c | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/refs.c b/refs.c
index 9911c97..02b1ef0 100644
--- a/refs.c
+++ b/refs.c
@@ -134,15 +134,15 @@ static struct ref_entry *search_ref_array(struct ref_array *array, const char *n
* Future: need to be in "struct repository"
* when doing a full libification.
*/
-static struct cached_refs {
- struct cached_refs *next;
+static struct ref_cache {
+ struct ref_cache *next;
char did_loose;
char did_packed;
struct ref_array loose;
struct ref_array packed;
/* The submodule name, or "" for the main repo. */
char name[FLEX_ARRAY];
-} *cached_refs;
+} *ref_cache;
static struct ref_entry *current_ref;
@@ -158,7 +158,7 @@ static void free_ref_array(struct ref_array *array)
array->refs = NULL;
}
-static void clear_cached_refs(struct cached_refs *ca)
+static void clear_ref_cache(struct ref_cache *ca)
{
if (ca->did_loose)
free_ref_array(&ca->loose);
@@ -167,27 +167,27 @@ static void clear_cached_refs(struct cached_refs *ca)
ca->did_loose = ca->did_packed = 0;
}
-static struct cached_refs *create_cached_refs(const char *submodule)
+static struct ref_cache *create_ref_cache(const char *submodule)
{
int len;
- struct cached_refs *refs;
+ struct ref_cache *refs;
if (!submodule)
submodule = "";
len = strlen(submodule) + 1;
- refs = xcalloc(1, sizeof(struct cached_refs) + len);
+ refs = xcalloc(1, sizeof(struct ref_cache) + len);
memcpy(refs->name, submodule, len);
return refs;
}
/*
- * Return a pointer to a cached_refs for the specified submodule. For
+ * Return a pointer to a ref_cache for the specified submodule. For
* the main repository, use submodule==NULL. The returned structure
* will be allocated and initialized but not necessarily populated; it
* should not be freed.
*/
-static struct cached_refs *get_cached_refs(const char *submodule)
+static struct ref_cache *get_ref_cache(const char *submodule)
{
- struct cached_refs *refs = cached_refs;
+ struct ref_cache *refs = ref_cache;
if (!submodule)
submodule = "";
while (refs) {
@@ -196,17 +196,17 @@ static struct cached_refs *get_cached_refs(const char *submodule)
refs = refs->next;
}
- refs = create_cached_refs(submodule);
- refs->next = cached_refs;
- cached_refs = refs;
+ refs = create_ref_cache(submodule);
+ refs->next = ref_cache;
+ ref_cache = refs;
return refs;
}
-static void invalidate_cached_refs(void)
+static void invalidate_ref_cache(void)
{
- struct cached_refs *refs = cached_refs;
+ struct ref_cache *refs = ref_cache;
while (refs) {
- clear_cached_refs(refs);
+ clear_ref_cache(refs);
refs = refs->next;
}
}
@@ -257,7 +257,7 @@ void clear_extra_refs(void)
static struct ref_array *get_packed_refs(const char *submodule)
{
- struct cached_refs *refs = get_cached_refs(submodule);
+ struct ref_cache *refs = get_ref_cache(submodule);
if (!refs->did_packed) {
const char *packed_refs_file;
@@ -379,7 +379,7 @@ void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname)
static struct ref_array *get_loose_refs(const char *submodule)
{
- struct cached_refs *refs = get_cached_refs(submodule);
+ struct ref_cache *refs = get_ref_cache(submodule);
if (!refs->did_loose) {
get_ref_dir(submodule, "refs", &refs->loose);
@@ -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
* [PATCH v4 3/7] invalidate_ref_cache(): expose this function in the refs API
From: mhagger @ 2011-10-17 2:38 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: <1318819091-7066-1-git-send-email-mhagger@alum.mit.edu>
From: Michael Haggerty <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 68b73aa..ddd799e 100644
--- a/refs.c
+++ b/refs.c
@@ -202,7 +202,7 @@ static struct ref_cache *get_ref_cache(const char *submodule)
return refs;
}
-static void invalidate_ref_cache(const char *submodule)
+void invalidate_ref_cache(const char *submodule)
{
clear_ref_cache(get_ref_cache(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 v4 0/7] Provide API to invalidate refs cache
From: mhagger @ 2011-10-17 2:38 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips, Michael Haggerty
From: Michael Haggerty <mhagger@alum.mit.edu>
These patches are re-rolled onto the current master and incorporate
Junio's suggestion to rename "struct cached_refs" to "ref_cache".
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 the refs API
clear_ref_cache(): rename parameter
clear_ref_cache(): extract two new functions
write_ref_sha1(): only invalidate the loose ref cache
clear_ref_cache(): inline function
refs.c | 59 +++++++++++++++++++++++++++++++----------------------------
refs.h | 8 ++++++++
2 files changed, 39 insertions(+), 28 deletions(-)
--
1.7.7.rc2
^ permalink raw reply
* [PATCH v4 5/7] clear_ref_cache(): extract two new functions
From: mhagger @ 2011-10-17 2:38 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: <1318819091-7066-1-git-send-email-mhagger@alum.mit.edu>
From: Michael Haggerty <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 623d673..2a21dc3 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_ref_cache(struct ref_cache *refs)
+static void clear_packed_ref_cache(struct ref_cache *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_loose_ref_cache(struct ref_cache *refs)
+{
+ if (refs->did_loose)
+ free_ref_array(&refs->loose);
+ refs->did_loose = 0;
+}
+
+static void clear_ref_cache(struct ref_cache *refs)
+{
+ clear_packed_ref_cache(refs);
+ clear_loose_ref_cache(refs);
}
static struct ref_cache *create_ref_cache(const char *submodule)
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v4 4/7] clear_ref_cache(): rename parameter
From: mhagger @ 2011-10-17 2:38 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: <1318819091-7066-1-git-send-email-mhagger@alum.mit.edu>
From: Michael Haggerty <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 ddd799e..623d673 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_ref_cache(struct ref_cache *ca)
+static void clear_ref_cache(struct ref_cache *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 ref_cache *create_ref_cache(const char *submodule)
--
1.7.7.rc2
^ permalink raw reply related
* [PATCH v4 6/7] write_ref_sha1(): only invalidate the loose ref cache
From: mhagger @ 2011-10-17 2:38 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: <1318819091-7066-1-git-send-email-mhagger@alum.mit.edu>
From: Michael Haggerty <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 2a21dc3..a888cea 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_loose_ref_cache(get_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 v4 2/7] invalidate_ref_cache(): take the submodule as parameter
From: mhagger @ 2011-10-17 2:38 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: <1318819091-7066-1-git-send-email-mhagger@alum.mit.edu>
From: Michael Haggerty <mhagger@alum.mit.edu>
Instead of invalidating the ref cache on an all-or-nothing basis,
invalidate the cache for a specific submodule.
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 02b1ef0..68b73aa 100644
--- a/refs.c
+++ b/refs.c
@@ -202,13 +202,9 @@ static struct ref_cache *get_ref_cache(const char *submodule)
return refs;
}
-static void invalidate_ref_cache(void)
+static void invalidate_ref_cache(const char *submodule)
{
- struct ref_cache *refs = ref_cache;
- while (refs) {
- clear_ref_cache(refs);
- refs = refs->next;
- }
+ clear_ref_cache(get_ref_cache(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 v4 7/7] clear_ref_cache(): inline function
From: mhagger @ 2011-10-17 2:38 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: <1318819091-7066-1-git-send-email-mhagger@alum.mit.edu>
From: Michael Haggerty <mhagger@alum.mit.edu>
clear_ref_cache() 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 a888cea..d8a4fa3 100644
--- a/refs.c
+++ b/refs.c
@@ -172,12 +172,6 @@ static void clear_loose_ref_cache(struct ref_cache *refs)
refs->did_loose = 0;
}
-static void clear_ref_cache(struct ref_cache *refs)
-{
- clear_packed_ref_cache(refs);
- clear_loose_ref_cache(refs);
-}
-
static struct ref_cache *create_ref_cache(const char *submodule)
{
int len;
@@ -215,7 +209,9 @@ static struct ref_cache *get_ref_cache(const char *submodule)
void invalidate_ref_cache(const char *submodule)
{
- clear_ref_cache(get_ref_cache(submodule));
+ struct ref_cache *refs = get_ref_cache(submodule);
+ clear_packed_ref_cache(refs);
+ clear_loose_ref_cache(refs);
}
static void read_packed_refs(FILE *f, struct ref_array *array)
--
1.7.7.rc2
^ permalink raw reply related
* Re: What's cooking in git.git (Oct 2011, #05; Fri, 14)
From: Jeff King @ 2011-10-17 3:37 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vvcrorh49.fsf@alter.siamese.dyndns.org>
On Sun, Oct 16, 2011 at 10:17:10AM -0700, Junio C Hamano wrote:
> >> * jk/daemon-msgs (2011-10-14) 1 commit
> >> - daemon: give friendlier error messages to clients
> >>
> >> Will merge to 'next'.
> >
> > I'm happy to tweak the "access denied" message if other people want. I
> > kind of hoped it wouldn't matter, and that most sites would use
> > --informative-errors.
>
> I've already updated it with the "not exported" bit from Sitaram.
What you queued in d5570f4 looks sane, but the merge into next is
curious. It's an evil merge that turns on informative errors by default:
$ git show 415cf53
commit 415cf53e710b2ff44d485e253bb35a1ca5dff636
Merge: fbc2ee6 d5570f4
Author: Junio C Hamano <gitster@pobox.com>
Date: Sat Oct 15 21:25:41 2011 -0700
Merge branch 'jk/daemon-msgs' into next
* jk/daemon-msgs:
daemon: give friendlier error messages to clients
Conflicts:
daemon.c
diff --cc daemon.c
index 91c4d9b,72fb53a..95b7df5
--- a/daemon.c
+++ b/daemon.c
@@@ -20,6 -20,7 +20,7 @@@
static int log_syslog;
static int verbose;
static int reuseaddr;
-static int informative_errors;
++static int informative_errors = 1;
static const char daemon_usage[] =
"git daemon [--verbose] [--syslog] [--export-all]\n"
The conflicts come from merging with Duy's version, which was already in
next. But the introduced line comes from my second patch, which was
rightly dropped, and should not be there. Was this intentional, or did
you do something clever with "git am" and my original series during
resolution and accidentally pull in that change?
-Peff
^ permalink raw reply
* Re: regression in git-gui since 2c5c66b... Merge branch 'jp/get-ref-dir-unsorted
From: Michael Haggerty @ 2011-10-17 3:40 UTC (permalink / raw)
To: Mark Levedahl; +Cc: Junio C Hamano, git
In-Reply-To: <4E9B8719.1090203@gmail.com>
On 10/17/2011 03:38 AM, Mark Levedahl wrote:
> On 10/16/2011 08:35 PM, Junio C Hamano wrote:
>> Mark Levedahl<mlevedahl@gmail.com> writes:
>>> I have a project organized as a number of nested git modules (not
>>> using git-submodule), and frequently use git-new-workdir to create the
>>> nested modules.
>>>
>>> Since the above merge-commit, git-gui is confused by this arrangement
>>> and reports every file in every nested module as being an untracked
>>> file in the top-level (super) project.
> [...]
>
> The following shows the problem for me:
>
> #!/bin/bash
> mkdir super sub
> cd sub
> git init
> touch a
> git add a
> git commit -m 'file' a
> git pack-refs --all
> cd ../super
> git init
> git new-workdir ../sub sub
> git-gui
>
>
> git-gui shows "sub/a" in the list of Unstaged Changes. Note that the
> "git pack-refs" call is needed to get the failure.
Please bear with me because I don't use git-gui so I don't really know
what to expect.
When I check out 2c5c66b and run the above script (actually, the script
listed below) what I see in git-gui is:
* In the "Unstaged Changes" window, "sub" is listed (not "sub/a").
* When I click on "sub", then in the "Untracked, not staged" window,
"Git Repository (subproject)" appears.
I see the exact same thing when I run the same test script on the
version before merge 2c5c66b.
What do you see?
What do you expect to see?
What versions of git, exactly, are you testing (what version do you
consider "good"; presumably it is version 2c5c66b that you consider "bad")?
Are you certain that you are using the same git version for all commands
("git", "git-gui", and "git-new-workdir")? Please especially note that
git-new-workdir is not part of a default git install, and therefore it
would be easy to accidentally use a different version of this script
than of the other commands.
Michael
#!/bin/bash
SRC=$(cd $(dirname $0); pwd)
GIT=$SRC/git
GIT_NEW_WORKDIR=$SRC/contrib/workdir/git-new-workdir
GITGUI=$SRC/git-gui/git-gui
rm -rf super sub
mkdir super sub
cd sub
$GIT init
touch a
$GIT add a
$GIT commit -m 'file' a
$GIT pack-refs --all
cd ../super
$GIT init
$GIT_NEW_WORKDIR ../sub sub
$GITGUI &
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
^ permalink raw reply
* Re: defined behaviour for multiple urls for a remote
From: Sitaram Chamarty @ 2011-10-17 3:41 UTC (permalink / raw)
To: Kirill Likhodedov; +Cc: git
In-Reply-To: <loom.20111014T113208-660@post.gmane.org>
On Fri, Oct 14, 2011 at 3:06 PM, Kirill Likhodedov
<Kirill.Likhodedov@jetbrains.com> wrote:
> Sitaram Chamarty <sitaramc <at> gmail.com> writes:
>
>> What's the defined behaviour if I do this:
>>
>> [remote "both"]
>> url = https://code.google.com/p/gitolite/
>> url = git <at> github.com:sitaramc/gitolite.git
>>
>> I know what I'm seeing (a fetch only goes to the first URL, and does a
>> HEAD->FETCH_HEAD because I didn't provide a refspec line, while a push
>> seems to push all to both), but I was curious what the official
>> position is, because I couldn't find it in the docs.
>
> Please see the message from Linus about that: http://marc.info/?l=git&m=116231242118202&w=2
cool; thanks!
> You also may check how Git understands your remotes by running
> git remote -v
Aah that's very clear!
> It will show, where it is going to fetch from and push to.
>
> I agree though, that documentation should be updated.
well in theory yes, but now that you mention it, 'git remote -v' is sufficient.
^ permalink raw reply
* Re: [PATCH/RFC] gitweb: add the ability to show side-by-side diff on commitdiff.
From: Junio C Hamano @ 2011-10-17 3:57 UTC (permalink / raw)
To: Kato Kazuyoshi; +Cc: Junio C Hamano, git
In-Reply-To: <CAFo4x0KPP1yZec+98_rn9tG_fhtB-DYAcdi90TwiwUPq+DP90g@mail.gmail.com>
Kato Kazuyoshi <kato.kazuyoshi@gmail.com> writes:
> On Mon, Oct 17, 2011 at 10:51 AM, Junio C Hamano <gitster@pobox.com> wrote:
>>
>> I think a better organization would be
>>
>> [1/2] change code so that $diff_class does not have leading SP
>> optionally catch a case where $diff_class stays empty as an error?
>>
>
> I think we don't have to treat empty $diff_class as an error because
> $diff_class will be an empty when $line is around modification
> (ex. foo or quux).
>
> foo
> - bar
> + baz
> quuz
Ok. then even though class="diff " is not any different from class="diff",
I have to say generated html output becomes aesthetically less nice with
this change; we may want to do something about it _iff_ it does not take
too much change, but as I said I do not care too much about it.
^ permalink raw reply
* Re: What's cooking in git.git (Oct 2011, #05; Fri, 14)
From: Junio C Hamano @ 2011-10-17 4:20 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20111017033706.GA26326@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> What you queued in d5570f4 looks sane, but the merge into next is
> curious.
Thanks for spotting. I think I had rerere that recorded the conflict
resolution with an older iteration of the topic with looser message
default or something.
^ permalink raw reply
* Re: [PATCH 2/4] git-gui: add smart case search mode in searchbar
From: Bert Wesarg @ 2011-10-17 5:32 UTC (permalink / raw)
To: Andrew Ardill; +Cc: Pat Thoyts, git
In-Reply-To: <CAH5451=jUS5PpMddwML36F-mH=pxxh8FsP2ZiRH2_NFBBy+Q5g@mail.gmail.com>
On Mon, Oct 17, 2011 at 00:32, Andrew Ardill <andrew.ardill@gmail.com> wrote:
> I don't really know tcl so I'm not certain, but it looks like you
> never reset the case sensitive flag once it has been set by entering
> an upper case letter. If I accidentally enter an upper case letter and
> have set smartcase true, I would expect that deleting that character
> would turn case sensitivity off again.
>
I never reset it, because your case is a way to search case-sensitive
for an expression in all lower-case. For example, if you would like to
search for 'git' case-sensitively, you would type: 'gitA^H'. A direct
shortcut to toggle the case flag could also be of use. The other idea
which come to mind, is to reset the case flag, if you clear the input
field. I.e. type 'G^Hgit' would still seach case-insensitive.
Bert
> Regards,
>
> Andrew Ardill
>
^ permalink raw reply
* Re: [PATCH v4 0/7] Provide API to invalidate refs cache
From: Junio C Hamano @ 2011-10-17 5:40 UTC (permalink / raw)
To: mhagger
Cc: git, Jeff King, Drew Northup, Jakub Narebski, Heiko Voigt,
Johan Herland, Julian Phillips
In-Reply-To: <1318819091-7066-1-git-send-email-mhagger@alum.mit.edu>
Thanks; will replace the topic with these and re-queue.
^ permalink raw reply
* Re: [PATCH] git-gui: fix multi selected file operation
From: Bert Wesarg @ 2011-10-17 5:54 UTC (permalink / raw)
To: Pat Thoyts; +Cc: git
In-Reply-To: <87ehydhnwk.fsf@fox.patthoyts.tk>
Hi,
On Sun, Oct 16, 2011 at 00:48, Pat Thoyts
<patthoyts@users.sourceforge.net> wrote:
> Bert Wesarg <bert.wesarg@googlemail.com> writes:
>
>>The current path for what we see the diff is not in the list of selected
>>paths. But when we add single paths (with Ctrl) to the set the current path
>>would not be used when the action is performed.
>>
>>Fix this by explicitly putting the path into the list before we start
>>showing the diff.
>>
>>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
>>---
>> git-gui.sh | 1 +
>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>
>>diff --git a/git-gui.sh b/git-gui.sh
>>index f897160..e5dd8bc 100755
>>--- a/git-gui.sh
>>+++ b/git-gui.sh
>>@@ -2474,6 +2474,7 @@ proc toggle_or_diff {w x y} {
>> [concat $after [list ui_ready]]
>> }
>> } else {
>>+ set selected_paths($path) 1
>> show_diff $path $w $lno
>> }
>> }
>
> It is not clear what I should be looking for to test this. Can you
> re-write the commit message to be more clear about what you are
> fixing. Is this multiple unstaged files in the staging box? If so I
> don't see what path display is changing.
Sorry, for this bad description. I will give you a recipe here what to
do to expose the problem. I try later to form this into a new commit
message:
You have 2 modified, not staged files A and B. Your current view shows
the diff for A. Adding B to the selection via Ctrl+Button1 and than
perform the "Stage To Commit" action from the "Commit" menu results
only in the staging of B.
Note, using Shift+Button1 (i.e. 'adding a range of files to the
selection') results in the staging of both files A and B.
Bert
>
> --
> Pat Thoyts http://www.patthoyts.tk/
> PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
>
^ permalink raw reply
* [PATCH 2/2] gitweb: add a feature to show side-by-side diff
From: Kato Kazuyoshi @ 2011-10-17 7:00 UTC (permalink / raw)
To: git
gitweb currently has a feature to show diff but it doesn't support
"side-by-side" style. This modification introduces:
* The "ds" query parameter to specify the style of diff.
* The format_diff_chunk() to reorganize an output of diff.
* The diff_nav() for form.
---
gitweb/gitweb.perl | 81 +++++++++++++++++++++++++++++++++++++++++----
gitweb/static/gitweb.css | 15 ++++++++
2 files changed, 88 insertions(+), 8 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 095adda..dca09dc 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -757,6 +757,7 @@ our @cgi_param_mapping = (
extra_options => "opt",
search_use_regexp => "sr",
ctag => "by_tag",
+ diff_style => "ds",
# this must be last entry (for manipulation from JavaScript)
javascript => "js"
);
@@ -1072,6 +1073,8 @@ sub evaluate_and_validate_params {
}
$search_regexp = $search_use_regexp ? $searchtext : quotemeta $searchtext;
}
+
+ $input_params{diff_style} ||= 'inline';
}
# path to the current git repository
@@ -2276,7 +2279,7 @@ sub format_diff_line {
}
$line = "<span class=\"chunk_info\">@@ $from_text $to_text @@</span>" .
"<span class=\"section\">" . esc_html($section, -nbsp=>1) .
"</span>";
- return "$div_open$line</div>\n";
+ return $diff_class, "$div_open$line</div>\n";
} elsif ($from && $to && $line =~ m/^\@{3}/) {
my ($prefix, $ranges, $section) = $line =~ m/^(\@+) (.*?) \@+(.*)$/;
my (@from_text, @from_start, @from_nlines, $to_text, $to_start, $to_nlines);
@@ -2309,9 +2312,9 @@ sub format_diff_line {
}
$line .= " $prefix</span>" .
"<span class=\"section\">" . esc_html($section, -nbsp=>1)
. "</span>";
- return "$div_open$line</div>\n";
+ return $diff_class, "$div_open$line</div>\n";
}
- return $div_open . esc_html($line, -nbsp=>1) . "</div>\n";
+ return $diff_class, $div_open . esc_html($line, -nbsp=>1) . "</div>\n";
}
# Generates undef or something like "_snapshot_" or "snapshot (_tbz2_ _zip_)",
@@ -4828,8 +4831,32 @@ sub git_difftree_body {
print "</table>\n";
}
+sub format_diff_chunk {
+ my @chunk = @_;
+
+ my $first_class = $chunk[0]->[0];
+ my @partial = map { $_->[1] } grep { $_->[0] eq $first_class } @chunk;
+
+ if (scalar @partial < scalar @chunk) {
+ return join '', ("<div class='chunk'><div class='old'>",
+ @partial,
+ "</div>",
+ "<div class='new'>",
+ (map {
+ $_->[1];
+ } @chunk[scalar @partial..scalar @chunk-1]),
+ "</div></div>");
+ } else {
+ return join '', ("<div class='chunk'><div class='",
+ ($first_class eq 'add' ? 'new' : 'old'),
+ "'>",
+ @partial,
+ "</div></div>");
+ }
+}
+
sub git_patchset_body {
- my ($fd, $difftree, $hash, @hash_parents) = @_;
+ my ($fd, $is_inline, $difftree, $hash, @hash_parents) = @_;
my ($hash_parent) = $hash_parents[0];
my $is_combined = (@hash_parents > 1);
@@ -4940,12 +4967,31 @@ sub git_patchset_body {
# the patch itself
LINE:
+ my @chunk;
while ($patch_line = <$fd>) {
chomp $patch_line;
next PATCH if ($patch_line =~ m/^diff /);
- print format_diff_line($patch_line, \%from, \%to);
+ my ($class, $line) = format_diff_line($patch_line, \%from, \%to);
+ if ($is_inline) {
+ print $line;
+ } elsif ($class eq 'add' || $class eq 'rem') {
+ push @chunk, [ $class, $line ];
+ } else {
+ if (@chunk) {
+ print format_diff_chunk(@chunk);
+ @chunk = ();
+ } elsif ($class eq 'chunk_header') {
+ print $line;
+ } else {
+ print '<div class="chunk"><div class="old">',
+ $line,
+ '</div><div class="new">',
+ $line,
+ '</div></div>';
+ }
+ }
}
} continue {
@@ -7053,7 +7099,8 @@ sub git_blobdiff {
if ($format eq 'html') {
print "<div class=\"page_body\">\n";
- git_patchset_body($fd, [ \%diffinfo ], $hash_base, $hash_parent_base);
+ git_patchset_body($fd, $input_params{diff_style} eq 'inline',
+ [ \%diffinfo ], $hash_base, $hash_parent_base);
close $fd;
print "</div>\n"; # class="page_body"
@@ -7078,6 +7125,22 @@ sub git_blobdiff_plain {
git_blobdiff('plain');
}
+sub diff_nav {
+ my ($style) = @_;
+
+ my %pairs = (inline => 'inline', 'sidebyside' => 'side by side');
+ join '', ($cgi->start_form({ method => 'get' }),
+ $cgi->hidden('p'),
+ $cgi->hidden('a'),
+ $cgi->hidden('h'),
+ $cgi->hidden('hp'),
+ $cgi->hidden('hb'),
+ $cgi->hidden('hpb'),
+ $cgi->popup_menu('ds', [keys %pairs], $style, \%pairs),
+ $cgi->submit('change'),
+ $cgi->end_form);
+}
+
sub git_commitdiff {
my %params = @_;
my $format = $params{-format} || 'html';
@@ -7230,7 +7293,8 @@ sub git_commitdiff {
my $ref = format_ref_marker($refs, $co{'id'});
git_header_html(undef, $expires);
- git_print_page_nav('commitdiff','', $hash,$co{'tree'},$hash, $formats_nav);
+ git_print_page_nav('commitdiff','', $hash,$co{'tree'},$hash,
+ $formats_nav . diff_nav($input_params{diff_style}));
git_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash);
print "<div class=\"title_text\">\n" .
"<table class=\"object_header\">\n";
@@ -7284,7 +7348,8 @@ sub git_commitdiff {
$use_parents ? @{$co{'parents'}} : $hash_parent);
print "<br/>\n";
- git_patchset_body($fd, \@difftree, $hash,
+ git_patchset_body($fd, $input_params{diff_style} eq 'inline',
+ \@difftree, $hash,
$use_parents ? @{$co{'parents'}} : $hash_parent);
close $fd;
print "</div>\n"; # class="page_body"
diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index 7d88509..dc84db2 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -618,6 +618,21 @@ div.remote {
cursor: pointer;
}
+/* side-by-side diff */
+div.chunk {
+ overflow: hidden;
+}
+
+div.chunk div.old {
+ float: left;
+ width: 50%;
+ overflow: hidden;
+}
+
+div.chunk div.new {
+ margin-left: 50%;
+ width: 50%;
+}
/* Style definition generated by highlight 2.4.5, http://www.andre-simon.de/ */
--
1.7.7.213.g8b0e1.dirty
^ permalink raw reply related
* [PATCH/RFC 1/2] gitweb: change format_diff_line() to remove leading SP from $diff_class
From: Kato Kazuyoshi @ 2011-10-17 6:59 UTC (permalink / raw)
To: git
The format_diff_line() will return $diff_class and HTML in upcoming changes.
---
gitweb/gitweb.perl | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 85d64b2..095adda 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2235,28 +2235,30 @@ sub format_diff_line {
# combined diff
my $prefix = substr($line, 0, scalar @{$from->{'href'}});
if ($line =~ m/^\@{3}/) {
- $diff_class = " chunk_header";
+ $diff_class = "chunk_header";
} elsif ($line =~ m/^\\/) {
- $diff_class = " incomplete";
+ $diff_class = "incomplete";
} elsif ($prefix =~ tr/+/+/) {
- $diff_class = " add";
+ $diff_class = "add";
} elsif ($prefix =~ tr/-/-/) {
- $diff_class = " rem";
+ $diff_class = "rem";
}
} else {
# assume ordinary diff
my $char = substr($line, 0, 1);
if ($char eq '+') {
- $diff_class = " add";
+ $diff_class = "add";
} elsif ($char eq '-') {
- $diff_class = " rem";
+ $diff_class = "rem";
} elsif ($char eq '@') {
- $diff_class = " chunk_header";
+ $diff_class = "chunk_header";
} elsif ($char eq "\\") {
- $diff_class = " incomplete";
+ $diff_class = "incomplete";
}
}
$line = untabify($line);
+
+ my $div_open = '<div class="' . (join ' ', ('diff', $diff_class)) . '">';
if ($from && $to && $line =~ m/^\@{2} /) {
my ($from_text, $from_start, $from_lines, $to_text, $to_start,
$to_lines, $section) =
$line =~ m/^\@{2} (-(\d+)(?:,(\d+))?) (\+(\d+)(?:,(\d+))?) \@{2}(.*)$/;
@@ -2274,7 +2276,7 @@ sub format_diff_line {
}
$line = "<span class=\"chunk_info\">@@ $from_text $to_text @@</span>" .
"<span class=\"section\">" . esc_html($section, -nbsp=>1) .
"</span>";
- return "<div class=\"diff$diff_class\">$line</div>\n";
+ return "$div_open$line</div>\n";
} elsif ($from && $to && $line =~ m/^\@{3}/) {
my ($prefix, $ranges, $section) = $line =~ m/^(\@+) (.*?) \@+(.*)$/;
my (@from_text, @from_start, @from_nlines, $to_text, $to_start, $to_nlines);
@@ -2307,9 +2309,9 @@ sub format_diff_line {
}
$line .= " $prefix</span>" .
"<span class=\"section\">" . esc_html($section, -nbsp=>1)
. "</span>";
- return "<div class=\"diff$diff_class\">$line</div>\n";
+ return "$div_open$line</div>\n";
}
- return "<div class=\"diff$diff_class\">" . esc_html($line, -nbsp=>1)
. "</div>\n";
+ return $div_open . esc_html($line, -nbsp=>1) . "</div>\n";
}
# Generates undef or something like "_snapshot_" or "snapshot (_tbz2_ _zip_)",
--
1.7.7.213.g8b0e1.dirty
^ permalink raw reply related
* Re: [PATCH] gitweb: provide a way to customize html headers
From: Lénaïc Huard @ 2011-10-17 7:28 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
Jakub Narebski <jnareb@gmail.com> writes:
> Lénaïc Huard <lenaic@lhuard.fr.eu.org> writes:
> > This allows web sites to add some specific html headers to the pages
> > generated by gitweb.
> What do you need this for?
I want to decorate the gitweb pages with the “Google Analytics” tracking code.
In order to do so, today, Google is recommending to add a <script> tag just
before the closing </head> tag.
https://www.google.com/support/analyticshelp/bin/answer.py?answer=1008080&hl=en
> > The new variable $site_htmlheader can be set to a filename the content
> > of which will be inserted at the end of the <head> section of each
> > page generated by gitweb.
> Hmmm... I wonder if a file with html header fragment (which is quite
> specific subset of HTML) is a best solution.
That’s true. The piece of code to be inserted in <head> is maybe small enough
so that we don’t need a file. Maybe $site_htmlheader could contain directly
the html snippet to be inserted in the pages?
> > Signed-off-by: L=FE=FF=00=E9na=FE=FF=00=EFc Huard <lenaic@lhuard.fr.eu.or=
g>
> > ---
> > gitweb/INSTALL | 3 +++
> Nb. there is patch in flight adding gitweb.conf(5) and gitweb(1)
> manpages...
Ok. So, I’ll update them once a decision will be taken concerning this
$site_htmlheader.
--
Lénaïc Huard
^ 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