Git development
 help / color / mirror / Atom feed
* Perhaps an obvious cut and paste error.
From: Junio C Hamano @ 2006-08-01  2:12 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <200608010259.13721.jnareb@gmail.com>

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 4e79390..a4a46d9 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -1441,7 +1434,7 @@ sub git_summary {
 	my $headlist = git_read_refs("refs/heads");
 	if (defined @$headlist) {
 		git_header_div('heads');
-		git_heads_body($taglist, $head, 0, 15,
+		git_heads_body($headlist, $head, 0, 15,
 		               $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=heads")}, "..."));
 	}
 

^ permalink raw reply related

* Re: Diff format in packs
From: Martin Langhoff @ 2006-08-01  2:16 UTC (permalink / raw)
  To: Jon Smirl; +Cc: Jakub Narebski, git
In-Reply-To: <9e4733910607311813l78791e40l1234cf0e458db66f@mail.gmail.com>

On 8/1/06, Jon Smirl <jonsmirl@gmail.com> wrote:
> On 7/31/06, Martin Langhoff <martin.langhoff@gmail.com> wrote:
> > Jon,
> >
> > just get all the file versions out of the ,v file and into the GIT
> > repo, then do find .git/objects/ -type f | git-pack-objects. You don't
> > have to even think of generating the packfile yourself.
>
> Moz CVS expands into over 1M files and 12GB in size. I keep getting
> concerned about algorithms that take days to complete and need 4GB to
> run.

If you run that every 1000 rcs files converted, it will be really
cheap in processing and memory footprint. That's not a concern.


> > On 8/1/06, Jon Smirl <jonsmirl@gmail.com> wrote:
> > > I am working on combining cvs2svn, parsecvs and cvsps into something
> > > that can handle Mozilla CVS.
> >
> > If you publish your WIP somewhere, I might be able to jump in and help
> > a bit. I've seen your "challenge" email earlier, but haven't been able
> > to get started yet -- lots of work on other foss fronts.
>
> I haven't got anything useful yet, I keep switching in and out of
> working on this. I am still trying to work out a viable transition
> strategy that I can attempt to sell the Mozilla developers on. So far
> I don't have one.

I understand that, and it's a shame.

> The requirements I have so far:

Yep to 1..4. I suspect that you can get "there" with a converted
cvs2svn transformed to deal with git as your are pursuing, and in
dealing with the follow-on imports using git-cvsimport. The only real
limitation there is that new branches opened in that transition period
may be imported with the root in the wrong place.

But for "ongoing" branches, the setup works great. I've done in many
times with parsecvs for the initial import and git-cvsimport for the
subsequent incrementals.

> 5) a bonus feature would be a partial repository to avoid the initial
> 700MB git download.

Agreed. However, I thought I had gotten it to be much slimmer than
that, but I may be wrong. Also, a current Moz checkout via cvs is
massively chatty, so between bandwidth and latency, I think the git
protocol beats cvs for the initial checkout even for Moz.

> I've spent more time looking at parsecvs than cvsps, is it reasonable
> to convert cvsps to the algorithm described above? Another strategy

I don't think cvsps is easily fixable.

> would be to use cvs2svn to build the changeset database and then use
> cvsps to simply read the changesets out of it and build the git
> repository.

Once cvs2svn has the db built, it should be easy to write a
perl/python script that mimics the output of cvsps.

> Parsecvs never finishes the conversion it always hits an error or GPF
> after 4-5 hours, probably a wild pointer somewhere.

Hmmmm. Nag Keith?



martin

^ permalink raw reply

* Re: [PATCH 19] gitweb: No need to quote path for list version of open "-|"
From: Junio C Hamano @ 2006-08-01  2:17 UTC (permalink / raw)
  To: jnareb; +Cc: git
In-Reply-To: <ealk0e$to2$2@sea.gmane.org>

Jakub Narebski <jnareb@gmail.com> writes:

> <opublikowany i wysłany>
>
> Junio C Hamano wrote:
>
>> I suspect the patch title is wrong -- it is not "no need to" but
>> "quoting path breaks so do not do it" ;-).
>> 
>> I guess this fixes the problem I saw last night?
>
> If I remember correctly it worked without this patch, for git 1.4.1.1 
> (i.e. with --full-history option, although not working as advertised: see my
> comment earlier in thread).

Couldn't have worked, or you have found a bug in whatever
command you invoked.  If it is told to look for a path that
starts with a single quote it should have done so and produced
no history since there is no such file.

In any case, the patch #19 seems to fix the problem.  Thanks.

^ permalink raw reply

* There can be more than two levels of subdirectories
From: Junio C Hamano @ 2006-08-01  2:18 UTC (permalink / raw)
  To: jnareb; +Cc: git
In-Reply-To: <ealk0e$to2$2@sea.gmane.org>

Earlier code to read .git/refs/{tags,heads} hierarchy had a
hardcoded up-to-two-level assumption.  Lift it by using
File::Find.

Signed-off-by: Junio C Hamano <junkio@cox.net>

---
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 4e79390..902b96a 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -14,6 +14,7 @@ use CGI::Util qw(unescape);
 use CGI::Carp qw(fatalsToBrowser);
 use Encode;
 use Fcntl ':mode';
+use File::Find qw();
 binmode STDOUT, ':utf8';
 
 our $cgi = new CGI;
@@ -697,23 +698,14 @@ sub git_read_refs {
 	my @reflist;
 
 	my @refs;
-	opendir my $dh, "$projectroot/$project/$ref_dir";
-	while (my $dir = readdir($dh)) {
-		if ($dir =~ m/^\./) {
-			next;
-		}
-		if (-d "$projectroot/$project/$ref_dir/$dir") {
-			opendir my $dh2, "$projectroot/$project/$ref_dir/$dir";
-			my @subdirs = grep !m/^\./, readdir $dh2;
-			closedir($dh2);
-			foreach my $subdir (@subdirs) {
-				push @refs, "$dir/$subdir"
-			}
-			next;
+	my $pfxlen = length("$projectroot/$project/$ref_dir");
+	File::Find::find(sub {
+		return if (/^\./);
+		if (-f $_) {
+			push @refs, substr($File::Find::name, $pfxlen + 1);
 		}
-		push @refs, $dir;
-	}
-	closedir($dh);
+	}, "$projectroot/$project/$ref_dir");
+
 	foreach my $ref_file (@refs) {
 		my $ref_id = git_read_hash("$project/$ref_dir/$ref_file");
 		my $type = git_get_type($ref_id) || next;

^ permalink raw reply related

* Re: Diff format in packs
From: Jon Smirl @ 2006-08-01  2:29 UTC (permalink / raw)
  To: Martin Langhoff; +Cc: Jakub Narebski, git
In-Reply-To: <46a038f90607311916k5d130f70gc0ac26eb8f15fec0@mail.gmail.com>

On 7/31/06, Martin Langhoff <martin.langhoff@gmail.com> wrote:
> > would be to use cvs2svn to build the changeset database and then use
> > cvsps to simply read the changesets out of it and build the git
> > repository.
>
> Once cvs2svn has the db built, it should be easy to write a
> perl/python script that mimics the output of cvsps.

This is an efficiency problem. My strategy instead is to build the git
objects for the revisions when the CVS file is initially parsed and
then track the sha-1 of the object. Otherwise I end up needing to use
CVS to pull each revision out after the changeseta are computed and
that's a slow process since it involves 1M forks of a cvs process.

People on the Python list have been giving me some pointers on how to
build the revision files efficiently. That's what I am working on
right now.


-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply

* Re: Diff format in packs
From: Martin Langhoff @ 2006-08-01  2:36 UTC (permalink / raw)
  To: Jon Smirl; +Cc: Jakub Narebski, git
In-Reply-To: <9e4733910607311929j189eb6b9r6a804cc744290fdc@mail.gmail.com>

On 8/1/06, Jon Smirl <jonsmirl@gmail.com> wrote:
> On 7/31/06, Martin Langhoff <martin.langhoff@gmail.com> wrote:
> > > would be to use cvs2svn to build the changeset database and then use
> > > cvsps to simply read the changesets out of it and build the git
> > > repository.
> >
> > Once cvs2svn has the db built, it should be easy to write a
> > perl/python script that mimics the output of cvsps.
>
> This is an efficiency problem. My strategy instead is to build the git

Agreed when it comes to the initial import. I thought you were meaning
for "driving" git-cvsimport when doing incrementals.

> People on the Python list have been giving me some pointers on how to
> build the revision files efficiently. That's what I am working on
> right now.

You can definitely steal that from parsecvs -- it should be trivial to
get parsecvs to do the RCS -> GIT part and store on disk the
path/revision -> SHA1. Yes?

cheers,


martin

^ permalink raw reply

* Re: [PATCH] gitweb: use a hash to lookup the sub for an action
From: Luben Tuikov @ 2006-08-01  2:50 UTC (permalink / raw)
  To: Matthias Lederhofer, git
In-Reply-To: <E1G7faj-0006W8-17@moooo.ath.cx>

--- Matthias Lederhofer <matled@gmx.net> wrote:
> Signed-off-by: Matthias Lederhofer <matled@gmx.net>

That's a great patch.

   Luben

> ---
>  gitweb/gitweb.cgi |   81 ++++++++++++++++-------------------------------------
>  1 files changed, 25 insertions(+), 56 deletions(-)
> 
> diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
> index c1ee79e..75390c8 100755
> --- a/gitweb/gitweb.cgi
> +++ b/gitweb/gitweb.cgi
> @@ -161,65 +161,34 @@ if (defined $searchtext) {
>  }
>  
>  # dispatch
> -if (!defined $action || $action eq "summary") {
> -	git_summary();
> -	exit;
> -} elsif ($action eq "heads") {
> -	git_heads();
> -	exit;
> -} elsif ($action eq "tags") {
> -	git_tags();
> -	exit;
> -} elsif ($action eq "blob") {
> -	git_blob();
> -	exit;
> -} elsif ($action eq "blob_plain") {
> -	git_blob_plain();
> -	exit;
> -} elsif ($action eq "tree") {
> -	git_tree();
> -	exit;
> -} elsif ($action eq "rss") {
> -	git_rss();
> -	exit;
> -} elsif ($action eq "commit") {
> -	git_commit();
> -	exit;
> -} elsif ($action eq "log") {
> -	git_log();
> -	exit;
> -} elsif ($action eq "blobdiff") {
> -	git_blobdiff();
> -	exit;
> -} elsif ($action eq "blobdiff_plain") {
> -	git_blobdiff_plain();
> -	exit;
> -} elsif ($action eq "commitdiff") {
> -	git_commitdiff();
> -	exit;
> -} elsif ($action eq "commitdiff_plain") {
> -	git_commitdiff_plain();
> -	exit;
> -} elsif ($action eq "history") {
> -	git_history();
> -	exit;
> -} elsif ($action eq "search") {
> -	git_search();
> -	exit;
> -} elsif ($action eq "shortlog") {
> -	git_shortlog();
> -	exit;
> -} elsif ($action eq "tag") {
> -	git_tag();
> -	exit;
> -} elsif ($action eq "blame") {
> -	git_blame2();
> -	exit;
> -} else {
> +my %actions = (
> +	"blame" => \&git_blame2,
> +	"blobdiff" => \&git_blobdiff,
> +	"blobdiff_plain" => \&git_blobdiff_plain,
> +	"blob" => \&git_blob,
> +	"blob_plain" => \&git_blob_plain,
> +	"commitdiff" => \&git_commitdiff,
> +	"commitdiff_plain" => \&git_commitdiff_plain,
> +	"commit" => \&git_commit,
> +	"heads" => \&git_heads,
> +	"history" => \&git_history,
> +	"log" => \&git_log,
> +	"rss" => \&git_rss,
> +	"search" => \&git_search,
> +	"shortlog" => \&git_shortlog,
> +	"summary" => \&git_summary,
> +	"tag" => \&git_tag,
> +	"tags" => \&git_tags,
> +	"tree" => \&git_tree,
> +);
> +
> +$action = 'summary' if (!defined($action));
> +if (!defined($actions{$action})) {
>  	undef $action;
>  	die_error(undef, "Unknown action.");
> -	exit;
>  }
> +$actions{$action}->();
> +exit;
>  
>  ## ======================================================================
>  ## validation, quoting/unquoting and escaping
> -- 
> 1.4.2.rc2.ge0bed
> 
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* Re: Why I love GIT but use Subversion (was: GIT user survey)
From: Pavel Roskin @ 2006-08-01  3:50 UTC (permalink / raw)
  To: Jörg W Mittag; +Cc: git
In-Reply-To: <1prv3rw6ldo9s$.dlg@jwmittag.my-fqdn.de>

Hello, Jörg!

On Tue, 2006-08-01 at 03:45 +0200, Jörg W Mittag wrote:

> In my case the operating environment is the Windows Explorer or
> Eclipse and my workflow is basically dragging and dropping files with
> the mouse.  I can do just that with TortoiseSVN and Subclipse without
> having to change the way I normally work.

I understand you don't really care about changesets (i.e. committing
several files at once and recording it as a single operation).  In that
case, would git-cvsserver satisfy your needs?  Would it make any
difference if there were a similar Subversion emulator?  Would DAV
support make any difference?

> With Git I would constantly
> need to switch back and forth between Explorer or Eclipse and Cygwin.

With git-cvsserver, you can run it and forget about it.  The rest would
be handled through the CVS interface.

-- 
Regards,
Pavel Roskin

^ permalink raw reply

* A few more fixups to gitweb
From: Junio C Hamano @ 2006-08-01  4:24 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git, Martin Langhoff, Luben Tuikov, Matthias Lederhofer
In-Reply-To: <200608010259.13721.jnareb@gmail.com>

I've applied most of the recent gitweb changes from the list
(except the one that processes gitweb.perl into gitweb.cgi, not
because I am opposed to it, but because merging it early would
make things a bit more inconvenient while many patches are in
flight on the list) and fixed up a few things I noticed.  I'll
be pushing out the results on "next" branch shortly, so if
people want to hack on gitweb further please base your changes
on this version (I am CC'ing this message to people who recently
worked on, or expressed interest in working on gitweb).

One thing to note.  Please make sure that you do not see
anything in Apache error log after you make your changes.  I do
not remember the details but kernel.org folks were very unhappy
earlier when gitweb spewed stuff into the error log, and if I
recall correctly things that output to the error stream were not
friendly to the http-server cache for some reason.

^ permalink raw reply

* Re: Why I love GIT but use Subversion
From: Junio C Hamano @ 2006-08-01  4:42 UTC (permalink / raw)
  To: Jörg W Mittag; +Cc: git
In-Reply-To: <1prv3rw6ldo9s$.dlg@jwmittag.my-fqdn.de>

Jörg W Mittag <Joerg.Mittag@Web.De> writes:

> Please, make those reasons go away.

These are all reasonable wishes.

The core level of git (which is written in C) is designed to be
usable as a building block for platform native IDE.  The primary
audience of git so far has been POSIX envirnoment, and the
command line interface we have in core git was one acceptable
form of "platform native IDE".  I know that is not a usual form
of IDE in some other world (most notably in MS circles).

I do not speak for others on this mailing list, but given the
background of how git came about into existence, which pretty
much defines the majority of the habitants of this mailing list,
I doubt there are many people who know git well enough and have
enough experience and motivation to implement "platform native
IDE" for MS platform.  Certainly I cannot imagine Linus and/or
myself doing Windows GUI programming to make git integrate into
MS environment seamlessly.  You probably are a lot more familiar
and qualified to implement such than myself.

So please step forward, enlist MS comrades, and start hacking,
if you want MS native git.  If you need help in understanding
the core git data structures, algorithms, and functions, I may
well be able to help you.  If you have difficulties interfacing
with Visual Studio on the other hand that is not something I can
help you with, although some others on the list might.

> Thank you for bearing with me through this long rant.

Thank *you* for sharing these thoughts.

^ permalink raw reply

* git-ls-files prefix superset problem
From: David Miller @ 2006-08-01  5:13 UTC (permalink / raw)
  To: git


I had been previously using git-1.1.3 on my local repositories
and I upgraded to the current git head:

b63fafdfd844c2037fba53b9944431c1378b4135

git commit stopped working, specifically it dies on
git-ls-files:

davem@sunset:~/src/GIT/net-2.6$ ../git/git-ls-files -- net/ipv4/tcp.c
fatal: git-ls-files: internal error - cache entry not superset of prefix
davem@sunset:~/src/GIT/net-2.6$ 

I added some debugging:

Trying get_pathspec([(null)],[net/ipv4/tcp.c])
prefixlen(0)
prefix_path() gives [net/ipv4/tcp.c]
ERROR: pathspec(net/ipv4/tcp.c)
verify_pathspec: len(9)
ERROR: len(9) ce_namelen(ce)(7) ce->name(COPYING)

Is something wrong with my index file?

I tried to rebuild it using:

git read-tree master
git checkout-index -f -a
git update-index --refresh

but I keep getting the same problem.

It happens on all of my local 2.6.x kernel GIT trees.

Any ideas?

Thanks a lot.

^ permalink raw reply

* Re: Fix up some fallout from "setup_git_directory()" cleanups
From: Linus Torvalds @ 2006-08-01  5:15 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.63.0608010118280.27436@wbgn013.biozentrum.uni-wuerzburg.de>



On Tue, 1 Aug 2006, Johannes Schindelin wrote:
> 
> Wouldn't this just be a _perfect_ task for 'sparse'?

Something like this?

		Linus
---
builtin-diff.c:266:7: warning: symbol 'i' shadows an earlier one
builtin-diff.c:226:6: originally declared here

builtin-fmt-merge-msg.c:141:7: warning: symbol 'len' shadows an earlier one
builtin-fmt-merge-msg.c:75:9: originally declared here

builtin-fmt-merge-msg.c:341:17: warning: symbol 'head' shadows an earlier one
builtin-fmt-merge-msg.c:252:13: originally declared here

builtin-mv.c:270:8: warning: symbol 'i' shadows an earlier one
builtin-mv.c:61:6: originally declared here

builtin-show-branch.c:755:17: warning: symbol 'commit' shadows an earlier one
builtin-show-branch.c:555:32: originally declared here

convert-objects.c:186:15: warning: symbol 'p' shadows an earlier one
convert-objects.c:154:10: originally declared here

date.c:635:14: warning: symbol 'n' shadows an earlier one
date.c:587:6: originally declared here

date.c:649:7: warning: symbol 'n' shadows an earlier one
date.c:587:6: originally declared here

fetch.c:51:16: warning: symbol 'tree' shadows an earlier one
fetch.c:37:37: originally declared here

fsck-objects.c:582:7: warning: symbol 'i' shadows an earlier one
fsck-objects.c:485:6: originally declared here

git.c:281:8: warning: symbol 'i' shadows an earlier one
git.c:263:6: originally declared here

pack-check.c:44:17: warning: symbol 'sha1' shadows an earlier one
pack-check.c:9:16: originally declared here

pack-objects.c:685:28: warning: symbol 'tree' shadows an earlier one
pack-objects.c:662:47: originally declared here

revision.c:85:17: warning: symbol 'commit' shadows an earlier one
revision.c:80:47: originally declared here

setup.c:165:7: warning: symbol 'len' shadows an earlier one
setup.c:156:6: originally declared here

tree-walk.c:116:21: warning: symbol 'entry' shadows an earlier one
tree-walk.c:113:20: originally declared here

^ permalink raw reply

* Re: git-ls-files prefix superset problem
From: Linus Torvalds @ 2006-08-01  5:18 UTC (permalink / raw)
  To: David Miller; +Cc: git
In-Reply-To: <20060731.221327.26966465.davem@davemloft.net>



On Mon, 31 Jul 2006, David Miller wrote:
> 
> I had been previously using git-1.1.3 on my local repositories
> and I upgraded to the current git head:
> 
> b63fafdfd844c2037fba53b9944431c1378b4135
> 
> git commit stopped working, specifically it dies on
> git-ls-files:
> 
> davem@sunset:~/src/GIT/net-2.6$ ../git/git-ls-files -- net/ipv4/tcp.c
> fatal: git-ls-files: internal error - cache entry not superset of prefix

It should be fixed by the recent commit

	Fix up some fallout from "setup_git_directory()" cleanup

that Junio already merged.

So just update your git again, and everything should be happy.

		Linus

^ permalink raw reply

* Re: git-ls-files prefix superset problem
From: David Miller @ 2006-08-01  5:25 UTC (permalink / raw)
  To: torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0607312217420.4168@g5.osdl.org>

From: Linus Torvalds <torvalds@osdl.org>
Date: Mon, 31 Jul 2006 22:18:47 -0700 (PDT)

> It should be fixed by the recent commit
> 
> 	Fix up some fallout from "setup_git_directory()" cleanup
> 
> that Junio already merged.
> 
> So just update your git again, and everything should be happy.

Yeah, just as you responded I noticed the there was local
variable shadowing of "prefix" which causes it to be NULL
and thus prune_cache() doesn't get called.

Thanks!

^ permalink raw reply

* Re: Why I love GIT but use Subversion
From: Martin Langhoff @ 2006-08-01  5:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jörg W Mittag, git
In-Reply-To: <7virld2hjt.fsf@assigned-by-dhcp.cox.net>

On 8/1/06, Junio C Hamano <junkio@cox.net> wrote:
> So please step forward, enlist MS comrades, and start hacking,

I don't know how mature the libification of git is, in terms of
working correctly on Windows without a full cygwin environemnt (but
perhaps with the cygwin dll). If it builds and works reasonably well
just linking to the dll, perhaps we should enlist the
TortoiseCVS/TortoiseSVN hackers to replace the SVN bindings with GIT
bindings.

Of course, that'd give us a simplified UI, but it'd get the ball rolling.

cheers,


martin

^ permalink raw reply

* Re: Why I love GIT but use Subversion
From: Jakub Narebski @ 2006-08-01  7:13 UTC (permalink / raw)
  To: git
In-Reply-To: <1prv3rw6ldo9s$.dlg@jwmittag.my-fqdn.de>

Jörg W Mittag wrote:

> Number 2 would probably be providing the same level of integration for
> Eclipse.

Git Eclipse plugin is in the works, currently in very early alpha stages:
  http://git.or.cz/gitwiki/InterfacesFrontendsAndTools#Eclipse

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: Perhaps an obvious cut and paste error.
From: Jakub Narebski @ 2006-08-01  7:23 UTC (permalink / raw)
  To: git
In-Reply-To: <7vlkq94325.fsf_-_@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:

> diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
> index 4e79390..a4a46d9 100755
> --- a/gitweb/gitweb.cgi
> +++ b/gitweb/gitweb.cgi
> @@ -1441,7 +1434,7 @@ sub git_summary {
>       my $headlist = git_read_refs("refs/heads");
>       if (defined @$headlist) {
>               git_header_div('heads');
> -             git_heads_body($taglist, $head, 0, 15,
> +             git_heads_body($headlist, $head, 0, 15,
>                              $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=heads")}, "..."));
>       }
>  
> 

Yes, of course. ACK.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: A few more fixups to gitweb
From: Jakub Narebski @ 2006-08-01  7:36 UTC (permalink / raw)
  To: git
In-Reply-To: <7vzmep2icr.fsf_-_@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:

> One thing to note.  Please make sure that you do not see
> anything in Apache error log after you make your changes.  I do
> not remember the details but kernel.org folks were very unhappy
> earlier when gitweb spewed stuff into the error log, and if I
> recall correctly things that output to the error stream were not
> friendly to the http-server cache for some reason.

By the way, I wonder why git when cloning/fetching via http protocol
uses e.g. "git/1.4.2.rc2.ge0bed" as User-Agent: string when fetching objects
and packs, and e.g. "curl/7.15.4 (i486-pc-linux-gnu) libcurl/7.15.4
OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5" as User-Agent: when fetching refs
(heads and tags) and info/refs.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: A few more fixups to gitweb
From: Junio C Hamano @ 2006-08-01  8:04 UTC (permalink / raw)
  To: jnareb; +Cc: git
In-Reply-To: <ean0a1$irf$1@sea.gmane.org>

Jakub Narebski <jnareb@gmail.com> writes:

> By the way, I wonder why git when cloning/fetching via http protocol
> uses e.g. "git/1.4.2.rc2.ge0bed" as User-Agent: string when fetching objects
> and packs, and e.g. "curl/7.15.4 (i486-pc-linux-gnu) libcurl/7.15.4
> OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5" as User-Agent: when fetching refs
> (heads and tags) and info/refs.

"Why?", meaning if we deliberately do so for some good reason?

There isn't.

git-http-fetch uses its own User-Agent string, but the shell
script wrappers that use curl executable do not bother setting
customized User-Agent string; that is why.

^ permalink raw reply

* Re: git+ssh://master.kernel.org/home/rmk/linux-2.6-arm.git
From: Junio C Hamano @ 2006-08-01  8:46 UTC (permalink / raw)
  To: git; +Cc: Russell King, Andrew Morton
In-Reply-To: <20060801001958.67a071b2.akpm@osdl.org>

Andrew Morton <akpm@osdl.org> writes:

> 
> fyi, a git-fetch of this tree gives:
>
> error: refs/heads/devel does not point to a valid commit object!
> error: refs/heads/devel does not point to a valid commit object!
>
> Junio, I'm running git-core-1.4.0-1.fc5 - perhaps more recent gits are
> better at telling the user if the error is remote or local.  If not: whine ;)

I'd try this out and see what people think.

-- >8 --
[PATCH] fetch/clone: mark messages from remote side stand out.

When dealing with a corrupt or out of sync remote repository,
the user often gets error messages like this:

	error: refs/heads/devel does not point to a valid commit object!

which leaves the user wondering if the breakage is on the local
end or on the remote end.  This is unnecessarily alarming.

This patch changes the way we display messages received from the
remote side over the git protocol sideband (i.e. stderr stream
of the remote process).  It shows them with blue background with
white letters, but this presentation is subject to proposals of
better ways from the list.

The problem was pointed out by Andrew Morton.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 fetch-clone.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/fetch-clone.c b/fetch-clone.c
index 81d1371..692d9b7 100644
--- a/fetch-clone.c
+++ b/fetch-clone.c
@@ -133,7 +133,10 @@ static pid_t setup_sideband(int sideband
 				fprintf(stderr, "\n");
 				exit(1);
 			case 2:
+				/* color sideband */
+				safe_write(2, "\033[44;37;1m", 10);
 				safe_write(2, buf+1, len);
+				safe_write(2, "\033[m", 3);
 				continue;
 			case 1:
 				safe_write(fd[1], buf+1, len);
-- 
1.4.2.rc2.gb9f77

^ permalink raw reply related

* Re: git+ssh://master.kernel.org/home/rmk/linux-2.6-arm.git
From: Andrew Morton @ 2006-08-01  8:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, rmk
In-Reply-To: <7v4pww3ktw.fsf@assigned-by-dhcp.cox.net>

On Tue, 01 Aug 2006 01:46:03 -0700
Junio C Hamano <junkio@cox.net> wrote:

> It shows them with blue background with
> white letters, but this presentation is subject to proposals of
> better ways from the list.

eek.  If any application on my machine starts emitting funny colours I'll
immediately stop everything and go work out how to make it stop ;)

It would be more traditional to stick "remote:" at the beginning of the
message or something.

^ permalink raw reply

* Re: git+ssh://master.kernel.org/home/rmk/linux-2.6-arm.git
From: Junio C Hamano @ 2006-08-01  9:04 UTC (permalink / raw)
  To: Andrew Morton; +Cc: git
In-Reply-To: <20060801015250.cfd4f223.akpm@osdl.org>

Andrew Morton <akpm@osdl.org> writes:

> On Tue, 01 Aug 2006 01:46:03 -0700
> Junio C Hamano <junkio@cox.net> wrote:
>
>> It shows them with blue background with
>> white letters, but this presentation is subject to proposals of
>> better ways from the list.
>
> eek.  If any application on my machine starts emitting funny colours I'll
> immediately stop everything and go work out how to make it stop ;)
>
> It would be more traditional to stick "remote:" at the beginning of the
> message or something.

Hehehe.  I succeeded getting your attention ;-).

^ permalink raw reply

* [PATCH 2/2] Set User-Agent string in shell scripts used for fetching
From: Jakub Narebski @ 2006-08-01  9:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <200608011134.52006.jnareb@gmail.com>

This needs checking for shell portability.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Junio C Hamano wrote:

> Jakub Narebski <jnareb@gmail.com> writes:
> 
>> By the way, I wonder why git when cloning/fetching via http protocol
>> uses e.g. "git/1.4.2.rc2.ge0bed" as User-Agent: string when fetching objects
>> and packs, and e.g. "curl/7.15.4 (i486-pc-linux-gnu) libcurl/7.15.4
>> OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5" as User-Agent: when fetching refs
>> (heads and tags) and info/refs.
> 
> "Why?", meaning if we deliberately do so for some good reason?
> 
> There isn't.
> 
> git-http-fetch uses its own User-Agent string, but the shell
> script wrappers that use curl executable do not bother setting
> customized User-Agent string; that is why.

So there :-)

 git-clone.sh     |    4 +++-
 git-fetch.sh     |    5 ++++-
 git-ls-remote.sh |    7 +++++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/git-clone.sh b/git-clone.sh
index adb752d..a9676d6 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -20,10 +20,12 @@ get_repo_base() {
 if [ -n "$GIT_SSL_NO_VERIFY" ]; then
 	curl_extra_args="-k"
 fi
+curl_user_agent="$(git --version)"
+curl_user_agent="git/${curl_user_agent##git version }"
 
 http_fetch () {
 	# $1 = Remote, $2 = Local
-	curl -nsfL $curl_extra_args "$1" >"$2"
+	curl -nsfL $curl_extra_args $curl_user_agent "$1" >"$2"
 }
 
 clone_dumb_http () {
diff --git a/git-fetch.sh b/git-fetch.sh
index cea6e0b..6635bd5 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -291,6 +291,8 @@ fetch_main () {
 			if [ -n "$GIT_SSL_NO_VERIFY" ]; then
 				curl_extra_args="-k"
 			fi
+			curl_user_agent="$(git --version)"
+			curl_user_agent="git/${curl_user_agent##git version }"
 			max_depth=5
 			depth=0
 			head="ref: $remote_name"
@@ -302,7 +304,8 @@ fetch_main () {
 					$u =~ s{([^-a-zA-Z0-9/.])}{sprintf"%%%02x",ord($1)}eg;
 					print "$u";
 					' "$head")
-				head=$(curl -nsfL $curl_extra_args "$remote/$remote_name_quoted")
+				head=$(curl -nsfL $curl_extra_args $curl_user_agent \
+					"$remote/$remote_name_quoted")
 				depth=$( expr \( $depth + 1 \) )
 			done
 			expr "z$head" : "z$_x40\$" >/dev/null ||
diff --git a/git-ls-remote.sh b/git-ls-remote.sh
index 38122ad..32b93da 100755
--- a/git-ls-remote.sh
+++ b/git-ls-remote.sh
@@ -53,8 +53,11 @@ http://* | https://* )
 	if [ -n "$GIT_SSL_NO_VERIFY" ]; then
 		curl_extra_args="-k"
 	fi
-	curl -nsf $curl_extra_args --header "Pragma: no-cache" "$peek_repo/info/refs" ||
-		echo "failed	slurping"
+	curl_user_agent="$(git --version)"
+	curl_user_agent="git/${curl_user_agent##git version }"
+	curl -nsf $curl_extra_args $curl_user_agent --header "Pragma: no-cache" \
+		"$peek_repo/info/refs" ||
+		echo "failed slurping"
 	;;
 
 rsync://* )
-- 
1.4.1.1

^ permalink raw reply related

* [PATCH 1/2] Use tabs for indent in shell scripts
From: Jakub Narebski @ 2006-08-01  9:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vd5bk3mqo.fsf@assigned-by-dhcp.cox.net>

Consistently use tabs for indenting in some shell scripts.  Needs
checking for consistency (command1 && command2 && command3 split into
lines).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 git-clone.sh     |   94 +++++-----
 git-fetch.sh     |  493 +++++++++++++++++++++++++++---------------------------
 git-ls-remote.sh |   50 +++--
 3 files changed, 319 insertions(+), 318 deletions(-)

diff --git a/git-clone.sh b/git-clone.sh
index a92b22a..adb752d 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -18,7 +18,7 @@ get_repo_base() {
 }
 
 if [ -n "$GIT_SSL_NO_VERIFY" ]; then
-    curl_extra_args="-k"
+	curl_extra_args="-k"
 fi
 
 http_fetch () {
@@ -43,7 +43,7 @@ Perhaps git-update-server-info needs to 
 		*^*)	continue;;
 		esac
 		if test -n "$use_separate_remote" &&
-		   branch_name=`expr "z$name" : 'zheads/\(.*\)'`
+			branch_name=`expr "z$name" : 'zheads/\(.*\)'`
 		then
 			tname="remotes/$origin/$branch_name"
 		else
@@ -119,13 +119,13 @@ while
 	*,--na|*,--nak|*,--nake|*,--naked|\
 	*,-b|*,--b|*,--ba|*,--bar|*,--bare) bare=yes ;;
 	*,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;;
-        *,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared) 
-          local_shared=yes; use_local=yes ;;
+	*,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared)
+		local_shared=yes; use_local=yes ;;
 	1,--template) usage ;;
 	*,--template)
 		shift; template="--template=$1" ;;
 	*,--template=*)
-	  template="$1" ;;
+		template="$1" ;;
 	*,-q|*,--quiet) quiet=-q ;;
 	*,--use-separate-remote)
 		use_separate_remote=t ;;
