Git development
 help / color / mirror / Atom feed
* 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

* Re: [PATCH 2/3] sha1_file: add the ability to parse objects in "pack file format"
From: Linus Torvalds @ 2006-07-12 15:13 UTC (permalink / raw)
  To: Peter Baumann; +Cc: Junio C Hamano, Git Mailing List
In-Reply-To: <slrneb96rd.dma.Peter.B.Baumann@xp.machine.xx>



On Wed, 12 Jul 2006, Peter Baumann wrote:
> 
> This doesn't match the logic used in unpack_object_header, which is used
> in the packs:

Yeah, good point. I reversed the meaning of the high bit by mistake. In 
pack-files, the high bit is a "there is more to come" bit, and in my new 
code it was a "this is the last byte" bit.

It doesn't matter for the ultimate reason for this (being able to re-use 
the actual _bulk_ of the data), but having it be different would be stupid 
and confusing, and means that we can't later try to use the same routines 
for packing/unpacking the objects.

Junio - do you want me to send an updated patch, or do you want to reverse 
bit#7 yourself?

		Linus

^ permalink raw reply

* Re: Sharing repositories later on
From: Junio C Hamano @ 2006-07-12 15:21 UTC (permalink / raw)
  To: Erik Mouw; +Cc: git
In-Reply-To: <20060712132800.GA7328@harddisk-recovery.com>

Erik Mouw <erik@harddisk-recovery.com> writes:

> 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?

repack -a -d -l perhaps?

^ 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 15:27 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0607120810320.5623@g5.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> Junio - do you want me to send an updated patch, or do you want to reverse 
> bit#7 yourself?

Pushed out in "pu" already, thanks.

^ permalink raw reply

* Re: Re : 2 questions on git-send-email usage
From: Linus Torvalds @ 2006-07-12 15:43 UTC (permalink / raw)
  To: Franck Bui-Huu; +Cc: Junio C Hamano, git
In-Reply-To: <44B4A6CA.3020206@innova-card.com>



On Wed, 12 Jul 2006, Franck Bui-Huu wrote:
> 
> [PATCH] Add a newline before appending "Signed-off-by:"
> 
> It looks nicer.

Yes. However, I think the sign-off detection is a bit broken (quite 
independently of your patch).

A number of people end up capitalizing the sign-off differently, so you 
have lines like "Signed-Off-By: Xy Zzy <xyzzy@example.org>".

Also, at least for the kernel, we often have alternative formats, like

	Acked-by: Elliot Xavier Ample <example@dummy.org>

and for that case, adding the extra newline is actually bad.

So I would suggest a totally different approach: instead of using 
"strstr(comments, signed_off_by)", it would probably be much better to 
just look for the last non-empty line, and see if it matches the format

	"^[nonspace]*: .*@.*$"

(yeah, that's not a valid regexp, but you get the idea).

On a slightly related note, I absolutely _hate_ how cherry-picking adds 
"(cherry-picked from commit <sha1>)" at the end. It's wrong for so many 
reasons, one of them being that it then breaks things like this, but the 
main one being that <sha1> will quite often actually end up not even 
_existing_ in the resulting archive (you cherry-picked from your private 
branch, and even if you keep your branch, you don't necessarily push it 
out).

Junio, can we make the default _not_ to do it, please?

			Linus

^ permalink raw reply

* Re: Sharing repositories later on
From: Linus Torvalds @ 2006-07-12 15:47 UTC (permalink / raw)
  To: Erik Mouw; +Cc: git
In-Reply-To: <20060712132800.GA7328@harddisk-recovery.com>



On Wed, 12 Jul 2006, Erik Mouw wrote:
> 
> I just learned out about "git clone -s" to share objects between
> repositories. How do I use that with already existing repositories?

Do

	echo "/source/git/project/.git/objects/" > .git/objects/info/alternates

and then follow it up with

	git repack -a -d -l

where the "-l" means that it will only put _local_ objects in the 
pack-file (strictly speaking, it will put any loose objects from the 
alternate tree too, so you'll have a fully packed archive, but it won't 
duplicate objects that are already packed in the alternate tree).

		Linus

^ permalink raw reply

* Re: Sharing repositories later on
From: Erik Mouw @ 2006-07-12 15:57 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vpsgazw5j.fsf@assigned-by-dhcp.cox.net>

On Wed, Jul 12, 2006 at 08:21:28AM -0700, Junio C Hamano wrote:
> Erik Mouw <erik@harddisk-recovery.com> writes:
> > 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?
> 
> repack -a -d -l perhaps?

Thanks, that did the trick. I now have a small pack with around 100
objects.


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: Re : 2 questions on git-send-email usage
From: Junio C Hamano @ 2006-07-12 16:19 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git, Franck Bui-Huu
In-Reply-To: <Pine.LNX.4.64.0607120834200.5623@g5.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> On a slightly related note, I absolutely _hate_ how cherry-picking adds 
> "(cherry-picked from commit <sha1>)" at the end. It's wrong for so many 
> reasons, one of them being that it then breaks things like this, but the 
> main one being that <sha1> will quite often actually end up not even 
> _existing_ in the resulting archive (you cherry-picked from your private 
> branch, and even if you keep your branch, you don't necessarily push it 
> out).
>
> Junio, can we make the default _not_ to do it, please?

I understand that it can be annoying.

I was hoping that however when you do something like this:

	git log --filter-backported-commits v2.6.16.9..v2.6.17

an improved log-inspection tool could notice and filter out the
ones that was backported from the mainline to the maintenance
branch.

But I realize that is probably a faulty logic.  First of all,
not all backports are cherry-picked (the same patch can be
applied from an e-mail, for example), so if we really want to do
the above filtering, we would need to be able to detect the same
patch anyway without "cherry-picked from" information.

To a certain degree, git-patch-id would help detecting such a
duplicated patch, but it would not help you detect "moral
equivalent" changes that are textually different.  A cherry-pick
after a conflict resolution that ends up applying a textually
different patch would still leave the "cherry-picked from"
message in the commit log (or a "note " header if we implement
it to reduce cluttering the log message), which would be the
only advantage of recording the information somehow.  But that
is probably not worth it -- it means "moral equivalent" changes
need to be recorded somehow by hand, which is unnecessarly
developer burden if it is rare enough to want to filter such
duplicates when inspecting the log.

Do people find "cherry-picked from" information useful?  Does
anybody mind if we change the default not to record it?

^ permalink raw reply

* Re: Re : 2 questions on git-send-email usage
From: Junio C Hamano @ 2006-07-12 16:24 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git, Franck Bui-Huu
In-Reply-To: <Pine.LNX.4.64.0607120834200.5623@g5.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> Yes. However, I think the sign-off detection is a bit broken (quite 
> independently of your patch).
>
> A number of people end up capitalizing the sign-off differently, so you 
> have lines like "Signed-Off-By: Xy Zzy <xyzzy@example.org>".
>
> Also, at least for the kernel, we often have alternative formats, like
>
> 	Acked-by: Elliot Xavier Ample <example@dummy.org>
>
> and for that case, adding the extra newline is actually bad.
>
> So I would suggest a totally different approach: instead of using 
> "strstr(comments, signed_off_by)", it would probably be much better to 
> just look for the last non-empty line, and see if it matches the format
>
> 	"^[nonspace]*: .*@.*$"

Documentation/SubmittingPatches (the kernel one) does not show
the ugly Camel-Case-With-Hyphen spelling, and I've been wondring
why people do that.  A hidden agenda by me was to migrate people
away from that practice, but that is an independent issue ;-).

