* [PATCH] Remove unnecessary ouput from t3600-rm.
From: Shawn Pearce @ 2006-05-29 7:16 UTC (permalink / raw)
To: Junio Hamano; +Cc: git
Moved the output of the setup commits and the test-file rm check to
file descriptors 3 and 4 hiding their messages unless -v is given.
This makes the test suite look a little cleaner when the rm test-file
setup step fails (and was probably expected to fail).
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
t/t3600-rm.sh | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index acaa4d6..5b6bf61 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -10,14 +10,14 @@ test_description='Test of the various op
# Setup some files to be removed, some with funny characters
touch -- foo bar baz 'space embedded' -q
git-add -- foo bar baz 'space embedded' -q
-git-commit -m "add normal files"
+git-commit -m "add normal files" >&3 2>&4
test_tabs=y
if touch -- 'tab embedded' 'newline
embedded'
then
git-add -- 'tab embedded' 'newline
embedded'
-git-commit -m "add files with tabs and newlines"
+git-commit -m "add files with tabs and newlines" >&3 2>&4
else
say 'Your filesystem does not allow tabs in filenames.'
test_tabs=n
@@ -28,7 +28,7 @@ # git-rm barfs, but if the test is run a
# arranged.
: >test-file
chmod a-w .
-rm -f test-file
+rm -f test-file >&3 2>&4
test -f test-file && test_failed_remove=y
chmod 775 .
rm -f test-file
--
1.3.3.g45d8
^ permalink raw reply related
* [PATCH] Make update-ref a builtin.
From: Shawn Pearce @ 2006-05-29 7:15 UTC (permalink / raw)
To: Junio Hamano; +Cc: git
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
This is applied on top of `next` and my other reflog changes.
I put it together just to reduce the disk usage - as Linus noted
PowerPC ain't too slim on its executables...
Makefile | 6 +++---
update-ref.c => builtin-update-ref.c | 9 +++++----
builtin.h | 1 +
git.c | 1 +
4 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 5f8ea18..7dfeb97 100644
--- a/Makefile
+++ b/Makefile
@@ -161,7 +161,7 @@ PROGRAMS = \
git-ssh-upload$X git-unpack-file$X \
git-unpack-objects$X git-update-index$X git-update-server-info$X \
git-upload-pack$X git-verify-pack$X git-write-tree$X \
- git-update-ref$X git-symbolic-ref$X \
+ git-symbolic-ref$X \
git-name-rev$X git-pack-redundant$X git-repo-config$X git-var$X \
git-describe$X git-merge-tree$X git-blame$X git-imap-send$X
@@ -172,7 +172,7 @@ BUILT_INS = git-log$X git-whatchanged$X
git-init-db$X git-tar-tree$X git-upload-tar$X git-format-patch$X \
git-ls-files$X git-ls-tree$X \
git-read-tree$X git-commit-tree$X \
- git-apply$X git-show-branch$X git-diff-files$X \
+ git-update-ref$X git-apply$X git-show-branch$X git-diff-files$X \
git-diff-index$X git-diff-stages$X git-diff-tree$X git-cat-file$X
# what 'all' will build and 'install' will install, in gitexecdir
@@ -228,7 +228,7 @@ BUILTIN_OBJS = \
builtin-read-tree.o builtin-commit-tree.o \
builtin-apply.o builtin-show-branch.o builtin-diff-files.o \
builtin-diff-index.o builtin-diff-stages.o builtin-diff-tree.o \
- builtin-cat-file.o
+ builtin-update-ref.o builtin-cat-file.o
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
LIBS = $(GITLIBS) -lz
diff --git a/update-ref.c b/builtin-update-ref.c
similarity index 85%
rename from update-ref.c
rename to builtin-update-ref.c
index a1e6bb9..2c62286 100644
--- a/update-ref.c
+++ b/builtin-update-ref.c
@@ -1,10 +1,11 @@
#include "cache.h"
#include "refs.h"
+#include "builtin.h"
-static const char git_update_ref_usage[] =
+static const char builtin_update_ref_usage[] =
"git-update-ref <refname> <value> [<oldval>] [-m <reason>]";
-int main(int argc, char **argv)
+int cmd_update_ref(int argc, const char **argv, char **envp)
{
const char *refname=NULL, *value=NULL, *oldval=NULL, *msg=NULL;
struct ref_lock *lock;
@@ -17,7 +18,7 @@ int main(int argc, char **argv)
for (i = 1; i < argc; i++) {
if (!strcmp("-m", argv[i])) {
if (i+1 >= argc)
- usage(git_update_ref_usage);
+ usage(builtin_update_ref_usage);
msg = argv[++i];
if (!*msg)
die("Refusing to perform update with empty message.");
@@ -39,7 +40,7 @@ int main(int argc, char **argv)
}
}
if (!refname || !value)
- usage(git_update_ref_usage);
+ usage(builtin_update_ref_usage);
if (get_sha1(value, sha1))
die("%s: not a valid SHA1", value);
diff --git a/builtin.h b/builtin.h
index 738ec3d..397b770 100644
--- a/builtin.h
+++ b/builtin.h
@@ -28,6 +28,7 @@ extern int cmd_grep(int argc, const char
extern int cmd_rm(int argc, const char **argv, char **envp);
extern int cmd_add(int argc, const char **argv, char **envp);
extern int cmd_rev_list(int argc, const char **argv, char **envp);
+extern int cmd_update_ref(int argc, const char **argv, char **envp);
extern int cmd_check_ref_format(int argc, const char **argv, char **envp);
extern int cmd_init_db(int argc, const char **argv, char **envp);
extern int cmd_tar_tree(int argc, const char **argv, char **envp);
diff --git a/git.c b/git.c
index 10ea934..f37b020 100644
--- a/git.c
+++ b/git.c
@@ -57,6 +57,7 @@ static void handle_internal_command(int
{ "init-db", cmd_init_db },
{ "tar-tree", cmd_tar_tree },
{ "upload-tar", cmd_upload_tar },
+ { "update-ref", cmd_update_ref },
{ "check-ref-format", cmd_check_ref_format },
{ "ls-files", cmd_ls_files },
{ "ls-tree", cmd_ls_tree },
--
1.3.3.g45d8
^ permalink raw reply related
* Re: [PATCH] git-receive-pack needs to set umask(2)
From: Johannes Schindelin @ 2006-05-29 7:13 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <e5d6i0$rnf$1@sea.gmane.org>
Hi,
On Mon, 29 May 2006, Jakub Narebski wrote:
> Michael Richardson wrote:
>
> > This change adds $GIT_DIR/umask to contain a single line, an integer
> > which will be fed to umask(). This should also work for the git daemon,
> > which I personally do not use, so this may be inappropriate.
>
> Shouldn't it be done rather via $GIT_DIR/config file, and
> git-repo-config? I.e. instead of adding new file to repository layout,
> $GIT_DIR/umask, add core.umask to git configuration?
See also
http://thread.gmane.org/gmane.comp.version-control.git/13856/focus=13876
The essence of the thread: If you want to do anything useful in a non-bare
repository, you are likely using other tools than git, which do not
interpret core.umask or $GIT_DIR/umask.
If you use a bare repository, just make it shared. No need for an umask.
Hth,
Dscho
^ permalink raw reply
* What's in git.git
From: Junio C Hamano @ 2006-05-29 6:44 UTC (permalink / raw)
To: git; +Cc: linux-kernel
* The 'master' branch has these since the last announcement.
This is a fairly big update.
- git-apply takes notice of beginning and end of file as
context (Catalin Marinas, Linus and me)
apply: treat EOF as proper context.
apply: force matching at the beginning.
- gitview updates (Aneesh Kumar K.V)
- git-mailinfo updates (Eric W. Biederman and me)
Make read_one_header_line return a flag not a length.
Move B and Q decoding into check header.
Refactor commit messge handling.
In handle_body only read a line if we don't already have one.
More accurately detect header lines in read_one_header_line
Allow in body headers beyond the in body header prefix.
mailinfo: skip bogus UNIX From line inside body
mailinfo: More carefully parse header lines in read_one_header_line()
- format-patch --start-number (Johannes Schindelin and me)
cache-tree: replace a sscanf() by two strtol() calls
Fix crash when reading the empty tree
git-format-patch --start-number <n>
built-in format-patch: various fixups.
format-patch: -n and -k are mutually exclusive.
- ls-remote rsync:// fix (me)
ls-remote: fix rsync:// to report HEAD
* This should fix clone over rsync:// (which is deprecated
but anyway).
- cache-tree optimization for apply & write-tree sequence (me,
Johannes, Dennis Stosberg)
read-cache/write-cache: optionally return cache checksum SHA1.
Add cache-tree.
Update write-tree to use cache-tree.
Invalidate cache-tree entries for touched paths in git-apply.
Use cache-tree in update-index.
Add test-dump-cache-tree
cache-tree: protect against "git prune".
index: make the index file format extensible.
Teach fsck-objects about cache-tree.
cache-tree: sort the subtree entries.
test-dump-cache-tree: report number of subtrees.
update-index: when --unresolve, smudge the relevant cache-tree entries.
read-tree: teach 1 and 2 way merges about cache-tree.
read-tree: teach 1-way merege and plain read to prime cache-tree.
cache_tree_update: give an option to update cache-tree only.
test-dump-cache-tree: validate the cached data as well.
cache-tree.c: typefix
fsck-objects: mark objects reachable from cache-tree
Fix test-dump-cache-tree in one-tree disappeared case.
read-tree: invalidate cache-tree entry when a new index entry is added.
cache-tree: a bit more debugging support.
fsck-objects: do not segfault on missing tree in cache-tree
fix git-write-tree with cache-tree on BE64
* I've held onto this too long but haven't seen breakage.
This should make cycles of "apply & write-tree" faster by
15-20%.
- documentation (Jeff King)
cat-file: document -p option
- cvsimport Perl backward compatibility (Jeff King)
cvsimport: avoid "use" with :tag
- build fixes (Jim Meyering, Martin Waitz)
Don't write directly to a make target ($@).
Documentation/Makefile: remove extra /
Add instructions to commit template.
- "git-clone --template" (me)
Let git-clone to pass --template=dir option to git-init-db.
- various fixes and cleanups (Linus, Martin Waitz, Petr Baudis,
Shawn Pearce, me)
builtin-rm: squelch compiler warnings.
fetch.c: remove an unused variable and dead code.
git-fetch: avoid using "case ... in (arm)"
bogus "fatal: Not a git repository"
t1002: use -U0 instead of --unified=0
Fix "--abbrev=xyz" for revision listing
Don't use "sscanf()" for tree mode scanning
Call builtin ls-tree in git-cat-file -p
Built git-upload-tar should be ignored.
- rev-list --objects memory leak fix (Linus)
Fix memory leak in "git rev-list --objects"
- cvsexportcommit fixups (Yann Dirson)
Do not call 'cmp' with non-existant -q flag.
Document current cvsexportcommit limitations.
Make cvsexportcommit create parent directories as needed.
* The 'next' branch, in addition, has these.
- portability of tests across different bourne flavors (Eric Wong)
t3300-funny-names: shell portability fixes
tests: Remove heredoc usage inside quotes
t5500-fetch-pack: remove local (bashism) usage.
t6000lib: workaround a possible dash bug
* I think these are OK to push out to "master".
- read-tree/write-tree --prefix from bind commit series (me)
read-tree: --prefix=<path>/ option.
write-tree: --prefix=<path>
read-tree: reorganize bind_merge code.
* I think these are OK to push out to "master".
- avoid wasted work in fetch-pack when receiving side has more
roots than the sender (me).
fetch-pack: give up after getting too many "ack continue"
* While this would not hurt, it is a client-side hack. To
fix the problem properly, the server side needs to become a
bit smarter.
- tree parser reorganization (Linus)
Add raw tree buffer info to "struct tree"
Make "tree_entry" have a SHA1 instead of a union of object pointers
Switch "read_tree_recursive()" over to tree-walk functionality
Remove "tree->entries" tree-entry list from tree parser
* This looks good; I would like to cook this for a while in
"next", and mark its graduation with 1.4.0 release.
- test fix for http-fetch segfault (Sean Estabrooks)
* Status?
- ref-log (Shawn Pearce)
Improve abstraction of ref lock/write.
Convert update-ref to use ref_lock API.
Log ref updates to logs/refs/<ref>
Support 'master@2 hours ago' syntax
Fix ref log parsing so it works properly.
General ref log reading improvements.
Added logs/ directory to repository layout.
Force writing ref if it doesn't exist.
Log ref updates made by fetch.
Change 'master@noon' syntax to 'master@{noon}'.
Correct force_write bug in refs.c
Change order of -m option to update-ref.
Include ref log detail in commit, reset, etc.
Create/delete branch ref logs.
Enable ref log creation in git checkout -b.
Verify git-commit provides a reflog message.
Test that git-branch -l works.
* I think these are OK to push out to "master" in that it
does not seem to cause regression, but I haven't used this
change for real work. Impressions?
* The 'pu' branch, in addition, has these.
- $HOME/.gitrc (Petr Baudis)
Read configuration also from ~/.gitrc
* I like this but it breaks the tests big time. Not "next"
material yet, unfortunately.
^ permalink raw reply
* Re: [PATCH 1/1] Tried to fix git-svn's handling of filenames with embedded '@'.
From: Eric Wong @ 2006-05-29 6:35 UTC (permalink / raw)
To: Seth Falcon; +Cc: git
In-Reply-To: <m2verqkobr.fsf@ziti.fhcrc.org>
Seth: how does this work?
Ick, I just found out keyword killing tests don't pass with
svn 1.1, though...
---
svn has trouble parsing files with embedded '@' characters. For
example,
svn propget svn:keywords foo@bar.c
svn: Syntax error parsing revision 'bar.c'
I asked about this on #svn and the workaround suggested was to append
an explicit revision specifier:
svn propget svn:keywords foo@bar.c@BASE
This patch appends '@BASE' to the filename in all calls to 'svn
propget'.
Patch originally by Seth Falcon <sethfalcon@gmail.com>
Seth: signoff?
[ew: Made to work with older svn that don't support peg revisions]
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
contrib/git-svn/git-svn.perl | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index b3e0684..54b93f4 100755
--- a/contrib/git-svn/git-svn.perl
+++ b/contrib/git-svn/git-svn.perl
@@ -34,7 +34,7 @@ my $sha1_short = qr/[a-f\d]{4,40}/;
my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,
$_find_copies_harder, $_l, $_version, $_upgrade, $_authors);
my (@_branch_from, %tree_map, %users);
-my $_svn_co_url_revs;
+my ($_svn_co_url_revs, $_svn_pg_peg_revs);
my %fc_opts = ( 'no-ignore-externals' => \$_no_ignore_ext,
'branch|b=s' => \@_branch_from,
@@ -336,7 +336,7 @@ sub show_ignore {
my %ign;
File::Find::find({wanted=>sub{if(lstat $_ && -d _ && -d "$_/.svn"){
s#^\./##;
- @{$ign{$_}} = safe_qx(qw(svn propget svn:ignore),$_);
+ @{$ign{$_}} = svn_propget_base('svn:ignore', $_);
}}, no_chdir=>1},'.');
print "\n# /\n";
@@ -860,7 +860,7 @@ sub sys { system(@_) == 0 or croak $? }
sub eol_cp {
my ($from, $to) = @_;
- my $es = safe_qx(qw/svn propget svn:eol-style/, $to);
+ my $es = svn_propget_base('svn:eol-style', $to);
open my $rfd, '<', $from or croak $!;
binmode $rfd or croak $!;
open my $wfd, '>', $to or croak $!;
@@ -898,7 +898,7 @@ sub do_update_index {
while (my $x = <$p>) {
chomp $x;
if (!$no_text_base && lstat $x && ! -l _ &&
- safe_qx(qw/svn propget svn:keywords/,$x)) {
+ svn_propget_base('svn:keywords', $x)) {
my $mode = -x _ ? 0755 : 0644;
my ($v,$d,$f) = File::Spec->splitpath($x);
my $tb = File::Spec->catfile($d, '.svn', 'tmp',
@@ -1136,6 +1136,9 @@ sub svn_compat_check {
if (grep /usage: checkout URL\[\@REV\]/,@co_help) {
$_svn_co_url_revs = 1;
}
+ if (grep /\[TARGET\[\@REV\]\.\.\.\]/, `svn propget -h`) {
+ $_svn_pg_peg_revs = 1;
+ }
# I really, really hope nobody hits this...
unless (grep /stop-on-copy/, (safe_qx(qw(svn log -h)))) {
@@ -1215,6 +1218,12 @@ sub load_authors {
close $authors or croak $!;
}
+sub svn_propget_base {
+ my ($p, $f) = @_;
+ $f .= '@BASE' if $_svn_pg_peg_revs;
+ return safe_qx(qw/svn propget/, $p, $f);
+}
+
__END__
Data structures:
--
1.3.3.gef0f
^ permalink raw reply related
* Re: Commands Mismatch in tutorial and the actual binaries.
From: Jakub Narebski @ 2006-05-29 6:07 UTC (permalink / raw)
To: git
In-Reply-To: <1148880611.7193.12.camel@localhost.localdomain>
kandagatla.Srinivas wrote:
> Hi All
> Im very new to GIT Stuff. But by installing the latest version (git-1.3.3)
> of GIT and going thru the tutorial, I am unable to understand why
> there is a mismatch in the commmands.
> Tutorial says use commands like git init-db but actually these are
> installed as git-init-db. Is this OK.. or NOT.
>
> One more doubt is .. I was unable to locate a command like git-add ..
>
> Can some one help me.
Actually, in properly installed git both versions should work,
and 'git command' is preferred version, at least for the ordinary
user level commands; "plumbing" commands are usually spelled 'git-command'.
Usually 'git command' is just a wrapper calling git-command.
--
Jakub Narebski
Warsaw, Poland
^ permalink raw reply
* Re: [PATCH 0/4] fix tests so they run without needing bash
From: Eric Wong @ 2006-05-29 5:39 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vu07dqyk8.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> You are my hero.
:)
You and Linus have already been my heroes for a while.
I was very pleasantly surprised that all the git-*.sh files work fine
(for me, at least) and only the tests needed modification.
--
Eric Wong
^ permalink raw reply
* Re: [PATCH 3/4] t5500-fetch-pack: remove local (bashism) usage.
From: Junio C Hamano @ 2006-05-29 5:36 UTC (permalink / raw)
To: Eric Wong; +Cc: git
In-Reply-To: <20060529052828.GB24077@localdomain>
Eric Wong <normalperson@yhbt.net> writes:
> Herbert Xu <herbert@gondor.apana.org.au> wrote:
>> On Thu, May 25, 2006 at 07:06:17PM -0700, Eric Wong wrote:
>> > None of the variables seem to conflict, so local was unnecessary.
>>
>> BTW, dash supports (and has always supported) local which is a quite
>> useful feature.
>
> Cool. Hmm... pdksh seems to support it here (Debian sid). I'm pretty
> sure local is not part of the POSIX spec, though; and I have seen
> /bin/sh that don't support it.
Concurred. There are things Herbert said are clearly dash bugs,
but this one is outside POSIX, so lets leave your changes to the
test for it.
^ permalink raw reply
* Re: [PATCH 2/4] tests: Remove heredoc usage inside quotes
From: Eric Wong @ 2006-05-29 5:30 UTC (permalink / raw)
To: Herbert Xu; +Cc: Junio C Hamano, git
In-Reply-To: <20060526122231.GB5372@gondor.apana.org.au>
Herbert Xu <herbert@gondor.apana.org.au> wrote:
> On Thu, May 25, 2006 at 07:06:16PM -0700, Eric Wong wrote:
> > The use of heredoc inside quoted strings doesn't seem to be
> > supported by dash. pdksh seems to handle it fine, however.
>
> This is a bug in dash and should be fixed there instead.
> Thanks for drawing my attention to it.
No problem. I think these dash bugs should be fixed in dash, but
continue to be worked around in git as old versions of dash will
probably continue to exist for a long time.
--
Eric Wong
^ permalink raw reply
* Commands Mismatch in tutorial and the actual binaries.
From: kandagatla.Srinivas @ 2006-05-29 5:30 UTC (permalink / raw)
To: git
Hi All
Im very new to GIT Stuff. But by installing the latest version<git-1.3.3
> of GIT and going thru the tutorial, I am unable to understand why
there is a mismatch in the commmands.
Tutorial says use commands like git init-db but actually these are
installed as git-init-db. Is this OK.. or NOT.
One more doubt is .. I was unable to locate a command like git-add ..
Can some one help me.
Regards
Srinivas.Kandagatla
Celuinte Soft Systems.
^ permalink raw reply
* Re: [PATCH 3/4] t5500-fetch-pack: remove local (bashism) usage.
From: Eric Wong @ 2006-05-29 5:28 UTC (permalink / raw)
To: Herbert Xu; +Cc: Junio C Hamano, git
In-Reply-To: <20060526122317.GC5372@gondor.apana.org.au>
Herbert Xu <herbert@gondor.apana.org.au> wrote:
> On Thu, May 25, 2006 at 07:06:17PM -0700, Eric Wong wrote:
> > None of the variables seem to conflict, so local was unnecessary.
>
> BTW, dash supports (and has always supported) local which is a quite
> useful feature.
Cool. Hmm... pdksh seems to support it here (Debian sid). I'm pretty
sure local is not part of the POSIX spec, though; and I have seen
/bin/sh that don't support it.
--
Eric Wong
^ permalink raw reply
* Re: [PATCH 1/1] Tried to fix git-svn's handling of filenames with embedded '@'.
From: Eric Wong @ 2006-05-29 5:25 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Seth Falcon
In-Reply-To: <7vlksldgp2.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> Seth Falcon <sethfalcon@gmail.com> writes:
>
> > svn has trouble parsing files with embedded '@' characters. For
> > example,
> >
> > svn propget svn:keywords foo@bar.c
> > svn: Syntax error parsing revision 'bar.c'
> >
> > I asked about this on #svn and the workaround suggested was to append
> > an explicit revision specifier:
> >
> > svn propget svn:keywords foo@bar.c@BASE
> >
> > This patch appends '@BASE' to the filename in all calls to 'svn
> > propget'.
>
> Eric, this sounds sane to me. Ack?
Doesn't work with svn 1.1 (a requirement of mine, unfortunately). I'll
have a fix for that in a bit.
--
Eric Wong
^ permalink raw reply
* Re: [PATCH] Support for configurable git command aliases
From: Jeff King @ 2006-05-29 3:58 UTC (permalink / raw)
To: git
In-Reply-To: <e5d9sm$5d4$1@sea.gmane.org>
On Mon, May 29, 2006 at 12:57:26AM +0200, Jakub Narebski wrote:
> Well, if [alias] would be used also for giving default options for git
> commands, e.g.
>
> [alias]
> log = log --pretty
A funny side effect of that would be that "git log" and "git-log" would
now have completely different defaults (unless the alias mechanism
starts intercepting direct calls to git-*, which seems invasive). I
wonder if it might be simpler to just add
core.defaults.log = "--pretty"
or similar.
-Peff
^ permalink raw reply
* [PATCH] git-send-email.perl extract_valid_address issue
From: Nicolas Troncoso Carrere @ 2006-05-29 4:00 UTC (permalink / raw)
To: git
The third fallback was returning if the match was done or not instead of
returning the actual email address that was matched. This prevented sending
the mail to the people included in the CC. This bug only affect those that
dont have Email::Valid.
I initialized $valid_email as undef so it would mimic the behavior of
Email::Verify->address(), which returns undef if no valid address was found.
Signed-off-by: Nicolas <ntroncos@inf.utfsm.cl>
---
git-send-email.perl | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
84853ca89c15de7a24e9eb9fd422654b86c63be9
diff --git a/git-send-email.perl b/git-send-email.perl
index 312a4ea..dfff3e6 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -316,7 +316,9 @@ sub extract_valid_address {
} else {
# less robust/correct than the monster regexp in Email::Valid,
# but still does a 99% job, and one less dependency
- return ($address =~ /([^\"<>\s]+@[^<>\s]+)/);
+ my $valid_email=undef;
+ ($valid_email ) = ($address =~ /([^\"<>\s]+@[^<>\s]+)/);
+ return ($valid_email);
}
}
--
Nicolás Troncoso Carrère User #272312 counter.li.org
Estudiante Magíster en Ciencias de la Informática
Universidad Técnica Federico Santa María
http://www.alumnos.inf.utfsm.cl/~ntroncos
^ permalink raw reply related
* Re: [PATCH] Support for configurable git command aliases
From: Junio C Hamano @ 2006-05-29 2:01 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
In-Reply-To: <20060528215945.GD10488@pasky.or.cz>
Petr Baudis <pasky@ucw.cz> writes:
>> I don't like this syntax. What other stuff (beside "cmd") would be under
>> "[alias "co"]? Why not simply:
>>
>> [alias]
>> co = commit -a
>> publish = push public.site.com:/pub/scm/my-public-repo
>
> Nice, I like this.
Sorry, I don't. The left hand side of '=' does not allow
anything but alnum and squashes the case. Please stick to
[alias "co"] syntax.
^ permalink raw reply
* Re: git-format-patch question
From: Seth Falcon @ 2006-05-29 1:01 UTC (permalink / raw)
To: git
In-Reply-To: <7vpshxdh0s.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
> Seth Falcon <sethfalcon@gmail.com> writes:
>
>> 1. When is one supposed to use --signoff? I gather the answer is
>> project specific, but a statement of what's expected for git
>> itself would probably help clarify things for me.
>
> You shouldn't ;-). Rather, you should sign-off when you make a
> commit, or if you are forwarding somebody else's patch, before
> you send the e-mail off.
>
>> 2. How should I add extra notes to an email generated using
>> git-format-patch? Is this in the docs somewhere that I missed? Is
>> there a recommended way to do this?
>
> Read the format-patch output in your e-mail buffer and edit just
> like you edit any text you write in your e-mail.
Thanks for the quick answers. I guess I was imagining things to be
more complicated than they are :-)
^ permalink raw reply
* [PATCH] Fix section slicing so help options are not misplaced in cg-commit(1)
From: Jonas Fonseca @ 2006-05-29 0:13 UTC (permalink / raw)
To: Petr Baudis, git
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
95724a5a97ca466e6eaccc7f46833a015dde2f24
Documentation/make-cg-asciidoc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
95724a5a97ca466e6eaccc7f46833a015dde2f24
diff --git a/Documentation/make-cg-asciidoc b/Documentation/make-cg-asciidoc
index 45fc981..3873618 100755
--- a/Documentation/make-cg-asciidoc
+++ b/Documentation/make-cg-asciidoc
@@ -48,7 +48,7 @@ DESCRIPTION=
OPTIONS=
MISC=
-section=$(echo "$BODY" | sed -n '1,/^[-~][-~]*[-~]$/p')
+section=$(echo "$BODY" | sed -n '1,/^[-][-]*[-]$/p')
section_lines=$(echo "$section" | wc -l)
lines=$(echo "$BODY" | wc -l)
--
1.3.3.gd882-dirty
--
Jonas Fonseca
^ permalink raw reply related
* [PATCH] Minor doc fixes
From: Jonas Fonseca @ 2006-05-29 0:12 UTC (permalink / raw)
To: Petr Baudis, git
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
1e376c11029a33deb811b77565fb558b6c192766
README | 2 +-
README.osx | 7 ++++---
cogito.spec.in | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
1e376c11029a33deb811b77565fb558b6c192766
diff --git a/README b/README
index a53b466..e6e1119 100644
--- a/README
+++ b/README
@@ -60,7 +60,7 @@ The following tools are optional but rec
Tool Description
-------------------------------------------------------------------------------
rsync For fetching files with the rsync backend.
-gnu coreutils The gnu versions of stat, date and cp \
+GNU coreutils The GNU versions of stat, date and cp \
are preferred over the BSD variants.
asciidoc (>= 7.0), xmlto For building documentation.
-------------------------------------------------------------------------------
diff --git a/README.osx b/README.osx
index d8df872..912d9fe 100644
--- a/README.osx
+++ b/README.osx
@@ -2,8 +2,9 @@ This version of Cogito should work on OS
To install on OS X:
-1) Install darwinports (http://darwinports.opendarwin.org/) 2) type
-"make Portfile" 3) type "sudo port install"
+ 1. Install darwinports (http://darwinports.opendarwin.org/)
+ 2. type "make Portfile"
+ 3. type "sudo port install"
You may have to deal with md5 mismatches. Either adjust the md5sum in
your new Portfile or place the new tarball in
@@ -11,7 +12,7 @@ your new Portfile or place the new tarba
Recommendations:
-The gnu versions of "stat" and "date" are preferred over their BSD
+The GNU versions of "stat" and "date" are preferred over their BSD
variants.
"patch", "diff", "merge", "curl" and "rsync" are required. OS X.4
diff --git a/cogito.spec.in b/cogito.spec.in
index 5509d77..70274c1 100644
--- a/cogito.spec.in
+++ b/cogito.spec.in
@@ -70,7 +70,7 @@ rm -rf $RPM_BUILD_ROOT
- Update summary and description
- Make architecture-independent
-* Wed Jul 6 2005 Chris Wright <chris@osdl.org> 0.12-1
+* Wed Jul 6 2005 Chris Wright <chrisw@osdl.org> 0.12-1
- update spec file
* Thu Jun 9 2005 Chris Wright <chrisw@osdl.org> 0.11.3-1
--
1.3.3.gd882-dirty
--
Jonas Fonseca
^ permalink raw reply related
* [PATCH] Portfile: bring it up to date; use description from cogito.spec.in
From: Jonas Fonseca @ 2006-05-29 0:11 UTC (permalink / raw)
To: Petr Baudis, git
---
9460c53c76fc00e3b7c45e58813cefde78cb99f5
Portfile.in | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
9460c53c76fc00e3b7c45e58813cefde78cb99f5
diff --git a/Portfile.in b/Portfile.in
index 9e380ad..297fd8a 100644
--- a/Portfile.in
+++ b/Portfile.in
@@ -4,13 +4,13 @@ name cogito
version @@VERSION@@
categories devel
maintainers bryan.larsen@gmail.com
-description Git core + cogito tools to provide a full distributed SCM.
-long_description The git core, developed by Linus Torvalds provides \
- an extremely fast and flexible filesystem-based \
- database designed to store directory trees with \
- regard to their history. The cogito tools, \
- developed by Petr Baudis, provide full distributed \
- SCM (software change management) functionality.
+description The Cogito Version Control System
+long_description Cogito is a version control system layered on top \
+ of the git tree history storage system. It aims at \
+ seamless user interface and ease of use, providing \
+ generally smoother user experience than the "raw" \
+ Core GIT itself and indeed many other version \
+ control systems.
homepage http://kernel.org/pub/software/scm/cogito/
master_sites http://kernel.org/pub/software/scm/cogito/
configure {}
--
1.3.3.gd882-dirty
--
Jonas Fonseca
^ permalink raw reply related
* [PATCH] ciabot: fix post-update hook description
From: Jonas Fonseca @ 2006-05-29 0:09 UTC (permalink / raw)
To: Petr Baudis, git
Also, improve on a few lost sentences
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
b2d8b2c5258b6585102c94f37c63dc2360092d87
contrib/ciabot.pl | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)
b2d8b2c5258b6585102c94f37c63dc2360092d87
diff --git a/contrib/ciabot.pl b/contrib/ciabot.pl
index 83a0d80..e23f5f1 100755
--- a/contrib/ciabot.pl
+++ b/contrib/ciabot.pl
@@ -14,15 +14,15 @@ #
# The master location of this file is in the Cogito repository
# (see http://www.kernel.org/git/).
#
-# This program is designed to run as the .git/commit-post-hook script. It takes
-# the commit information, massaging it and mailing it to the address given below.
+# This program is designed to run as the .git/hooks/post-commit hook. It takes
+# the commit information, massages it and mails it to the address given below.
#
-# The calling convention of the commit-post-hook script is:
+# The calling convention of the post-commit hook is:
#
-# commit-post-hook $commit_sha1 $branch_name
+# .git/hooks/post-commit $commit_sha1 $branch_name
#
# If it does not work, try to disable $xml_rpc in the configuration section
-# below.
+# below. Also, remember to make the hook file executable.
#
#
# Note that you can (and it might be actually more desirable) also use this
@@ -36,9 +36,9 @@ # for merged in $(git-rev-list $newhead
# /path/to/ciabot.pl $merged $refname
# done
#
-# This is useful when you use a remote repository without working copy, where
-# you only push to - the update hook will be trigerred each time you push into
-# that repository, and the pushed commits will be reported through CIA.
+# This is useful when you use a remote repository that you only push to. The
+# update hook will be triggered each time you push into that repository, and
+# the pushed commits will be reported through CIA.
use strict;
use vars qw ($project $from_email $dest_email $noisy $rpc_uri $sendmail
@@ -78,19 +78,19 @@ # not deliver the event at all if CIA se
# unfortunately not an uncommon condition.
$xml_rpc = 0;
-# You can make this bot to totally ignore events concerning the objects
-# specified below. Each object is composed of <path>/<filename>,
+# This variable should contain a regexp, against which each file will be
+# checked, and if the regexp is matched, the file is ignored. This can be
+# useful if you do not want auto-updated files, such as e.g. ChangeLog, to
+# appear via CIA.
#
-# This variable should contain regexp, against which will each object be
-# checked, and if the regexp is matched, the file is ignored. Therefore ie. to
-# ignore all changes in the two files above and everything concerning module
-# 'admin', use:
+# The following example will make the script ignore all changes in two specific
+# files in two different modules, and everything concerning module 'admin':
#
# $ignore_regexp = "^(gentoo/Manifest|elinks/src/bfu/inphist.c|admin/)";
$ignore_regexp = "";
# It can be useful to also grab the generated XML message by some other
-# programs and ie. autogenerate some content based on it. Here you can specify
+# programs and e.g. autogenerate some content based on it. Here you can specify
# a file to which it will be appended.
$alt_local_message_target = "";
--
1.3.3.gd882-dirty
--
Jonas Fonseca
^ permalink raw reply related
* Don't use "sscanf()" for tree mode scanning
From: Linus Torvalds @ 2006-05-28 23:16 UTC (permalink / raw)
To: Junio C Hamano, Git Mailing List
Doing an oprofile run on the result of my git rev-list memory leak fixes
and tree parsing cleanups, I was surprised by the third-highest entry
being
samples % image name app name symbol name
179751 2.7163 libc-2.4.so libc-2.4.so _IO_vfscanf@@GLIBC_2.4
where that 2.7% is actually more than 5% of one CPU, because this was run
on a dual CPU setup with the other CPU just being idle.
That seems to all be from the use of 'sscanf(tree, "%o", &mode)' for the
tree buffer parsing.
So do the trivial octal parsing by hand, which also gives us where the
first space in the string is (and thus where the pathname starts) so we
can get rid of the "strchr(tree, ' ')" call too.
This brings the "git rev-list --all --objects" time down from 63 seconds
to 55 seconds on the historical kernel archive for me, so it's quite
noticeable - tree parsing is a lot of what we end up doing when following
all the objects.
[ I also see a 5% speedup on a full "git fsck-objects" on the current
kernel archive, so that sscanf() really does seem to have hurt our
performance by a surprising amount ]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
tree-walk.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/tree-walk.c b/tree-walk.c
index 9f7abb7..3922058 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -47,18 +47,33 @@ void update_tree_entry(struct tree_desc
desc->size = size - len;
}
+static const char *get_mode(const char *str, unsigned int *modep)
+{
+ unsigned char c;
+ unsigned int mode = 0;
+
+ while ((c = *str++) != ' ') {
+ if (c < '0' || c > '7')
+ return NULL;
+ mode = (mode << 3) + (c - '0');
+ }
+ *modep = mode;
+ return str;
+}
+
const unsigned char *tree_entry_extract(struct tree_desc *desc, const char **pathp, unsigned int *modep)
{
void *tree = desc->buf;
unsigned long size = desc->size;
int len = strlen(tree)+1;
const unsigned char *sha1 = tree + len;
- const char *path = strchr(tree, ' ');
+ const char *path;
unsigned int mode;
- if (!path || size < len + 20 || sscanf(tree, "%o", &mode) != 1)
+ path = get_mode(tree, &mode);
+ if (!path || size < len + 20)
die("corrupt tree file");
- *pathp = path+1;
+ *pathp = path;
*modep = canon_mode(mode);
return sha1;
}
^ permalink raw reply related
* Re: [PATCH] Support for configurable git command aliases
From: Jakub Narebski @ 2006-05-28 22:57 UTC (permalink / raw)
To: git
In-Reply-To: <20060528215945.GD10488@pasky.or.cz>
Petr Baudis wrote:
> Dear diary, on Sat, May 27, 2006 at 02:52:35PM CEST, I got a letter
> where Horst von Brand <vonbrand@inf.utfsm.cl> said that...
>>
>> I don't like this syntax. What other stuff (beside "cmd") would be under
>> "[alias "co"]? Why not simply:
>>
>> [alias]
>> co = commit -a
>> publish = push public.site.com:/pub/scm/my-public-repo
>
> Nice, I like this.
>
> Well, the following isn't exactly the nicest code I have ever written...
> But it seems to work. ;-)
Well, if [alias] would be used also for giving default options for git
commands, e.g.
[alias]
log = log --pretty
(from what Petr "Pasky" Baudis said on IRC, currently on the right side
there should be only true git commands, which eliminates nicely problems
with recursion ;-), it would be better to ensure that aliases are checked
*only* for interactive sessions - otherwise using aliases for default
arguments would/could mess the scripts.
--
Jakub Narebski
Warsaw, Poland
^ permalink raw reply
* [PATCH] Read configuration also from ~/.gitrc
From: Petr Baudis @ 2006-05-28 22:26 UTC (permalink / raw)
To: Anand Kumria; +Cc: git
In-Reply-To: <20060526152837.GQ23852@progsoc.uts.edu.au>
Hi,
Dear diary, on Fri, May 26, 2006 at 05:28:37PM CEST, I got a letter
where Anand Kumria <wildfire@progsoc.uts.edu.au> said that...
> git is unable to construct a reasonable default email address in my
> current environment. So, I use GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL
> to override things.
>
> This has worked well but, now, I need to vary the email address for some
> repositories. Unfortunately the environment variables override
> .git/config.
>
> It would be good if things were like:
> - try to construct one automagically
> - use ~/.git/config (if available)
> - use .git/config
> - use environment variables
>
> That way I could set my default email address in ~/.git/config and
> override it as required for those repositories that need it.
hmm, might it be as simple as this?
---
This command makes Git read configuration from ~/.gitrc in addition
to the per-repository .git/config configuration file, and updates
the documentation accordingly (and also expands it a little).
Idea by Anand Kumria.
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
Documentation/git-commit-tree.txt | 9 +++++----
Documentation/git-repo-config.txt | 6 +++---
Documentation/git-var.txt | 5 +++--
Documentation/git.txt | 15 +++++++++++----
config.c | 6 +++++-
5 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt
index 41d1a1c..1b0d102 100644
--- a/Documentation/git-commit-tree.txt
+++ b/Documentation/git-commit-tree.txt
@@ -49,8 +49,9 @@ A commit encapsulates:
- committer name and email and the commit time.
If not provided, "git-commit-tree" uses your name, hostname and domain to
-provide author and committer info. This can be overridden by
-either `.git/config` file, or using the following environment variables.
+provide author and committer info. This can be overridden by either the
+`~/.gitrc` file, the `.git/config` file, or using the following
+environment variables.
GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL
@@ -60,8 +61,8 @@ either `.git/config` file, or using the
(nb "<", ">" and "\n"s are stripped)
-In `.git/config` file, the following items are used for GIT_AUTHOR_NAME and
-GIT_AUTHOR_EMAIL:
+In the configuration file, the following items are used for GIT_AUTHOR_NAME
+and GIT_AUTHOR_EMAIL:
[user]
name = "Your Name"
diff --git a/Documentation/git-repo-config.txt b/Documentation/git-repo-config.txt
index 660c18f..bb7f81f 100644
--- a/Documentation/git-repo-config.txt
+++ b/Documentation/git-repo-config.txt
@@ -3,7 +3,7 @@ git-repo-config(1)
NAME
----
-git-repo-config - Get and set options in .git/config
+git-repo-config - Get and set git runtime configuration options
SYNOPSIS
@@ -37,7 +37,7 @@ no checks or transformations are perform
This command will fail if:
-. The .git/config file is invalid,
+. The configuration file is invalid,
. Can not write to .git/config,
. no section was provided,
. the section or key is invalid,
@@ -70,7 +70,7 @@ OPTIONS
Remove all matching lines from .git/config.
-l, --list::
- List all variables set in .git/config.
+ List all variables set in ~/.gitrc or .git/config.
EXAMPLE
diff --git a/Documentation/git-var.txt b/Documentation/git-var.txt
index a5b1a0d..4679aef 100644
--- a/Documentation/git-var.txt
+++ b/Documentation/git-var.txt
@@ -18,8 +18,9 @@ OPTIONS
-------
-l::
Cause the logical variables to be listed. In addition, all the
- variables of the git configuration file .git/config are listed
- as well. (However, the configuration variables listing functionality
+ variables of the git configuration files `~/.gitrc` and `.git/config`
+ are listed as well.
+ (However, the configuration variables listing functionality
is deprecated in favor of `git-repo-config -l`.)
EXAMPLE
diff --git a/Documentation/git.txt b/Documentation/git.txt
index e474bdf..f4e5df5 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -116,7 +116,7 @@ gitlink:git-read-tree[1]::
Reads tree information into the index.
gitlink:git-repo-config[1]::
- Get and set options in .git/config.
+ Get and set git runtime configuration options.
gitlink:git-unpack-objects[1]::
Unpacks objects out of a packed archive.
@@ -473,8 +473,7 @@ gitlink:gitk[1]::
Configuration Mechanism
-----------------------
-Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file
-is used to hold per-repository configuration options. It is a
+You can adjust the Git behaviour by a configuration file. It is a
simple text file modelled after `.ini` format familiar to some
people. Here is an example:
@@ -496,7 +495,15 @@ #
------------
Various commands read from the configuration file and adjust
-their operation accordingly.
+their operation accordingly. See gitlink:git-repo-config[1]
+for details and list of options.
+
+Git first reads the per-user global configuration from `~/.gitrc`
+and then per-repository configuration from the `.git/config` file.
+Either of these files may be missing; the per-repository configuration
+wins in case of a conflict. Some behaviour can be also tweaked using
+environment variables; in general, they take precedence over configuration
+options.
Identifier Terminology
diff --git a/config.c b/config.c
index 0248c6d..8a98865 100644
--- a/config.c
+++ b/config.c
@@ -312,7 +312,11 @@ int git_config_from_file(config_fn_t fn,
int git_config(config_fn_t fn)
{
- return git_config_from_file(fn, git_path("config"));
+ int ret = 0;
+ if (getenv("HOME"))
+ ret += git_config_from_file(fn, mkpath("%s/.gitrc", getenv("HOME")));
+ ret += git_config_from_file(fn, git_path("config"));
+ return ret;
}
/*
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
A person is just about as big as the things that make them angry.
^ permalink raw reply related
* [PATCH 4/4] Remove "tree->entries" tree-entry list from tree parser
From: Linus Torvalds @ 2006-05-28 22:13 UTC (permalink / raw)
To: Junio C Hamano, Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0605281453460.5623@g5.osdl.org>
This finally removes the tree-entry list from "struct tree", since most of
the users can just use the tree-walk infrastructure to walk the raw tree
buffers instead of the tree-entry list.
The tree-entry list is inefficient, and generates tons of small
allocations for no good reason. The tree-walk infrastructure is generally
no harder to use than following a linked list, and allows us to do most
tree parsing in-place.
Some programs still use the old tree-entry lists, and are a bit painful to
convert without major surgery. For them we have a helper function that
creates a temporary tree-entry list on demand. We can convert those too
eventually, but with this they no longer affect any users who don't need
the explicit lists.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
builtin-ls-tree.c | 2 +
builtin-read-tree.c | 4 +--
builtin-rev-list.c | 26 ++++++++++------
fetch.c | 16 +++++++---
fsck-objects.c | 7 +++-
http-push.c | 30 +++++++++++++------
revision.c | 3 +-
tree.c | 81 ++++++++++++++++++++++++++++++++++++---------------
tree.h | 4 ++-
9 files changed, 116 insertions(+), 57 deletions(-)
diff --git a/builtin-ls-tree.c b/builtin-ls-tree.c
index 48385d5..b8d0d88 100644
--- a/builtin-ls-tree.c
+++ b/builtin-ls-tree.c
@@ -53,7 +53,7 @@ static int show_recursive(const char *ba
}
}
-static int show_tree(unsigned char *sha1, const char *base, int baselen,
+static int show_tree(const unsigned char *sha1, const char *base, int baselen,
const char *pathname, unsigned mode, int stage)
{
int retval = 0;
diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index f0b8dad..da0731c 100644
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
@@ -163,7 +163,7 @@ #endif
struct tree *tree = lookup_tree(posns[i]->sha1);
any_dirs = 1;
parse_tree(tree);
- subposns[i] = tree->entries;
+ subposns[i] = create_tree_entry_list(tree);
posns[i] = posns[i]->next;
src[i + merge] = &df_conflict_entry;
continue;
@@ -368,7 +368,7 @@ static int unpack_trees(merge_fn_t fn)
if (len) {
posns = xmalloc(len * sizeof(struct tree_entry_list *));
for (i = 0; i < len; i++) {
- posns[i] = ((struct tree *) posn->item)->entries;
+ posns[i] = create_tree_entry_list((struct tree *) posn->item);
posn = posn->next;
}
if (unpack_trees_rec(posns, len, "", fn, &indpos))
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 94f520b..6e2b898 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -113,7 +113,7 @@ static struct object_list **process_tree
const char *name)
{
struct object *obj = &tree->object;
- struct tree_entry_list *entry;
+ struct tree_desc desc;
struct name_path me;
if (!revs.tree_objects)
@@ -128,16 +128,22 @@ static struct object_list **process_tree
me.up = path;
me.elem = name;
me.elem_len = strlen(name);
- entry = tree->entries;
- tree->entries = NULL;
- while (entry) {
- struct tree_entry_list *next = entry->next;
- if (entry->directory)
- p = process_tree(lookup_tree(entry->sha1), p, &me, entry->name);
+
+ desc.buf = tree->buffer;
+ desc.size = tree->size;
+
+ while (desc.size) {
+ unsigned mode;
+ const char *name;
+ const unsigned char *sha1;
+
+ sha1 = tree_entry_extract(&desc, &name, &mode);
+ update_tree_entry(&desc);
+
+ if (S_ISDIR(mode))
+ p = process_tree(lookup_tree(sha1), p, &me, name);
else
- p = process_blob(lookup_blob(entry->sha1), p, &me, entry->name);
- free(entry);
- entry = next;
+ p = process_blob(lookup_blob(sha1), p, &me, name);
}
free(tree->buffer);
tree->buffer = NULL;
diff --git a/fetch.c b/fetch.c
index f7f8902..d9fe41f 100644
--- a/fetch.c
+++ b/fetch.c
@@ -41,16 +41,22 @@ static int process_tree(struct tree *tre
if (parse_tree(tree))
return -1;
- entry = tree->entries;
- tree->entries = NULL;
+ entry = create_tree_entry_list(tree);
while (entry) {
struct tree_entry_list *next = entry->next;
- if (process(entry->item.any))
- return -1;
- free(entry->name);
+
+ if (entry->directory) {
+ struct tree *tree = lookup_tree(entry->sha1);
+ process_tree(tree);
+ } else {
+ struct blob *blob = lookup_blob(entry->sha1);
+ process(&blob->object);
+ }
free(entry);
entry = next;
}
+ free(tree->buffer);
+ tree->buffer = NULL;
return 0;
}
diff --git a/fsck-objects.c b/fsck-objects.c
index 44b6465..ec99a7a 100644
--- a/fsck-objects.c
+++ b/fsck-objects.c
@@ -10,6 +10,7 @@ #include "refs.h"
#include "pack.h"
#define REACHABLE 0x0001
+#define SEEN 0x0002
static int show_root = 0;
static int show_tags = 0;
@@ -160,7 +161,7 @@ static int fsck_tree(struct tree *item)
struct tree_entry_list *entry, *last;
last = NULL;
- for (entry = item->entries; entry; entry = entry->next) {
+ for (entry = create_tree_entry_list(item); entry; entry = entry->next) {
if (strchr(entry->name, '/'))
has_full_path = 1;
has_zero_pad |= entry->zeropad;
@@ -204,7 +205,6 @@ static int fsck_tree(struct tree *item)
}
if (last)
free(last);
- item->entries = NULL;
free(item->buffer);
item->buffer = NULL;
@@ -276,6 +276,9 @@ static int fsck_sha1(unsigned char *sha1
struct object *obj = parse_object(sha1);
if (!obj)
return error("%s: object not found", sha1_to_hex(sha1));
+ if (obj->flags & SEEN)
+ return 0;
+ obj->flags |= SEEN;
if (obj->type == blob_type)
return 0;
if (obj->type == tree_type)
diff --git a/http-push.c b/http-push.c
index f492a5d..72ad89c 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1704,6 +1704,7 @@ static struct object_list **process_blob
return p;
obj->flags |= SEEN;
+ name = strdup(name);
return add_object(obj, p, path, name);
}
@@ -1713,7 +1714,7 @@ static struct object_list **process_tree
const char *name)
{
struct object *obj = &tree->object;
- struct tree_entry_list *entry;
+ struct tree_desc desc;
struct name_path me;
obj->flags |= LOCAL;
@@ -1724,21 +1725,30 @@ static struct object_list **process_tree
die("bad tree object %s", sha1_to_hex(obj->sha1));
obj->flags |= SEEN;
+ name = strdup(name);
p = add_object(obj, p, NULL, name);
me.up = path;
me.elem = name;
me.elem_len = strlen(name);
- entry = tree->entries;
- tree->entries = NULL;
- while (entry) {
- struct tree_entry_list *next = entry->next;
- if (entry->directory)
- p = process_tree(lookup_tree(entry->sha1), p, &me, entry->name);
+
+ desc.buf = tree->buffer;
+ desc.size = tree->size;
+
+ while (desc.size) {
+ unsigned mode;
+ const char *name;
+ const unsigned char *sha1;
+
+ sha1 = tree_entry_extract(&desc, &name, &mode);
+ update_tree_entry(&desc);
+
+ if (S_ISDIR(mode))
+ p = process_tree(lookup_tree(sha1), p, &me, name);
else
- p = process_blob(lookup_blob(entry->sha1), p, &me, entry->name);
- free(entry);
- entry = next;
+ p = process_blob(lookup_blob(sha1), p, &me, name);
}
+ free(tree->buffer);
+ tree->buffer = NULL;
return p;
}
diff --git a/revision.c b/revision.c
index 35f8e3b..c366178 100644
--- a/revision.c
+++ b/revision.c
@@ -63,8 +63,7 @@ void mark_tree_uninteresting(struct tree
return;
if (parse_tree(tree) < 0)
die("bad tree %s", sha1_to_hex(obj->sha1));
- entry = tree->entries;
- tree->entries = NULL;
+ entry = create_tree_entry_list(tree);
while (entry) {
struct tree_entry_list *next = entry->next;
if (entry->directory)
diff --git a/tree.c b/tree.c
index 8a7fdd4..db6e59f 100644
--- a/tree.c
+++ b/tree.c
@@ -151,22 +151,65 @@ struct tree *lookup_tree(const unsigned
return (struct tree *) obj;
}
-int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)
+static int track_tree_refs(struct tree *item)
{
+ int n_refs = 0, i;
+ struct object_refs *refs;
struct tree_desc desc;
- struct tree_entry_list **list_p;
- int n_refs = 0;
+ /* Count how many entries there are.. */
+ desc.buf = item->buffer;
+ desc.size = item->size;
+ while (desc.size) {
+ n_refs++;
+ update_tree_entry(&desc);
+ }
+
+ /* Allocate object refs and walk it again.. */
+ i = 0;
+ refs = alloc_object_refs(n_refs);
+ desc.buf = item->buffer;
+ desc.size = item->size;
+ while (desc.size) {
+ unsigned mode;
+ const char *name;
+ const unsigned char *sha1;
+ struct object *obj;
+
+ sha1 = tree_entry_extract(&desc, &name, &mode);
+ update_tree_entry(&desc);
+ if (S_ISDIR(mode))
+ obj = &lookup_tree(sha1)->object;
+ else
+ obj = &lookup_blob(sha1)->object;
+ refs->ref[i++] = obj;
+ }
+ set_object_refs(&item->object, refs);
+ return 0;
+}
+
+int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)
+{
if (item->object.parsed)
return 0;
item->object.parsed = 1;
item->buffer = buffer;
item->size = size;
- desc.buf = buffer;
- desc.size = size;
+ if (track_object_refs)
+ track_tree_refs(item);
+ return 0;
+}
+
+struct tree_entry_list *create_tree_entry_list(struct tree *tree)
+{
+ struct tree_desc desc;
+ struct tree_entry_list *ret = NULL;
+ struct tree_entry_list **list_p = &ret;
+
+ desc.buf = tree->buffer;
+ desc.size = tree->size;
- list_p = &item->entries;
while (desc.size) {
unsigned mode;
const char *path;
@@ -186,29 +229,19 @@ int parse_tree_buffer(struct tree *item,
entry->next = NULL;
update_tree_entry(&desc);
- n_refs++;
*list_p = entry;
list_p = &entry->next;
}
+ return ret;
+}
- if (track_object_refs) {
- struct tree_entry_list *entry;
- unsigned i = 0;
- struct object_refs *refs = alloc_object_refs(n_refs);
- for (entry = item->entries; entry; entry = entry->next) {
- struct object *obj;
-
- if (entry->directory)
- obj = &lookup_tree(entry->sha1)->object;
- else
- obj = &lookup_blob(entry->sha1)->object;
- refs->ref[i++] = obj;
- }
-
- set_object_refs(&item->object, refs);
+void free_tree_entry_list(struct tree_entry_list *list)
+{
+ while (list) {
+ struct tree_entry_list *next = list->next;
+ free(list);
+ list = next;
}
-
- return 0;
}
int parse_tree(struct tree *item)
diff --git a/tree.h b/tree.h
index a27bae4..c7b5248 100644
--- a/tree.h
+++ b/tree.h
@@ -20,9 +20,11 @@ struct tree {
struct object object;
void *buffer;
unsigned long size;
- struct tree_entry_list *entries;
};
+struct tree_entry_list *create_tree_entry_list(struct tree *);
+void free_tree_entry_list(struct tree_entry_list *);
+
struct tree *lookup_tree(const unsigned char *sha1);
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);
^ permalink raw reply related
* [PATCH 3/4] Switch "read_tree_recursive()" over to tree-walk functionality
From: Linus Torvalds @ 2006-05-28 22:11 UTC (permalink / raw)
To: Junio C Hamano, Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0605281453460.5623@g5.osdl.org>
Don't use the tree_entry list, it really had no major reason not to just
walk the raw tree instead.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
tree.c | 33 ++++++++++++++++++++-------------
1 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/tree.c b/tree.c
index ba8742c..8a7fdd4 100644
--- a/tree.c
+++ b/tree.c
@@ -78,19 +78,26 @@ int read_tree_recursive(struct tree *tre
int stage, const char **match,
read_tree_fn_t fn)
{
- struct tree_entry_list *list;
+ struct tree_desc desc;
+
if (parse_tree(tree))
return -1;
- list = tree->entries;
- while (list) {
- struct tree_entry_list *current = list;
- list = list->next;
- if (!match_tree_entry(base, baselen, current->name,
- current->mode, match))
+
+ desc.buf = tree->buffer;
+ desc.size = tree->size;
+
+ while (desc.size) {
+ unsigned mode;
+ const char *name;
+ const unsigned char *sha1;
+
+ sha1 = tree_entry_extract(&desc, &name, &mode);
+ update_tree_entry(&desc);
+
+ if (!match_tree_entry(base, baselen, name, mode, match))
continue;
- switch (fn(current->sha1, base, baselen,
- current->name, current->mode, stage)) {
+ switch (fn(sha1, base, baselen, name, mode, stage)) {
case 0:
continue;
case READ_TREE_RECURSIVE:
@@ -98,16 +105,16 @@ int read_tree_recursive(struct tree *tre
default:
return -1;
}
- if (current->directory) {
+ if (S_ISDIR(mode)) {
int retval;
- int pathlen = strlen(current->name);
+ int pathlen = strlen(name);
char *newbase;
newbase = xmalloc(baselen + 1 + pathlen);
memcpy(newbase, base, baselen);
- memcpy(newbase + baselen, current->name, pathlen);
+ memcpy(newbase + baselen, name, pathlen);
newbase[baselen + pathlen] = '/';
- retval = read_tree_recursive(lookup_tree(current->sha1),
+ retval = read_tree_recursive(lookup_tree(sha1),
newbase,
baselen + pathlen + 1,
stage, match, fn);
^ permalink raw reply related
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