* setting up a git repo on apache
From: Alan Larkin @ 2006-08-09 15:58 UTC (permalink / raw)
To: git
New user ... Hi.
I realise that this is really an apache question, but Im not getting any
help from their mailing lists and figure that there must be someone here
whos done this.
Can someone please help me get a GIT repo running on Apache 2.
Specifically my problem is with DAV.
$ git push http://localhost:/webdav/git/myproj master
Error: no DAV locking support on remote repo
I have dav_fs.conf, dav_fs.load, and dav.load in mods-enabled. They
load the modules and set
DAVLockDB /var/lock/apache2/DAV.lock
Apache owns and has full access to that directory.
I have removed all .htaccess files below /var/www/webdav. I am not
using any form of authentication. I have tried with and without aliases
for the repo directory. I have tried setting DAV on for
/var/www/webdav/git, and /var/www/webdav/git/myproj.
Its always the same. No DAV locking support.
If could help or even point me to some appropriate documentation (Ive
looked and looked and cant find any) Id appreciate it.
Thanks.
^ permalink raw reply
* Re: [PATCH] Workaround for strange cmp bug
From: Johannes Schindelin @ 2006-08-09 13:42 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0608091309590.1800@wbgn013.biozentrum.uni-wuerzburg.de>
Hi,
On Wed, 9 Aug 2006, Johannes Schindelin wrote:
> On Wed, 9 Aug 2006, Junio C Hamano wrote:
>
> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> >
> > > [ a whole lot about the output of cmp when calling a test with -v ]
Thinking about it again, I remember replacing 'cmp' by 'diff -u' quite a
few times, because the output of the latter was even more helpful... And
besides, 'diff -u' is not broken in my setup ;-)
Ciao,
Dscho
^ permalink raw reply
* Strange output of git-diff-tree
From: Jakub Narebski @ 2006-08-09 13:24 UTC (permalink / raw)
To: git
First (noticed by matled) is that for git-diff-tree with single tree
as an argument it outputs fist commit-id of commit given at input.
It is not mentioned in documentation and I think totally unnecessary:
1038:jnareb@roke:~/git> git diff-tree --abbrev origin
d5dc6a76d49367cddc015e01d2e9aa22e64d7e28
:040000 040000 44fb36d... 1c26294... M Documentation
Second, for some combination of options for it returns "..." instead of
0{40} for file creation. It seems that the culprit is "--find-copies-harder"
option:
1043:jnareb@roke:~/git> git rev-list --full-history next | \
git diff-tree --find-copies-harder -B -C -M -r --full-history --stdin \
-- gitweb/gitweb.perl gitweb/gitweb.cgi gitweb.cgi | less | grep " A"
:000000 100755 ... 017664b8f440f5ec151cf5653245ee02aefd3db2 A gitweb.cgi
1047:jnareb@roke:~/git> git rev-list --full-history next | \
git diff-tree -B -C -M -r --stdin \
-- gitweb/gitweb.perl gitweb/gitweb.cgi gitweb.cgi | less | grep " A"
:000000 100755 0000000000000000000000000000000000000000 017664b8f440f5ec151cf5653245ee02aefd3db2 A gitweb.cgi
Third, while it detects that gitweb/gitweb.perl was renamed from
gitweb/gitweb.cgi:
[...] R100 gitweb/gitweb.cgi gitweb/gitweb.perl
it does not notice that gitweb/gitweb.cgi was gitweb.cgi in
1130ef362fc8d9c3422c23f5d5a833e93d3f5c13.
All those for git version 1.4.1.1
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: git-svn added files to my commit?!
From: Eric Wong @ 2006-08-09 13:16 UTC (permalink / raw)
To: Seth Falcon; +Cc: git
In-Reply-To: <m2fygazbdc.fsf@gmail.com>
Sorry for the delayed response; and furthermore, I've barely slept the
past few days, so don't expect full coherency.
Seth Falcon <sethfalcon@gmail.com> wrote:
> [cc'ing the list in case others are seeing similar, etc]
>
> I think this is related to git-svn eol handling.
It is... git-svn is issuing 'svn revert' before running 'svn up' which
means it's changing newlines between git commits.
I can't remember exactly why manual eol handling was needed in git-svn,
but I think it had to do with disabling keyword expansion and copying
from the original text-base files. Of course, the 'svn revert' command
is there for a reason, too (looking at the comment in git-svn).
Perhaps getting rid of keyword killing and accepting expansions with the
command-line client is the simplest and safest way to go.
I've been using the SVN:: libraries exclusively for a while now and all
seems well, save for initial checkouts or big commits which are
significantly slower in some cases (I think using SVN::Delta for
downloads should fix this).
--
Eric Wong
^ permalink raw reply
* [PATCH 2/2] merge-recur: do not setenv("GIT_INDEX_FILE")
From: Johannes Schindelin @ 2006-08-09 13:07 UTC (permalink / raw)
To: git, junkio
Since there are no external calls left in merge-recur, we do not need
to set the environment variable GIT_INDEX_FILE all the time.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
merge-recursive.c | 22 +++++++++-------------
1 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index b8b0951..7a93dd9 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -116,6 +116,7 @@ static void output_commit_title(struct c
}
}
+static const char *current_index_file = NULL;
static const char *original_index_file;
static const char *temporary_index_file;
static int cache_dirty = 0;
@@ -124,12 +125,12 @@ static int flush_cache(void)
{
/* flush temporary index */
struct lock_file *lock = xcalloc(1, sizeof(struct lock_file));
- int fd = hold_lock_file_for_update(lock, getenv("GIT_INDEX_FILE"));
+ int fd = hold_lock_file_for_update(lock, current_index_file);
if (fd < 0)
die("could not lock %s", lock->filename);
if (write_cache(fd, active_cache, active_nr) ||
close(fd) || commit_lock_file(lock))
- die ("unable to write %s", getenv("GIT_INDEX_FILE"));
+ die ("unable to write %s", current_index_file);
discard_cache();
cache_dirty = 0;
return 0;
@@ -137,11 +138,10 @@ static int flush_cache(void)
static void setup_index(int temp)
{
- const char *idx = temp ? temporary_index_file: original_index_file;
+ current_index_file = temp ? temporary_index_file: original_index_file;
if (cache_dirty)
die("fatal: cache changed flush_cache();");
unlink(temporary_index_file);
- setenv("GIT_INDEX_FILE", idx, 1);
discard_cache();
}
@@ -174,7 +174,7 @@ static int add_cacheinfo(unsigned int mo
{
struct cache_entry *ce;
if (!cache_dirty)
- read_cache_from(getenv("GIT_INDEX_FILE"));
+ read_cache_from(current_index_file);
cache_dirty++;
ce = make_cache_entry(mode, sha1 ? sha1 : null_sha1, path, stage, refresh);
if (!ce)
@@ -223,7 +223,7 @@ static int git_merge_trees(int index_onl
struct unpack_trees_options opts;
if (!cache_dirty) {
- read_cache_from(getenv("GIT_INDEX_FILE"));
+ read_cache_from(current_index_file);
cache_dirty = 1;
}
@@ -260,7 +260,7 @@ static struct tree *git_write_tree(void)
return NULL;
}
} else
- read_cache_from(getenv("GIT_INDEX_FILE"));
+ read_cache_from(current_index_file);
if (!active_cache_tree)
active_cache_tree = cache_tree();
@@ -338,7 +338,7 @@ static struct path_list *get_unmerged(vo
unmerged->strdup_paths = 1;
if (!cache_dirty) {
- read_cache_from(getenv("GIT_INDEX_FILE"));
+ read_cache_from(current_index_file);
cache_dirty++;
}
for (i = 0; i < active_nr; i++) {
@@ -468,10 +468,6 @@ static int remove_path(const char *name)
return ret;
}
-/*
- * TODO: once we no longer call external programs, we'd probably be better off
- * not setting / getting the environment variable GIT_INDEX_FILE all the time.
- */
int remove_file(int clean, const char *path)
{
int update_cache = index_only || clean;
@@ -479,7 +475,7 @@ int remove_file(int clean, const char *p
if (update_cache) {
if (!cache_dirty)
- read_cache_from(getenv("GIT_INDEX_FILE"));
+ read_cache_from(current_index_file);
cache_dirty++;
if (remove_file_from_cache(path))
return -1;
--
1.4.2.rc3.g55597-dirty
^ permalink raw reply related
* [PATCH 1/2] merge-recur: do not call git-write-tree
From: Johannes Schindelin @ 2006-08-09 13:04 UTC (permalink / raw)
To: git, junkio
Since merge-recur is in C, and uses libgit, it can call the relevant
functions directly, without writing the index file.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
merge-recursive.c | 44 ++++++++++++++++++++------------------------
1 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index f5c0080..b8b0951 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -248,38 +248,34 @@ static int git_merge_trees(int index_onl
return rc;
}
-/*
- * TODO: this can be streamlined by refactoring builtin-write-tree.c
- */
static struct tree *git_write_tree(void)
{
- FILE *fp;
- int rc;
- char buf[41];
- unsigned char sha1[20];
- int ch;
- unsigned i = 0;
+ struct tree *result = NULL;
+
if (cache_dirty) {
+ unsigned i;
for (i = 0; i < active_nr; i++) {
struct cache_entry *ce = active_cache[i];
if (ce_stage(ce))
return NULL;
}
- flush_cache();
- }
- fp = popen("git-write-tree 2>/dev/null", "r");
- while ((ch = fgetc(fp)) != EOF)
- if (i < sizeof(buf)-1 && ch >= '0' && ch <= 'f')
- buf[i++] = ch;
- else
- break;
- rc = pclose(fp);
- if (rc == -1 || WEXITSTATUS(rc))
- return NULL;
- buf[i] = '\0';
- if (get_sha1(buf, sha1) != 0)
- return NULL;
- return lookup_tree(sha1);
+ } else
+ read_cache_from(getenv("GIT_INDEX_FILE"));
+
+ if (!active_cache_tree)
+ active_cache_tree = cache_tree();
+
+ if (!cache_tree_fully_valid(active_cache_tree) &&
+ cache_tree_update(active_cache_tree,
+ active_cache, active_nr, 0, 0) < 0)
+ die("error building trees");
+
+ result = lookup_tree(active_cache_tree->sha1);
+
+ flush_cache();
+ cache_dirty = 0;
+
+ return result;
}
static int save_files_dirs(const unsigned char *sha1,
--
1.4.2.rc3.g55597-dirty
^ permalink raw reply related
* Re: [PATCH and RFC] gitweb: Remove --full-history from git_history
From: Jakub Narebski @ 2006-08-09 12:56 UTC (permalink / raw)
To: git
In-Reply-To: <ebcivb$t6m$1@sea.gmane.org>
Jakub Narebski wrote:
> I wonder which version is faster: --full-history, or filter using
> diff-tree?
>
> ab -n 10 "http://localhost/cgi-bin/gitweb/gitweb.cgi?p=git.git;a=history;hb=next;f=gitweb/gitweb.perl"
> (ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0) says
>
> Requests per second: 0.09 [#/sec] (mean)
> Time per request: 10918.552 [ms] (mean)
> Time per request: 10918.552 [ms] (mean, across all concurrent requests)
> Transfer rate: 2.13 [Kbytes/sec] received
>
> Connection Times (ms)
> min mean[+/-sd] median max
> Connect: 0 0 0.0 0 0
> Processing: 8851 10917 2776.1 9284 16420
> Waiting: 407 457 95.1 428 721
> Total: 8851 10917 2776.1 9284 16420
Adding "--remove-empty" (would this change output for git_history much?)
changes this to:
Requests per second: 0.75 [#/sec] (mean)
Time per request: 1341.702 [ms] (mean)
Time per request: 1341.702 [ms] (mean, across all concurrent requests)
Transfer rate: 17.37 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 1208 1340 206.6 1241 1729
Waiting: 386 408 36.6 403 510
Total: 1208 1340 206.6 1241 1729
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH and RFC] gitweb: Remove --full-history from git_history
From: Jakub Narebski @ 2006-08-09 12:04 UTC (permalink / raw)
To: git
In-Reply-To: <7vu04m413f.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
>> Stop pretending that gitweb is rename-aware, and remove --full-history
>> option to git-rev-list in git_history (for "history" action):
>
> Where did you get the idea that --full-history has anything to
> do with renames?
> Message-ID: <20060701005924.7726.qmail@web31812.mail.mud.yahoo.com>
http://marc.theaimsgroup.com/?l=git&m=115171557714437
> Message-ID: <Pine.LNX.4.64.0606301818480.12404@g5.osdl.org>
http://marc.theaimsgroup.com/?l=git&m=115171683714119
Ooops, sorry, my mistake. Still, even if the patch is to be dropped,
the proposal about rename detection is still valid.
I wonder which version is faster: --full-history, or filter using
diff-tree?
ab -n 10 "http://localhost/cgi-bin/gitweb/gitweb.cgi?p=git.git;a=history;hb=next;f=gitweb/gitweb.perl"
(ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0) says
Requests per second: 0.09 [#/sec] (mean)
Time per request: 10918.552 [ms] (mean)
Time per request: 10918.552 [ms] (mean, across all concurrent requests)
Transfer rate: 2.13 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 8851 10917 2776.1 9284 16420
Waiting: 407 457 95.1 428 721
Total: 8851 10917 2776.1 9284 16420
for --full-history version, and
Requests per second: 0.11 [#/sec] (mean)
Time per request: 9076.865 [ms] (mean)
Time per request: 9076.865 [ms] (mean, across all concurrent requests)
Transfer rate: 2.57 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 8741 9076 271.7 9100 9581
Waiting: 299 405 49.5 404 507
Total: 8741 9076 271.7 9100 9581
for the pipe through git-diff-tree version, both with very similar
times (check out median column), although --full-history version
seems slightly slower...
Still, it is ab on workstation, not separate server, an only average
over 10 requests.
And
1025:jnareb@roke:~/git> time git rev-list next -- gitweb/gitweb.perl
[...]
real 0m2.623s
user 0m2.536s
sys 0m0.016s
1024:jnareb@roke:~/git> time git rev-list next | git diff-tree -r --stdin -- gitweb/gitweb.perl
[...]
real 0m6.857s
user 0m6.024s
sys 0m0.068s
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH] Workaround for strange cmp bug
From: Johannes Schindelin @ 2006-08-09 11:12 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7v3bc65gk0.fsf@assigned-by-dhcp.cox.net>
Hi,
On Wed, 9 Aug 2006, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > The cmp(1) (cmp (GNU diffutils) 2.8.7) distributed with openSUSE 10.1 has
> > a subtle "shortcoming":
Okay, I will try to fix the distribution. I only thought it was worthwhile
spreading the workaround for other poor souls.
> It actually is very useful, in the chain of &&, to see that
> these steps in our tests output something when they shouldn't
> when the tests are run under -v; you may have noticed that the
> tests written by me have seemingly useless "echo happy" (which
> always returns true) and such, and they are there for a reason.
Well, I found myself stuck with too many of hard-to-debug cascades, where
there is no "echo happy". I think that you are lost with most test
scripts, if you do not use "bash -x".
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH/RFC] gitweb: Great subroutines renaming
From: Junio C Hamano @ 2006-08-09 11:11 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <ebcf9s$h32$1@sea.gmane.org>
Jakub Narebski <jnareb@gmail.com> writes:
> It's not a problem to do '...'/'next' link _after_ the body, but
> the paging navigation bar is at the _top_ of page, before
> outputting the body.
A good web engineering practice is to prepare the data before
you generate a single line of output, so after or top should not
make a difference, I would think.
^ permalink raw reply
* Re: [PATCH and RFC] gitweb: Remove --full-history from git_history
From: Junio C Hamano @ 2006-08-09 11:09 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <200608091257.19461.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
> Stop pretending that gitweb is rename-aware, and remove --full-history
> option to git-rev-list in git_history (for "history" action):
Where did you get the idea that --full-history has anything to
do with renames?
Message-ID: <20060701005924.7726.qmail@web31812.mail.mud.yahoo.com>
Message-ID: <Pine.LNX.4.64.0606301818480.12404@g5.osdl.org>
^ permalink raw reply
* Re: [PATCH/RFC] gitweb: Great subroutines renaming
From: Jakub Narebski @ 2006-08-09 11:01 UTC (permalink / raw)
To: git
In-Reply-To: <7vy7ty41xb.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
>> It is needed in gitweb to create pagination/paging navigation bar.
>> Currently it is done by reading all the output into array, and
>> checking length of this array.
>
> If you want to show 10 and do ... when you have more than that,
> the standard technique is to ask for 11 ;-).
It's not a problem to do '...'/'next' link _after_ the body, but
the paging navigation bar is at the _top_ of page, before
outputting the body. See e.g.
http://www.kernel.org/git/?p=git/git.git;a=shortlog
there is "HEAD * prev * next" at the top, and "next" at the bottom
of the revision list.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* [PATCH and RFC] gitweb: Remove --full-history from git_history
From: Jakub Narebski @ 2006-08-09 10:57 UTC (permalink / raw)
To: git
Stop pretending that gitweb is rename-aware, and remove --full-history
option to git-rev-list in git_history (for "history" action):
* gitweb cannot handle renames as of yet; it uses constant original
$file_name as 'f' argument in links
* at least for git 1.4.1.1 --full-history option doesn't follow
renames (check 'git rev-list next -- gitweb/test/file+plus+sign'
with and without --full-history option and compare to
'git rev-list next -- gitweb/test/file+plus+sign test/file+plus+sign')
and is three times slower than git-rev-list without --full-history
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This is call for better rename support in git (better than --full-history).
There was such an attempt in "[RFC, PATCH] Teach revision.c about renames"
by Fredrik Kuivinen
http://marc.theaimsgroup.com/?l=git&m=114772921317920
but IIRC patch was dropped in the favor of --full-history option.
What is needed by gitweb is for git-rev-list to not only follow revisions
of file contents across renames, and return more revisions, but also
return _how_ filename changes, without need to call git-diff-tree on each
returned revision.
PROPOSAL:
---------
Implement --follow/--follow-path/--follow-contents option to git-rev-list,
which would output besides revision ids also current path limit; the format
could be for example:
<commit> [ -- <paths>...]
for example:
$ git rev-list --follow db58b69ba -- gitweb/test/file+plus+sign
0a8f4f0020cb35095005852c0797f0b90e9ebb74 -- gitweb/test/file+plus+sign
85852d44e48c1d1c6d815cc5fccf1b580f2f2cad -- test/file+plus+sign
cc3245b6512a01d74c0fd460d762ba8a1e8b968a -- test/file+plus+sign
There might be better format, as the proposed isn't best for copying
detections support, as path limit gets larger and one cannot immediately
get which element of new <paths>... correspond to which original <paths>...
element. Same with splitting file vs. simply creating file.
It should be not that hard to implement, just detecting copying, renaming
and filename vanishing, and updating current path limit; or putting
modified path limit and revision to start modified path-limit from to
the queue...
gitweb/gitweb.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ae13e3e..59222c2 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2284,7 +2284,7 @@ sub git_history {
git_print_page_path($file_name, $ftype);
open my $fd, "-|",
- $GIT, "rev-list", "--full-history", $hash_base, "--", $file_name;
+ $GIT, "rev-list", $hash_base, "--", $file_name;
print "<table cellspacing=\"0\">\n";
my $alternate = 0;
while (my $line = <$fd>) {
--
1.4.1.1
^ permalink raw reply related
* Re: [PATCH/RFC] gitweb: Great subroutines renaming
From: Junio C Hamano @ 2006-08-09 10:51 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <ebcd8r$bi7$1@sea.gmane.org>
Jakub Narebski <jnareb@gmail.com> writes:
> It is needed in gitweb to create pagination/paging navigation bar.
> Currently it is done by reading all the output into array, and
> checking length of this array.
If you want to show 10 and do ... when you have more than that,
the standard technique is to ask for 11 ;-).
^ permalink raw reply
* Re: [PATCH] Workaround for strange cmp bug
From: Junio C Hamano @ 2006-08-09 10:50 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0608091221550.1800@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> The cmp(1) (cmp (GNU diffutils) 2.8.7) distributed with openSUSE 10.1 has
> a subtle "shortcoming":
>
> $ echo a > a
> $ echo b > b
> $ cmp a b && echo nonono
> a b differ: char 1, line 1
> $ cmp a b >/dev/null && echo nonono
> nonono
> $ cmp -s a b >/dev/null && echo nonono
>
> So, if cmp should _not_ be quiet, _and_ the output is redirected to
> /dev/null, it has a bogus exit value. Our test suite redirects to
> /dev/null, which triggers that bug. (Obviously, the tests pass when
> running with '-v', which made that a real bugger to debug.)
While I sympathize unfortunate users who are stuck with such a
broken implementation of an important basic tool, such a rewrite
unnecessarily makes debugging of both test scripts _and_ real
breakage harder.
It actually is very useful, in the chain of &&, to see that
these steps in our tests output something when they shouldn't
when the tests are run under -v; you may have noticed that the
tests written by me have seemingly useless "echo happy" (which
always returns true) and such, and they are there for a reason.
Please get the distribution fixed.
^ permalink raw reply
* Re: [PATCH/RFC] gitweb: Great subroutines renaming
From: Jakub Narebski @ 2006-08-09 10:26 UTC (permalink / raw)
To: git
In-Reply-To: <7vejvsyum8.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
>> Matthias Lederhofer has noticed that parsing all the tags in "summary" and
>> "tags" views, while we use only epoch/timestamp information to sort them
>> and discard most of parsed input, is bottleneck due to the fact that
>> usually number of tags is linear with history (version tags) and the fact
>> that for each tag is one invocation of git (one fork, two execs).
>
> Maybe we would want to expose for_each_ref somehow to the
> command level then. Looking at how "git branch" without any
> argument lists the branches, and how "git tag -l" lists the
> tags, it appears that we could benefit from such a command [*1*].
> -- >8 -- [*1*] -- >8 --
> [PATCH] git-show-refs
>
> Implementation is left as an exercise ;-)
[...]
> +SYNOPSIS
> +--------
> +'git-show-refs' [--count=<max>] [--sort=<sortkeys>] [--format=<format>] [<pattern>]
It would be useful for application in gitweb to have [-l|--count-lines]
option which would print number of lines (excluding the one with number
of lines) before any output. It could be used to know before reading all
the output how many lines would be, and if there is something more than
(for --count=<max>) <max> lines.
It is needed in gitweb to create pagination/paging navigation bar.
Currently it is done by reading all the output into array, and
checking length of this array.
While at it, --skip=<count> would also be nice, although not that
necessary.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* [PATCH] Workaround for strange cmp bug
From: Johannes Schindelin @ 2006-08-09 10:24 UTC (permalink / raw)
To: git, junkio
The cmp(1) (cmp (GNU diffutils) 2.8.7) distributed with openSUSE 10.1 has
a subtle "shortcoming":
$ echo a > a
$ echo b > b
$ cmp a b && echo nonono
a b differ: char 1, line 1
$ cmp a b >/dev/null && echo nonono
nonono
$ cmp -s a b >/dev/null && echo nonono
So, if cmp should _not_ be quiet, _and_ the output is redirected to
/dev/null, it has a bogus exit value. Our test suite redirects to
/dev/null, which triggers that bug. (Obviously, the tests pass when
running with '-v', which made that a real bugger to debug.)
Since we have all too many '&&' cascades in the test scripts, and you
have to run 'bash -x t*.sh' anyway, the output of cmp when running
the tests with '-v' is not too helpful. Therefore we can replace all
calls to cmp with 'cmp -s'.
This patch was produced by
$ perl -i.bak -pe 's/cmp ([^-])/cmp -s $1/' t/*.sh
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
t/t1002-read-tree-m-u-2way.sh | 32 +++++++++++++++---------------
t/t1003-read-tree-prefix.sh | 2 +-
t/t1020-subdirectory.sh | 16 ++++++++-------
t/t1200-tutorial.sh | 22 ++++++++++-----------
t/t1300-repo-config.sh | 40 +++++++++++++++++++-------------------
t/t2101-update-index-reupdate.sh | 12 ++++++-----
t/t3300-funny-names.sh | 2 +-
t/t4012-diff-binary.sh | 4 ++--
t/t4109-apply-multifrag.sh | 12 ++++++-----
t/t4110-apply-scan.sh | 2 +-
t/t5300-pack-object.sh | 12 ++++++-----
t/t5400-send-pack.sh | 4 ++--
t/t6021-merge-criss-cross.sh | 2 +-
t/t9101-git-svn-props.sh | 2 +-
t/t9105-git-svn-commit-diff.sh | 2 +-
15 files changed, 83 insertions(+), 83 deletions(-)
diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh
index da3c813..6be4ee2 100755
--- a/t/t1002-read-tree-m-u-2way.sh
+++ b/t/t1002-read-tree-m-u-2way.sh
@@ -59,9 +59,9 @@ test_expect_success \
git-read-tree --reset -u $treeH &&
git-read-tree -m -u $treeH $treeM &&
git-ls-files --stage >1-3.out &&
- cmp M.out 1-3.out &&
+ cmp -s M.out 1-3.out &&
sum bozbar frotz nitfol >actual3.sum &&
- cmp M.sum actual3.sum &&
+ cmp -s M.sum actual3.sum &&
check_cache_at bozbar clean &&
check_cache_at frotz clean &&
check_cache_at nitfol clean'
@@ -79,7 +79,7 @@ test_expect_success \
compare_change 4diff.out expected &&
check_cache_at yomin clean &&
sum bozbar frotz nitfol >actual4.sum &&
- cmp M.sum actual4.sum &&
+ cmp -s M.sum actual4.sum &&
echo yomin >yomin1 &&
diff yomin yomin1 &&
rm -f yomin1'
@@ -98,7 +98,7 @@ test_expect_success \
compare_change 5diff.out expected &&
check_cache_at yomin dirty &&
sum bozbar frotz nitfol >actual5.sum &&
- cmp M.sum actual5.sum &&
+ cmp -s M.sum actual5.sum &&
: dirty index should have prevented -u from checking it out. &&
echo yomin yomin >yomin1 &&
diff yomin yomin1 &&
@@ -115,7 +115,7 @@ test_expect_success \
diff -U0 M.out 6.out &&
check_cache_at frotz clean &&
sum bozbar frotz nitfol >actual3.sum &&
- cmp M.sum actual3.sum &&
+ cmp -s M.sum actual3.sum &&
echo frotz >frotz1 &&
diff frotz frotz1 &&
rm -f frotz1'
@@ -132,7 +132,7 @@ test_expect_success \
diff -U0 M.out 7.out &&
check_cache_at frotz dirty &&
sum bozbar frotz nitfol >actual7.sum &&
- if cmp M.sum actual7.sum; then false; else :; fi &&
+ if cmp -s M.sum actual7.sum; then false; else :; fi &&
: dirty index should have prevented -u from checking it out. &&
echo frotz frotz >frotz1 &&
diff frotz frotz1 &&
@@ -163,9 +163,9 @@ test_expect_success \
git-update-index --add rezrov &&
git-read-tree -m -u $treeH $treeM &&
git-ls-files --stage >10.out &&
- cmp M.out 10.out &&
+ cmp -s M.out 10.out &&
sum bozbar frotz nitfol >actual10.sum &&
- cmp M.sum actual10.sum'
+ cmp -s M.sum actual10.sum'
test_expect_success \
'11 - dirty path removed.' \
@@ -210,9 +210,9 @@ test_expect_success \
compare_change 14diff.out expected &&
sum bozbar frotz >actual14.sum &&
grep -v nitfol M.sum > expected14.sum &&
- cmp expected14.sum actual14.sum &&
+ cmp -s expected14.sum actual14.sum &&
sum bozbar frotz nitfol >actual14a.sum &&
- if cmp M.sum actual14a.sum; then false; else :; fi &&
+ if cmp -s M.sum actual14a.sum; then false; else :; fi &&
check_cache_at nitfol clean &&
echo nitfol nitfol >nitfol1 &&
diff nitfol nitfol1 &&
@@ -232,9 +232,9 @@ test_expect_success \
check_cache_at nitfol dirty &&
sum bozbar frotz >actual15.sum &&
grep -v nitfol M.sum > expected15.sum &&
- cmp expected15.sum actual15.sum &&
+ cmp -s expected15.sum actual15.sum &&
sum bozbar frotz nitfol >actual15a.sum &&
- if cmp M.sum actual15a.sum; then false; else :; fi &&
+ if cmp -s M.sum actual15a.sum; then false; else :; fi &&
echo nitfol nitfol nitfol >nitfol1 &&
diff nitfol nitfol1 &&
rm -f nitfol1'
@@ -267,7 +267,7 @@ test_expect_success \
diff -U0 M.out 18.out &&
check_cache_at bozbar clean &&
sum bozbar frotz nitfol >actual18.sum &&
- cmp M.sum actual18.sum'
+ cmp -s M.sum actual18.sum'
test_expect_success \
'19 - local change already having a good result, further modified.' \
@@ -282,9 +282,9 @@ test_expect_success \
check_cache_at bozbar dirty &&
sum frotz nitfol >actual19.sum &&
grep -v bozbar M.sum > expected19.sum &&
- cmp expected19.sum actual19.sum &&
+ cmp -s expected19.sum actual19.sum &&
sum bozbar frotz nitfol >actual19a.sum &&
- if cmp M.sum actual19a.sum; then false; else :; fi &&
+ if cmp -s M.sum actual19a.sum; then false; else :; fi &&
echo gnusto gnusto >bozbar1 &&
diff bozbar bozbar1 &&
rm -f bozbar1'
@@ -300,7 +300,7 @@ test_expect_success \
diff -U0 M.out 20.out &&
check_cache_at bozbar clean &&
sum bozbar frotz nitfol >actual20.sum &&
- cmp M.sum actual20.sum'
+ cmp -s M.sum actual20.sum'
test_expect_success \
'21 - no local change, dirty cache.' \
diff --git a/t/t1003-read-tree-prefix.sh b/t/t1003-read-tree-prefix.sh
index 48ab117..a7156b2 100755
--- a/t/t1003-read-tree-prefix.sh
+++ b/t/t1003-read-tree-prefix.sh
@@ -21,7 +21,7 @@ two/one' >expect
test_expect_success 'read-tree --prefix' '
git-read-tree --prefix=two/ $tree &&
git-ls-files >actual &&
- cmp expect actual
+ cmp -s expect actual
'
test_done
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index 4409b87..8bd4174 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -46,10 +46,10 @@ test_expect_success 'cat-file' '
two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` &&
echo "$two" &&
git-cat-file -p "$two" >actual &&
- cmp dir/two actual &&
+ cmp -s dir/two actual &&
cd dir &&
git-cat-file -p "$two" >actual &&
- cmp two actual
+ cmp -s two actual
'
rm -f actual dir/actual
@@ -86,10 +86,10 @@ test_expect_success 'write-tree' '
test_expect_success 'checkout-index' '
cd $HERE &&
git-checkout-index -f -u one &&
- cmp one original.one &&
+ cmp -s one original.one &&
cd dir &&
git-checkout-index -f -u two &&
- cmp two ../original.two
+ cmp -s two ../original.two
'
test_expect_success 'read-tree' '
@@ -97,13 +97,13 @@ test_expect_success 'read-tree' '
rm -f one dir/two &&
tree=`git-write-tree` &&
git-read-tree --reset -u "$tree" &&
- cmp one original.one &&
- cmp dir/two original.two &&
+ cmp -s one original.one &&
+ cmp -s dir/two original.two &&
cd dir &&
rm -f two &&
git-read-tree --reset -u "$tree" &&
- cmp two ../original.two &&
- cmp ../one ../original.one
+ cmp -s two ../original.two &&
+ cmp -s ../one ../original.one
'
test_done
diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh
index c7db20e..2e2a898 100755
--- a/t/t1200-tutorial.sh
+++ b/t/t1200-tutorial.sh
@@ -27,9 +27,9 @@ index 557db03..263414f 100644
+It's a new day for git
EOF
git-diff-files -p > diff.output
-test_expect_success 'git-diff-files -p' 'cmp diff.expect diff.output'
+test_expect_success 'git-diff-files -p' 'cmp -s diff.expect diff.output'
git diff > diff.output
-test_expect_success 'git diff' 'cmp diff.expect diff.output'
+test_expect_success 'git diff' 'cmp -s diff.expect diff.output'
tree=$(git-write-tree 2>/dev/null)
@@ -40,10 +40,10 @@ output="$(echo "Initial commit" | git-co
test_expect_success 'commit' "test 'Committing initial tree 8988da15d077d4829fc51d8544c097def6644dbb' = \"$output\""
git-diff-index -p HEAD > diff.output
-test_expect_success 'git-diff-index -p HEAD' 'cmp diff.expect diff.output'
+test_expect_success 'git-diff-index -p HEAD' 'cmp -s diff.expect diff.output'
git diff HEAD > diff.output
-test_expect_success 'git diff HEAD' 'cmp diff.expect diff.output'
+test_expect_success 'git diff HEAD' 'cmp -s diff.expect diff.output'
#rm hello
#test_expect_success 'git-read-tree --reset HEAD' "git-read-tree --reset HEAD ; test \"hello: needs update\" = \"$(git-update-index --refresh)\""
@@ -75,15 +75,15 @@ git-whatchanged -p --root | \
sed -e "1s/^\(.\{7\}\).\{40\}/\1VARIABLE/" \
-e "2,3s/^\(.\{8\}\).*$/\1VARIABLE/" \
> whatchanged.output
-test_expect_success 'git-whatchanged -p --root' 'cmp whatchanged.expect whatchanged.output'
+test_expect_success 'git-whatchanged -p --root' 'cmp -s whatchanged.expect whatchanged.output'
git tag my-first-tag
-test_expect_success 'git tag my-first-tag' 'cmp .git/refs/heads/master .git/refs/tags/my-first-tag'
+test_expect_success 'git tag my-first-tag' 'cmp -s .git/refs/heads/master .git/refs/tags/my-first-tag'
# TODO: test git-clone
git checkout -b mybranch
-test_expect_success 'git checkout -b mybranch' 'cmp .git/refs/heads/master .git/refs/heads/mybranch'
+test_expect_success 'git checkout -b mybranch' 'cmp -s .git/refs/heads/master .git/refs/heads/mybranch'
cat > branch.expect <<EOF
master
@@ -91,7 +91,7 @@ cat > branch.expect <<EOF
EOF
git branch > branch.output
-test_expect_success 'git branch' 'cmp branch.expect branch.output'
+test_expect_success 'git branch' 'cmp -s branch.expect branch.output'
git checkout mybranch
echo "Work, work, work" >>hello
@@ -125,7 +125,7 @@ cat > show-branch.expect << EOF
EOF
git show-branch --topo-order master mybranch > show-branch.output
-test_expect_success 'git show-branch' 'cmp show-branch.expect show-branch.output'
+test_expect_success 'git show-branch' 'cmp -s show-branch.expect show-branch.output'
git checkout mybranch
@@ -138,7 +138,7 @@ EOF
git resolve HEAD master "Merge upstream changes." | \
sed -e "1s/[0-9a-f]\{40\}/VARIABLE/g" > resolve.output
-test_expect_success 'git resolve' 'cmp resolve.expect resolve.output'
+test_expect_success 'git resolve' 'cmp -s resolve.expect resolve.output'
cat > show-branch2.expect << EOF
! [master] Merged "mybranch" changes.
@@ -148,7 +148,7 @@ cat > show-branch2.expect << EOF
EOF
git show-branch --topo-order master mybranch > show-branch2.output
-test_expect_success 'git show-branch' 'cmp show-branch2.expect show-branch2.output'
+test_expect_success 'git show-branch' 'cmp -s show-branch2.expect show-branch2.output'
# TODO: test git fetch
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 0de2497..5af856d 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -16,7 +16,7 @@ cat > expect << EOF
penguin = little blue
EOF
-test_expect_success 'initial' 'cmp .git/config expect'
+test_expect_success 'initial' 'cmp -s .git/config expect'
git-repo-config Core.Movie BadPhysics
@@ -26,7 +26,7 @@ cat > expect << EOF
Movie = BadPhysics
EOF
-test_expect_success 'mixed case' 'cmp .git/config expect'
+test_expect_success 'mixed case' 'cmp -s .git/config expect'
git-repo-config Cores.WhatEver Second
@@ -38,7 +38,7 @@ cat > expect << EOF
WhatEver = Second
EOF
-test_expect_success 'similar section' 'cmp .git/config expect'
+test_expect_success 'similar section' 'cmp -s .git/config expect'
git-repo-config CORE.UPPERCASE true
@@ -51,7 +51,7 @@ cat > expect << EOF
WhatEver = Second
EOF
-test_expect_success 'similar section' 'cmp .git/config expect'
+test_expect_success 'similar section' 'cmp -s .git/config expect'
test_expect_success 'replace with non-match' \
'git-repo-config core.penguin kingpin !blue'
@@ -69,7 +69,7 @@ cat > expect << EOF
WhatEver = Second
EOF
-test_expect_success 'non-match result' 'cmp .git/config expect'
+test_expect_success 'non-match result' 'cmp -s .git/config expect'
cat > .git/config << EOF
[beta] ; silly comment # another comment
@@ -97,7 +97,7 @@ # empty line
[nextSection] noNewline = ouch
EOF
-test_expect_success 'multiple unset is correct' 'cmp .git/config expect'
+test_expect_success 'multiple unset is correct' 'cmp -s .git/config expect'
mv .git/config2 .git/config
@@ -114,7 +114,7 @@ # empty line
[nextSection] noNewline = ouch
EOF
-test_expect_success 'all replaced' 'cmp .git/config expect'
+test_expect_success 'all replaced' 'cmp -s .git/config expect'
git-repo-config beta.haha alpha
@@ -128,7 +128,7 @@ # empty line
[nextSection] noNewline = ouch
EOF
-test_expect_success 'really mean test' 'cmp .git/config expect'
+test_expect_success 'really mean test' 'cmp -s .git/config expect'
git-repo-config nextsection.nonewline wow
@@ -143,7 +143,7 @@ # empty line
nonewline = wow
EOF
-test_expect_success 'really really mean test' 'cmp .git/config expect'
+test_expect_success 'really really mean test' 'cmp -s .git/config expect'
test_expect_success 'get value' 'test alpha = $(git-repo-config beta.haha)'
git-repo-config --unset beta.haha
@@ -158,7 +158,7 @@ # empty line
nonewline = wow
EOF
-test_expect_success 'unset' 'cmp .git/config expect'
+test_expect_success 'unset' 'cmp -s .git/config expect'
git-repo-config nextsection.NoNewLine "wow2 for me" "for me$"
@@ -173,7 +173,7 @@ # empty line
NoNewLine = wow2 for me
EOF
-test_expect_success 'multivar' 'cmp .git/config expect'
+test_expect_success 'multivar' 'cmp -s .git/config expect'
test_expect_success 'non-match' \
'git-repo-config --get nextsection.nonewline !for'
@@ -200,7 +200,7 @@ # empty line
NoNewLine = wow2 for me
EOF
-test_expect_success 'multivar replace' 'cmp .git/config expect'
+test_expect_success 'multivar replace' 'cmp -s .git/config expect'
test_expect_failure 'ambiguous value' 'git-repo-config nextsection.nonewline'
@@ -222,7 +222,7 @@ # empty line
NoNewLine = wow2 for me
EOF
-test_expect_success 'multivar unset' 'cmp .git/config expect'
+test_expect_success 'multivar unset' 'cmp -s .git/config expect'
test_expect_failure 'invalid key' 'git-repo-config inval.2key blabla'
@@ -245,7 +245,7 @@ # empty line
Alpha = beta
EOF
-test_expect_success 'hierarchical section value' 'cmp .git/config expect'
+test_expect_success 'hierarchical section value' 'cmp -s .git/config expect'
cat > expect << EOF
beta.noindent=sillyValue
@@ -255,7 +255,7 @@ version.1.2.3eX.alpha=beta
EOF
test_expect_success 'working --list' \
- 'git-repo-config --list > output && cmp output expect'
+ 'git-repo-config --list > output && cmp -s output expect'
cat > expect << EOF
beta.noindent sillyValue
@@ -263,7 +263,7 @@ nextsection.nonewline wow2 for me
EOF
test_expect_success '--get-regexp' \
- 'git-repo-config --get-regexp in > output && cmp output expect'
+ 'git-repo-config --get-regexp in > output && cmp -s output expect'
cat > .git/config << EOF
[novalue]
@@ -292,7 +292,7 @@ cat > expect << EOF
x = y
EOF
-test_expect_success 'new section is partial match of another' 'cmp .git/config expect'
+test_expect_success 'new section is partial match of another' 'cmp -s .git/config expect'
git-repo-config b.x y
git-repo-config a.b c
@@ -307,7 +307,7 @@ 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' 'cmp -s .git/config expect'
cat > other-config << EOF
[ein]
@@ -320,7 +320,7 @@ EOF
GIT_CONFIG=other-config git-repo-config -l > output
-test_expect_success 'alternative GIT_CONFIG' 'cmp output expect'
+test_expect_success 'alternative GIT_CONFIG' 'cmp -s output expect'
GIT_CONFIG=other-config git-repo-config anwohner.park ausweis
@@ -331,7 +331,7 @@ 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' 'cmp -s other-config expect'
test_done
diff --git a/t/t2101-update-index-reupdate.sh b/t/t2101-update-index-reupdate.sh
index a78ea7f..bc452c4 100755
--- a/t/t2101-update-index-reupdate.sh
+++ b/t/t2101-update-index-reupdate.sh
@@ -17,7 +17,7 @@ test_expect_success 'update-index --add'
echo goodbye people >file2 &&
git-update-index --add file1 file2 &&
git-ls-files -s >current &&
- cmp current expected'
+ cmp -s current expected'
test_expect_success 'update-index --again' \
'rm -f file1 &&
@@ -30,7 +30,7 @@ test_expect_success 'update-index --agai
echo happy - failed as expected
fi &&
git-ls-files -s >current &&
- cmp current expected'
+ cmp -s current expected'
cat > expected <<\EOF
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
@@ -38,7 +38,7 @@ EOF
test_expect_success 'update-index --remove --again' \
'git-update-index --remove --again &&
git-ls-files -s >current &&
- cmp current expected'
+ cmp -s current expected'
test_expect_success 'first commit' 'git-commit -m initial'
@@ -55,7 +55,7 @@ test_expect_success 'update-index again'
echo happy >dir1/file3 &&
git-update-index --again &&
git-ls-files -s >current &&
- cmp current expected'
+ cmp -s current expected'
cat > expected <<\EOF
100644 d7fb3f695f06c759dbf3ab00046e7cc2da22d10f 0 dir1/file3
@@ -68,7 +68,7 @@ test_expect_success 'update-index --upda
git-update-index --again &&
cd .. &&
git-ls-files -s >current &&
- cmp current expected'
+ cmp -s current expected'
cat > expected <<\EOF
100644 594fb5bb1759d90998e2bf2a38261ae8e243c760 0 dir1/file3
@@ -79,6 +79,6 @@ test_expect_success 'update-index --upda
cat file2 >dir1/file3 &&
git-update-index --again dir1/ &&
git-ls-files -s >current &&
- cmp current expected'
+ cmp -s current expected'
test_done
diff --git a/t/t3300-funny-names.sh b/t/t3300-funny-names.sh
index c12270e..d2c1af8 100755
--- a/t/t3300-funny-names.sh
+++ b/t/t3300-funny-names.sh
@@ -24,7 +24,7 @@ EOF
cat >"$p1" "$p0"
echo 'Foo Bar Baz' >"$p2"
-test -f "$p1" && cmp "$p0" "$p1" || {
+test -f "$p1" && cmp -s "$p0" "$p1" || {
# since FAT/NTFS does not allow tabs in filenames, skip this test
say 'Your filesystem does not allow tabs in filenames, test skipped.'
test_done
diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh
index 323606c..0ff3c4d 100755
--- a/t/t4012-diff-binary.sh
+++ b/t/t4012-diff-binary.sh
@@ -25,11 +25,11 @@ cat > expected <<\EOF
EOF
test_expect_success 'diff without --binary' \
'git-diff | git-apply --stat --summary >current &&
- cmp current expected'
+ cmp -s current expected'
test_expect_success 'diff with --binary' \
'git-diff --binary | git-apply --stat --summary >current &&
- cmp current expected'
+ cmp -s current expected'
# apply needs to be able to skip the binary material correctly
# in order to report the line number of a corrupt patch.
diff --git a/t/t4109-apply-multifrag.sh b/t/t4109-apply-multifrag.sh
index 5988e1a..85ef40e 100755
--- a/t/t4109-apply-multifrag.sh
+++ b/t/t4109-apply-multifrag.sh
@@ -145,8 +145,8 @@ mv main.c main.c.git
test_expect_success "S = patch (1)" \
'cat patch1.patch patch2.patch | patch -p1'
-test_expect_success "S = cmp (1)" \
- 'cmp main.c.git main.c'
+test_expect_success "S = cmp -s (1)" \
+ 'cmp -s main.c.git main.c'
rm -f main.c main.c.git
@@ -157,8 +157,8 @@ mv main.c main.c.git
test_expect_success "S = patch (2)" \
'cat patch1.patch patch2.patch patch3.patch | patch -p1'
-test_expect_success "S = cmp (2)" \
- 'cmp main.c.git main.c'
+test_expect_success "S = cmp -s (2)" \
+ 'cmp -s main.c.git main.c'
rm -f main.c main.c.git
@@ -169,8 +169,8 @@ mv main.c main.c.git
test_expect_success "S = patch (3)" \
'cat patch1.patch patch4.patch | patch -p1'
-test_expect_success "S = cmp (3)" \
- 'cmp main.c.git main.c'
+test_expect_success "S = cmp -s (3)" \
+ 'cmp -s main.c.git main.c'
test_done
diff --git a/t/t4110-apply-scan.sh b/t/t4110-apply-scan.sh
index 005f744..3c767a4 100755
--- a/t/t4110-apply-scan.sh
+++ b/t/t4110-apply-scan.sh
@@ -95,7 +95,7 @@ test_expect_success "S = patch scan" \
mv new.txt patch.txt
test_expect_success "S = cmp" \
- 'cmp apply.txt patch.txt'
+ 'cmp -s apply.txt patch.txt'
test_done
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index de45ac4..5564162 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -56,7 +56,7 @@ test_expect_success \
'(cd ../.git && find objects -type f -print) |
while read path
do
- cmp $path ../.git/$path || {
+ cmp -s $path ../.git/$path || {
echo $path differs.
return 1
}
@@ -86,7 +86,7 @@ test_expect_success \
'(cd ../.git && find objects -type f -print) |
while read path
do
- cmp $path ../.git/$path || {
+ cmp -s $path ../.git/$path || {
echo $path differs.
return 1
}
@@ -182,17 +182,17 @@ test_expect_success \
'build pack index for an existing pack' \
'cp test-1-${packname_1}.pack test-3.pack &&
git-index-pack -o tmp.idx test-3.pack &&
- cmp tmp.idx test-1-${packname_1}.idx &&
+ cmp -s tmp.idx test-1-${packname_1}.idx &&
git-index-pack test-3.pack &&
- cmp test-3.idx test-1-${packname_1}.idx &&
+ cmp -s test-3.idx test-1-${packname_1}.idx &&
cp test-2-${packname_2}.pack test-3.pack &&
git-index-pack -o tmp.idx test-2-${packname_2}.pack &&
- cmp tmp.idx test-2-${packname_2}.idx &&
+ cmp -s tmp.idx test-2-${packname_2}.idx &&
git-index-pack test-3.pack &&
- cmp test-3.idx test-2-${packname_2}.idx &&
+ cmp -s test-3.idx test-2-${packname_2}.idx &&
:'
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index f3694ac..cb32283 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -52,7 +52,7 @@ test_expect_success \
echo >&2 Thanks, it correctly failed.
true
fi &&
- if cmp victim/.git/refs/heads/master .git/refs/heads/master
+ if cmp -s victim/.git/refs/heads/master .git/refs/heads/master
then
# should have been left as it was!
false
@@ -61,7 +61,7 @@ test_expect_success \
fi &&
# this should update
git-send-pack --force ./victim/.git/ master &&
- cmp victim/.git/refs/heads/master .git/refs/heads/master
+ cmp -s victim/.git/refs/heads/master .git/refs/heads/master
'
test_done
diff --git a/t/t6021-merge-criss-cross.sh b/t/t6021-merge-criss-cross.sh
index 8f7366d..97e85b9 100755
--- a/t/t6021-merge-criss-cross.sh
+++ b/t/t6021-merge-criss-cross.sh
@@ -93,6 +93,6 @@ cat > file-expect <<EOF
9
EOF
-test_expect_success 'Criss-cross merge result' 'cmp file file-expect'
+test_expect_success 'Criss-cross merge result' 'cmp -s file file-expect'
test_done
diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh
index a5a235f..e19c3df 100755
--- a/t/t9101-git-svn-props.sh
+++ b/t/t9101-git-svn-props.sh
@@ -97,7 +97,7 @@ test_expect_success 'fetch and pull late
for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf
do
- test_expect_success "Comparing $i" "cmp $i new_wc/$i"
+ test_expect_success "Comparing $i" "cmp -s $i new_wc/$i"
done
diff --git a/t/t9105-git-svn-commit-diff.sh b/t/t9105-git-svn-commit-diff.sh
index f994b72..315bdd3 100755
--- a/t/t9105-git-svn-commit-diff.sh
+++ b/t/t9105-git-svn-commit-diff.sh
@@ -35,7 +35,7 @@ test_expect_success 'test the commit-dif
test -n '$prev' && test -n '$head' &&
git-svn commit-diff '$prev' '$head' '$svnrepo' &&
svn co $svnrepo wc &&
- cmp readme wc/readme
+ cmp -s readme wc/readme
"
test_done
--
1.4.2.rc3.ge5673-dirty
^ permalink raw reply related
* Re: [PATCH] Update git-init-db(1) and documentation of core.sharedRepository
From: Junio C Hamano @ 2006-08-09 0:47 UTC (permalink / raw)
To: Jonas Fonseca; +Cc: git
In-Reply-To: <20060809002623.GB10115@diku.dk>
Jonas Fonseca <fonseca@diku.dk> writes:
> Combine option descriptions in git-init-db(1). Reflect the changes to
> additionally allow all users to read the created git repository.
Thanks.
> I noticed that the git-init-db(1) --template description says: "The
> default template directory is `/usr/share/git-core/templates`", which
> makes me wonder if we should substitute these hard-coded paths when
> installing the man pages ...
While it would be nicer, I do not think it is worth it. After
all it says "The default..." -- if a particular installation is
not using the default location, I expect that the users are
clever enough to adjust the reading of it.
^ permalink raw reply
* [PATCH] Update git-init-db(1) and documentation of core.sharedRepository
From: Jonas Fonseca @ 2006-08-09 0:26 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
Combine option descriptions in git-init-db(1). Reflect the changes to
additionally allow all users to read the created git repository.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
I noticed that the git-init-db(1) --template description says: "The
default template directory is `/usr/share/git-core/templates`", which
makes me wonder if we should substitute these hard-coded paths when
installing the man pages ...
$ sed \
-e 's#/usr/share/git-core/templates#$(template_dir)#'
... etc ...
... at least git-clone(1) also hard-codes this path.
Documentation/config.txt | 9 +++++--
Documentation/git-init-db.txt | 51 ++++++++++++++++++++++++++++-------------
2 files changed, 41 insertions(+), 19 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index d89916b..4de7d72 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -83,9 +83,12 @@ core.repositoryFormatVersion::
version.
core.sharedRepository::
- If true, the repository is made shareable between several users
- in a group (making sure all the files and objects are group-writable).
- See gitlink:git-init-db[1]. False by default.
+ When 'group' (or 'true'), the repository is made shareable between
+ several users in a group (making sure all the files and objects are
+ group-writable). When 'all' (or 'world' or 'everybody'), the
+ repository will be readable by all users, additionally to being
+ group-shareable. When 'umask' (or 'false'), git will use permissions
+ reported by umask(2). See gitlink:git-init-db[1]. False by default.
core.warnAmbiguousRefs::
If true, git will warn you if the ref name you passed it is ambiguous
diff --git a/Documentation/git-init-db.txt b/Documentation/git-init-db.txt
index 0a4fc14..3d04096 100644
--- a/Documentation/git-init-db.txt
+++ b/Documentation/git-init-db.txt
@@ -8,17 +8,47 @@ git-init-db - Creates an empty git repos
SYNOPSIS
--------
-'git-init-db' [--template=<template_directory>] [--shared]
+'git-init-db' [--template=<template_directory>] [--shared[=<permissions>]]
OPTIONS
-------
+
+--
+
--template=<template_directory>::
- Provide the directory from which templates will be used.
- The default template directory is `/usr/share/git-core/templates`.
---shared::
- Specify that the git repository is to be shared amongst several users.
+Provide the directory from which templates will be used. The default template
+directory is `/usr/share/git-core/templates`.
+
+When specified, `<template_directory>` is used as the source of the template
+files rather than the default. The template files include some directory
+structure, some suggested "exclude patterns", and copies of non-executing
+"hook" files. The suggested patterns and hook files are all modifiable and
+extensible.
+
+--shared[={false|true|umask|group|all|world|everybody}]::
+
+Specify that the git repository is to be shared amongst several users. This
+allows users belonging to the same group to push into that
+repository. When specified, the config variable "core.sharedRepository" is
+set so that files and directories under `$GIT_DIR` are created with the
+requested permissions. When not specified, git will use permissions reported
+by umask(2).
+
+The option can have the following values, defaulting to 'group' if no value
+is given:
+
+ - 'umask' (or 'false'): Use permissions reported by umask(2). The default,
+ when `--shared` is not specified.
+
+ - 'group' (or 'true'): Make the repository group-writable, (and g+sx, since
+ the git group may be not the primary group of all users).
+
+ - 'all' (or 'world' or 'everybody'): Same as 'group', but make the repository
+ readable by all users.
+
+--
DESCRIPTION
@@ -29,12 +59,6 @@ template files.
An initial `HEAD` file that references the HEAD of the master branch
is also created.
-If `--template=<template_directory>` is specified, `<template_directory>`
-is used as the source of the template files rather than the default.
-The template files include some directory structure, some suggested
-"exclude patterns", and copies of non-executing "hook" files. The
-suggested patterns and hook files are all modifiable and extensible.
-
If the `$GIT_DIR` environment variable is set then it specifies a path
to use instead of `./.git` for the base of the repository.
@@ -42,11 +66,6 @@ If the object storage directory is speci
environment variable then the sha1 directories are created underneath -
otherwise the default `$GIT_DIR/objects` directory is used.
-A shared repository allows users belonging to the same group to push into that
-repository. When specifying `--shared` the config variable "core.sharedRepository"
-is set to 'true' so that directories under `$GIT_DIR` are made group writable
-(and g+sx, since the git group may be not the primary group of all users).
-
Running `git-init-db` in an existing repository is safe. It will not overwrite
things that are already there. The primary reason for rerunning `git-init-db`
is to pick up newly added templates.
--
Jonas Fonseca
^ permalink raw reply related
* [PATCH 8] autoconf: It is --without-python, not --no-python
From: Jakub Narebski @ 2006-08-09 0:19 UTC (permalink / raw)
To: git
In-Reply-To: <200608081834.09271.jnareb@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
configure.ac | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index ae56462..e890131 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,7 +78,7 @@ #
# Define NO_PYTHON if you want to lose all benefits of the recursive merge.
# Define PYTHON_PATH to provide path to Python.
AC_ARG_WITH(python,[AS_HELP_STRING([--with-python=PATH], [provide PATH to python])
-AS_HELP_STRING([--no-python], [don't use python scripts])],
+AS_HELP_STRING([--without-python], [don't use python scripts])],
[if test "$withval" = "no"; then \
NO_PYTHON=YesPlease; \
elif test "$withval" = "yes"; then \
--
1.4.1.1
^ permalink raw reply related
* [PATCH 7] autoconf: Add support for setting CURLDIR, OPENSSLDIR, EXPATDIR
From: Jakub Narebski @ 2006-08-09 0:15 UTC (permalink / raw)
To: git
In-Reply-To: <200608081834.09271.jnareb@gmail.com>
Add support for --with-openssl=PATH and --without-openssl,
--with-curl=PATH and --without-curl, --with-expat=PATH and
--without-expat ./configure options, each setting or unsetting
appropriate NO_PACKAGE and if called with argument also PACKAGEDIR
(of which only CURLDIR is documented in Makefile)
All above options are supported as override to autodetection; more to
come in the same style (override to autodetection), so moved the bulk
of comments for site configuration down.
Needs review by someone well versed in autoconf and m4.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
With this patch current autoconf generated ./configure script can
do everything the first abandoned (rewritten) version could...
and much, much more.
configure.ac | 158 +++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 101 insertions(+), 57 deletions(-)
diff --git a/configure.ac b/configure.ac
index bc2824b..ae56462 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,53 +46,29 @@ else \
fi; \
fi; \
]) # GIT_CONF_APPEND_PATH
+#
+# GIT_PARSE_WITH(PACKAGE)
+# -----------------------
+# For use in AC_ARG_WITH action-if-found, for packages default ON.
+# * Set NO_PACKAGE=YesPlease for --without-PACKAGE
+# * Set PACKAGEDIR=PATH for --with-PACKAGE=PATH
+# * Unset NO_PACKAGE for --with-PACKAGE without ARG
+AC_DEFUN([GIT_PARSE_WITH],
+[PACKAGE=m4_toupper($1); \
+if test "$withval" = "no"; then \
+ m4_toupper(NO_$1)=YesPlease; \
+elif test "$withval" = "yes"; then \
+ m4_toupper(NO_$1)=; \
+else \
+ m4_toupper(NO_$1)=; \
+ GIT_CONF_APPEND_LINE(${PACKAGE}DIR=$withval); \
+fi \
+])# GIT_PARSE_WITH
-## Site configuration
+## Site configuration related to programs (before tests)
## --with-PACKAGE[=ARG] and --without-PACKAGE
#
-# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
-# tests. These tests take up a significant amount of the total test time
-# but are not needed unless you plan to talk to SVN repos.
-#
-# Define MOZILLA_SHA1 environment variable when running make to make use of
-# a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast
-# on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default
-# choice) has very fast version optimized for i586.
-#
-# Define PPC_SHA1 environment variable when running make to make use of
-# a bundled SHA1 routine optimized for PowerPC.
-#
-# Define ARM_SHA1 environment variable when running make to make use of
-# a bundled SHA1 routine optimized for ARM.
-#
-# Define NO_OPENSSL environment variable if you do not have OpenSSL.
-# This also implies MOZILLA_SHA1.
-#
-# Define NO_CURL if you do not have curl installed. git-http-pull and
-# git-http-push are not built, and you cannot use http:// and https://
-# transports.
-#
-# Define CURLDIR=/foo/bar if your curl header and library files are in
-# /foo/bar/include and /foo/bar/lib directories.
-#
-# Define NO_EXPAT if you do not have expat installed. git-http-push is
-# not built, and you cannot push using http:// and https:// transports.
-#
-# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
-# installed in /sw, but don't want GIT to link against any libraries
-# installed there. If defined you may specify your own (or Fink's)
-# include directories and library directories by defining CFLAGS
-# and LDFLAGS appropriately.
-#
-# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
-# have DarwinPorts installed in /opt/local, but don't want GIT to
-# link against any libraries installed there. If defined you may
-# specify your own (or DarwinPort's) include directories and
-# library directories by defining CFLAGS and LDFLAGS appropriately.
-#
-# Define NO_MMAP if you want to avoid mmap.
-#
# Define SHELL_PATH to provide path to shell.
GIT_ARG_SET_PATH(shell)
#
@@ -114,20 +90,6 @@ AS_HELP_STRING([--no-python], [don't use
])
AC_SUBST(NO_PYTHON)
AC_SUBST(PYTHON_PATH)
-#
-## --enable-FEATURE[=ARG] and --disable-FEATURE
-# Define COLLISION_CHECK below if you believe that SHA1's
-# 1461501637330902918203684832716283019655932542976 hashes do not give you
-# sufficient guarantee that no collisions between objects will ever happen.
-#
-# Define USE_NSEC below if you want git to care about sub-second file mtimes
-# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
-# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
-# randomly break unless your underlying filesystem supports those sub-second
-# times (my ext3 doesn't).
-#
-# Define USE_STDEV below if you want git to care about the underlying device
-# change being considered an inode change from the update-cache perspective.
## Checks for programs.
@@ -259,6 +221,7 @@ else
fi
AC_SUBST(NO_C99_FORMAT)
+
## Checks for library functions.
## (in default C library and libraries checked by AC_CHECK_LIB)
AC_MSG_NOTICE([CHECKS for library functions])
@@ -299,6 +262,87 @@ # Define NO_ACCURATE_DIFF if your diff p
# a missing newline at the end of the file.
+## Site configuration (override autodetection)
+## --with-PACKAGE[=ARG] and --without-PACKAGE
+AC_MSG_NOTICE([CHECKS for site configuration])
+#
+# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
+# tests. These tests take up a significant amount of the total test time
+# but are not needed unless you plan to talk to SVN repos.
+#
+# Define MOZILLA_SHA1 environment variable when running make to make use of
+# a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast
+# on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default
+# choice) has very fast version optimized for i586.
+#
+# Define PPC_SHA1 environment variable when running make to make use of
+# a bundled SHA1 routine optimized for PowerPC.
+#
+# Define ARM_SHA1 environment variable when running make to make use of
+# a bundled SHA1 routine optimized for ARM.
+#
+# Define NO_OPENSSL environment variable if you do not have OpenSSL.
+# This also implies MOZILLA_SHA1.
+#
+# Define OPENSSLDIR=/foo/bar if your openssl header and library files are in
+# /foo/bar/include and /foo/bar/lib directories.
+AC_ARG_WITH(openssl,
+AS_HELP_STRING([--with-openssl],[use OpenSSL library (default is YES)])
+AS_HELP_STRING([], [ARG can be prefix for openssl library and headers]),\
+GIT_PARSE_WITH(openssl))
+#
+# Define NO_CURL if you do not have curl installed. git-http-pull and
+# git-http-push are not built, and you cannot use http:// and https://
+# transports.
+#
+# Define CURLDIR=/foo/bar if your curl header and library files are in
+# /foo/bar/include and /foo/bar/lib directories.
+AC_ARG_WITH(curl,
+AS_HELP_STRING([--with-curl],[support http(s):// transports (default is YES)])
+AS_HELP_STRING([], [ARG can be also prefix for curl library and headers]),
+GIT_PARSE_WITH(curl))
+#
+# Define NO_EXPAT if you do not have expat installed. git-http-push is
+# not built, and you cannot push using http:// and https:// transports.
+#
+# Define EXPATDIR=/foo/bar if your expat header and library files are in
+# /foo/bar/include and /foo/bar/lib directories.
+AC_ARG_WITH(expat,
+AS_HELP_STRING([--with-expat],
+[support git-push using http:// and https:// transports via WebDAV (default is YES)])
+AS_HELP_STRING([], [ARG can be also prefix for expat library and headers]),
+GIT_PARSE_WITH(expat))
+#
+# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
+# installed in /sw, but don't want GIT to link against any libraries
+# installed there. If defined you may specify your own (or Fink's)
+# include directories and library directories by defining CFLAGS
+# and LDFLAGS appropriately.
+#
+# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
+# have DarwinPorts installed in /opt/local, but don't want GIT to
+# link against any libraries installed there. If defined you may
+# specify your own (or DarwinPort's) include directories and
+# library directories by defining CFLAGS and LDFLAGS appropriately.
+#
+# Define NO_MMAP if you want to avoid mmap.
+
+## --enable-FEATURE[=ARG] and --disable-FEATURE
+#
+# Define COLLISION_CHECK below if you believe that SHA1's
+# 1461501637330902918203684832716283019655932542976 hashes do not give you
+# sufficient guarantee that no collisions between objects will ever happen.
+#
+# Define USE_NSEC below if you want git to care about sub-second file mtimes
+# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
+# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
+# randomly break unless your underlying filesystem supports those sub-second
+# times (my ext3 doesn't).
+#
+# Define USE_STDEV below if you want git to care about the underlying device
+# change being considered an inode change from the update-cache perspective.
+
+
## Output files
AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"])
AC_OUTPUT
--
1.4.1.1
^ permalink raw reply related
* Re: fast-import and unique objects.
From: Jon Smirl @ 2006-08-08 23:56 UTC (permalink / raw)
To: Shawn Pearce; +Cc: git
In-Reply-To: <20060808224537.GB18163@spearce.org>
[-- Attachment #1: Type: text/plain, Size: 2940 bytes --]
On 8/8/06, Shawn Pearce <spearce@spearce.org> wrote:
> Jon Smirl <jonsmirl@gmail.com> wrote:
> > We're designing a dumpfile format for git like the one SVN has.
>
> I'm not sure I'd call it a dumpfile format. More like an importfile
> format. Reading a GIT pack is really pretty trivial; if someone was
> going to write a parser/reader to pull apart a GIT repository and
> use that information in another way they would just do it against
> the pack files. Its really not that much code. But generating a
> pack efficiently for a large volume of data is slightly less trivial;
> the attempt here is to produce some tool that can take a relatively
> trivial data stream and produce a reasonable (but not necessarily
> absolute smallest) pack from it in the least amount of CPU and
> disk time necessary to do the job. I would hope that nobody would
> seriously consider dumping a GIT repository back INTO this format!
>
> [snip]
> > AFAIK the svn code doesn't do merge commits. We probably need a post
> > processing pass in the git repo that finds the merges and closes off
> > the branches. gitk won't be pretty with 1,500 open branches. This may
> > need some manual clues.
>
> *wince* 1500 open branches. Youch. OK, that answers a lot of
> questions for me with regards to memory handling in fast-import.
> Which you provide excellent suggestions for below. I guess I didn't
> think you had nearly that many...
>
> [snip]
> > The file names are used over and over. Alloc a giant chunk of memory
> > and keep appending the file name strings to it. Then build a little
> > tree so that you can look up existing names. i.e. turn the files names
> > into atoms. Never delete anything.
>
> Agreed. For 1500 branches its worth doing.
>
> [snip]
> > About 100,000 files in the initial change set that builds the repo.
> > FInal repo has 120,000 files.
> >
> > There are 1,500 branches. I haven't looked at the svn dump file format
> > for branches, but I suspect that it sends everything on a branch out
> > at once and doesn't intersperse it with the trunk commits.
>
> If you can tell fast-import your are completely done processing a
> branch I can recycle the memory I have tied up for that branch; but
> if that's going to be difficult then... hmm.
>
> Right now I'm looking at around 5 MB/branch, based on implementing
> the memory handling optimizations you suggested. That's still *huge*
> for 1500 branches. I clearly can't hang onto every branch in memory
> for the entire life of the import like I was planning on doing.
> I'll kick that around for a couple of hours and see what I come
> up with.
Some of these branches are what cvs2svn calls unlabeled branches.
cvs2svn is probably creating more of these than necessary since the
code for coalescing them into a single big unlabeled branch is not
that good.
I attached the list of branch names being generated.
>
> --
> Shawn.
>
--
Jon Smirl
jonsmirl@gmail.com
[-- Attachment #2: cvs2svn-branches.txt.bz2 --]
[-- Type: application/x-bzip2, Size: 24830 bytes --]
^ permalink raw reply
* Re: [PATCH] Racy git: avoid having to be always too careful
From: Johannes Schindelin @ 2006-08-08 23:44 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Linus Torvalds, git
In-Reply-To: <7vpsfau8qn.fsf@assigned-by-dhcp.cox.net>
Hi,
On Tue, 8 Aug 2006, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > Okay, how about 100 paths? And make _this_ a config variable?
>
> Actually, I have a better patch I'll be pushing out in "next"
> this evening.
Pity. I just whipped up this patch...
-- 8< --
[PATCH] read-cache: introduce core.racyThreshold
The expensive sleep is done only when there are more than 100 updated
files now. This number is overrideable by the core.racyThreshold variable.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
Documentation/config.txt | 5 +++++
cache.h | 1 +
config.c | 5 +++++
environment.c | 1 +
read-cache.c | 2 +-
5 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index d89916b..f428fb5 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -103,6 +103,11 @@ core.legacyheaders::
database directly (where the "http://" and "rsync://" protocols
count as direct access).
+core.racyThreshold::
+ The number of files which need to be updated at least, before
+ read-cache sleeps to make the timestamps of these files and the
+ timestamp of the index file distinct.
+
alias.*::
Command aliases for the gitlink:git[1] command wrapper - e.g.
after defining "alias.last = cat-file commit HEAD", the invocation
diff --git a/cache.h b/cache.h
index 19fdef6..8c0a830 100644
--- a/cache.h
+++ b/cache.h
@@ -193,6 +193,7 @@ extern int warn_ambiguous_refs;
extern int shared_repository;
extern const char *apply_default_whitespace;
extern int zlib_compression_level;
+extern int racy_threshold;
#define GIT_REPO_VERSION 0
extern int repository_format_version;
diff --git a/config.c b/config.c
index c6e6f6a..01b8c23 100644
--- a/config.c
+++ b/config.c
@@ -291,6 +291,11 @@ int git_default_config(const char *var,
return 0;
}
+ if (!strcmp(var, "core.racythreshold")) {
+ racy_threshold = git_config_int(var, value);
+ return 0;
+ }
+
if (!strcmp(var, "user.name")) {
strlcpy(git_default_name, value, sizeof(git_default_name));
return 0;
diff --git a/environment.c b/environment.c
index 1ce3411..3656f36 100644
--- a/environment.c
+++ b/environment.c
@@ -24,6 +24,7 @@ const char *apply_default_whitespace = N
int zlib_compression_level = Z_DEFAULT_COMPRESSION;
int pager_in_use;
int pager_use_color = 1;
+int racy_threshold = 100;
static int dyn_git_object_dir, dyn_git_index_file, dyn_git_graft_file;
static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
diff --git a/read-cache.c b/read-cache.c
index d64b503..42a3f78 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1021,7 +1021,7 @@ int write_cache(int newfd, struct cache_
* This assumes that nobody is touching the working tree while
* we are updating the index.
*/
- if (20 < recent || entries <= recent * 4) {
+ if (racy_threshold < recent) {
now = fstat(newfd, &st) ? 0 : st.st_mtime;
while (now && !fstat(newfd, &st) && st.st_mtime <= now) {
struct timespec rq, rm;
--
1.4.2.rc3.gfa72-dirty
^ permalink raw reply related
* [PATCH 6/4] autoconf: Add forgotten NO_OPENSSL=@NO_OPENSSL@ to config.mak.in
From: Jakub Narebski @ 2006-08-08 23:42 UTC (permalink / raw)
To: git
In-Reply-To: <200608081839.07112.jnareb@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Or just correct previous patch, instead.
config.mak.in | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/config.mak.in b/config.mak.in
index 99b13a7..369e611 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -24,6 +24,7 @@ export srcdir VPATH
NO_PYTHON=@NO_PYTHON@
NEEDS_SSL_WITH_CRYPTO=@NEEDS_SSL_WITH_CRYPTO@
+NO_OPENSSL=@NO_OPENSSL@
NO_CURL=@NO_CURL@
NO_EXPAT=@NO_EXPAT@
NEEDS_LIBICONV=@NEEDS_LIBICONV@
--
1.4.1.1
^ permalink raw reply related
* Re: HOWTO set up a repository which can be pushed into over HTTP
From: Johannes Schindelin @ 2006-08-08 23:11 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, git
In-Reply-To: <20060808190220.GA6001@nospam.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 7646 bytes --]
Hi,
On Tue, 8 Aug 2006, Rutger Nijlunsing wrote:
> On Mon, Aug 07, 2006 at 12:55:43AM -0700, Junio C Hamano wrote:
> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> >
> > > Do people find it useful? Or would you like to wait until I implement an
> > > option in git-http-push to actually init an HTTP repo remotely?
> >
> > I do not have need for push over http-dav at the moment myself,
> > but I would imagine I would certainly look for it when I would
> > need to later.
> >
> > Do people find it useful? More importantly, has somebody else
> > independently tried to follow the documentation and found the
> > description accurate and helpful?
>
> Today I did try to follow it, and it made an otherwise impossible job
> for me doable, although still taking too much hours and a patch. The
> 'impossible job' for me had to do with my zero-apache experience and
> (probably) a bug in WebDAV.
Thank you for doing that valuable work! I think the patch is fine (take
that as an Acked-by:); next time you might want to send it as a proper
patch mail ;-)
> -This text assumes that you
> -
> -- have an Apache webserver,
> -- can edit the configuration of it,
> -- can restart it, and
> +
> +What's needed:
> +
> +- Have an Apache webserver
> +
> + On Debian:
> + $ apt-get install apache2
> + To get apache2 by default started,
> + edit /etc/default/apache2 and set NO_START=0
> +
> +- can edit the configuration of it
> +
> + On Debian: this means being able to edit files under /etc/apache2
On some other setups, it is /etc/httpd/. Since it is not specific to
Debian, we might want to give some common options, but refer the user to
the Apache manual if she cannot find it.
> +
> +- can restart it.
> + 'apachectl --graceful' might do.
It is Ã'apachectl graceful' here (without'--').
> + On Debian:
> + $ /etc/init.d/apache2 restart
This should work everywhere, except it might be called apache or httpd
instead. However, please warn users that this interrupts (however briefly)
a running webserver, and if you do that on a production machine, users
just downloading an iso file might be rightfully upset.
> - have permissions to chown a directory
>
> +In effect, this probably means you're going to be root.
Right.
> - $ cd /usr/local/apache/htdocs
> - $ mkdir my-new-repo.git
> + $ cd /usr/local/apache/htdocs
> + $ mkdir my-new-repo.git
> +
> + On Debian:
> +
> + $ cd /var/www
> + $ mkdir my-new-repo.git
Again, it might be cooler to be a bit more portable: if the user found
httpd.config, he could just "grep DocumentRoot /where/ever/httpd.conf".
> Change the ownership to your webserver's credentials
> +
> + $ chown -R www.www .
> +
> + On Debian:
> +
> + $ chown -R www-data.www-data .
Again, a better way would be to direct the user to "grep ^User httpd.conf"
and "grep ^Group httpd.conf".
> +Restart apache2, and check whether http://server/my-new-repo.git gives
> +a directory listing. If not, check whether apache started up
> +succesfully.
A useful addition.
> Step 2: enable DAV on this repository
> -------------------------------------
>
> -In your httpd.conf, make sure that this line exists:
> +In your httpd.conf, make sure that this line exists which is the file
> +used for locking DAV operations:
> +
> + DAVLockDB "/usr/local/apache2/temp/DAV.lock"
> +
> + On Debian:
>
> - DAVLockDB "/usr/local/apache2/temp/DAV.lock"
> + Enable the dav and dav_fs modules of apache:
> + $ a2enmod dav_fs
> + $ a2enmod dav
> + The DAV lock is located in /etc/apache2/mods-available/dav_fs.conf:
> + DAVLockDB /var/lock/apache2/DAVLock
I did not find a2enmod on my only Debian setup, so a more portable way
would be to tell the user to insert the following lines in httpd.conf:
LoadModule dav_module libexec/httpd/libdav.so
AddModule mod_dav.c
(I do not know if there are setups where you have to load dav_fs
explicitely...)
> Then, add something like this to your httpd.conf
>
> - <Location /my-new-repo.git>
> - DAV on
> - AuthType Basic
> - AuthName "Git"
> - AuthUserFile /usr/local/apache2/conf/passwd.git
> - Require valid-user
> - </Location>
> + <Location /my-new-repo.git>
> + DAV on
> + AuthType Basic
> + AuthName "Git"
> + AuthUserFile /usr/local/apache2/conf/passwd.git
> + Require valid-user
> + </Location>
> +
> + On Debian:
> + Create (or add to) /etc/apache2/conf.d/git.conf :
Is this picked up automatically?
> + <Location /my-new-repo.git>
> + DAV on
> + AuthType Basic
> + AuthName "Git"
> + AuthUserFile /etc/apache2/passwd.git
> + Require valid-user
> + </Location>
We should not violate the DRY principle ("Don´'Repeat Yourself").
> +
> +The password file can be somewhere else, but it has to be readable by
> +Apache and preferably not readable by the world.
>
> -The password file can be somewhere else, but it has to be readable by
> -Apache.
> +Create this file by
> + $ htpasswd -c /usr/local/apache2/conf/passwd.git <user>
>
> -You can create this file by
> + On Debian:
> + $ htpasswd -c /etc/apache2/passwd.git <user>
>
> - $ htpasswd -c /usr/local/apache2/conf/passwd.git <user>
> -
> -you will be asked a password, and the file is created. Subsequent calls
> +You will be asked a password, and the file is created. Subsequent calls
> to htpasswd should omit the '-c' option, since you want to append to the
> existing file.
>
> -You need to restart Apache; 'apachectl --graceful' is sufficient.
So, it was my fault to begin with: the '--' is wrong.
> +Now go to http://<username>@<servername>/my-new-repo.git in your
> +browser to check whether it asks for a password and accepts the right
> +password.
Helpful.
> +On Debian:
> +
> + To test the WebDAV part, do:
> +
> + $ apt-get install litmus
> + $ litmus http://<servername>/my-new-repo.git <username> <password>
There has to be a more portable way to test WebDAV, like an URL to type
into a webbrowser. DAV wizards, anyone?
> -Then, add the following to your .netrc (you can do without, but will be
> +Then, add the following to your ~/.netrc (you can do without, but will be
Okay, I thought it was common knowledge where this resides. Although I
would say $HOME/.netrc instead.
> +...and set permissions:
> + chmod 600 ~/.netrc
Yeah, right. I always forget about this.
> + On Windows, use %HOMEDRIVE%%HOMEPATH%.netrc instead.
Huh? You want to access it with something else than cygwin?
> +To check whether all is OK, do:
> +
> + curl --netrc --location -v http://<username>@<servername>/my-new-repo.git/
> +
> +...this should give a directory listing in HTML of /var/www/my-new-repo.git .
Does everybody who has libcurl installed, have curl installed also?
> >From your client repository, do
>
> - $ git-http-push upload master
> + $ git push upload master
> +
> +This pushes branch 'master' (which is assumed to be the branch you
> +want to export) to repository called 'upload', which we previously
> +defined with git-repo-config.
>
> -(This assumes that the branch you want to export is called 'master' in your
> -client setup...)
Your wording is much clearer.
> request; This can happen when you start Apache, but then disable the
> network interface. A simple restart of Apache helps.
>
> -In other cases, reading /usr/local/apache2/logs/error_log is often helpful.
> -
> +Errors like (22/502) are of format (curl error code/http error
> +code). So (22/404) means something like 'not found' at the server.
I think the error log is more useful than the http error codes.
Ciao,
Dscho
^ 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