@@ -137,18 +137,18 @@ while
 	*,-o|*,--or|*,--ori|*,--orig|*,--origi|*,--origin)
 		case "$2" in
 		'')
-		    usage ;;
+			usage ;;
 		*/*)
-		    echo >&2 "'$2' is not suitable for an origin name"
-		    exit 1
+			echo >&2 "'$2' is not suitable for an origin name"
+			exit 1
 		esac
 		git-check-ref-format "heads/$2" || {
-		    echo >&2 "'$2' is not suitable for a branch name"
-		    exit 1
+			echo >&2 "'$2' is not suitable for a branch name"
+			exit 1
 		}
 		test -z "$origin_override" || {
-		    echo >&2 "Do not give more than one --origin options."
-		    exit 1
+			echo >&2 "Do not give more than one --origin options."
+			exit 1
 		}
 		origin_override=yes
 		origin="$2"; shift
@@ -167,8 +167,8 @@ done
 repo="$1"
 if test -z "$repo"
 then
-    echo >&2 'you must specify a repository to clone.'
-    exit 1
+	echo >&2 'you must specify a repository to clone.'
+	exit 1
 fi
 
 # --bare implies --no-checkout
@@ -225,9 +225,9 @@ then
 		echo "$reference/objects" >"$GIT_DIR/objects/info/alternates"
 		(cd "$reference" && tar cf - refs) |
 		(cd "$GIT_DIR/refs" &&
-		 mkdir reference-tmp &&
-		 cd reference-tmp &&
-		 tar xf -)
+			mkdir reference-tmp &&
+			cd reference-tmp &&
+			tar xf -)
 	else
 		echo >&2 "$reference: not a local directory." && usage
 	fi
@@ -245,26 +245,26 @@ yes,yes)
 
 	case "$local_shared" in
 	no)
-	    # See if we can hardlink and drop "l" if not.
-	    sample_file=$(cd "$repo" && \
-			  find objects -type f -print | sed -e 1q)
+		# See if we can hardlink and drop "l" if not.
+		sample_file=$(cd "$repo" && \
+			find objects -type f -print | sed -e 1q)
 
-	    # objects directory should not be empty since we are cloning!
-	    test -f "$repo/$sample_file" || exit
+		# objects directory should not be empty since we are cloning!
+		test -f "$repo/$sample_file" || exit
 
-	    l=
-	    if ln "$repo/$sample_file" "$GIT_DIR/objects/sample" 2>/dev/null
-	    then
-		    l=l
-	    fi &&
-	    rm -f "$GIT_DIR/objects/sample" &&
-	    cd "$repo" &&
-	    find objects -depth -print | cpio -pumd$l "$GIT_DIR/" || exit 1
-	    ;;
+		l=
+		if ln "$repo/$sample_file" "$GIT_DIR/objects/sample" 2>/dev/null
+		then
+			l=l
+		fi &&
+		rm -f "$GIT_DIR/objects/sample" &&
+		cd "$repo" &&
+		find objects -depth -print | cpio -pumd$l "$GIT_DIR/" || exit 1
+		;;
 	yes)
-	    mkdir -p "$GIT_DIR/objects/info"
-	    echo "$repo/objects" >> "$GIT_DIR/objects/info/alternates"
-	    ;;
+		mkdir -p "$GIT_DIR/objects/info"
+		echo "$repo/objects" >> "$GIT_DIR/objects/info/alternates"
+		;;
 	esac
 	git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" || exit 1
 	;;
@@ -282,19 +282,19 @@ yes,yes)
 			rm -f "$GIT_DIR/TMP_ALT"
 		if test -f "$GIT_DIR/TMP_ALT"
 		then
-		    ( cd "$D" &&
-		      . git-parse-remote &&
-		      resolve_alternates "$repo" <"$GIT_DIR/TMP_ALT" ) |
-		    while read alt
-		    do
-			case "$alt" in 'bad alternate: '*) die "$alt";; esac
-			case "$quiet" in
-			'')	echo >&2 "Getting alternate: $alt" ;;
-			esac
-			rsync $quiet -av --ignore-existing  \
-			    --exclude info "$alt" "$GIT_DIR/objects" || exit
-		    done
-		    rm -f "$GIT_DIR/TMP_ALT"
+			( cd "$D" &&
+				. git-parse-remote &&
+				resolve_alternates "$repo" <"$GIT_DIR/TMP_ALT" ) |
+			while read alt
+			do
+				case "$alt" in 'bad alternate: '*) die "$alt";; esac
+				case "$quiet" in
+				'')	echo >&2 "Getting alternate: $alt" ;;
+				esac
+				rsync $quiet -av --ignore-existing  \
+					--exclude info "$alt" "$GIT_DIR/objects" || exit
+			done
+			rm -f "$GIT_DIR/TMP_ALT"
 		fi
 		git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD" || exit 1
 		;;
diff --git a/git-fetch.sh b/git-fetch.sh
index c2eebee..cea6e0b 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -90,124 +90,124 @@ then
 fi
 
 append_fetch_head () {
-    head_="$1"
-    remote_="$2"
-    remote_name_="$3"
-    remote_nick_="$4"
-    local_name_="$5"
-    case "$6" in
-    t) not_for_merge_='not-for-merge' ;;
-    '') not_for_merge_= ;;
-    esac
+	head_="$1"
+	remote_="$2"
+	remote_name_="$3"
+	remote_nick_="$4"
+	local_name_="$5"
+	case "$6" in
+		t) not_for_merge_='not-for-merge' ;;
+		'') not_for_merge_= ;;
+	esac
 
-    # remote-nick is the URL given on the command line (or a shorthand)
-    # remote-name is the $GIT_DIR relative refs/ path we computed
-    # for this refspec.
+	# remote-nick is the URL given on the command line (or a shorthand)
+	# remote-name is the $GIT_DIR relative refs/ path we computed
+	# for this refspec.
 
-    # the $note_ variable will be fed to git-fmt-merge-msg for further
-    # processing.
-    case "$remote_name_" in
-    HEAD)
-	note_= ;;
-    refs/heads/*)
-	note_="$(expr "$remote_name_" : 'refs/heads/\(.*\)')"
-	note_="branch '$note_' of " ;;
-    refs/tags/*)
-	note_="$(expr "$remote_name_" : 'refs/tags/\(.*\)')"
-	note_="tag '$note_' of " ;;
-    refs/remotes/*)
-	note_="$(expr "$remote_name_" : 'refs/remotes/\(.*\)')"
-	note_="remote branch '$note_' of " ;;
-    *)
-	note_="$remote_name of " ;;
-    esac
-    remote_1_=$(expr "z$remote_" : 'z\(.*\)\.git/*$') &&
+	# the $note_ variable will be fed to git-fmt-merge-msg for further
+	# processing.
+	case "$remote_name_" in
+	HEAD)
+		note_= ;;
+	refs/heads/*)
+		note_="$(expr "$remote_name_" : 'refs/heads/\(.*\)')"
+		note_="branch '$note_' of " ;;
+	refs/tags/*)
+		note_="$(expr "$remote_name_" : 'refs/tags/\(.*\)')"
+		note_="tag '$note_' of " ;;
+	refs/remotes/*)
+		note_="$(expr "$remote_name_" : 'refs/remotes/\(.*\)')"
+		note_="remote branch '$note_' of " ;;
+	*)
+		note_="$remote_name of " ;;
+	esac
+	remote_1_=$(expr "z$remote_" : 'z\(.*\)\.git/*$') &&
 	remote_="$remote_1_"
-    note_="$note_$remote_"
+	note_="$note_$remote_"
 
-    # 2.6.11-tree tag would not be happy to be fed to resolve.
-    if git-cat-file commit "$head_" >/dev/null 2>&1
-    then
-	headc_=$(git-rev-parse --verify "$head_^0") || exit
-	echo "$headc_	$not_for_merge_	$note_" >>"$GIT_DIR/FETCH_HEAD"
-	[ "$verbose" ] && echo >&2 "* committish: $head_"
-	[ "$verbose" ] && echo >&2 "  $note_"
-    else
-	echo "$head_	not-for-merge	$note_" >>"$GIT_DIR/FETCH_HEAD"
-	[ "$verbose" ] && echo >&2 "* non-commit: $head_"
-	[ "$verbose" ] && echo >&2 "  $note_"
-    fi
-    if test "$local_name_" != ""
-    then
-	# We are storing the head locally.  Make sure that it is
-	# a fast forward (aka "reverse push").
-	fast_forward_local "$local_name_" "$head_" "$note_"
-    fi
+	# 2.6.11-tree tag would not be happy to be fed to resolve.
+	if git-cat-file commit "$head_" >/dev/null 2>&1
+	then
+		headc_=$(git-rev-parse --verify "$head_^0") || exit
+		echo "$headc_	$not_for_merge_	$note_" >>"$GIT_DIR/FETCH_HEAD"
+		[ "$verbose" ] && echo >&2 "* committish: $head_"
+		[ "$verbose" ] && echo >&2 "  $note_"
+	else
+		echo "$head_	not-for-merge	$note_" >>"$GIT_DIR/FETCH_HEAD"
+		[ "$verbose" ] && echo >&2 "* non-commit: $head_"
+		[ "$verbose" ] && echo >&2 "  $note_"
+	fi
+	if test "$local_name_" != ""
+	then
+		# We are storing the head locally.  Make sure that it is
+		# a fast forward (aka "reverse push").
+		fast_forward_local "$local_name_" "$head_" "$note_"
+	fi
 }
 
 fast_forward_local () {
-    mkdir -p "$(dirname "$GIT_DIR/$1")"
-    case "$1" in
-    refs/tags/*)
-	# Tags need not be pointing at commits so there
-	# is no way to guarantee "fast-forward" anyway.
-	if test -f "$GIT_DIR/$1"
-	then
-		if now_=$(cat "$GIT_DIR/$1") && test "$now_" = "$2"
+	mkdir -p "$(dirname "$GIT_DIR/$1")"
+	case "$1" in
+	refs/tags/*)
+		# Tags need not be pointing at commits so there
+		# is no way to guarantee "fast-forward" anyway.
+		if test -f "$GIT_DIR/$1"
 		then
-			[ "$verbose" ] && echo >&2 "* $1: same as $3" ||:
+			if now_=$(cat "$GIT_DIR/$1") && test "$now_" = "$2"
+			then
+				[ "$verbose" ] && echo >&2 "* $1: same as $3" ||:
+			else
+				echo >&2 "* $1: updating with $3"
+				git-update-ref -m "$rloga: updating tag" "$1" "$2"
+			fi
 		else
-			echo >&2 "* $1: updating with $3"
-			git-update-ref -m "$rloga: updating tag" "$1" "$2"
+			echo >&2 "* $1: storing $3"
+			git-update-ref -m "$rloga: storing tag" "$1" "$2"
 		fi
-	else
-		echo >&2 "* $1: storing $3"
-		git-update-ref -m "$rloga: storing tag" "$1" "$2"
-	fi
-	;;
+		;;
 
-    refs/heads/* | refs/remotes/*)
-	# $1 is the ref being updated.
-	# $2 is the new value for the ref.
-	local=$(git-rev-parse --verify "$1^0" 2>/dev/null)
-	if test "$local"
-	then
-	    # Require fast-forward.
-	    mb=$(git-merge-base "$local" "$2") &&
-	    case "$2,$mb" in
-	    $local,*)
-	        if test -n "$verbose"
+	refs/heads/* | refs/remotes/*)
+		# $1 is the ref being updated.
+		# $2 is the new value for the ref.
+		local=$(git-rev-parse --verify "$1^0" 2>/dev/null)
+		if test "$local"
 		then
-			echo >&2 "* $1: same as $3"
+			# Require fast-forward.
+			mb=$(git-merge-base "$local" "$2") &&
+			case "$2,$mb" in
+			$local,*)
+				if test -n "$verbose"
+				then
+					echo >&2 "* $1: same as $3"
+				fi
+				;;
+			*,$local)
+				echo >&2 "* $1: fast forward to $3"
+				echo >&2 "  from $local to $2"
+				git-update-ref -m "$rloga: fast-forward" "$1" "$2" "$local"
+				;;
+			*)
+				false
+				;;
+			esac || {
+				echo >&2 "* $1: does not fast forward to $3;"
+				case ",$force,$single_force," in
+				*,t,*)
+					echo >&2 "  forcing update."
+					git-update-ref -m "$rloga: forced-update" "$1" "$2" "$local"
+					;;
+				*)
+					echo >&2 "  not updating."
+					exit 1
+					;;
+				esac
+			}
+		else
+			echo >&2 "* $1: storing $3"
+			git-update-ref -m "$rloga: storing head" "$1" "$2"
 		fi
 		;;
-	    *,$local)
-		echo >&2 "* $1: fast forward to $3"
-		echo >&2 "  from $local to $2"
-		git-update-ref -m "$rloga: fast-forward" "$1" "$2" "$local"
-		;;
-	    *)
-		false
-		;;
-	    esac || {
-		echo >&2 "* $1: does not fast forward to $3;"
-		case ",$force,$single_force," in
-		*,t,*)
-			echo >&2 "  forcing update."
-			git-update-ref -m "$rloga: forced-update" "$1" "$2" "$local"
-			;;
-		*)
-			echo >&2 "  not updating."
-			exit 1
-			;;
-		esac
-	    }
-	else
-	    echo >&2 "* $1: storing $3"
-	    git-update-ref -m "$rloga: storing head" "$1" "$2"
-	fi
-	;;
-    esac
+	esac
 }
 
 case "$update_head_ok" in
@@ -225,26 +225,27 @@ reflist=$(get_remote_refs_for_fetch "$@"
 if test "$tags"
 then
 	taglist=`IFS="	" &&
-		  (
+		(
 			git-ls-remote $upload_pack --tags "$remote" ||
 			echo fail ouch
-		  ) |
-	          while read sha1 name
-		  do
+		) |
+		while read sha1 name
+		do
 			case "$sha1" in
 			fail)
 				exit 1
 			esac
 			case "$name" in
-			*^*) continue ;;
+			*^*)
+				continue ;;
 			esac
-		  	if git-check-ref-format "$name"
+			if git-check-ref-format "$name"
 			then
-			    echo ".${name}:${name}"
+				echo ".${name}:${name}"
 			else
-			    echo >&2 "warning: tag ${name} ignored"
+				echo >&2 "warning: tag ${name} ignored"
 			fi
-		  done` || exit
+		done` || exit
 	if test "$#" -gt 1
 	then
 		# remote URL plus explicit refspecs; we need to merge them.
@@ -256,146 +257,146 @@ then
 fi
 
 fetch_main () {
-  reflist="$1"
-  refs=
+	reflist="$1"
+	refs=
 
-  for ref in $reflist
-  do
-      refs="$refs$LF$ref"
+	for ref in $reflist
+	do
+		refs="$refs$LF$ref"
 
-      # These are relative path from $GIT_DIR, typically starting at refs/
-      # but may be HEAD
-      if expr "z$ref" : 'z\.' >/dev/null
-      then
-	  not_for_merge=t
-	  ref=$(expr "z$ref" : 'z\.\(.*\)')
-      else
-	  not_for_merge=
-      fi
-      if expr "z$ref" : 'z+' >/dev/null
-      then
-	  single_force=t
-	  ref=$(expr "z$ref" : 'z+\(.*\)')
-      else
-	  single_force=
-      fi
-      remote_name=$(expr "z$ref" : 'z\([^:]*\):')
-      local_name=$(expr "z$ref" : 'z[^:]*:\(.*\)')
+		# These are relative path from $GIT_DIR, typically starting at refs/
+		# but may be HEAD
+		if expr "z$ref" : 'z\.' >/dev/null
+		then
+			not_for_merge=t
+			ref=$(expr "z$ref" : 'z\.\(.*\)')
+		else
+			not_for_merge=
+		fi
+		if expr "z$ref" : 'z+' >/dev/null
+		then
+			single_force=t
+			ref=$(expr "z$ref" : 'z+\(.*\)')
+		else
+			single_force=
+		fi
+		remote_name=$(expr "z$ref" : 'z\([^:]*\):')
+		local_name=$(expr "z$ref" : 'z[^:]*:\(.*\)')
 
-      rref="$rref$LF$remote_name"
+		rref="$rref$LF$remote_name"
 
-      # There are transports that can fetch only one head at a time...
-      case "$remote" in
-      http://* | https://*)
-	  if [ -n "$GIT_SSL_NO_VERIFY" ]; then
-	      curl_extra_args="-k"
-	  fi
-	  max_depth=5
-	  depth=0
-	  head="ref: $remote_name"
-	  while (expr "z$head" : "zref:" && expr $depth \< $max_depth) >/dev/null
-	  do
-	    remote_name_quoted=$(@@PERL@@ -e '
-	      my $u = $ARGV[0];
-              $u =~ s/^ref:\s*//;
-	      $u =~ s{([^-a-zA-Z0-9/.])}{sprintf"%%%02x",ord($1)}eg;
-	      print "$u";
-	  ' "$head")
-	    head=$(curl -nsfL $curl_extra_args "$remote/$remote_name_quoted")
-	    depth=$( expr \( $depth + 1 \) )
-	  done
-	  expr "z$head" : "z$_x40\$" >/dev/null ||
-	      die "Failed to fetch $remote_name from $remote"
-	  echo >&2 Fetching "$remote_name from $remote" using http
-	  git-http-fetch -v -a "$head" "$remote/" || exit
-	  ;;
-      rsync://*)
-	  TMP_HEAD="$GIT_DIR/TMP_HEAD"
-	  rsync -L -q "$remote/$remote_name" "$TMP_HEAD" || exit 1
-	  head=$(git-rev-parse --verify TMP_HEAD)
-	  rm -f "$TMP_HEAD"
-	  test "$rsync_slurped_objects" || {
-	      rsync -av --ignore-existing --exclude info \
-		  "$remote/objects/" "$GIT_OBJECT_DIRECTORY/" || exit
+		# There are transports that can fetch only one head at a time...
+		case "$remote" in
+		http://* | https://*)
+			if [ -n "$GIT_SSL_NO_VERIFY" ]; then
+				curl_extra_args="-k"
+			fi
+			max_depth=5
+			depth=0
+			head="ref: $remote_name"
+			while (expr "z$head" : "zref:" && expr $depth \< $max_depth) >/dev/null
+			do
+				remote_name_quoted=$(@@PERL@@ -e '
+					my $u = $ARGV[0];
+					$u =~ s/^ref:\s*//;
+					$u =~ s{([^-a-zA-Z0-9/.])}{sprintf"%%%02x",ord($1)}eg;
+					print "$u";
+					' "$head")
+				head=$(curl -nsfL $curl_extra_args "$remote/$remote_name_quoted")
+				depth=$( expr \( $depth + 1 \) )
+			done
+			expr "z$head" : "z$_x40\$" >/dev/null ||
+				die "Failed to fetch $remote_name from $remote"
+			echo >&2 Fetching "$remote_name from $remote" using http
+			git-http-fetch -v -a "$head" "$remote/" || exit
+			;;
+		rsync://*)
+			TMP_HEAD="$GIT_DIR/TMP_HEAD"
+			rsync -L -q "$remote/$remote_name" "$TMP_HEAD" || exit 1
+			head=$(git-rev-parse --verify TMP_HEAD)
+			rm -f "$TMP_HEAD"
+			test "$rsync_slurped_objects" || {
+				rsync -av --ignore-existing --exclude info \
+					"$remote/objects/" "$GIT_OBJECT_DIRECTORY/" || exit
 
-	      # Look at objects/info/alternates for rsync -- http will
-	      # support it natively and git native ones will do it on
-	      # the remote end.  Not having that file is not a crime.
-	      rsync -q "$remote/objects/info/alternates" \
-		  "$GIT_DIR/TMP_ALT" 2>/dev/null ||
-		  rm -f "$GIT_DIR/TMP_ALT"
-	      if test -f "$GIT_DIR/TMP_ALT"
-	      then
-		  resolve_alternates "$remote" <"$GIT_DIR/TMP_ALT" |
-		  while read alt
-		  do
-		      case "$alt" in 'bad alternate: '*) die "$alt";; esac
-		      echo >&2 "Getting alternate: $alt"
-		      rsync -av --ignore-existing --exclude info \
-		      "$alt" "$GIT_OBJECT_DIRECTORY/" || exit
-		  done
-		  rm -f "$GIT_DIR/TMP_ALT"
-	      fi
-	      rsync_slurped_objects=t
-	  }
-	  ;;
-      *)
-	  # We will do git native transport with just one call later.
-	  continue ;;
-      esac
+			# Look at objects/info/alternates for rsync -- http will
+			# support it natively and git native ones will do it on
+			# the remote end.  Not having that file is not a crime.
+			rsync -q "$remote/objects/info/alternates" \
+				"$GIT_DIR/TMP_ALT" 2>/dev/null ||
+				rm -f "$GIT_DIR/TMP_ALT"
+			if test -f "$GIT_DIR/TMP_ALT"
+			then
+				resolve_alternates "$remote" <"$GIT_DIR/TMP_ALT" |
+				while read alt
+				do
+					case "$alt" in 'bad alternate: '*) die "$alt";; esac
+					echo >&2 "Getting alternate: $alt"
+					rsync -av --ignore-existing --exclude info \
+						"$alt" "$GIT_OBJECT_DIRECTORY/" || exit
+				done
+				rm -f "$GIT_DIR/TMP_ALT"
+			fi
+			rsync_slurped_objects=t
+			}
+			;;
+		*)
+			# We will do git native transport with just one call later.
+			continue ;;
+		esac
 
