* Re: [PATCH] Remove more gcc extension usage.
From: Paul Jakma @ 2006-07-12 13:46 UTC (permalink / raw)
To: Shawn Pearce; +Cc: Jan-Benedict Glaw, Junio C Hamano, git
In-Reply-To: <20060710052255.GA15173@spearce.org>
On Mon, 10 Jul 2006, Shawn Pearce wrote:
> So Monday turned out to be today. The compiler version:
>
> $ cc -V
> cc: Forte Developer 7 C 5.4 2002/03/09
> usage: cc [ options] files. Use 'cc -flags' for details
> and from `man cc`:
>
> -xc99 enables C99 features:
Only a subset of C99.
You need SOS10 for full C99 support, Sun have made SOS freely
downloadable since version 10.
regards,
--
Paul Jakma paul@clubi.ie paul@jakma.org Key ID: 64A2FF6A
Fortune:
It is easier to change the specification to fit the program than vice versa.
^ permalink raw reply
* Sharing repositories later on
From: Erik Mouw @ 2006-07-12 13:28 UTC (permalink / raw)
To: git
Hi,
I just learned out about "git clone -s" to share objects between
repositories. How do I use that with already existing repositories?
Right now I have a "linux-2.6" repository to track Linus's 2.6 kernel
tree and an "elinux-2.6" tree that pulls from linux-2.6 and holds my
own changes. I created a file .git/objects/info/alternates that
contains the line "/home/erik/git/linux-2.6/.git/objects". Now how do I
get rid of the "old" objects and packs without loosing my changes?
Erik
--
+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands
^ permalink raw reply
* Re: remove perl from git-commit.sh
From: Alex Riesen @ 2006-07-12 12:23 UTC (permalink / raw)
To: Petr Baudis; +Cc: git, Junio C Hamano
In-Reply-To: <20060712114805.GD13776@pasky.or.cz>
On 7/12/06, Petr Baudis <pasky@suse.cz> wrote:
> BTW, why people so often want to keep stuff like the following from
> commit messages?
Well, strictly speaking it isn't the description of what the patch does.
> > than having to constantly patch git-commit.sh for binmode
> > or perl path (Windows has no stable tool set, and perl
> > for instance often resides "somewhere").
>
> ...but I would prefer much better if we could actually fix the problem.
> I'm not sure what "patching for binmode" takes but it sounds that we
ActiveState Perl normally replaces \n in the output with \r\n, which is
annoying, as the rest of git does output \n verbatim.
> should do it for the other Perl scripts anyway. If Cygwin usually really
> doesn't have stable Perl path, you could special-case PERL_PATH in
It's not cygwin. It's an organization typical for windows environements:
stinky trash can.
> Makefile for Cygwin to be just "perl" (or perhaps that's the issue only
> for non-source packages so you might want to simply set PERL_PATH to
> perl when building those).
I did. I didn't mention it because the patch was about the binmode.
sh is from cygwin here, so just removing this one dependency helps
a lot. I will change other scripts as soon as they get problematic.
Another small problem is with windows pathnames (activestate perl
expects _windows_ path, but allows forward slashes in it: c:/a/b/c).
I have calls to cygpath (converts cygwin path to windows and vice
versa) all over (not everywhere, just clone, rerere, mv, shortlog and
fmt-merge-msg. The tools that were important to me) just to deal
with this. It's a horribly unstable and poorly tested and breaks from
time to time but it mostly works. As I saw no complaints here about
the same problem I have never submitted the changes. Maybe I am
just unlucky to have to deal with windows so often.
^ permalink raw reply
* Re: remove perl from git-commit.sh
From: Petr Baudis @ 2006-07-12 11:48 UTC (permalink / raw)
To: Alex Riesen; +Cc: git, Junio C Hamano
In-Reply-To: <81b0412b0607120415g243f2160tf42c40e52b8bc9ac@mail.gmail.com>
Dear diary, on Wed, Jul 12, 2006 at 01:15:03PM CEST, I got a letter
where Alex Riesen <raa.lkml@gmail.com> said that...
> ---
BTW, why people so often want to keep stuff like the following from
commit messages?
> git-commit.sh has only ohne place where perl is used
> and it can actually quite trivially be done in sh.
> git-ls-files without "-z" produces quoted output, even if
> is different from that produced by perl code it could be
> enough. Otherwise I'd better suggest to add another
> quoting style (replacing only \t, \n and backslash)
Of course getting rid of Perl from the "essentials" is an option...
> than having to constantly patch git-commit.sh for binmode
> or perl path (Windows has no stable tool set, and perl
> for instance often resides "somewhere").
...but I would prefer much better if we could actually fix the problem.
I'm not sure what "patching for binmode" takes but it sounds that we
should do it for the other Perl scripts anyway. If Cygwin usually really
doesn't have stable Perl path, you could special-case PERL_PATH in
Makefile for Cygwin to be just "perl" (or perhaps that's the issue only
for non-source packages so you might want to simply set PERL_PATH to
perl when building those).
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Snow falling on Perl. White noise covering line noise.
Hides all the bugs too. -- J. Putnam
^ permalink raw reply
* Re: remove perl from git-commit.sh
From: Alex Riesen @ 2006-07-12 11:41 UTC (permalink / raw)
To: Nikolai Weibull; +Cc: git, Junio C Hamano
In-Reply-To: <dbfc82860607120435v5482ce31pdf002f049c51669a@mail.gmail.com>
On 7/12/06, Nikolai Weibull <now@bitwi.se> wrote:
> Anyway, I was just wondering
> what the motives were, not questioning them ;-).
Being forced to use ActiveState Perl on a W2K in a
corporate environment.
^ permalink raw reply
* Re: remove perl from git-commit.sh
From: Nikolai Weibull @ 2006-07-12 11:35 UTC (permalink / raw)
To: Alex Riesen; +Cc: git, Junio C Hamano
In-Reply-To: <81b0412b0607120423q8c75ecl7d42dfd67f99a549@mail.gmail.com>
On 7/12/06, Alex Riesen <raa.lkml@gmail.com> wrote:
> On 7/12/06, Nikolai Weibull <now@bitwi.se> wrote:
> > > Otherwise I'd better suggest to add another
> > > quoting style (replacing only \t, \n and backslash)
> > One could always do the quoting with sed, or am I missing something?
> No, but if look closely at this list you'll find a lot of incompatibilities
> in sed too. So the less, the better
Well, that's true, of course, but something as "simple" as what is
needed in this case should be possible. Anyway, I was just wondering
what the motives were, not questioning them ;-).
nikolai
^ permalink raw reply
* Re: remove perl from git-commit.sh
From: Alex Riesen @ 2006-07-12 11:23 UTC (permalink / raw)
To: Nikolai Weibull; +Cc: git, Junio C Hamano
In-Reply-To: <dbfc82860607120417m19c0ecefydb4b3f4cf60d646a@mail.gmail.com>
On 7/12/06, Nikolai Weibull <now@bitwi.se> wrote:
> > Otherwise I'd better suggest to add another
> > quoting style (replacing only \t, \n and backslash)
>
> One could always do the quoting with sed, or am I missing something?
>
No, but if look closely at this list you'll find a lot of incompatibilities
in sed too. So the less, the better
^ permalink raw reply
* Re: remove perl from git-commit.sh
From: Nikolai Weibull @ 2006-07-12 11:17 UTC (permalink / raw)
To: Alex Riesen; +Cc: git, Junio C Hamano
In-Reply-To: <81b0412b0607120415g243f2160tf42c40e52b8bc9ac@mail.gmail.com>
On 7/12/06, Alex Riesen <raa.lkml@gmail.com> wrote:
> Otherwise I'd better suggest to add another
> quoting style (replacing only \t, \n and backslash)
One could always do the quoting with sed, or am I missing something?
nikolai
^ permalink raw reply
* remove perl from git-commit.sh
From: Alex Riesen @ 2006-07-12 11:15 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
[-- Attachment #1: Type: text/plain, Size: 631 bytes --]
It is really annoying when the essentials do not work.
I think we could improve at least them, by minimizing
their dependencies to external tools.
---
git-commit.sh has only ohne place where perl is used
and it can actually quite trivially be done in sh.
git-ls-files without "-z" produces quoted output, even if
is different from that produced by perl code it could be
enough. Otherwise I'd better suggest to add another
quoting style (replacing only \t, \n and backslash) than
having to constantly patch git-commit.sh for binmode
or perl path (Windows has no stable tool set, and perl
for instance often resides "somewhere").
[-- Attachment #2: 0001-remove-perl-from-git-commit.sh.txt --]
[-- Type: text/plain, Size: 1501 bytes --]
From 69bf41df4ef69d0f1e4ab52942c59bb3fd568cb8 Mon Sep 17 00:00:00 2001
From: Alex Riesen <raa.lkml@gmail.com>
Date: Wed, 12 Jul 2006 13:02:23 +0200
Subject: remove perl from git-commit.sh
---
git-commit.sh | 32 +++++++++++++-------------------
1 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/git-commit.sh b/git-commit.sh
index 802dd72..4cf3fab 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -138,32 +138,26 @@ #'
if test -z "$untracked_files"; then
option="--directory --no-empty-directory"
fi
+ hdr_shown=
if test -f "$GIT_DIR/info/exclude"
then
- git-ls-files -z --others $option \
+ git-ls-files --others $option \
--exclude-from="$GIT_DIR/info/exclude" \
--exclude-per-directory=.gitignore
else
- git-ls-files -z --others $option \
+ git-ls-files --others $option \
--exclude-per-directory=.gitignore
fi |
- @@PERL@@ -e '$/ = "\0";
- my $shown = 0;
- while (<>) {
- chomp;
- s|\\|\\\\|g;
- s|\t|\\t|g;
- s|\n|\\n|g;
- s/^/# /;
- if (!$shown) {
- print "#\n# Untracked files:\n";
- print "# (use \"git add\" to add to commit)\n";
- print "#\n";
- $shown = 1;
- }
- print "$_\n";
- }
- '
+ while read line; do
+ if [ -z "$hdr_shown" ]; then
+ echo '#'
+ echo '# Untracked files:'
+ echo '# (use "git add" to add to commit)'
+ echo '#'
+ hdr_shown=1
+ fi
+ echo "# $line"
+ done
if test -n "$verbose" -a -z "$IS_INITIAL"
then
--
1.4.1.gb4adf
^ permalink raw reply related
* [RFC] New REuse REcorded REsolve tool.
From: Shawn Pearce @ 2006-07-12 9:33 UTC (permalink / raw)
To: git
What follows is a draft implementation of a different git-rerere tool.
Please use caution when testing this on any real repository. It has
been very lightly tested and only for a small handful of cases.
Its probably going to fail on something that I haven't tried yet.
It could overwrite entries in your current index, making it possible
to commit a file with <<<< === >>>> conflict markers in it. :-)
My goal with this tool is to get something that git-merge can use
as a pre-filter to the current git-rerere and by which git-merge
can automatically reuse prior resolutions on a more predictable
basis then what happens with git-rerere today. Ideally I want
git-rerere2 to make the merge commit for me if it was successful
at resolving all unmerged entries and thus have git-merge return
with an exit code of 0 rather than 1.
Lots of TODOs still exist:
- Prune cache at some threshold in size/age.
- Anchor prior recorded merge commits along a special ref (to prevent
them from pruning while they are still in the cache).
- Automatically create merge commit if successfully resolved.
- Test cases.
- More/better documentation.
- Friendly error handling on invalid command line option combinations.
And all of the above means no signoff yet. :-)
-->8--
New REuse REcorded REsolve tool.
git-rerere2 attempts to remember lines of development that have been
merged together before by tracking merge commits in .git/rr2-cache.
When two lines of development are merged together again in the
future git-rerere2 searches its cache for the most recent merge
commit between the two branches and tries to select the merge commit
that contains the maximum number of commits from each branch.
If such a commit exists in the cache then git-rerere2 attempts
to resolve any unmerged index entries by comparing the conflicted
stage 1/2/3 from the chosen prior merge against the current index;
if stage 1 is unchanged and stage 2/3 are unchanged (but possibly
permuted in order) then the working directory (and current index)
are updated with resolved file as committed in the chosen commit.
Unlike git-rerere, git-rerere2 can remember and reuse structual
modifications (adds/deletes, mode changes, type changes) as well as
reuse binary file resolutions which the standard RCS `merge` tool
wouldn't have been able to process. However, also unlike git-rerere,
git-rerere2 does not attempt to merge the contents of a file.
---
.gitignore | 1
Makefile | 2
git-commit.sh | 4 +
git-merge.sh | 4 +
git-rerere2.perl | 281 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 291 insertions(+), 1 deletions(-)
diff --git a/.gitignore b/.gitignore
index fb0fa3f..1a3ed42 100644
--- a/.gitignore
+++ b/.gitignore
@@ -87,6 +87,7 @@ git-repack
git-repo-config
git-request-pull
git-rerere
+git-rerere2
git-reset
git-resolve
git-rev-list
diff --git a/Makefile b/Makefile
index 5b7bac8..e1fa96a 100644
--- a/Makefile
+++ b/Makefile
@@ -147,7 +147,7 @@ SCRIPT_SH = \
SCRIPT_PERL = \
git-archimport.perl git-cvsimport.perl git-relink.perl \
- git-shortlog.perl git-rerere.perl \
+ git-shortlog.perl git-rerere.perl git-rerere2.perl \
git-annotate.perl git-cvsserver.perl \
git-svnimport.perl git-mv.perl git-cvsexportcommit.perl \
git-send-email.perl git-svn.perl
diff --git a/git-commit.sh b/git-commit.sh
index 802dd72..3451072 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -742,6 +742,10 @@ else
fi
ret="$?"
rm -f "$GIT_DIR/COMMIT_MSG" "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG"
+if test -d "$GIT_DIR/rr2-cache"
+then
+ git-rerere2 --record
+fi
if test -d "$GIT_DIR/rr-cache"
then
git-rerere
diff --git a/git-merge.sh b/git-merge.sh
index a9cfafb..53a907b 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -375,6 +375,10 @@ Conflicts:
sed -e 's/^[^ ]* / /' |
uniq
} >>"$GIT_DIR/MERGE_MSG"
+ if test -d "$GIT_DIR/rr2-cache"
+ then
+ git-rerere2 --reset --remember-unmerged --reuse "$head_arg" "$@"
+ fi
if test -d "$GIT_DIR/rr-cache"
then
git-rerere
diff --git a/git-rerere2.perl b/git-rerere2.perl
new file mode 100644
index 0000000..8925faf
--- /dev/null
+++ b/git-rerere2.perl
@@ -0,0 +1,281 @@
+#!/usr/bin/perl
+#
+# REuse REcorded REsolve. This tool records a conflicted automerge
+# result and its hand resolution, and helps to resolve future
+# automerge that results in the same conflict.
+#
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use File::Spec::Functions qw(catfile);
+use Git;
+
+my $repo = Git->repository;
+my $cache_dir = catfile($repo->repo_path, 'rr2-cache');
+my $cache_toc = catfile($cache_dir, 'contents');
+my $tmp_lst = catfile($cache_dir, 'current_unmerged');
+
+my ($enable, $disable,
+ $reset, $remember_unmerged,
+ $reuse, $dry_run, $no_update,
+ $record,
+ $man, $help);
+GetOptions(
+ "enable" => \$enable,
+ "disable" => \$disable,
+ "reset" => \$reset,
+ "remember-unmerged" => \$remember_unmerged,
+ "reuse" => \$reuse,
+ "n|dry-run" =>, \$dry_run,
+ "no-update" =>, \$no_update,
+ "record" => \$record,
+ "man" => \$man,
+ "help" => \$help,
+);
+pod2usage(1) if $help;
+pod2usage(-exitstatus => 0, -verbose => 2) if $man;
+
+if ($enable) {
+ mkdir $cache_dir, 0777;
+ die "Failed to create $cache_dir: $!\n" unless -d $cache_dir;
+ print "Created $cache_dir\n";
+ exit 0;
+}
+exit unless -d $cache_dir;
+
+my (%unmerged);
+sub load_unmerged ($$);
+sub save_unmerged ($$);
+
+if ($reset) {
+ unlink $tmp_lst;
+} else {
+ if (open(T, '<',$tmp_lst)) {
+ load_unmerged \*T, \%unmerged;
+ close T;
+ }
+}
+
+if ($remember_unmerged) {
+ my ($f,$c) = $repo->command_output_pipe(qw(ls-files -z --unmerged));
+ load_unmerged $f, \%unmerged;
+ $repo->command_close_pipe($f,$c);
+
+ if (%unmerged) {
+ open(T, '>',$tmp_lst) or die "Can't overwrite $tmp_lst: $!\n";
+ save_unmerged \*T, \%unmerged;
+ close T;
+ } else {
+ unlink $tmp_lst;
+ }
+}
+
+if ($reuse && !$record && @ARGV > 1 && %unmerged) {
+ my %cache_by_parent;
+ if (open(T,'<',$cache_toc)) {
+ while (<T>) {
+ chop;
+ my ($then, $result, @parents) = split / /;
+ my $e = [$then, $result, @parents];
+ push @{$cache_by_parent{$_}}, $e foreach @parents;
+ }
+ close T;
+ }
+
+ my $base = $repo->command_oneline('merge-base',@ARGV);
+ my %possib_results;
+ foreach my $r (@ARGV) {
+ my ($f,$c) = $repo->command_output_pipe('rev-list',"^$base",$r);
+ while (<$f>) {
+ chop;
+ my $e_arr = $cache_by_parent{$_};
+ next unless $e_arr;
+ $possib_results{$_->[1]}++ foreach @$e_arr;
+ }
+ $repo->command_close_pipe($f,$c);
+ }
+ my @p = sort {$b->[0] <=> $a->[0]}
+ grep {$possib_results{$_} == @ARGV} keys %possib_results;
+ my $best = $p[0];
+
+ my @reuse;
+ if (open(T, '<',catfile($cache_dir, $best))) {
+ my %best_conflicts;
+ $_ = <T>;
+ load_unmerged \*T, \%best_conflicts;
+ close T;
+
+ print "Trying to reuse resolution(s) from $best.\n";
+ my ($name, $u);
+ while (($name,$u) = each %unmerged) {
+ my $b = $best_conflicts{$name};
+ next unless $b; # no prior resolution
+ next unless $u->[1] eq $b->[1]; # different base
+ next unless (($u->[2] eq $b->[2] && $u->[3] eq $b->[3])
+ || ($u->[2] eq $b->[3] && $u->[3] eq $b->[2]));
+
+ push @reuse, $name;
+ }
+ }
+
+ if (@reuse) {
+ print "Reuse ",$_,"\n" foreach @reuse;
+ print "\n";
+
+ if ($dry_run) {
+ print "Skipped checkout (--dry-run enabled).\n";
+ } else {
+ print "Checking out resolved versions...\n";
+ my $idx = catfile($repo->repo_path,'rerere2idx');
+ local $ENV{GIT_INDEX_FILE} = $idx;
+ $repo->command(qw(read-tree --reset),$best);
+ my ($f,$c) = $repo->command_input_pipe(
+ qw(checkout-index --force -z --stdin));
+ print $f $_, "\0" foreach @reuse;
+ $repo->command_close_pipe($f,$c);
+ unlink $idx;
+ }
+ delete $unmerged{$_} foreach @reuse;
+
+ if ($dry_run) {
+ print "Skipped index update (--dry-run enabled).\n";
+ } elsif ($no_update) {
+ print "Skipped index update (--no-update enabled).\n";
+ } else {
+ print "Updating index with resolved versions...\n";
+ my ($f,$c) = $repo->command_input_pipe(
+ qw(update-index -z --stdin));
+ print $f $_, "\0" foreach @reuse;
+ $repo->command_close_pipe($f,$c);
+ }
+
+ if (%unmerged) {
+ unless ($dry_run) {
+ open(T, '>',$tmp_lst)
+ or die "Can't overwrite $tmp_lst: $!\n";
+ save_unmerged \*T, \%unmerged;
+ close T;
+ }
+ print "Some conflicts remain.\n";
+ exit 1;
+ } else {
+ unlink $tmp_lst unless $dry_run;
+ print "Everything resolved.\n";
+ exit 0;
+ }
+ } else {
+ print "No matching resolutions available for reuse.\n";
+ }
+ exit 1;
+}
+
+if (!$reuse && $record && %unmerged) {
+ my $head = $repo->command_oneline(qw(rev-parse --verify HEAD));
+ my $now = time;
+
+ my @parents;
+ my ($f,$c) = $repo->command_output_pipe(qw(cat-file commit HEAD));
+ while (<$f>) {
+ push @parents, $1 if /^parent ([0-9a-f]{40})/;
+ last if /^author /;
+ }
+ $repo->command_close_pipe($f,$c);
+
+ unlink $tmp_lst;
+ exit unless @parents > 1;
+
+ open(T, '>',catfile($cache_dir,$head)) or die "Can't cache: $!\n";
+ print T $now,' ',$head,' ',join(' ', @parents),"\n";
+ save_unmerged \*T, \%unmerged;
+ close T;
+
+ my %toc;
+ if (open(T,'<',$cache_toc)) {
+ while (<T>) {
+ chop;
+ my ($then, $result, $ps) = split / /, $_, 3;
+ $toc{$ps} = [$then, $result, $ps];
+ }
+ close T;
+ }
+
+ my $ps = join(' ', sort @parents);
+ $toc{$ps} = [$now, $head, $ps];
+
+ open(T, '>',$cache_toc) or die "Can't update $cache_toc: $!\n";
+ foreach my $e (sort {$a->[0] <=> $b->[1]} values %toc) {
+ print T join(' ', @$e), "\n";
+ }
+ close T;
+}
+
+exit;
+
+sub load_unmerged ($$) {
+ my ($f, $um) = @_;
+ local $_;
+ local $/ = "\0";
+ my $cur_name;
+ my @cur_stages = ('', '', '', '');
+ while ($_ = <$f>) {
+ chomp;
+ my ($info,$name) = split /\t/, $_, 2;
+ if ($cur_name && $name ne $cur_name) {
+ $um->{$cur_name} = [@cur_stages];
+ @cur_stages = ('', '', '', '');
+ }
+ $cur_name = $name;
+ $info =~ / ([123])$/;
+ $cur_stages[$1] = $info;
+ }
+ $um->{$cur_name} = [@cur_stages] if $cur_name;
+}
+
+sub save_unmerged ($$) {
+ my ($f, $um) = @_;
+ foreach my $cur_name (sort keys %$um) {
+ my $u = $um->{$cur_name};
+ foreach my $stage (1..3) {
+ my $s = $u->[$stage];
+ next unless $s;
+ print $f $s,"\t",$cur_name,"\0";
+ }
+ }
+}
+
+__END__
+
+=head1 NAME
+
+git-rerere2 - REuse REcorded REsolve
+
+=head1 SYNOPSIS
+
+ git-rerere2 --enable ; #to activate
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--enable>
+
+Activate git-rerere2 in the current repository.
+
+=item B<-n> | B<--dry-run>
+
+Perform reuse actions in memory but don't alter the working directory
+or the index.
+
+=item B<--no-update>
+
+Update the working directory with a reused resolution but don't
+update the index. This will leave the index entry unmerged with
+all relevant stages still contained within it. It is the caller's
+responsibility to update the index prior to commit.
+
+=back
+
+=cut
+
--
1.4.1.gd3d5
^ permalink raw reply related
* Re: [PATCH] gitweb.cgi: Teach tree->raw to not require the hash of the blob
From: Jakub Narebski @ 2006-07-12 8:32 UTC (permalink / raw)
To: git
In-Reply-To: <7v64i31h6f.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
> Luben Tuikov <ltuikov@yahoo.com> writes:
>
>> Teach tree->raw to not require the hash of the blob, but to
>> figure it out from the file name. This allows to externally
>> link to files into the repository, such that the hash is not
>> required. I.e. the file obtained would be as of the HEAD
>> commit.
>>
>> In contrast tree->blob for binary files passes the hash, as
>> does tree->blob->plain for "text/*" files.
> I think _allowing_ to accept filename not hash is a sane change,
> and would be useful if you want to allow linking to always the
> HEAD version from external sites, but I do not think listing the
> raw link in the tree view without the hash is a good idea. It
> makes things quite confusing that "blob" link in its
> neighbourhood gives the blob from that specific version, but
> "raw" gives the version from HEAD, even when you are browsing
> something other than HEAD.
>
> BTW, can somebody volunteer to be a gitweb/ "subsystem
> maintainer"?
I think the change to raw aka. blob_plain and not to plain is because in
plain view you have this HEAD link which takes us to HEAD revision of the
file (even if we are on different branch IIRC).
Workaround for either format is to remove 'h' (hash) parameter entirely, and
put in 'hb' (hashbase aka headref aka branch) the branch name. Gitweb then
shows the contents of latest version of the file.
BTW. sometimes you want to link to specific version of the file, and
sometimes to newest. I think it would be best (if possible, feasible, and
not too much resource consuming) that links from tree specified by hash be
to specified by hash version of file, while links from tree specified by
headref and name only would have links to latest version of the file.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH 2/3] sha1_file: add the ability to parse objects in "pack file format"
From: Peter Baumann @ 2006-07-12 8:28 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Peter Baumann, git, Linus Torvalds
In-Reply-To: <7vveq3z41v.fsf@assigned-by-dhcp.cox.net>
On Wed, Jul 12, 2006 at 12:16:12AM -0700, Junio C Hamano wrote:
> >> + bits = 4;
> >> + size = c & 0xf;
> >> + while (!(c & 0x80)) {
> >> + if (bits >= 8*sizeof(long))
> >> + return -1;
> >> + c = *map++;
> >> + size += (c & 0x7f) << bits;
> >> + bits += 7;
> >> + mapsize--;
> >> + }
> >
> > This doesn't match the logic used in unpack_object_header, which is used
> > in the packs:
> > ...
> >> + c = (type << 4) | (len & 15);
> >> + len >>= 4;
> >> + hdr_len = 1;
> >> + while (len) {
> >> + *hdr++ = c;
> >> + hdr_len++;
> >> + c = (len & 0x7f);
> >> + len >>= 7;
> >> + }
> >> + *hdr = c | 0x80;
> >> + return hdr_len;
> >> +}
> >> +
> >
> > Dito, but in this case see pack-objects.c
>
> Well, while these are not strictly needed to match, there is no
> good reason to make them inconsistent. Very well spotted.
>
During packing one could simply copy the existing object into the generated
pack in the non delta case, so I think this _is_ necessary/usefull.
-Peter Baumann
^ permalink raw reply
* Re: Re : 2 questions on git-send-email usage
From: Franck Bui-Huu @ 2006-07-12 7:37 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Franck, git
In-Reply-To: <7vd5cc3q0o.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
>
> Haven't checked the code around the patch yet, but does it work
> when the original commit log message ends with a blank line and
> existing signed-off-by lines by other people? You do not want
> an extra blank lines there.
>
argh, no I just tested the previous case. Here is an update
which fix all cases.
-- >8 --
[PATCH] Add a newline before appending "Signed-off-by:"
It looks nicer.
Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
---
log-tree.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/log-tree.c b/log-tree.c
index 9d8d46f..69d5c8a 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -17,9 +17,10 @@ static int append_signoff(char *buf, int
int signoff_len = strlen(signoff);
static const char signed_off_by[] = "Signed-off-by: ";
char *cp = buf;
+ int has_signoff = 0;
/* Do we have enough space to add it? */
- if (buf_sz - at <= strlen(signed_off_by) + signoff_len + 2)
+ if (buf_sz - at <= strlen(signed_off_by) + signoff_len + 3)
return at;
/* First see if we already have the sign-off by the signer */
@@ -32,8 +33,11 @@ static int append_signoff(char *buf, int
!strncmp(cp, signoff, signoff_len) &&
isspace(cp[signoff_len]))
return at; /* we already have him */
+ has_signoff = 1;
}
+ if (!has_signoff)
+ buf[at++] = '\n';
strcpy(buf + at, signed_off_by);
at += strlen(signed_off_by);
strcpy(buf + at, signoff);
--
1.4.1.g55b7
^ permalink raw reply related
* Re: [PATCH 2/3] sha1_file: add the ability to parse objects in "pack file format"
From: Junio C Hamano @ 2006-07-12 7:16 UTC (permalink / raw)
To: Peter Baumann; +Cc: git, Linus Torvalds
In-Reply-To: <slrneb96rd.dma.Peter.B.Baumann@xp.machine.xx>
Peter Baumann <Peter.B.Baumann@stud.informatik.uni-erlangen.de>
writes:
>> + bits = 4;
>> + size = c & 0xf;
>> + while (!(c & 0x80)) {
>> + if (bits >= 8*sizeof(long))
>> + return -1;
>> + c = *map++;
>> + size += (c & 0x7f) << bits;
>> + bits += 7;
>> + mapsize--;
>> + }
>
> This doesn't match the logic used in unpack_object_header, which is used
> in the packs:
> ...
>> + c = (type << 4) | (len & 15);
>> + len >>= 4;
>> + hdr_len = 1;
>> + while (len) {
>> + *hdr++ = c;
>> + hdr_len++;
>> + c = (len & 0x7f);
>> + len >>= 7;
>> + }
>> + *hdr = c | 0x80;
>> + return hdr_len;
>> +}
>> +
>
> Dito, but in this case see pack-objects.c
Well, while these are not strictly needed to match, there is no
good reason to make them inconsistent. Very well spotted.
^ permalink raw reply
* Re: [PATCH 2/3] sha1_file: add the ability to parse objects in "pack file format"
From: Peter Baumann @ 2006-07-12 6:49 UTC (permalink / raw)
To: git
In-Reply-To: <Pine.LNX.4.64.0607111656250.5623@g5.osdl.org>
On 2006-07-12, Linus Torvalds <torvalds@osdl.org> wrote:
[...]
> Anyway, I think this following patch replaces the old 2/3 and 3/3 (it
> still depends on the original [1/3] cleanup.
>
> (It also renames and reverses the meaning of the config file option: it's
> now "[core] LegacyHeaders = true" for using legacy headers.)
>
> Not heavily tested, but seems ok.
>
> sf? Dscho? Can you check this thing out?
>
> Linus
> ----
[...]
> diff --git a/sha1_file.c b/sha1_file.c
> index 8734d50..475b23d 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -684,26 +684,74 @@ static void *map_sha1_file_internal(cons
> return map;
> }
>
> -static int unpack_sha1_header(z_stream *stream, void *map, unsigned long mapsize, void *buffer, unsigned long size)
> +static int unpack_sha1_header(z_stream *stream, unsigned char *map, unsigned long mapsize, void *buffer, unsigned long bufsiz)
> {
> + unsigned char c;
> + unsigned int word, bits;
> + unsigned long size;
> + static const char *typename[8] = {
> + NULL, /* OBJ_EXT */
> + "commit", "tree", "blob", "tag",
> + NULL, NULL, NULL
> + };
> + const char *type;
> +
> /* Get the data stream */
> memset(stream, 0, sizeof(*stream));
> stream->next_in = map;
> stream->avail_in = mapsize;
> stream->next_out = buffer;
> - stream->avail_out = size;
> + stream->avail_out = bufsiz;
> +
> + /*
> + * Is it a zlib-compressed buffer? If so, the first byte
> + * must be 0x78 (15-bit window size, deflated), and the
> + * first 16-bit word is evenly divisible by 31
> + */
> + word = (map[0] << 8) + map[1];
> + if (map[0] == 0x78 && !(word % 31)) {
> + inflateInit(stream);
> + return inflate(stream, 0);
> + }
> +
> + c = *map++;
> + mapsize--;
> + type = typename[(c >> 4) & 7];
> + if (!type)
> + return -1;
> +
> + bits = 4;
> + size = c & 0xf;
> + while (!(c & 0x80)) {
> + if (bits >= 8*sizeof(long))
> + return -1;
> + c = *map++;
> + size += (c & 0x7f) << bits;
> + bits += 7;
> + mapsize--;
> + }
This doesn't match the logic used in unpack_object_header, which is used
in the packs:
static unsigned long unpack_object_header(struct packed_git *p, unsigned long offset,
enum object_type *type, unsigned long *sizep)
{
unsigned shift;
unsigned char *pack, c;
unsigned long size;
if (offset >= p->pack_size)
die("object offset outside of pack file");
pack = (unsigned char *) p->pack_base + offset;
c = *pack++;
offset++;
*type = (c >> 4) & 7;
size = c & 15;
shift = 4;
while (c & 0x80) { <==========
if (offset >= p->pack_size)
die("object offset outside of pack file");
c = *pack++;
offset++;
size += (c & 0x7f) << shift;
shift += 7;
}
*sizep = size; <==========
return offset;
}
> @@ -1414,6 +1462,49 @@ static int write_buffer(int fd, const vo
> return 0;
> }
>
> +static int write_binary_header(unsigned char *hdr, enum object_type type, unsigned long len)
> +{
> + int hdr_len;
> + unsigned char c;
> +
> + c = (type << 4) | (len & 15);
> + len >>= 4;
> + hdr_len = 1;
> + while (len) {
> + *hdr++ = c;
> + hdr_len++;
> + c = (len & 0x7f);
> + len >>= 7;
> + }
> + *hdr = c | 0x80;
> + return hdr_len;
> +}
> +
Dito, but in this case see pack-objects.c
/*
* The per-object header is a pretty dense thing, which is
* - first byte: low four bits are "size", then three bits of "type",
* and the high bit is "size continues".
* - each byte afterwards: low seven bits are size continuation,
* with the high bit being "size continues"
*/
static int encode_header(enum object_type type, unsigned long size, unsigned char *hdr)
{
int n = 1;
unsigned char c;
if (type < OBJ_COMMIT || type > OBJ_DELTA)
die("bad type %d", type);
c = (type << 4) | (size & 15);
size >>= 4;
while (size) {
*hdr++ = c | 0x80; <=======
c = size & 0x7f;
size >>= 7;
n++;
}
*hdr = c; <=======
return n;
}
-Peter Baumann
^ permalink raw reply
* Re: [PATCH 2/3] sha1_file: add the ability to parse objects in "pack file format"
From: Junio C Hamano @ 2006-07-12 6:35 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0607111755180.5623@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
> I shouldn't have introduced the new TYPE_xxx macros. I should just have
> used the same OBJ_xxx macros that we use in the pack-file.
>
> Junio: this patch is totally independent from the other patches, and is on
> top of you current "master". It gets rid of TYPE_xxx in favor of the
> OBJ_xxx enums, which are moved from pack.h into object.h.
You seem to have forgotten one file (fetch-pack.c) but that was
trivial. I'll apply and push it out shortly.
This might collide with a few topic branches but I have rerere
to help me cope with it ;-).
^ permalink raw reply
* Re: [PATCH] gitweb.cgi: Teach tree->raw to not require the hash of the blob
From: Junio C Hamano @ 2006-07-12 6:16 UTC (permalink / raw)
To: ltuikov; +Cc: git
In-Reply-To: <20060712034345.14009.qmail@web31802.mail.mud.yahoo.com>
Luben Tuikov <ltuikov@yahoo.com> writes:
> Teach tree->raw to not require the hash of the blob, but to
> figure it out from the file name. This allows to externally
> link to files into the repository, such that the hash is not
> required. I.e. the file obtained would be as of the HEAD
> commit.
>
> In contrast tree->blob for binary files passes the hash, as
> does tree->blob->plain for "text/*" files.
>
> Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
> ---
> gitweb/gitweb.cgi | 20 ++++++++++++++++----
> 1 files changed, 16 insertions(+), 4 deletions(-)
This has exactly the same line number problem.
@@ -1678,8 +1690,7 @@ sub git_tree {
$cgi->a({-href => "$my_uri?" . esc...
# " | " . $cgi->a({-href => "$my_uri...
" | " . $cgi->a({-href => "$my_uri...
- " | " . $cgi->a({-href => "$my_uri...
+ " | " . $cgi->a({-href => "$my_uri...
"</td>\n";
} elsif ($t_type eq "tree") {
print "<td class=\"list\">" .
You are removing one line and adding one line, so the number of
old and new lines better match.
Hand-applied, tried, got confused and dropped.
I think _allowing_ to accept filename not hash is a sane change,
and would be useful if you want to allow linking to always the
HEAD version from external sites, but I do not think listing the
raw link in the tree view without the hash is a good idea. It
makes things quite confusing that "blob" link in its
neighbourhood gives the blob from that specific version, but
"raw" gives the version from HEAD, even when you are browsing
something other than HEAD.
BTW, can somebody volunteer to be a gitweb/ "subsystem
maintainer"?
^ permalink raw reply
* Re: [PATCH] gitweb.css: Courer fonts for commits and tree-diff
From: Junio C Hamano @ 2006-07-12 6:02 UTC (permalink / raw)
To: ltuikov; +Cc: git
In-Reply-To: <20060712034323.48414.qmail@web31806.mail.mud.yahoo.com>
Luben Tuikov <ltuikov@yahoo.com> writes:
> Courer fonts for the commit header, commit message,
> and tree-diff.
>
> Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
I really do not want to be in the position to judge a patch like
this, whose evaluation is solely based on "prettiness" factor.
But if I really have to, I would say this makes things uglier
and less readable. Maybe asking for monospace is less yucky but
naming Courier explicitly?
BTW what tool do you use to generate and send your patches? I
remember another patch from you recently did not apply and it
turned out the problem was that the last hunk had line numbers
wrong. This patch has exactly the same problem and I am
wondering why.
I count 10 lines of original and 15 lines of new material in
this hunk but the hunk header claims to have 11 lines of
original text.
---
gitweb/gitweb.css | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index 98410f5..b51282b 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
...
@@ -142,11 +144,15 @@ table {
padding: 8px 4px;
}
-table.project_list, table.diff_tree {
+table.project_list {
border-spacing: 0;
}
+table.diff_tree {
+ border-spacing: 0;
+ font-family: courier;
+}
+
table.blame {
border-collapse: collapse;
}
--
1.4.1.g9ca3
^ permalink raw reply
* Re: Error writing loose object on Cygwin
From: Shawn Pearce @ 2006-07-12 5:00 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.64.0607112132540.5623@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> wrote:
> On Tue, 11 Jul 2006, Junio C Hamano wrote:
>
> > Shawn Pearce <spearce@spearce.org> writes:
> >
> > > Has anyone else seen this type of behavior before? Any suggestions
> > > on debugging this issue?
> >
> > I would suggest raising this (politely) to Cygwin people.
>
> Well, since it apparently works with W2000, and breaks with XP, I suspect
> it's actually Windows that just returns the wrong error code.
>
> It's entirely possible that we should just make that whole
>
> if (ret == ENOENT)
>
> go away. Yes, it's the right error code if a subdirectory is missing, and
> yes, POSIX requires it, and yes, WXP is probably just a horrible piece of
> sh*t, but on the other hand, I don't think git really has any serious
> reason to even care.
>
> So we might as well say that if the link() fails for _any_ reason, we'll
> try to see if doing the mkdir() and re-trying the link helps.
Hmm. Its a single mkdir call before we give up and tell the user
something is wrong. The following change appears to work OK here on
a reasonably POSIX compliant system (OK meaning it reports errors reasonably).
Given that this type of error (failed link) shouldn't happen
that often, except for on Coda or FAT (according to a comment in
move_temp_to_file), I guess the change is OK and comes with little
penalty. But for Coda and FAT users things are going to slow down a
little bit as we try mkdir for every new loose object being created
before we try rename.
Tomorrow when I get access to my Cygwin system again I'll try to
write up a tiny test case which shows the error behavior we are
seeing and send it to the Cygwin mailing list, as this really does
seem to be a Cygwin or Windows issue. But of course having GIT
handle this case slightly better wouldn't be bad either. :-)
diff --git a/sha1_file.c b/sha1_file.c
index 8734d50..db4bddc 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1336,26 +1336,23 @@ static int link_temp_to_file(const char
return 0;
/*
- * Try to mkdir the last path component if that failed
- * with an ENOENT.
+ * Try to mkdir the last path component if that failed.
*
* Re-try the "link()" regardless of whether the mkdir
* succeeds, since a race might mean that somebody
* else succeeded.
*/
ret = errno;
- if (ret == ENOENT) {
- char *dir = strrchr(filename, '/');
- if (dir) {
- *dir = 0;
- mkdir(filename, 0777);
- if (adjust_shared_perm(filename))
- return -2;
- *dir = '/';
- if (!link(tmpfile, filename))
- return 0;
- ret = errno;
- }
+ char *dir = strrchr(filename, '/');
+ if (dir) {
+ *dir = 0;
+ mkdir(filename, 0777);
+ if (adjust_shared_perm(filename))
+ return -2;
+ *dir = '/';
+ if (!link(tmpfile, filename))
+ return 0;
+ ret = errno;
}
return ret;
}
^ permalink raw reply related
* Re: git-daemon problem
From: Junio C Hamano @ 2006-07-12 4:42 UTC (permalink / raw)
To: Matthias Lederhofer; +Cc: git
In-Reply-To: <E1G0QeX-0003hG-0I@moooo.ath.cx>
Matthias Lederhofer <matled@gmx.net> writes:
> A few weeks ago upgrading from 1.3.x to 1.4.1 I had a problem with
> git-daemon. I started git-daemon on a terminal but did not redirect
> stdin/stdout/stderr to /dev/null (actually using daemon(8) on freebsd
> without -f but just disowning the process and closing the terminal
> works fine too, nothing freebsd/daemon(8) specific). After closing
> the terminal I was not able to use the git-daemon anymore with some
> versions of the git. So now I took some time and tried to find what
> was the reason for that.
HMMMMMMMMM.
I did this silly experiment. Close, instead of connecting them
to /dev/null, the low 3 file descriptors:
$ git-daemon 0<&- 1>&- 2>&- --export-all /pub/git &
$ lsof -p $! | sed -n -e '/ FD /p' -e '/[0-9]u/p'
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
git-daemo 13921 junio 0u IPv6 1973673 TCP *:9419 (LISTEN)
git-daemo 13921 junio 1u IPv4 1973674 TCP *:9419 (LISTEN)
It gets worse. This is what happens when you close only fd #2.
$ git-daemon 2>&- --export-all /pub/git &
$ lsof -p $! | sed -n -e '/ FD /p' -e '/[0-9]u/p'
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
git-daemo 13961 junio 0u CHR 136,7 9 /dev/pts/7
git-daemo 13961 junio 1u CHR 136,7 9 /dev/pts/7
git-daemo 13961 junio 2u IPv6 1975187 TCP *:9419 (LISTEN)
git-daemo 13961 junio 3u IPv4 1975188 TCP *:9419 (LISTEN)
Now, after we do accept(), we spawn a subprocess in handle(),
and in the child process dup2() the fd connected to the peer to
fd 0 and 1 of the child process -- and we do not do anything to
fd 2 of the child process.
If you do not close any of the low 3 file descriptors, fd 2 of
the child process is connected to whatever error stream of
daemon is, so you would not see this problem, but this certainly
is bad.
Maybe we should check if fd 2 is sane at daemon startup, and
otherwise open /dev/null for writing and dup2 it to fd 2?
Currently, under --inetd mode we have freopen of stderr, but
that does not help this issue. It would make die() and error()
in daemon itself behave sanely but when you start the daemon
with the low file descriptors closed, fileno(stderr) may be
different from 2.
^ permalink raw reply
* Re: Error writing loose object on Cygwin
From: Linus Torvalds @ 2006-07-12 4:36 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Shawn Pearce, git
In-Reply-To: <7vr70r1ms5.fsf@assigned-by-dhcp.cox.net>
On Tue, 11 Jul 2006, Junio C Hamano wrote:
> Shawn Pearce <spearce@spearce.org> writes:
>
> > Has anyone else seen this type of behavior before? Any suggestions
> > on debugging this issue?
>
> I would suggest raising this (politely) to Cygwin people.
Well, since it apparently works with W2000, and breaks with XP, I suspect
it's actually Windows that just returns the wrong error code.
It's entirely possible that we should just make that whole
if (ret == ENOENT)
go away. Yes, it's the right error code if a subdirectory is missing, and
yes, POSIX requires it, and yes, WXP is probably just a horrible piece of
sh*t, but on the other hand, I don't think git really has any serious
reason to even care.
So we might as well say that if the link() fails for _any_ reason, we'll
try to see if doing the mkdir() and re-trying the link helps.
Linus
^ permalink raw reply
* Re: [PATCH 2/3] sha1_file: add the ability to parse objects in "pack file format"
From: Linus Torvalds @ 2006-07-12 4:31 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, sf, Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0607111755180.5623@g5.osdl.org>
On Tue, 11 Jul 2006, Linus Torvalds wrote:
>
> Junio: this patch is totally independent from the other patches, and is on
> top of you current "master". It gets rid of TYPE_xxx in favor of the
> OBJ_xxx enums, which are moved from pack.h into object.h.
...
> static inline const char *typename(unsigned int type)
> {
> - return type_names[type > TYPE_TAG ? TYPE_BAD : type];
> + return type_names[type > OBJ_TAG ? OBJ_BAD : type];
That should be "[type > OBJ_BAD ? OBJ_BAD : type]"
Not that any users will care, because the current users of the typename()
macro are the old TYPE_xxxx users which will never see the OBJ_DELTA case
anyway. So it's not a big deal, but let's do it right for future users (ie
if the pack-file things want to start using "typename(type)" and they
actually _have_ delta descriptors).
Linus
^ permalink raw reply
* Re: Error writing loose object on Cygwin
From: Junio C Hamano @ 2006-07-12 4:15 UTC (permalink / raw)
To: Shawn Pearce; +Cc: git
In-Reply-To: <20060712035746.GA7863@spearce.org>
Shawn Pearce <spearce@spearce.org> writes:
> Has anyone else seen this type of behavior before? Any suggestions
> on debugging this issue?
I would suggest raising this (politely) to Cygwin people.
^ permalink raw reply
* Error writing loose object on Cygwin
From: Shawn Pearce @ 2006-07-12 3:57 UTC (permalink / raw)
To: git
I've got a weird bug that a coworker just found today on Cygwin
running on XP. He was trying to do `git add foo` in a brand new
repository which was stored on a Solaris server[*1*] and mounted
on his XP desktop by way of samba[*2*].
My coworker received the "unable to write sha1 filename %s:%s"
error in move_temp_to_file during git-add. After sprinkling some
printfs all over that area of sha1_file.c I concluded that GIT was
receiving back EACCES as the error from the first link attempt in
link_temp_to_file (rather than ENOENT) when the parent directory
didn't exist.
Reproducing it on XP systems was easy, as was working around the
problem:
mkdir foo
cd foo
git init-db
echo foo>foo
git add foo # dies with "unable to write sha1 filename"
mkdir .git/objects/25
git add foo # now succeeds without error
What's more interesting is Windows 2000 systems accessing the same
Solaris server and the same samba server with the same version of
Cygwin didn't have any problems (the first git add succeeded).
This was Cygwin 1.5.19-4 and 1.4.1. The tiny patch below fixes
the issue for us, but certainly seems like not the best way to go
about this... But right now I've got my coworkers running GIT 1.4.1
plus the patch below.
Has anyone else seen this type of behavior before? Any suggestions
on debugging this issue?
Footnotes:
[*1*] Yes, this Solaris server is the same one that has the old
compiler and almost no GNU tools, which means GIT, StGIT,
cogito and pg's higher level functions are all broken...
[*2*] Yes, Solaris is a real UNIX and the coworker should just use
GIT there. The problem is we have some GIT based scripts which
mirror a version control tool that is only available through
a Java applet running in Internet Explorer on a Windows
system. Which means although we can use GIT on Solaris
there are some operations that we need to execute on
Windows...
-->8--
Assume EACCES means ENOENT when creating sha1 objects.
---
sha1_file.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index 8179630..c04d6a5 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1344,7 +1344,7 @@ static int link_temp_to_file(const char
* else succeeded.
*/
ret = errno;
- if (ret == ENOENT) {
+ if (ret == ENOENT || ret == EACCES) {
char *dir = strrchr(filename, '/');
if (dir) {
*dir = 0;
--
1.4.1
^ permalink raw reply related
* Re: [PATCH 2/3] sha1_file: add the ability to parse objects in "pack file format"
From: Linus Torvalds @ 2006-07-12 3:45 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, sf, Git Mailing List
In-Reply-To: <Pine.LNX.4.63.0607120226210.29667@wbgn013.biozentrum.uni-wuerzburg.de>
On Wed, 12 Jul 2006, Johannes Schindelin wrote:
>>
> I completely forgot to mention that type_names[] is already declared in
> object.h. Obviously, it is not really important, but maybe it would be
> better to obey the DRY principle (think addition of "bind" object type).
Actually, the type_names[] array in object.h is _totally_ different. That
one is indexed by TYPE_xxx, not OBJ_xxxx.
And yeah, it's stupid to have two different numberings for the same thing,
and we really really shouldn't. But the OBJ_xxx numbering was originally a
a totally internal implementation detail to just the pack-files.
I shouldn't have introduced the new TYPE_xxx macros. I should just have
used the same OBJ_xxx macros that we use in the pack-file.
Junio: this patch is totally independent from the other patches, and is on
top of you current "master". It gets rid of TYPE_xxx in favor of the
OBJ_xxx enums, which are moved from pack.h into object.h.
That way, we can't have people mixing up the two different kinds of type
enumeration.
(Eventually, I want to get rid of passing around the "type strings"
entirely, and this will help - no confusion about two different integer
enumeration).
Linus
----
diff --git a/blob.c b/blob.c
index 496f270..d1af2e6 100644
--- a/blob.c
+++ b/blob.c
@@ -10,12 +10,12 @@ struct blob *lookup_blob(const unsigned
if (!obj) {
struct blob *ret = alloc_blob_node();
created_object(sha1, &ret->object);
- ret->object.type = TYPE_BLOB;
+ ret->object.type = OBJ_BLOB;
return ret;
}
if (!obj->type)
- obj->type = TYPE_BLOB;
- if (obj->type != TYPE_BLOB) {
+ obj->type = OBJ_BLOB;
+ if (obj->type != OBJ_BLOB) {
error("Object %s is a %s, not a blob",
sha1_to_hex(sha1), typename(obj->type));
return NULL;
diff --git a/builtin-diff.c b/builtin-diff.c
index ae901dd..cb38f44 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -285,9 +285,9 @@ int cmd_diff(int argc, const char **argv
obj = deref_tag(obj, NULL, 0);
if (!obj)
die("invalid object '%s' given.", name);
- if (obj->type == TYPE_COMMIT)
+ if (obj->type == OBJ_COMMIT)
obj = &((struct commit *)obj)->tree->object;
- if (obj->type == TYPE_TREE) {
+ if (obj->type == OBJ_TREE) {
if (ARRAY_SIZE(ent) <= ents)
die("more than %d trees given: '%s'",
(int) ARRAY_SIZE(ent), name);
@@ -297,7 +297,7 @@ int cmd_diff(int argc, const char **argv
ents++;
continue;
}
- if (obj->type == TYPE_BLOB) {
+ if (obj->type == OBJ_BLOB) {
if (2 <= blobs)
die("more than two blobs given: '%s'", name);
memcpy(blob[blobs].sha1, obj->sha1, 20);
diff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c
index 6527482..b3c4f98 100644
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
@@ -177,7 +177,7 @@ static void shortlog(const char *name, u
int flags = UNINTERESTING | TREECHANGE | SEEN | SHOWN | ADDED;
branch = deref_tag(parse_object(sha1), sha1_to_hex(sha1), 40);
- if (!branch || branch->type != TYPE_COMMIT)
+ if (!branch || branch->type != OBJ_COMMIT)
return;
setup_revisions(0, NULL, rev, NULL);
diff --git a/builtin-grep.c b/builtin-grep.c
index 4c2f7df..a79bac3 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -891,9 +891,9 @@ static int grep_tree(struct grep_opt *op
static int grep_object(struct grep_opt *opt, const char **paths,
struct object *obj, const char *name)
{
- if (obj->type == TYPE_BLOB)
+ if (obj->type == OBJ_BLOB)
return grep_sha1(opt, obj->sha1, name);
- if (obj->type == TYPE_COMMIT || obj->type == TYPE_TREE) {
+ if (obj->type == OBJ_COMMIT || obj->type == OBJ_TREE) {
struct tree_desc tree;
void *data;
int hit;
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 63bad0e..8f32871 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -167,16 +167,16 @@ static void show_commit_list(struct rev_
const char *name = pending->name;
if (obj->flags & (UNINTERESTING | SEEN))
continue;
- if (obj->type == TYPE_TAG) {
+ if (obj->type == OBJ_TAG) {
obj->flags |= SEEN;
add_object_array(obj, name, &objects);
continue;
}
- if (obj->type == TYPE_TREE) {
+ if (obj->type == OBJ_TREE) {
process_tree((struct tree *)obj, &objects, NULL, name);
continue;
}
- if (obj->type == TYPE_BLOB) {
+ if (obj->type == OBJ_BLOB) {
process_blob((struct blob *)obj, &objects, NULL, name);
continue;
}
diff --git a/commit.c b/commit.c
index c6bf10d..46d5867 100644
--- a/commit.c
+++ b/commit.c
@@ -56,7 +56,7 @@ static struct commit *check_commit(struc
const unsigned char *sha1,
int quiet)
{
- if (obj->type != TYPE_COMMIT) {
+ if (obj->type != OBJ_COMMIT) {
if (!quiet)
error("Object %s is a %s, not a commit",
sha1_to_hex(sha1), typename(obj->type));
@@ -86,11 +86,11 @@ struct commit *lookup_commit(const unsig
if (!obj) {
struct commit *ret = alloc_commit_node();
created_object(sha1, &ret->object);
- ret->object.type = TYPE_COMMIT;
+ ret->object.type = OBJ_COMMIT;
return ret;
}
if (!obj->type)
- obj->type = TYPE_COMMIT;
+ obj->type = OBJ_COMMIT;
return check_commit(obj, sha1, 0);
}
diff --git a/describe.c b/describe.c
index 8e68d5d..324ca89 100644
--- a/describe.c
+++ b/describe.c
@@ -67,7 +67,7 @@ static int get_name(const char *path, co
* Otherwise only annotated tags are used.
*/
if (!strncmp(path, "refs/tags/", 10)) {
- if (object->type == TYPE_TAG)
+ if (object->type == OBJ_TAG)
prio = 2;
else
prio = 1;
diff --git a/fetch-pack.c b/fetch-pack.c
index f2c51eb..b7824db 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -46,7 +46,7 @@ static int rev_list_insert_ref(const cha
{
struct object *o = deref_tag(parse_object(sha1), path, 0);
- if (o && o->type == TYPE_COMMIT)
+ if (o && o->type == OBJ_COMMIT)
rev_list_push((struct commit *)o, SEEN);
return 0;
@@ -256,14 +256,14 @@ static int mark_complete(const char *pat
{
struct object *o = parse_object(sha1);
- while (o && o->type == TYPE_TAG) {
+ while (o && o->type == OBJ_TAG) {
struct tag *t = (struct tag *) o;
if (!t->tagged)
break; /* broken repository */
o->flags |= COMPLETE;
o = parse_object(t->tagged->sha1);
}
- if (o && o->type == TYPE_COMMIT) {
+ if (o && o->type == OBJ_COMMIT) {
struct commit *commit = (struct commit *)o;
commit->object.flags |= COMPLETE;
insert_by_date(commit, &complete);
@@ -357,7 +357,7 @@ static int everything_local(struct ref *
* in sync with the other side at some time after
* that (it is OK if we guess wrong here).
*/
- if (o->type == TYPE_COMMIT) {
+ if (o->type == OBJ_COMMIT) {
struct commit *commit = (struct commit *)o;
if (!cutoff || cutoff < commit->date)
cutoff = commit->date;
@@ -376,7 +376,7 @@ static int everything_local(struct ref *
struct object *o = deref_tag(lookup_object(ref->old_sha1),
NULL, 0);
- if (!o || o->type != TYPE_COMMIT || !(o->flags & COMPLETE))
+ if (!o || o->type != OBJ_COMMIT || !(o->flags & COMPLETE))
continue;
if (!(o->flags & SEEN)) {
diff --git a/fsck-objects.c b/fsck-objects.c
index ef54a8a..e167f41 100644
--- a/fsck-objects.c
+++ b/fsck-objects.c
@@ -297,13 +297,13 @@ static int fsck_sha1(unsigned char *sha1
if (obj->flags & SEEN)
return 0;
obj->flags |= SEEN;
- if (obj->type == TYPE_BLOB)
+ if (obj->type == OBJ_BLOB)
return 0;
- if (obj->type == TYPE_TREE)
+ if (obj->type == OBJ_TREE)
return fsck_tree((struct tree *) obj);
- if (obj->type == TYPE_COMMIT)
+ if (obj->type == OBJ_COMMIT)
return fsck_commit((struct commit *) obj);
- if (obj->type == TYPE_TAG)
+ if (obj->type == OBJ_TAG)
return fsck_tag((struct tag *) obj);
/* By now, parse_object() would've returned NULL instead. */
return objerror(obj, "unknown type '%d' (internal fsck error)", obj->type);
@@ -472,7 +472,7 @@ static int fsck_cache_tree(struct cache_
}
mark_reachable(obj, REACHABLE);
obj->used = 1;
- if (obj->type != TYPE_TREE)
+ if (obj->type != OBJ_TREE)
err |= objerror(obj, "non-tree in cache-tree");
}
for (i = 0; i < it->subtree_nr; i++)
diff --git a/http-push.c b/http-push.c
index f761584..4768619 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1784,16 +1784,16 @@ static int get_delta(struct rev_info *re
if (obj->flags & (UNINTERESTING | SEEN))
continue;
- if (obj->type == TYPE_TAG) {
+ if (obj->type == OBJ_TAG) {
obj->flags |= SEEN;
p = add_one_object(obj, p);
continue;
}
- if (obj->type == TYPE_TREE) {
+ if (obj->type == OBJ_TREE) {
p = process_tree((struct tree *)obj, p, NULL, name);
continue;
}
- if (obj->type == TYPE_BLOB) {
+ if (obj->type == OBJ_BLOB) {
p = process_blob((struct blob *)obj, p, NULL, name);
continue;
}
@@ -1960,12 +1960,12 @@ static int ref_newer(const unsigned char
* old. Otherwise we require --force.
*/
o = deref_tag(parse_object(old_sha1), NULL, 0);
- if (!o || o->type != TYPE_COMMIT)
+ if (!o || o->type != OBJ_COMMIT)
return 0;
old = (struct commit *) o;
o = deref_tag(parse_object(new_sha1), NULL, 0);
- if (!o || o->type != TYPE_COMMIT)
+ if (!o || o->type != OBJ_COMMIT)
return 0;
new = (struct commit *) o;
@@ -2044,7 +2044,7 @@ static void add_remote_info_ref(struct r
fwrite_buffer(ref_info, 1, len, buf);
free(ref_info);
- if (o->type == TYPE_TAG) {
+ if (o->type == OBJ_TAG) {
o = deref_tag(o, ls->dentry_name, 0);
if (o) {
len = strlen(ls->dentry_name) + 45;
diff --git a/name-rev.c b/name-rev.c
index 083d067..f92f14e 100644
--- a/name-rev.c
+++ b/name-rev.c
@@ -84,14 +84,14 @@ static int name_ref(const char *path, co
if (tags_only && strncmp(path, "refs/tags/", 10))
return 0;
- while (o && o->type == TYPE_TAG) {
+ while (o && o->type == OBJ_TAG) {
struct tag *t = (struct tag *) o;
if (!t->tagged)
break; /* broken repository */
o = parse_object(t->tagged->sha1);
deref = 1;
}
- if (o && o->type == TYPE_COMMIT) {
+ if (o && o->type == OBJ_COMMIT) {
struct commit *commit = (struct commit *)o;
if (!strncmp(path, "refs/heads/", 11))
@@ -111,7 +111,7 @@ static const char* get_rev_name(struct o
struct rev_name *n;
struct commit *c;
- if (o->type != TYPE_COMMIT)
+ if (o->type != OBJ_COMMIT)
return "undefined";
c = (struct commit *) o;
n = c->util;
@@ -172,7 +172,7 @@ int main(int argc, char **argv)
}
o = deref_tag(parse_object(sha1), *argv, 0);
- if (!o || o->type != TYPE_COMMIT) {
+ if (!o || o->type != OBJ_COMMIT) {
fprintf(stderr, "Could not get commit for %s. Skipping.\n",
*argv);
continue;
diff --git a/object.c b/object.c
index 37277f9..e7ca56e 100644
--- a/object.c
+++ b/object.c
@@ -19,7 +19,8 @@ struct object *get_indexed_object(unsign
}
const char *type_names[] = {
- "none", "blob", "tree", "commit", "bad"
+ "none", "commit", "tree", "blob", "tag",
+ "bad type 5", "bad type 6", "delta", "bad",
};
static unsigned int hash_obj(struct object *obj, unsigned int n)
@@ -88,7 +89,7 @@ void created_object(const unsigned char
{
obj->parsed = 0;
obj->used = 0;
- obj->type = TYPE_NONE;
+ obj->type = OBJ_NONE;
obj->flags = 0;
memcpy(obj->sha1, sha1, 20);
@@ -131,7 +132,7 @@ struct object *lookup_unknown_object(con
if (!obj) {
union any_object *ret = xcalloc(1, sizeof(*ret));
created_object(sha1, &ret->object);
- ret->object.type = TYPE_NONE;
+ ret->object.type = OBJ_NONE;
return &ret->object;
}
return obj;
diff --git a/object.h b/object.h
index e0125e1..7893e94 100644
--- a/object.h
+++ b/object.h
@@ -24,12 +24,19 @@ struct object_array {
#define TYPE_BITS 3
#define FLAG_BITS 27
-#define TYPE_NONE 0
-#define TYPE_BLOB 1
-#define TYPE_TREE 2
-#define TYPE_COMMIT 3
-#define TYPE_TAG 4
-#define TYPE_BAD 5
+/*
+ * The object type is stored in 3 bits.
+ */
+enum object_type {
+ OBJ_NONE = 0,
+ OBJ_COMMIT = 1,
+ OBJ_TREE = 2,
+ OBJ_BLOB = 3,
+ OBJ_TAG = 4,
+ /* 5/6 for future expansion */
+ OBJ_DELTA = 7,
+ OBJ_BAD,
+};
struct object {
unsigned parsed : 1;
@@ -40,14 +47,14 @@ struct object {
};
extern int track_object_refs;
-extern const char *type_names[];
+extern const char *type_names[9];
extern unsigned int get_max_object_index(void);
extern struct object *get_indexed_object(unsigned int);
static inline const char *typename(unsigned int type)
{
- return type_names[type > TYPE_TAG ? TYPE_BAD : type];
+ return type_names[type > OBJ_TAG ? OBJ_BAD : type];
}
extern struct object_refs *lookup_object_refs(struct object *);
diff --git a/pack-check.c b/pack-check.c
diff --git a/pack.h b/pack.h
index 694e0c5..eb07b03 100644
--- a/pack.h
+++ b/pack.h
@@ -1,20 +1,7 @@
#ifndef PACK_H
#define PACK_H
-/*
- * The packed object type is stored in 3 bits.
- * The type value 0 is a reserved prefix if ever there is more than 7
- * object types, or any future format extensions.
- */
-enum object_type {
- OBJ_EXT = 0,
- OBJ_COMMIT = 1,
- OBJ_TREE = 2,
- OBJ_BLOB = 3,
- OBJ_TAG = 4,
- /* 5/6 for future expansion */
- OBJ_DELTA = 7,
-};
+#include "object.h"
/*
* Packed object header
diff --git a/revision.c b/revision.c
index 7df9089..874e349 100644
--- a/revision.c
+++ b/revision.c
@@ -135,7 +135,7 @@ static struct commit *handle_commit(stru
/*
* Tag object? Look what it points to..
*/
- while (object->type == TYPE_TAG) {
+ while (object->type == OBJ_TAG) {
struct tag *tag = (struct tag *) object;
if (revs->tag_objects && !(flags & UNINTERESTING))
add_pending_object(revs, object, tag->tag);
@@ -148,7 +148,7 @@ static struct commit *handle_commit(stru
* Commit object? Just return it, we'll do all the complex
* reachability crud.
*/
- if (object->type == TYPE_COMMIT) {
+ if (object->type == OBJ_COMMIT) {
struct commit *commit = (struct commit *)object;
if (parse_commit(commit) < 0)
die("unable to parse commit %s", name);
@@ -164,7 +164,7 @@ static struct commit *handle_commit(stru
* Tree object? Either mark it uniniteresting, or add it
* to the list of objects to look at later..
*/
- if (object->type == TYPE_TREE) {
+ if (object->type == OBJ_TREE) {
struct tree *tree = (struct tree *)object;
if (!revs->tree_objects)
return NULL;
@@ -179,7 +179,7 @@ static struct commit *handle_commit(stru
/*
* Blob object? You know the drill by now..
*/
- if (object->type == TYPE_BLOB) {
+ if (object->type == OBJ_BLOB) {
struct blob *blob = (struct blob *)object;
if (!revs->blob_objects)
return NULL;
@@ -494,11 +494,11 @@ static int add_parents_only(struct rev_i
return 0;
while (1) {
it = get_reference(revs, arg, sha1, 0);
- if (it->type != TYPE_TAG)
+ if (it->type != OBJ_TAG)
break;
memcpy(sha1, ((struct tag*)it)->tagged->sha1, 20);
}
- if (it->type != TYPE_COMMIT)
+ if (it->type != OBJ_COMMIT)
return 0;
commit = (struct commit *)it;
for (parents = commit->parents; parents; parents = parents->next) {
diff --git a/send-pack.c b/send-pack.c
index 4019a4b..10bc8bc 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -151,12 +151,12 @@ static int ref_newer(const unsigned char
* old. Otherwise we require --force.
*/
o = deref_tag(parse_object(old_sha1), NULL, 0);
- if (!o || o->type != TYPE_COMMIT)
+ if (!o || o->type != OBJ_COMMIT)
return 0;
old = (struct commit *) o;
o = deref_tag(parse_object(new_sha1), NULL, 0);
- if (!o || o->type != TYPE_COMMIT)
+ if (!o || o->type != OBJ_COMMIT)
return 0;
new = (struct commit *) o;
diff --git a/server-info.c b/server-info.c
index fdfe05a..7df628f 100644
--- a/server-info.c
+++ b/server-info.c
@@ -12,7 +12,7 @@ static int add_info_ref(const char *path
struct object *o = parse_object(sha1);
fprintf(info_ref_fp, "%s %s\n", sha1_to_hex(sha1), path);
- if (o->type == TYPE_TAG) {
+ if (o->type == OBJ_TAG) {
o = deref_tag(o, path, 0);
if (o)
fprintf(info_ref_fp, "%s %s^{}\n",
diff --git a/sha1_name.c b/sha1_name.c
index f2cbafa..5fe8e5d 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -381,13 +381,13 @@ static int peel_onion(const char *name,
sp++; /* beginning of type name, or closing brace for empty */
if (!strncmp(commit_type, sp, 6) && sp[6] == '}')
- expected_type = TYPE_COMMIT;
+ expected_type = OBJ_COMMIT;
else if (!strncmp(tree_type, sp, 4) && sp[4] == '}')
- expected_type = TYPE_TREE;
+ expected_type = OBJ_TREE;
else if (!strncmp(blob_type, sp, 4) && sp[4] == '}')
- expected_type = TYPE_BLOB;
+ expected_type = OBJ_BLOB;
else if (sp[0] == '}')
- expected_type = TYPE_NONE;
+ expected_type = OBJ_NONE;
else
return -1;
@@ -416,9 +416,9 @@ static int peel_onion(const char *name,
memcpy(sha1, o->sha1, 20);
return 0;
}
- if (o->type == TYPE_TAG)
+ if (o->type == OBJ_TAG)
o = ((struct tag*) o)->tagged;
- else if (o->type == TYPE_COMMIT)
+ else if (o->type == OBJ_COMMIT)
o = &(((struct commit *) o)->tree->object);
else
return error("%.*s: expected %s type, but the object dereferences to %s type",
diff --git a/tag.c b/tag.c
index 74d0dab..864ac1b 100644
--- a/tag.c
+++ b/tag.c
@@ -5,7 +5,7 @@ const char *tag_type = "tag";
struct object *deref_tag(struct object *o, const char *warn, int warnlen)
{
- while (o && o->type == TYPE_TAG)
+ while (o && o->type == OBJ_TAG)
o = parse_object(((struct tag *)o)->tagged->sha1);
if (!o && warn) {
if (!warnlen)
@@ -21,12 +21,12 @@ struct tag *lookup_tag(const unsigned ch
if (!obj) {
struct tag *ret = alloc_tag_node();
created_object(sha1, &ret->object);
- ret->object.type = TYPE_TAG;
+ ret->object.type = OBJ_TAG;
return ret;
}
if (!obj->type)
- obj->type = TYPE_TAG;
- if (obj->type != TYPE_TAG) {
+ obj->type = OBJ_TAG;
+ if (obj->type != OBJ_TAG) {
error("Object %s is a %s, not a tree",
sha1_to_hex(sha1), typename(obj->type));
return NULL;
diff --git a/tree.c b/tree.c
index 1023655..a6032e3 100644
--- a/tree.c
+++ b/tree.c
@@ -131,12 +131,12 @@ struct tree *lookup_tree(const unsigned
if (!obj) {
struct tree *ret = alloc_tree_node();
created_object(sha1, &ret->object);
- ret->object.type = TYPE_TREE;
+ ret->object.type = OBJ_TREE;
return ret;
}
if (!obj->type)
- obj->type = TYPE_TREE;
- if (obj->type != TYPE_TREE) {
+ obj->type = OBJ_TREE;
+ if (obj->type != OBJ_TREE) {
error("Object %s is a %s, not a tree",
sha1_to_hex(sha1), typename(obj->type));
return NULL;
@@ -216,11 +216,11 @@ struct tree *parse_tree_indirect(const u
do {
if (!obj)
return NULL;
- if (obj->type == TYPE_TREE)
+ if (obj->type == OBJ_TREE)
return (struct tree *) obj;
- else if (obj->type == TYPE_COMMIT)
+ else if (obj->type == OBJ_COMMIT)
obj = &(((struct commit *) obj)->tree->object);
- else if (obj->type == TYPE_TAG)
+ else if (obj->type == OBJ_TAG)
obj = ((struct tag *) obj)->tagged;
else
return NULL;
diff --git a/upload-pack.c b/upload-pack.c
index b18eb9b..2e820c9 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -326,7 +326,7 @@ static int got_sha1(char *hex, unsigned
o = parse_object(sha1);
if (!o)
die("oops (%s)", sha1_to_hex(sha1));
- if (o->type == TYPE_COMMIT) {
+ if (o->type == OBJ_COMMIT) {
struct commit_list *parents;
if (o->flags & THEY_HAVE)
return 0;
@@ -457,7 +457,7 @@ static int send_ref(const char *refname,
o->flags |= OUR_REF;
nr_our_refs++;
}
- if (o->type == TYPE_TAG) {
+ if (o->type == OBJ_TAG) {
o = deref_tag(o, refname, 0);
packet_write(1, "%s %s^{}\n", sha1_to_hex(o->sha1), refname);
}
^ 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