I like your "detect lines that looks like a RFC2822 header that
has some e-mail address" approach quite a lot.

^ 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 16:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vzmffz5xe.fsf@assigned-by-dhcp.cox.net>



On Tue, 11 Jul 2006, Junio C Hamano wrote:
> 
> You seem to have forgotten one file (fetch-pack.c) but that was
> trivial.  I'll apply and push it out shortly.

Actually, it was fetch.c, not fetch-pack.c, and I forgot that due to a 
very real (and totally separate) bug.

The makefile doesn't have any dependencies for "fetch.o" and "rsh.o", so 
when you change the headers, they never get rebuilt.

I think fetch.o and rsh.o should either get added to the library files, or 
we need something like this..

(I didn't check that I caught all the appropriate *.o files, but this 
should be better than what we have now).

Even better would be to make the dependancies automatic. The kernel does 
that really well with some GNU Makefile magic, but it also depends on 
magic gcc command line flags ("-Wp,-MD,$(depfile)")

		Linus

---
diff --git a/Makefile b/Makefile
index e75fb13..854e0af 100644
--- a/Makefile
+++ b/Makefile
@@ -236,6 +236,9 @@ BUILTIN_OBJS = \
 	builtin-cat-file.o builtin-mailsplit.o builtin-stripspace.o \
 	builtin-update-ref.o builtin-fmt-merge-msg.o
 
+MISC_OBJS = \
+	fetch.o rsh.o http-fetch.o http-push.o
+
 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
 LIBS = $(GITLIBS) -lz
 
@@ -615,7 +618,7 @@ git-http-push$X: revision.o http.o http-
 	$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 
-$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
+$(LIB_OBJS) $(BUILTIN_OBJS) $(MISC_OBJS): $(LIB_H)
 $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
 $(DIFF_OBJS): diffcore.h
 

^ permalink raw reply related

* Re: Re : 2 questions on git-send-email usage
From: Linus Torvalds @ 2006-07-12 16:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Franck Bui-Huu
In-Reply-To: <7v1wsqzt8f.fsf@assigned-by-dhcp.cox.net>



On Wed, 12 Jul 2006, Junio C Hamano wrote:

> Linus Torvalds <torvalds@osdl.org> writes:
> >
> > A number of people end up capitalizing the sign-off differently, so you 
> > have lines like "Signed-Off-By: Xy Zzy <xyzzy@example.org>".
> 
> Documentation/SubmittingPatches (the kernel one) does not show
> the ugly Camel-Case-With-Hyphen spelling, and I've been wondring
> why people do that.