-      append_fetch_head "$head" "$remote" \
-	  "$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
+		append_fetch_head "$head" "$remote" \
+			"$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
 
-  done
+	done
 
-  case "$remote" in
-  http://* | https://* | rsync://* )
-      ;; # we are already done.
-  *)
-    ( : subshell because we muck with IFS
-      IFS=" 	$LF"
-      (
-	  git-fetch-pack $exec $keep "$remote" $rref || echo failed "$remote"
-      ) |
-      while read sha1 remote_name
-      do
-	  case "$sha1" in
-	  failed)
-		  echo >&2 "Fetch failure: $remote"
-		  exit 1 ;;
-	  esac
-	  found=
-	  single_force=
-	  for ref in $refs
-	  do
-	      case "$ref" in
-	      +$remote_name:*)
-		  single_force=t
-		  not_for_merge=
-		  found="$ref"
-		  break ;;
-	      .+$remote_name:*)
-		  single_force=t
-		  not_for_merge=t
-		  found="$ref"
-		  break ;;
-	      .$remote_name:*)
-		  not_for_merge=t
-		  found="$ref"
-		  break ;;
-	      $remote_name:*)
-		  not_for_merge=
-		  found="$ref"
-		  break ;;
-	      esac
-	  done
-	  local_name=$(expr "z$found" : 'z[^:]*:\(.*\)')
-	  append_fetch_head "$sha1" "$remote" \
-		  "$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
-      done
-    ) || exit ;;
-  esac
+	case "$remote" in
+	http://* | https://* | rsync://* )
+		;; # we are already done.
+	*)
+		( : subshell because we muck with IFS
+			IFS=" 	$LF"
+			(
+				git-fetch-pack $exec $keep "$remote" $rref || echo failed "$remote"
+			) |
+			while read sha1 remote_name
+			do
+				case "$sha1" in
+				failed)
+					echo >&2 "Fetch failure: $remote"
+					exit 1 ;;
+				esac
+				found=
+				single_force=
+				for ref in $refs
+				do
+					case "$ref" in
+					+$remote_name:*)
+						single_force=t
+						not_for_merge=
+						found="$ref"
+						break ;;
+					.+$remote_name:*)
+						single_force=t
+						not_for_merge=t
+						found="$ref"
+						break ;;
+					.$remote_name:*)
+						not_for_merge=t
+						found="$ref"
+						break ;;
+					$remote_name:*)
+						not_for_merge=
+						found="$ref"
+						break ;;
+					esac
+				done
+				local_name=$(expr "z$found" : 'z[^:]*:\(.*\)')
+				append_fetch_head "$sha1" "$remote" \
+					"$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
+			done
+		) || exit ;;
+	esac
 
 }
 
@@ -439,7 +440,7 @@ case ",$update_head_ok,$orig_head," in
 	curr_head=$(git-rev-parse --verify HEAD 2>/dev/null)
 	if test "$curr_head" != "$orig_head"
 	then
-	    git-update-ref \
+		git-update-ref \
 			-m "$rloga: Undoing incorrectly fetched HEAD." \
 			HEAD "$orig_head"
 		die "Cannot fetch into the current branch."
diff --git a/git-ls-remote.sh b/git-ls-remote.sh
index 2fdcaf7..38122ad 100755
--- a/git-ls-remote.sh
+++ b/git-ls-remote.sh
@@ -2,36 +2,36 @@ #!/bin/sh
 #
 
 usage () {
-    echo >&2 "usage: $0 [--heads] [--tags] [-u|--upload-pack <upload-pack>]"
-    echo >&2 "          <repository> <refs>..."
-    exit 1;
+	echo >&2 "usage: $0 [--heads] [--tags] [-u|--upload-pack <upload-pack>]"
+	echo >&2 "          <repository> <refs>..."
+	exit 1;
 }
 
 die () {
-    echo >&2 "$*"
-    exit 1
+	echo >&2 "$*"
+	exit 1
 }
 
 exec=
 while case "$#" in 0) break;; esac
 do