Yeah, I actually try to edit it to the "proper" format when I notice it 
(which is not most of the time, but it's pretty rare to begin with).

More commonly, people mistype their own email addresses, and 
_occasionally_ just mis-type the whole Signed-off-by: line (we've got a 
few semi-colons instead of colons in the kernel, for example, and some 
lines that are missing the final '>' in the email etc.

So being somewhat forgiving might help, but I think another thing that 
migth help is a flag to "git-am" to _not_ apply a patch that lacks a 
previous sign-off.

I, for example, don't use the --signoff flag, partly because I want to 
make sure that I sign of only on patches that already have a sign-off from 
the previous person when it comes as email (or I add the sign-off only 
after looking at the patch closely). But if there was a 
"--error-on-no-signoff" flag, I could use it.

			Linus

^ permalink raw reply

* Re: [PATCH] gitweb.css: Courer fonts for commits and tree-diff
From: Luben Tuikov @ 2006-07-12 17:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vac7f1htw.fsf@assigned-by-dhcp.cox.net>

--- Junio C Hamano <junkio@cox.net> wrote:
> 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?

Sometimes people would put ASCII art in their commit messages,
things like a simple table, compiler output, log output, etc,
and I wanted to _preserve_ the intent of such output.  This is why
I changed it to Courier. (sorry for the misspelling of Courier)

> 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 use git.  Those patches are against a one-off branch, which I created
for the purpose of sending you the patches.

The original patches are against my "git-lt" branch, which has
the File::MMagic changes in it -- it is my working branch.
So I generated a patch off of "git-lt", applied it to "one-off-gitweb",
which is identical to the git "master" branch, and sent the patches.

      Luben


> 
> 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
> 
> 
> -
> 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: [PATCH] gitweb.cgi: Teach tree->raw to not require the hash of the blob
From: Luben Tuikov @ 2006-07-12 17:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7v64i31h6f.fsf@assigned-by-dhcp.cox.net>

--- Junio C Hamano <junkio@cox.net> 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.
> >
> > 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.
[cut]
> Hand-applied, tried, got confused and dropped.

I'll regenerate and send it to the list.

> 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,

Indeed, it is useful.

> 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.

I just thought it to be an easy place to put the "raw"-no-hash
link.

BTW, Junio, it would be a shame to lose this capability.  How
would you like to proceed with this?  Where would you like to
see this kind of link go?

> BTW, can somebody volunteer to be a gitweb/ "subsystem
> maintainer"?

Make sure you pick someone liberal without personal aspirations
or turning it into a personal crusade.  Service to the community
(not self, or company XYZ) is best.

    Luben

^ permalink raw reply

* Re: [PATCH] gitweb.cgi: Teach tree->raw to not require the hash of the blob
From: Luben Tuikov @ 2006-07-12 18:02 UTC (permalink / raw)
  To: Jakub Narebski, junkio; +Cc: git
In-Reply-To: <e92c1e$lvk$1@sea.gmane.org>

--- Jakub Narebski <jnareb@gmail.com> wrote:
> 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.

You seem to have hand-edited the mail headers to remove
Junio and myself from the CC/To headers list, but leave git@vger.

Please don't do that.  Just click Reply-All and continue with your
message.

Thanks,
    Luben

P.S. Restored.

^ permalink raw reply

* Re: [PATCH] gitweb.cgi: Teach tree->raw to not require the hash of the blob
From: Jakub Narebski @ 2006-07-12 18:12 UTC (permalink / raw)
  To: ltuikov, junkio, git
In-Reply-To: <20060712180204.23953.qmail@web31801.mail.mud.yahoo.com>

On 7/12/06, Luben Tuikov <ltuikov@yahoo.com> wrote:

> You seem to have hand-edited the mail headers to remove
> Junio and myself from the CC/To headers list, but leave git@vger.
>
> Please don't do that.  Just click Reply-All and continue with your
> message.

No, I've just replied from newsreader (not mail client) via GMane news
interface to git mailing list (gmane.comp.version-control.git), and I forgot
to use Reply-All, i.e. use mail as well as news interface.

Besides I seem to have problems trying to configure KNode to send
mail, especially with mixed mail+news sending.
-- 
Jakub Narebski

^ permalink raw reply

* Re: git-daemon problem
From: Matthias Lederhofer @ 2006-07-12 19:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vlkqz1lja.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> wrote:
> This breaks the newer clients that knows how to do side-band
> doesn't it?
Probably, this patch is just to give a starting point where the
problem could be.

> Would this replacement patch help?
[use write instead of safe_write]

This seems to fix it.  Perhaps it should be xwrite instead of write.

> 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?
daemon startup is probably not the right place because as long as the
terminal is open this will be fine.

^ permalink raw reply

* [PATCH] documentation about exclude/ignore files
From: Matthias Lederhofer @ 2006-07-12 19:54 UTC (permalink / raw)
  To: git

---
Use .git/info/exclude in the example in git-ls-files.txt as .gitignore
is used there and update the list of commands looking at
.git/info/exclude in repository-layout.txt.

---
 Documentation/git-ls-files.txt      |    4 ++--
 Documentation/repository-layout.txt |    8 +++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt
index 4d8a2ad..8520b97 100644
--- a/Documentation/git-ls-files.txt
+++ b/Documentation/git-ls-files.txt
@@ -207,7 +207,7 @@ An exclude pattern is of the following f
 An example:
 
 --------------------------------------------------------------
-    $ cat .git/ignore
+    $ cat .git/info/exclude
     # ignore objects and archives, anywhere in the tree.
     *.[oa]
     $ cat Documentation/.gitignore
@@ -217,7 +217,7 @@ An example:
     !foo.html
     $ git-ls-files --ignored \
         --exclude='Documentation/*.[0-9]' \
-        --exclude-from=.git/ignore \
+        --exclude-from=.git/info/exclude \
         --exclude-per-directory=.gitignore
 --------------------------------------------------------------
 
diff --git a/Documentation/repository-layout.txt b/Documentation/repository-layout.txt
index b52dfdc..275d18b 100644
--- a/Documentation/repository-layout.txt
+++ b/Documentation/repository-layout.txt
@@ -120,9 +120,11 @@ info/grafts::
 
 info/exclude::
 	This file, by convention among Porcelains, stores the
-	exclude pattern list.  `git status` looks at it, but
-	otherwise it is not looked at by any of the core git
-	commands.
+	exclude pattern list. `.gitignore` is the per-directory
+	ignore file.  `git status`, `git add`, `git rm` and `git
+	clean` look at it but the core git commands do not look
+	at it.  See also: gitlink:git-ls-files[1] `--exclude-from`
+	and `--exclude-per-directory`.
 
 remotes::
 	Stores shorthands to be used to give URL and default
-- 
1.4.1.gb16f

^ permalink raw reply related

* Note on "git grep"
From: Linus Torvalds @ 2006-07-12 21:33 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List


Heh. Since I've been bisecting a laptop of mine that keeps having ACPI 
problems, I notived something fun about "git grep".

Using the external "grep" is about 10 times faster for the hot-cache case, 
but for cold-cache, forcing the internal one is actually a _lot_ faster 
because a fully packed kernel archive just gets wonderfully better IO 
patterns than the "real filesystem" image.

So doing "git grep some-random-string HEAD" takes about 16 seconds 
cold-cache, and 11 seconds hot-cache.

In contrast, doing "git grep some-random-string" takes over a minute 
cold-cache, and about 2 seconds hot-cache. It's kind of sad that we can't 
dynamically notice which case we have, since the hot-cache case is _so_ 
much better for the external grep, but then cold-cache sucks for it..

I just thought I'd point this out to people, since I found it interesting 
how the built-in grep functionality actually outperforms the "real" one 
under some circumstances.

		Linus

^ permalink raw reply

* [PATCH] Documentation: Fix ssh:// URLs in generated documentation
From: Alp Toker @ 2006-07-12 21:55 UTC (permalink / raw)
  To: git

Commit c3f17061be95de3498449a548e93883aebff23d6 was causing warnings
during doc generation due to bad asciidoc markup.

This resulted in "ssh://[user@]host.xz/path/to/repo.git/" being rendered
as "host.xz/path/to/repo.git/" in the man pages and html output.

This patch converts sections listing URL formats to verbatim.

It also changes a minor capitalization inconsistency which ended up
appearing in several man pages by inclusion.

Signed-off-by: Alp Toker <alp@atoker.com>
---
 Documentation/urls.txt |   34 ++++++++++++++--------------------
 1 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/Documentation/urls.txt b/Documentation/urls.txt
index 9abec80..2b5a7f8 100644
--- a/Documentation/urls.txt
+++ b/Documentation/urls.txt
@@ -4,33 +4,27 @@ GIT URLS[[URLS]]
 One of the following notations can be used
 to name the remote repository:
 
-===============================================================
-- rsync://host.xz/path/to/repo.git/
-- http://host.xz/path/to/repo.git/
-- https://host.xz/path/to/repo.git/
-- git://host.xz/path/to/repo.git/
-- git://host.xz/~user/path/to/repo.git/
-- ssh://[user@]host.xz/path/to/repo.git/
-- ssh://[user@]host.xz/~user/path/to/repo.git/
-- ssh://[user@]host.xz/~/path/to/repo.git
-===============================================================
-
-SSH Is the default transport protocol and also supports an
+	rsync://host.xz/path/to/repo.git/
+	http://host.xz/path/to/repo.git/
+	https://host.xz/path/to/repo.git/
+	git://host.xz/path/to/repo.git/
+	git://host.xz/~user/path/to/repo.git/
+	ssh://[user@]host.xz/path/to/repo.git/
+	ssh://[user@]host.xz/~user/path/to/repo.git/
+	ssh://[user@]host.xz/~/path/to/repo.git
+
+SSH is the default transport protocol and also supports an
 scp-like syntax.  Both syntaxes support username expansion,
 as does the native git protocol. The following three are
 identical to the last three above, respectively:
 
-===============================================================
-- host.xz:/path/to/repo.git/
-- host.xz:~user/path/to/repo.git/
-- host.xz:path/to/repo.git
-===============================================================
+	host.xz:/path/to/repo.git/
+	host.xz:~user/path/to/repo.git/
+	host.xz:path/to/repo.git
 
 To sync with a local directory, use:
 
-===============================================================
-- /path/to/repo.git/
-===============================================================
+	/path/to/repo.git/
 
 REMOTES
 -------
-- 
1.4.1.g2fca1

^ permalink raw reply related

* git-read-tree: fatal: Entry 'Kbuild' not uptodate. Cannot merge.
From: Daniel Drake @ 2006-07-12 22:35 UTC (permalink / raw)
  To: git

Hi,

I'm having problems trying to merge one branch into another.

$ git --version
git version 1.4.1

$ git branch
* master
   origin
   rf-al7230b
   softmac-experimental

$ git checkout softmac-experimental

$ git diff

$ git pull . master
Merging HEAD with fd0fad8005cb8bfee0225ea04595d915639539e1
Merging:
9b1099f2d6686397ec6b98725afb62051ca6c421 BSS info change handling
fd0fad8005cb8bfee0225ea04595d915639539e1 Merge branch 'wireless-dev'
found 2 common ancestor(s):
a65c077e5fa4ba6d27f87f26b629a5c36ac8181b Justify the existance of 
basic/mandatory rate registers
62fbc2bb68a98d40c53cc07f80e36707e5a84bcc Merge branch 
'softmac-suggest-txrate' into wireless-dev
   Merging:
   a65c077e5fa4ba6d27f87f26b629a5c36ac8181b Justify the existance of 
basic/mandatory rate registers
   62fbc2bb68a98d40c53cc07f80e36707e5a84bcc Merge branch 
'softmac-suggest-txrate' into wireless-dev
   found 1 common ancestor(s):
   19ff9003ab13ff90c55c60a5bb7dd2ddc4d89685 Remove VENDOR_ defines
   Auto-merging zd_mac.c
git-read-tree: fatal: Entry 'Kbuild' not uptodate. Cannot merge.

$ git diff
diff --git a/Kbuild b/Kbuild
diff --git a/zd_chip.c b/zd_chip.c
diff --git a/zd_chip.h b/zd_chip.h
diff --git a/zd_def.h b/zd_def.h
diff --git a/zd_ieee80211.c b/zd_ieee80211.c
diff --git a/zd_ieee80211.h b/zd_ieee80211.h
diff --git a/zd_mac.c b/zd_mac.c
diff --git a/zd_mac.h b/zd_mac.h
diff --git a/zd_netdev.c b/zd_netdev.c
diff --git a/zd_rf.c b/zd_rf.c
diff --git a/zd_rf.h b/zd_rf.h
diff --git a/zd_rf_al2230.c b/zd_rf_al2230.c
diff --git a/zd_rf_rf2959.c b/zd_rf_rf2959.c
diff --git a/zd_usb.c b/zd_usb.c
diff --git a/zd_usb.h b/zd_usb.h
diff --git a/zd_util.c b/zd_util.c
diff --git a/zd_util.h b/zd_util.h

Now, I think I've seen this once or twice before, and I think I solved 
it by checking out all those files listed by "git diff" one by one.

However, when I try this now, the list produced by "git diff" shrinks 
and grows as I check more of them out, and I can't seem to get it down 
to 0 again.

I have also tried the -f flags for checkout and pull, no difference.

What's going on?

Thanks,
Daniel

^ permalink raw reply

* Re: git-read-tree: fatal: Entry 'Kbuild' not uptodate. Cannot merge.
From: Linus Torvalds @ 2006-07-12 22:39 UTC (permalink / raw)
  To: Daniel Drake; +Cc: git
In-Reply-To: <44B57932.4090708@gentoo.org>



On Wed, 12 Jul 2006, Daniel Drake wrote:
>
> git-read-tree: fatal: Entry 'Kbuild' not uptodate. Cannot merge.
> 
> $ git diff
> diff --git a/Kbuild b/Kbuild
> diff --git a/zd_chip.c b/zd_chip.c
> diff --git a/zd_chip.h b/zd_chip.h
> ...

Do "git update-index --refresh", does it go away?

Although "git checkout -f" should also have done it (much more 
expensively)

		Linus

^ permalink raw reply

* Re: git-read-tree: fatal: Entry 'Kbuild' not uptodate. Cannot merge.
From: Daniel Drake @ 2006-07-12 22:49 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0607121538300.5623@g5.osdl.org>

Linus Torvalds wrote:
> 
> On Wed, 12 Jul 2006, Daniel Drake wrote:
>> git-read-tree: fatal: Entry 'Kbuild' not uptodate. Cannot merge.
>>
>> $ git diff
>> diff --git a/Kbuild b/Kbuild
>> diff --git a/zd_chip.c b/zd_chip.c
>> diff --git a/zd_chip.h b/zd_chip.h
>> ...
> 
> Do "git update-index --refresh", does it go away?

Yep, thanks.

Daniel

^ permalink raw reply

* [PATCH] gitweb: Make command invocations go through the git wrapper
From: Alp Toker @ 2006-07-12 22:55 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

This patch makes invocations of core git commands go through the 'git'
binary itself, which improves readability and might help system
administrators lock down their CGI environment for security.

Signed-off-by: Alp Toker <alp@atoker.com>
---
 gitweb/gitweb.cgi |   62 +++++++++++++++++++++++++----------------------------
 1 files changed, 29 insertions(+), 33 deletions(-)

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 3d9fa44..2fd1e5f 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -22,20 +22,16 @@ our $my_url = $cgi->url();
 our $my_uri = $cgi->url(-absolute => 1);
 our $rss_link = "";
 
-# location of the git-core binaries
-our $gitbin = "/usr/bin";
+# core git executable to use
+# this can just be "git" if your webserver has a sensible PATH
+our $GIT = "/usr/bin/git";
 
 # absolute fs-path which will be prepended to the project path
 #our $projectroot = "/pub/scm";
 our $projectroot = "/home/kay/public_html/pub/scm";
 
-# version of the git-core binaries
-our $git_version = qx($gitbin/git --version);
-if ($git_version =~ m/git version (.*)$/) {
-	$git_version = $1;
-} else {
-	$git_version = "unknown";
-}
+# version of the core git binary
+our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown";
 
 # location for temporary files needed for diffs
 our $git_temp = "/tmp/gitweb";
@@ -392,7 +388,7 @@ sub die_error {
 sub git_get_type {
 	my $hash = shift;
 
-	open my $fd, "-|", "$gitbin/git-cat-file -t $hash" or return;
+	open my $fd, "-|", "$GIT cat-file -t $hash" or return;
 	my $type = <$fd>;
 	close $fd or return;
 	chomp $type;
@@ -404,7 +400,7 @@ sub git_read_head {
 	my $oENV = $ENV{'GIT_DIR'};
 	my $retval = undef;
 	$ENV{'GIT_DIR'} = "$projectroot/$project";
-	if (open my $fd, "-|", "$gitbin/git-rev-parse", "--verify", "HEAD") {
+	if (open my $fd, "-|", $GIT, "rev-parse", "--verify", "HEAD") {
 		my $head = <$fd>;
 		close $fd;
 		if (defined $head && $head =~ /^([0-9a-fA-F]{40})$/) {
@@ -444,7 +440,7 @@ sub git_read_tag {
 	my %tag;
 	my @comment;
 
-	open my $fd, "-|", "$gitbin/git-cat-file tag $tag_id" or return;
+	open my $fd, "-|", "$GIT cat-file tag $tag_id" or return;
 	$tag{'id'} = $tag_id;
 	while (my $line = <$fd>) {
 		chomp $line;
@@ -516,7 +512,7 @@ sub git_read_commit {
 		@commit_lines = @$commit_text;
 	} else {
 		$/ = "\0";
-		open my $fd, "-|", "$gitbin/git-rev-list --header --parents --max-count=1 $commit_id" or return;
+		open my $fd, "-|", "$GIT rev-list --header --parents --max-count=1 $commit_id" or return;
 		@commit_lines = split '\n', <$fd>;
 		close $fd or return;
 		$/ = "\n";
@@ -614,7 +610,7 @@ sub git_diff_print {
 	if (defined $from) {
 		$from_tmp = "$git_temp/gitweb_" . $$ . "_from";
 		open my $fd2, "> $from_tmp";
-		open my $fd, "-|", "$gitbin/git-cat-file blob $from";
+		open my $fd, "-|", "$GIT cat-file blob $from";
 		my @file = <$fd>;
 		print $fd2 @file;
 		close $fd2;
@@ -625,7 +621,7 @@ sub git_diff_print {
 	if (defined $to) {
 		$to_tmp = "$git_temp/gitweb_" . $$ . "_to";
 		open my $fd2, "> $to_tmp";
-		open my $fd, "-|", "$gitbin/git-cat-file blob $to";
+		open my $fd, "-|", "$GIT cat-file blob $to";
 		my @file = <$fd>;
 		print $fd2 @file;
 		close $fd2;
@@ -844,7 +840,7 @@ sub git_get_project_config {
 	$key =~ s/^gitweb\.//;
 	return if ($key =~ m/\W/);
 
-	my $val = qx($gitbin/git-repo-config --get gitweb.$key);
+	my $val = qx($GIT repo-config --get gitweb.$key);
 	return ($val);
 }
 
@@ -1066,7 +1062,7 @@ sub git_summary {
 	      "<tr><td>owner</td><td>$owner</td></tr>\n" .
 	      "<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n" .
 	      "</table>\n";
-	open my $fd, "-|", "$gitbin/git-rev-list --max-count=17 " . git_read_head($project) or die_error(undef, "Open failed.");
+	open my $fd, "-|", "$GIT rev-list --max-count=17 " . git_read_head($project) or die_error(undef, "Open failed.");
 	my (@revlist) = map { chomp; $_ } <$fd>;
 	close $fd;
 	print "<div>\n" .
@@ -1254,7 +1250,7 @@ sub git_blame {
 		$hash = git_get_hash_by_path($hash_base, $file_name, "blob")
 			or die_error(undef, "Error lookup file.");
 	}
-	open ($fd, "-|", "$gitbin/git-annotate", '-l', '-t', '-r', $file_name, $hash_base)
+	open ($fd, "-|", $GIT, "annotate", '-l', '-t', '-r', $file_name, $hash_base)
 		or die_error(undef, "Open failed.");
 	git_header_html();
 	print "<div class=\"page_nav\">\n" .
@@ -1449,7 +1445,7 @@ sub git_get_hash_by_path {
 	my $tree = $base;
 	my @parts = split '/', $path;
 	while (my $part = shift @parts) {
-		open my $fd, "-|", "$gitbin/git-ls-tree $tree" or die_error(undef, "Open git-ls-tree failed.");
+		open my $fd, "-|", "$GIT ls-tree $tree" or die_error(undef, "Open git-ls-tree failed.");
 		my (@entries) = map { chomp; $_ } <$fd>;
 		close $fd or return undef;
 		foreach my $line (@entries) {
@@ -1536,7 +1532,7 @@ sub git_blob_plain_mimetype {
 
 sub git_blob_plain {
 	my $type = shift;
-	open my $fd, "-|", "$gitbin/git-cat-file blob $hash" or die_error("Couldn't cat $file_name, $hash");
+	open my $fd, "-|", "$GIT cat-file blob $hash" or die_error("Couldn't cat $file_name, $hash");
 
 	$type ||= git_blob_plain_mimetype($fd, $file_name);
 
@@ -1563,7 +1559,7 @@ sub git_blob {
 		$hash = git_get_hash_by_path($base, $file_name, "blob") || die_error(undef, "Error lookup file.");
 	}
 	my $have_blame = git_get_project_config_bool ('blame');
-	open my $fd, "-|", "$gitbin/git-cat-file blob $hash" or die_error(undef, "Open failed.");
+	open my $fd, "-|", "$GIT cat-file blob $hash" or die_error(undef, "Open failed.");
 	my $mimetype = git_blob_plain_mimetype($fd, $file_name);
 	if ($mimetype !~ m/^text\//) {
 		close $fd;
@@ -1629,7 +1625,7 @@ sub git_tree {
 		}
 	}
 	$/ = "\0";
-	open my $fd, "-|", "$gitbin/git-ls-tree -z $hash" or die_error(undef, "Open git-ls-tree failed.");
+	open my $fd, "-|", "$GIT ls-tree -z $hash" or die_error(undef, "Open git-ls-tree failed.");
 	chomp (my (@entries) = <$fd>);
 	close $fd or die_error(undef, "Reading tree failed.");
 	$/ = "\n";
@@ -1712,7 +1708,7 @@ #			      " | " . $cgi->a({-href => "$my
 
 sub git_rss {
 	# http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
-	open my $fd, "-|", "$gitbin/git-rev-list --max-count=150 " . git_read_head($project) or die_error(undef, "Open failed.");
+	open my $fd, "-|", "$GIT rev-list --max-count=150 " . git_read_head($project) or die_error(undef, "Open failed.");
 	my (@revlist) = map { chomp; $_ } <$fd>;
 	close $fd or die_error(undef, "Reading rev-list failed.");
 	print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
@@ -1732,7 +1728,7 @@ sub git_rss {
 			last;
 		}
 		my %cd = date_str($co{'committer_epoch'});
-		open $fd, "-|", "$gitbin/git-diff-tree -r $co{'parent'} $co{'id'}" or next;
+		open $fd, "-|", "$GIT diff-tree -r $co{'parent'} $co{'id'}" or next;
 		my @difftree = map { chomp; $_ } <$fd>;
 		close $fd or next;
 		print "<item>\n" .
@@ -1820,7 +1816,7 @@ sub git_log {
 	      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$hash;hb=$hash")}, "tree") . "<br/>\n";
 
 	my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
-	open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error(undef, "Open failed.");
+	open my $fd, "-|", "$GIT rev-list $limit $hash" or die_error(undef, "Open failed.");
 	my (@revlist) = map { chomp; $_ } <$fd>;
 	close $fd;
 
@@ -1911,7 +1907,7 @@ sub git_commit {
 		$root = " --root";
 		$parent = "";
 	}
-	open my $fd, "-|", "$gitbin/git-diff-tree -r -M $root $parent $hash" or die_error(undef, "Open failed.");
+	open my $fd, "-|", "$GIT diff-tree -r -M $root $parent $hash" or die_error(undef, "Open failed.");
 	@difftree = map { chomp; $_ } <$fd>;
 	close $fd or die_error(undef, "Reading diff-tree failed.");
 
@@ -2153,7 +2149,7 @@ sub git_commitdiff {
 	if (!defined $hash_parent) {
 		$hash_parent = $co{'parent'};
 	}
-	open my $fd, "-|", "$gitbin/git-diff-tree -r $hash_parent $hash" or die_error(undef, "Open failed.");
+	open my $fd, "-|", "$GIT diff-tree -r $hash_parent $hash" or die_error(undef, "Open failed.");
 	my (@difftree) = map { chomp; $_ } <$fd>;
 	close $fd or die_error(undef, "Reading diff-tree failed.");
 
@@ -2243,14 +2239,14 @@ sub git_commitdiff {
 
 sub git_commitdiff_plain {
 	mkdir($git_temp, 0700);
-	open my $fd, "-|", "$gitbin/git-diff-tree -r $hash_parent $hash" or die_error(undef, "Open failed.");
+	open my $fd, "-|", "$GIT diff-tree -r $hash_parent $hash" or die_error(undef, "Open failed.");
 	my (@difftree) = map { chomp; $_ } <$fd>;
 	close $fd or die_error(undef, "Reading diff-tree failed.");
 
 	# try to figure out the next tag after this commit
 	my $tagname;
 	my $refs = read_info_ref("tags");
-	open $fd, "-|", "$gitbin/git-rev-list HEAD";
+	open $fd, "-|", "$GIT rev-list HEAD";
 	chomp (my (@commits) = <$fd>);
 	close $fd;
 	foreach my $commit (@commits) {
@@ -2321,7 +2317,7 @@ sub git_history {
 	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
 
 	open my $fd, "-|",
-		"$gitbin/git-rev-list --full-history $hash -- \'$file_name\'";
+		"$GIT rev-list --full-history $hash -- \'$file_name\'";
 	print "<table cellspacing=\"0\">\n";
 	my $alternate = 0;
 	while (my $line = <$fd>) {
@@ -2408,7 +2404,7 @@ sub git_search {
 	my $alternate = 0;
 	if ($commit_search) {
 		$/ = "\0";
-		open my $fd, "-|", "$gitbin/git-rev-list --header --parents $hash" or next;
+		open my $fd, "-|", "$GIT rev-list --header --parents $hash" or next;
 		while (my $commit_text = <$fd>) {
 			if (!grep m/$searchtext/i, $commit_text) {
 				next;
@@ -2458,7 +2454,7 @@ sub git_search {
 
 	if ($pickaxe_search) {
 		$/ = "\n";
-		open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin -S\'$searchtext\'";
+		open my $fd, "-|", "$GIT rev-list $hash | $GIT diff-tree -r --stdin -S\'$searchtext\'";
 		undef %co;
 		my @files;
 		while (my $line = <$fd>) {
@@ -2529,7 +2525,7 @@ sub git_shortlog {
 	      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$hash;hb=$hash")}, "tree") . "<br/>\n";
 
 	my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
-	open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error(undef, "Open failed.");
+	open my $fd, "-|", "$GIT rev-list $limit $hash" or die_error(undef, "Open failed.");
 	my (@revlist) = map { chomp; $_ } <$fd>;
 	close $fd;
 
-- 
1.4.1.g2fca1

^ permalink raw reply related

* [PATCH] gitweb.css: Courier fonts for commits and tree-diff
From: Luben Tuikov @ 2006-07-13  3:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 207 bytes --]

Courier fonts for the commit header, commit message,
and tree-diff.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.css |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

[-- Attachment #2: pat1954662842 --]
[-- Type: application/octet-stream, Size: 685 bytes --]

diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index 98410f5..b51282b 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -60,6 +60,7 @@ div.page_footer_text {
 
 div.page_body {
 	padding: 8px;
+	font-family: courier;
 }
 
 div.title, a.title {
@@ -79,6 +80,7 @@ div.title_text {
 	padding: 6px 0px;
 	border: solid #d9d8d1;
 	border-width: 0px 0px 1px;
+	font-family: courier;
 }
 
 div.log_body {
@@ -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 related

* [PATCH] gitweb.cgi: Teach tree->raw to not require the hash of the blob
From: Luben Tuikov @ 2006-07-13  3:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 502 bytes --]

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(-)

[-- Attachment #2: pat867582916 --]
[-- Type: application/octet-stream, Size: 2055 bytes --]

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 2e87de4..e904eb7 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -1521,6 +1521,14 @@ sub git_blob_plain_mimetype {
 }
 
 sub git_blob_plain {
+	if (!defined $hash) {
+		if (defined $file_name) {
+			my $base = $hash_base || git_read_head($project);
+			$hash = git_get_hash_by_path($base, $file_name, "blob") || die_error(undef, "Error lookup file.");
+		} else {
+			die_error(undef, "No file name defined.");
+		}
+	}
 	my $type = shift;
 	open my $fd, "-|", "$gitbin/git-cat-file blob $hash" or die_error("Couldn't cat $file_name, $hash");
 
@@ -1544,9 +1552,13 @@ sub git_blob_plain {
 }
 
 sub git_blob {
-	if (!defined $hash && defined $file_name) {
-		my $base = $hash_base || git_read_head($project);
-		$hash = git_get_hash_by_path($base, $file_name, "blob") || die_error(undef, "Error lookup file.");
+	if (!defined $hash) {
+		if (defined $file_name) {
+			my $base = $hash_base || git_read_head($project);
+			$hash = git_get_hash_by_path($base, $file_name, "blob") || die_error(undef, "Error lookup file.");
+		} else {
+			die_error(undef, "No file name defined.");
+		}
 	}
 	my $have_blame = git_get_project_config_bool ('blame');
 	open my $fd, "-|", "$gitbin/git-cat-file blob $hash" or die_error(undef, "Open failed.");
@@ -1678,8 +1690,7 @@ sub git_tree {
 			      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$t_hash$base_key;f=$base$t_name")}, "blob") .
 #			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;h=$t_hash$base_key;f=$base$t_name")}, "blame") .
 			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$hash_base;f=$base$t_name")}, "history") .
-			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$t_hash;f=$base$t_name")}, "raw") .
+			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;f=$base$t_name")}, "raw") .
 			      "</td>\n";
 		} elsif ($t_type eq "tree") {
 			print "<td class=\"list\">" .
-- 
1.4.1.g9ca3


^ permalink raw reply related


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