-  case "$1" in
-  -h|--h|--he|--hea|--head|--heads)
-  heads=heads; shift ;;
-  -t|--t|--ta|--tag|--tags)
-  tags=tags; shift ;;
-  -u|--u|--up|--upl|--uploa|--upload|--upload-|--upload-p|--upload-pa|\
-  --upload-pac|--upload-pack)
-	shift
-	exec="--exec=$1"
-	shift;;
-  --)
-  shift; break ;;
-  -*)
-  usage ;;
-  *)
-  break ;;
-  esac
+	case "$1" in
+	-h|--h|--he|--hea|--head|--heads)
+		heads=heads; shift ;;
+	-t|--t|--ta|--tag|--tags)
+		tags=tags; shift ;;
+	-u|--u|--up|--upl|--uploa|--upload|--upload-|--upload-p|--upload-pa|\
+		--upload-pac|--upload-pack)
+		shift
+		exec="--exec=$1"
+		shift;;
+	--)
+		shift; break ;;
+	-*)
+		usage ;;
+	*)
+		break ;;
+	esac
 done
 
 case "$#" in 0) usage ;; esac
@@ -50,9 +50,9 @@ tmpdir=$tmp-d
 
 case "$peek_repo" in
 http://* | https://* )
-        if [ -n "$GIT_SSL_NO_VERIFY" ]; then
-            curl_extra_args="-k"
-        fi
+	if [ -n "$GIT_SSL_NO_VERIFY" ]; then
+		curl_extra_args="-k"
+	fi
 	curl -nsf $curl_extra_args --header "Pragma: no-cache" "$peek_repo/info/refs" ||
 		echo "failed	slurping"
 	;;
-- 
1.4.1.1

^ permalink raw reply related

* Re: [PATCH 1/2] Use tabs for indent in shell scripts
From: Junio C Hamano @ 2006-08-01  9:50 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <200608011134.52006.jnareb@gmail.com>

Jakub Narebski <jnareb@gmail.com> writes:

>  if [ -n "$GIT_SSL_NO_VERIFY" ]; then
> -    curl_extra_args="-k"
> +	curl_extra_args="-k"
>  fi

Things like this makes some sense...

>  		if test -n "$use_separate_remote" &&
> -		   branch_name=`expr "z$name" : 'zheads/\(.*\)'`
> +			branch_name=`expr "z$name" : 'zheads/\(.*\)'`
>  		then

... but not this, which is not just indent but an alignment.

>  		case "$2" in
>  		'')
> -		    usage ;;
> +			usage ;;
>  		*/*)
> -		    echo >&2 "'$2' is not suitable for an origin name"
> -		    exit 1
> +			echo >&2 "'$2' is not suitable for an origin name"
> +			exit 1

Also shell scripts tend to become too deeply indented, and 4-column
indentation helps to keep things within typical screen width.

In short, not very enthused.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox