Git development
 help / color / mirror / Atom feed
* [PATCH] gitweb: make PATHINFO URL generation conditional on input URL.
From: Martin Waitz @ 2006-10-03 18:08 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <efu3u4$tc9$1@sea.gmane.org>

Now the feature 'pathinfo' configuration only applies to the project
list.  All other URLs are generated in the form the webpage was
called itself.

Signed-off-by: Martin Waitz <tali@admingilde.org>
---
 gitweb/gitweb.perl |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 0ff6f7c..70246de 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -206,6 +206,8 @@ our $git_version = qx($GIT --version) =~
 
 $projects_list ||= $projectroot;
 
+our $use_pathinfo_url = gitweb_check_feature('pathinfo');
+
 # ======================================================================
 # input validation and dispatch
 our $action = $cgi->param('a');
@@ -226,6 +228,8 @@ if (defined $project) {
 		undef $project;
 		die_error(undef, "No such project");
 	}
+	# we got called without PATH_INFO, let's keep it that way.
+	$use_pathinfo_url = 0;
 }
 
 our $file_name = $cgi->param('f');
@@ -308,6 +312,10 @@ sub evaluate_path_info {
 		undef $project;
 		return;
 	}
+	
+	# we were called using a PATH_INFO URL, let's keep it that way.
+	$use_pathinfo_url = 1;
+
 	# do not change any parameters if an action is given using the query string
 	return if $action;
 	$path_info =~ s,^$project/*,,;
@@ -402,8 +410,7 @@ sub href(%) {
 
 	$params{'project'} = $project unless exists $params{'project'};
 
-	my ($use_pathinfo) = gitweb_check_feature('pathinfo');
-	if ($use_pathinfo) {
+	if ($use_pathinfo_url) {
 		# use PATH_INFO for project name
 		$href .= "/$params{'project'}" if defined $params{'project'};
 		delete $params{'project'};
-- 
1.4.2.3

-- 
Martin Waitz

^ permalink raw reply related

* [PATCH] gitweb: warn if feature cannot be overridden.
From: Martin Waitz @ 2006-10-03 18:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jakub Narebski, git
In-Reply-To: <7vbqotpadg.fsf@assigned-by-dhcp.cox.net>

If the administrator configures pathinfo to be overrideable by the
local repository a warning is shown.

Signed-off-by: Martin Waitz <tali@admingilde.org>
---
 gitweb/gitweb.perl |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 10e803a..0ff6f7c 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -116,6 +116,10 @@ sub gitweb_check_feature {
 		$feature{$name}{'override'},
 		@{$feature{$name}{'default'}});
 	if (!$override) { return @defaults; }
+	if (!defined $sub) {
+		warn "feature $name is not overrideable";
+		return @defaults;
+	}
 	return $sub->(@defaults);
 }
 
-- 
1.4.2.3

-- 
Martin Waitz

^ permalink raw reply related

* Re: [PATCH] gitweb: start to generate PATH_INFO URLs.
From: Jakub Narebski @ 2006-10-03 17:50 UTC (permalink / raw)
  To: git
In-Reply-To: <7vbqotpadg.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:

> Jakub Narebski <jnareb@gmail.com> writes:
> 
>> Martin Waitz wrote:
>>
>>> +       'pathinfo' => {
>>> +               'override' => 0,
>>> +               'default' => [1]},
>>
>> You should add failsafe to gitweb_check_feature for when 'sub' is not
set;
>> for example when somebody sets $feature{'pathinfo'}{'override'} to 1.
> 
> Yes, I noticed this last night while playing with it.  We would
> at least need a big warning that says this should not be made
> overridable (which does not make any sense anyway).
> 
> Setting 'sub' to a failsafe one that only returns what is in the
> default without looking at individual repository would be the
> cleanest, I think.

Perhaps we should not add 'override' key, and test for existence
of 'override' to fallback on 'sub'.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: Why gitweb commitdiff NO diff output ?
From: Junio C Hamano @ 2006-10-03 17:39 UTC (permalink / raw)
  To: Martin Waitz; +Cc: git, Jakub Narebski
In-Reply-To: <20061003095250.GJ2871@admingilde.org>

Martin Waitz <tali@admingilde.org> writes:

>> > My git repository import from subversion, and the latest files has
>> > correct mime-type property, but gitweb commitdiff NO diff output !
>> > 
>> > file:82dc767b3f1425435fa6d8fa7511718d3f614172 ->
>> > file:4c7269ed65bf8691c46541497fbecc706f7d012f
>> > 
>> > file:6817671d9af75b9adcc439d62f9047c7b2a9adb2 ->
>> > file:575d40108f550ac5965bb6ea8b6792fa9cc10536
>> 
>> Not enough information.
>
> A few months ago, I got that a on kernel.org a few times, too.
> After reloading the page it always got shown correctly, so I never bothered
> to report it.

This is just a wild guess without reproduction, but if that was
seen on kernel.org _temporarily_, it could be that rsync was in
the middle of mirroring and things other than these blobs that
were needed for you to reach that page (i.e. the commits and the
trees, and the refs/heads/master to mark the tip of the ancestry
chain) were already on the gitweb public machine but blobs
weren't.

^ permalink raw reply

* Re: [PATCH 1/2] Move code resolving packed refs into its own function.
From: Junio C Hamano @ 2006-10-03 17:39 UTC (permalink / raw)
  To: git; +Cc: jnareb
In-Reply-To: <eftjua$2ii$1@sea.gmane.org>

Jakub Narebski <jnareb@gmail.com> writes:

> Junio C Hamano wrote:
>
>>  - I think gitweb should be Ok; it does peek-remote on the
>>    repository.  Although we would probably want to update
>>    git_get_references and git_get_refs_list sub to use
>>    for-each-ref there, that can be done as a later optimization.
>
> I'd rather have gitweb use git-for-each-ref after the command
> is in the official release... if not, then keep it in the 'next'
> branch.

Of course.  What else did you expect?

> By the way, I have an idea to join the git-show-ref and git-for-each-ref:
> simply add --deref option to git-for-each-ref, which would output
> dereferenced tag just after the reference itself (well, perhaps with the
> exception when sorting, perhaps not), with the deref name like in
> git-show-ref and git-peek-remote, i.e. <ref>^{}

Patches welcome.  --verify needs to use totally separate
codepath though.  for-each-ref is primarily for easy displaying
and expects the caller to script in order to skip ones that are
irrelevant while listing (e.g. asking for *objectname does not
error for a non-tag but the caller can deduce that ref is not a
tag by it being empty and skip it); show-ref --verify is for
easy checking for an exact match and should not even walk.

^ permalink raw reply

* Re: [PATCH] gitweb: start to generate PATH_INFO URLs.
From: Junio C Hamano @ 2006-10-03 17:39 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git, Martin Waitz
In-Reply-To: <eftkdk$2ii$3@sea.gmane.org>

Jakub Narebski <jnareb@gmail.com> writes:

> Martin Waitz wrote:
>
>> +       'pathinfo' => {
>> +               'override' => 0,
>> +               'default' => [1]},
>
> You should add failsafe to gitweb_check_feature for when 'sub' is not set;
> for example when somebody sets $feature{'pathinfo'}{'override'} to 1.

Yes, I noticed this last night while playing with it.  We would
at least need a big warning that says this should not be made
overridable (which does not make any sense anyway).

Setting 'sub' to a failsafe one that only returns what is in the
default without looking at individual repository would be the
cleanest, I think.

^ permalink raw reply

* Re: [PATCH] gitweb: start to generate PATH_INFO URLs
From: Junio C Hamano @ 2006-10-03 17:36 UTC (permalink / raw)
  To: Martin Waitz; +Cc: git, Jakub Narebski
In-Reply-To: <20061003171229.GN2871@admingilde.org>

Martin Waitz <tali@admingilde.org> writes:

> On Tue, Oct 03, 2006 at 02:16:05PM +0200, Jakub Narebski wrote:
>> 
>> I have just modified href() to be able to use it for actions which don't
>> need the ?p= parameter... and you didn't take into consideration the case
>> when $params{'project'} is set, but undefined.
>
> is this handled correctly in the second patch which got committed to
> next?

I did only a light testing last night and I do not remember
testing this particular issue I did not see an obvious
breakage.  Could you two please verify and send in fixes if you
find any more issues around this area?

I think Jakub's suggestion to respond in PATH_INFO to requests
that does use PATH_INFO is a good one.

^ permalink raw reply

* Re: [PATCH] gitweb: start to generate PATH_INFO URLs
From: Jakub Narebski @ 2006-10-03 17:19 UTC (permalink / raw)
  To: git
In-Reply-To: <20061003171229.GN2871@admingilde.org>

Martin Waitz wrote:

> On Tue, Oct 03, 2006 at 02:16:05PM +0200, Jakub Narebski wrote:
>> Martin Waitz wrote:
>> > Instead of providing the project as a ?p= parameter it is simply appended
>> > to the base URI.
>> 
>> I have just modified href() to be able to use it for actions which don't
>> need the ?p= parameter... and you didn't take into consideration the case
>> when $params{'project'} is set, but undefined.
> 
> is this handled correctly in the second patch which got committed to
> next?

I think it is (from the examining the patch, not from testing).

Perhaps we should use PATH_INFO if current URL uses PATH_INFO... 
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: [PATCH] gitweb: start to generate PATH_INFO URLs
From: Martin Waitz @ 2006-10-03 17:12 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <eftk98$2ii$2@sea.gmane.org>

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

hoi :)

On Tue, Oct 03, 2006 at 02:16:05PM +0200, Jakub Narebski wrote:
> Martin Waitz wrote:
> > Instead of providing the project as a ?p= parameter it is simply appended
> > to the base URI.
> 
> I have just modified href() to be able to use it for actions which don't
> need the ?p= parameter... and you didn't take into consideration the case
> when $params{'project'} is set, but undefined.

is this handled correctly in the second patch which got committed to
next?

-- 
Martin Waitz

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] gitweb: start to generate PATH_INFO URLs
From: Jakub Narebski @ 2006-10-03 16:43 UTC (permalink / raw)
  To: git
In-Reply-To: <7v8xk2jofc.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:

> Martin Waitz <tali@admingilde.org> writes:
> 
>> Instead of providing the project as a ?p= parameter it is simply appended
>> to the base URI.
>> All other parameters are appended to that, except for ?a=summary which
>> is the default and can be omitted.
> 
> Supporting PATH_INFO in the sense that we do sensible things
> when we get called with one is one thing, but generating such a
> URL that uses PATH_INFO is a different thing.  I suspect not
> everybody's webserver is configured to call us with PATH_INFO,
> so this should be conditional.

Or perhaps we should use PATH_INFO if the URL of current page uses
PATH_INFO too. The only place where we have to decide is the projects
list page (i.e. no arguments).
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* [PATCH] git-commit: cleanup unused function.
From: Martin Waitz @ 2006-10-03 16:38 UTC (permalink / raw)
  To: git

The report() function is not used anymore. Kill it.

Signed-off-by: Martin Waitz <tali@admingilde.org>
---
 git-commit.sh |   27 ---------------------------
 1 files changed, 0 insertions(+), 27 deletions(-)

diff --git a/git-commit.sh b/git-commit.sh
index 5a4c659..6f6cbda 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -32,33 +32,6 @@ save_index () {
 	cp -p "$THIS_INDEX" "$NEXT_INDEX"
 }
 
-report () {
-  header="#
-# $1:
-#   ($2)
-#
-"
-  trailer=""
-  while read status name newname
-  do
-    printf '%s' "$header"
-    header=""
-    trailer="#
-"
-    case "$status" in
-    M ) echo "#	modified: $name";;
-    D*) echo "#	deleted:  $name";;
-    T ) echo "#	typechange: $name";;
-    C*) echo "#	copied: $name -> $newname";;
-    R*) echo "#	renamed: $name -> $newname";;
-    A*) echo "#	new file: $name";;
-    U ) echo "#	unmerged: $name";;
-    esac
-  done
-  printf '%s' "$trailer"
-  [ "$header" ]
-}
-
 run_status () {
 	# If TMP_INDEX is defined, that means we are doing
 	# "--only" partial commit, and that index file is used
-- 
1.4.2.1.gbc1a5


-- 
Martin Waitz

^ permalink raw reply related

* Re: [PATCH] gitweb: tree view: eliminate redundant "blob"
From: Linus Torvalds @ 2006-10-03 16:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jakub Narebski, git
In-Reply-To: <7v1wpqujck.fsf@assigned-by-dhcp.cox.net>



On Mon, 2 Oct 2006, Junio C Hamano wrote:
> 
> Honestly, I _hate_ to be in the position to decide in which
> color the bikeshed should be, but sometimes that is what a
> maintainer has to do.

Quite often, that's _exactly_ the one thing a maintainer should do. Most 
"non-bikeshed-painting" issues don't need maintainers. They are obvious to 
everybody, and/or there's only one person who actually did the work, and 
nobody else ends up beign competent enough, and people know it.

The real glory of maintainership isn't making the big and important 
decisions. The real glory lies in all the _small_ stuff that doesn't 
really matter, and that people will just argue forever.

The ability to just cut off the stupid debate early about something that 
otherwise never gets resolved (or that causes bad feelings just because 
people get worked up over some perceived issue), _that_ is what the 
maintainer is all about.

			Linus

^ permalink raw reply

* [PATCH] git-rebase: Add a -v option to show a diffstat of the changes upstream at the start of a rebase.
From: Robert Shearman @ 2006-10-03 16:29 UTC (permalink / raw)
  To: Git Mailing List

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


Signed-off-by: Robert Shearman <rob@codeweavers.com>
---
  Documentation/git-rebase.txt |    5 ++++-
  git-rebase.sh                |   12 +++++++++++-
  2 files changed, 15 insertions(+), 2 deletions(-)

[-- Attachment #2: fa9469c0860b24ea50036973e5c53b4da19041cf.diff --]
[-- Type: text/x-patch, Size: 1757 bytes --]

diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 9d7bcaa..10f2924 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -7,7 +7,7 @@ git-rebase - Rebase local commits to a n
 
 SYNOPSIS
 --------
-'git-rebase' [--merge] [--onto <newbase>] <upstream> [<branch>]
+'git-rebase' [-v] [--merge] [--onto <newbase>] <upstream> [<branch>]
 
 'git-rebase' --continue | --skip | --abort
 
@@ -121,6 +121,9 @@ OPTIONS
 	is used instead (`git-merge-recursive` when merging a single
 	head, `git-merge-octopus` otherwise).  This implies --merge.
 
+-v, \--verbose::
+	Display a diffstat of what changed upstream since the last rebase.
+
 include::merge-strategies.txt[]
 
 NOTES
diff --git a/git-rebase.sh b/git-rebase.sh
index 413636e..546fa44 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -3,7 +3,7 @@ #
 # Copyright (c) 2005 Junio C Hamano.
 #
 
-USAGE='[--onto <newbase>] <upstream> [<branch>]'
+USAGE='[-v] [--onto <newbase>] <upstream> [<branch>]'
 LONG_USAGE='git-rebase replaces <branch> with a new branch of the
 same name.  When the --onto option is provided the new branch starts
 out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>
@@ -39,6 +39,7 @@ strategy=recursive
 do_merge=
 dotest=$GIT_DIR/.dotest-merge
 prec=4
+verbose=
 
 continue_merge () {
 	test -n "$prev_head" || die "prev_head must be defined"
@@ -190,6 +191,9 @@ do
 		esac
 		do_merge=t
 		;;
+	-v|--verbose)
+		verbose=t
+		;;
 	-*)
 		usage
 		;;
@@ -273,6 +277,12 @@ then
 	exit 0
 fi
 
+if test -n "$verbose"
+then
+	echo "Changes from $mb to $onto:"
+	git-diff-tree --stat --summary "$mb" "$onto"
+fi
+
 # Rewind the head to "$onto"; this saves our current head in ORIG_HEAD.
 git-reset --hard "$onto"
 


^ permalink raw reply related

* [PATCH] git-rebase: Use --ignore-if-in-upstream option when executing git-format-patch.
From: Robert Shearman @ 2006-10-03 16:29 UTC (permalink / raw)
  To: Git Mailing List

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


This reduces the number of conflicts when rebasing after a series of 
patches to the same piece of code is committed upstream.

Signed-off-by: Robert Shearman <rob@codeweavers.com>
---
  git-rebase.sh |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

[-- Attachment #2: b751c3c0da70a7b1dfddb5dd42412f1d2f1cc73d.diff --]
[-- Type: text/x-patch, Size: 420 bytes --]

diff --git a/git-rebase.sh b/git-rebase.sh
index a7373c0..413636e 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -286,7 +286,7 @@ fi
 
 if test -z "$do_merge"
 then
-	git-format-patch -k --stdout --full-index "$upstream"..ORIG_HEAD |
+	git-format-patch -k --stdout --full-index --ignore-if-in-upstream "$upstream"..ORIG_HEAD |
 	git am --binary -3 -k --resolvemsg="$RESOLVEMSG" \
 		--reflog-action=rebase
 	exit $?


^ permalink raw reply related

* [RFC] submodule prototype
From: Martin Waitz @ 2006-10-03 16:26 UTC (permalink / raw)
  To: git

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

hoi :)

so, now my little submodule prototype did it's first pull correctly
so I think I should share some ideas here.

http://git.admingilde.org/tali/git.git/module

A submodule here is implemented as a more-or-less normal GIT repository.
The object directory is shared with the parent and all refs are visible
in both the parent and all submodules (via refs/parent and refs/module)
so that fsck works.

On top of that is some special handling for commit and pull:
When commiting in the parent project then all submodule refs are
stored in the tree, too.
Fetching from a remote parent copies all submodule references into
the current repository, too.
After a successful merge the submodules are updated to reflect
the new state.

The code below is obviously not finished and very fragile,
it has only been tested with the litte test script so far,
but I think it's a nice basis for discussion.

What do you think?

Some specific questions:

User interface: like show here only one more command to set up
submodules and then using standard commands for parent and submodule
or does it make more sense to add special commands for updating
submodules (and not recursing into them by default)?

Does it really make sense to have one shared object directory?
This allows to fetch the whole project in one go, but it
might be more robust to set up individual object databases.

diff --git a/.gitignore b/.gitignore
index a3d9c7a..2ef60fc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,6 +47,7 @@ git-http-push
 git-imap-send
 git-index-pack
 git-init-db
+git-init-module
 git-instaweb
 git-local-fetch
 git-log
diff --git a/Makefile b/Makefile
index 8467447..4493973 100644
--- a/Makefile
+++ b/Makefile
@@ -154,7 +154,7 @@ ### --- END CONFIGURATION SECTION ---
 SCRIPT_SH = \
 	git-bisect.sh git-branch.sh git-checkout.sh \
 	git-cherry.sh git-clean.sh git-clone.sh git-commit.sh \
-	git-fetch.sh \
+	git-fetch.sh git-init-module.sh \
 	git-ls-remote.sh \
 	git-merge-one-file.sh git-parse-remote.sh \
 	git-pull.sh git-rebase.sh \
diff --git a/git-checkout.sh b/git-checkout.sh
index 580a9e8..a8764fd 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -211,3 +211,20 @@ if [ "$?" -eq 0 ]; then
 else
 	exit 1
 fi
+
+#
+# Now checkout all the submodules recursively
+# FIXME: handle branch updates
+#
+unset GIT_DIR
+parent_dir=`pwd`
+if test -r .gitmodules; then
+	while read module; do
+		cd "$parent_dir"
+		HEAD=$(git-symbolic-ref "../.gitmodule/$module/HEAD")
+		mkdir -p "$module"
+		cd "$module"
+		git-init-module >/dev/null
+		git-checkout $HEAD
+	done < .gitmodules
+fi
diff --git a/git-clone.sh b/git-clone.sh
index e1b3bf3..cce21e9 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -410,7 +410,7 @@ Pull: refs/heads/$head_points_at:$origin
 
 	case "$no_checkout" in
 	'')
-		git-read-tree -m -u -v HEAD HEAD
+		git-checkout
 	esac
 fi
 rm -f "$GIT_DIR/CLONE_HEAD" "$GIT_DIR/REMOTE_HEAD"
diff --git a/git-commit.sh b/git-commit.sh
index 5a4c659..1b79182 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -342,6 +342,18 @@ then
 	TOP=./
 fi
 
+# update the .gitmodule/ contents
+# FIXME: don't overwrite, test if submodule is ancestor of current value
+if test -r .gitmodules; then
+	while read module; do
+		rm -rf ".gitmodule/$module"
+		mkdir -p ".gitmodule/$module/refs"
+		cp -a "$module/.git/refs/heads" ".gitmodule/$module/refs/"
+		cp -a "$module/.git/refs/tags" ".gitmodule/$module/refs/"
+		cp -a "$module/.git/HEAD" ".gitmodule/$module/"
+	done < .gitmodules
+fi
+
 case "$all,$also" in
 t,)
 	save_index &&
diff --git a/git-init-module.sh b/git-init-module.sh
new file mode 100644
index 0000000..b64f630
--- /dev/null
+++ b/git-init-module.sh
@@ -0,0 +1,65 @@
+#!/bin/sh -e
+
+USAGE=""
+LONG_USAGE="Sets up a GIT sub module in the current directory"
+SUBDIRECTORY_OK=yes
+
+# get directory of parent GIT repository
+GIT_MODULE_DIR=`pwd`
+cd ..
+. git-sh-setup
+GIT_PARENT_DIR=`cd "$GIT_DIR" && pwd`
+GIT_PARENT_DIR="${GIT_PARENT_DIR%.git}"
+
+# make relative path
+GIT_MODULE_REL_DIR="${GIT_MODULE_DIR#$GIT_PARENT_DIR}"
+GIT_PARENT_REL_DIR="$GIT_PARENT_DIR" # FIXME should be made relative
+
+populate_dirs() {
+	(cd "$1" && find . -type d) | (cd "$2" && xargs mkdir -p)
+}
+
+# a mv which can merge directory trees
+move() {
+	populate_dirs "$@"
+	(cd "$1" && find . ! -type d) | xargs -n 1 -i mv "{}" "$2"
+	find "$1" -depth | xargs rmdir
+}
+
+
+# create a basic repository here
+cd "$GIT_MODULE_DIR"
+git-init-db
+
+# use parents object directory instead
+if test ! -L .git/objects; then
+	move .git/objects "$GIT_PARENT_DIR/.git/objects/"
+	ln -s "$GIT_PARENT_REL_DIR/.git/objects" .git/objects
+fi
+
+# make all references known everywhere, so that git-fsck-objects works.
+mkdir -p "$GIT_PARENT_DIR/.git/refs/module/$GIT_MODULE_REL_DIR"
+ln -s -f -n "$GIT_PARENT_REL_DIR/.git/refs" .git/refs/parent
+for dir in heads tags remotes; do
+	ln -s -f -n "$GIT_MODULE_DIR/.git/refs/$dir" "$GIT_PARENT_DIR/.git/refs/module/$GIT_MODULE_REL_DIR/$dir"
+done
+
+
+# copy heads from parent, but without overwriting anything
+GIT_PARENT_REFS="$GIT_PARENT_DIR/.gitmodule/$GIT_MODULE_REL_DIR"
+mkdir -p "$GIT_PARENT_REFS"
+populate_dirs "$GIT_PARENT_REFS" .git
+(cd "$GIT_PARENT_REFS" && find ! -type d) | while read path; do
+	if test ! -e ".git/$path"; then
+		cp "$GIT_PARENT_REFS/$path" ".git/$path"
+	fi
+done
+
+# register the module in the parent
+(cat "$GIT_PARENT_DIR/.gitmodules" 2>/dev/null || true;
+ echo "$GIT_MODULE_REL_DIR") |
+	sort -u > "$GIT_PARENT_DIR/.gitmodules.new"
+mv "$GIT_PARENT_DIR/.gitmodules.new" "$GIT_PARENT_DIR/.gitmodules"
+
+grep "^/$GIT_MODULE_REL_DIR$" "$GIT_PARENT_DIR/.gitignore" >/dev/null 2>&1 ||
+echo "/$GIT_MODULE_REL_DIR" >> "$GIT_PARENT_DIR/.gitignore"
diff --git a/git-merge.sh b/git-merge.sh
index d049e16..273d864 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -97,8 +97,33 @@ finish () {
 		esac
 		;;
 	esac
+
+	# now take a look at changes in submodules
+	if test -e .gitmodules; then
+		while read module; do
+			merge_module "$module"
+		done < .gitmodules
+	fi
 }
 
+merge_module () {
+	module="$1"
+	HEAD=$(git-symbolic-ref "../.gitmodule/$module/HEAD")
+	new_head=$(cat ".gitmodule/$module/$HEAD")
+	# FIXME: first step: merge HEAD only
+	(set -e
+		cd "$module"
+		unset GIT_DIR
+		# FIXME: sure there is a nicer way to do this...
+		echo "Updateing $module"
+		git-branch "refs/update/$HEAD" "$new_head"
+		git-merge "updated by parent" "$HEAD" "refs/update/$HEAD"
+		git-branch -d "refs/update/$HEAD"
+		git-checkout "$HEAD"
+	)
+}
+
+
 rloga=
 while case "$#" in 0) break ;; esac
 do
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 187f088..230eb4d 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -149,6 +149,17 @@ get_remote_default_refs_for_fetch () {
 	*)
 		die "internal error: get-remote-default-ref-for-push $1" ;;
 	esac
+	# also fetch all submodule data
+	if test -e .gitmodules; then
+		while read module; do
+			(cd .gitmodule/$module/refs && find * ! -type d) |
+			while read ref; do
+				# only fetch the ref, don't store it
+				# as it gets stored in the repository directly
+				echo ".refs/module/$module/$ref:"
+			done
+		done < .gitmodules
+	fi
 }
 
 get_remote_refs_for_push () {
diff --git a/t/t7500-submodule.sh b/t/t7500-submodule.sh
new file mode 100755
index 0000000..cb57fef
--- /dev/null
+++ b/t/t7500-submodule.sh
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+test_description="Test submodule support."
+
+. ./test-lib.sh
+
+
+test_expect_success "Create parent" \
+    'mkdir p &&
+     cd p &&
+     git-init-db &&
+     echo "Parent repository" > README &&
+     git-add README &&
+     git-commit -a -m "init parent" &&
+     cd ..'
+
+test_expect_success "Create submodule" \
+    'mkdir p/sub &&
+     cd p/sub &&
+     git-init-module &&
+     echo "Submodule repository" > README &&
+     git-add README &&
+     git-commit -a -m "init submodule" &&
+     cd ../..'
+
+test_expect_success "Add submodule to parent" \
+    'cd p &&
+     git-add .gitmodules .gitignore &&
+     git-status >/dev/null &&
+     git-add .gitmodule &&
+     git-commit -a -m "add submodule" &&
+     cd ..'
+
+check_repos() {
+     ( git-status > ../actual || true ) &&
+     git-fsck-objects --full 2>&1 >> ../actual 2>&1 &&
+     cd sub &&
+     ( git-status >> ../../actual 2>&1 || true ) &&
+     git-fsck-objects --full >> ../../actual 2>&1 &&
+     cd ../.. &&
+     echo "nothing to commit" > expected &&
+     echo "nothing to commit" >> expected &&
+     diff -u expected actual
+}
+
+test_expect_success "Check repositories" \
+    'cd p && check_repos'
+
+test_expect_success "Cloning parent" \
+    'git-clone p p2'
+
+test_expect_success "Check cloned repositories" \
+    'cd p2 && check_repos'
+
+test_expect_success "Commit to submodule" \
+    'cd p/sub &&
+     echo foo > bar &&
+     git-add bar &&
+     git-commit -a -m "add bar" &&
+     cd ../..'
+
+test_expect_success "Commit to parent" \
+    'cd p &&
+     git-commit -a -m "update sub" &&
+     cd ..'
+
+test_expect_success "Pull changes into clone" \
+    'cd p2 &&
+     git-pull ../p &&
+     test -f sub/bar &&
+     cd ..'
+
+test_expect_success "Check updated repositories" \
+    'cd p2 && check_repos'
+
+test_done

-- 
Martin Waitz

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related

* Re: [PATCH] gitweb: document webserver configuration for common gitweb/repo URLs.
From: Alan Chandler @ 2006-10-03 13:35 UTC (permalink / raw)
  To: Martin Waitz; +Cc: git
In-Reply-To: <20061003080328.GI2871@admingilde.org>

Martin Waitz writes: 

> Add a small apache configuration which shows how to use apache
> to put gitweb and GIT repositories at the same URL. 
> 
 

It might be helpful to include 

SetEnv GITWEB_CONFIG /etc/gitweb.conf 

in that little apache snippet, to show how specify a config file for gitweb. 

 

 --
Alan Chandler
alan@chandlerfamily.org.uk
(via webmail - normally means I am not at my computer)

^ permalink raw reply

* Re: [PATCH] Gitweb - provide site headers and footers
From: Alan Chandler @ 2006-10-03 13:32 UTC (permalink / raw)
  To: git
In-Reply-To: <1159879743194-git-send-email-alan@chandlerfamily.org.uk>

Alan Chandler writes: 

> From: Alan Chandler <alan@chandlerfamily.org.uk> 
> 
> This allows web sites with a header and footer standard for each page
> to add them to the pages produced by gitweb. 
> 

My web site at http://www.chandlerfamily.org.uk/git shows the example of 
this, although the list of projects is null at the moment, 

That is because I am using the very latest gitweb from master, but git is an 
older version (debian etch) which doesn't understand git --git-dir=... 

I will update to latest git sometime later this week, but I am away on 
business for a couple of days. 


 --
Alan Chandler
alan@chandlerfamily.org.uk
(via webmail - normally means I am not at my computer)

^ permalink raw reply

* [PATCH] Gitweb - provide site headers and footers
From: Alan Chandler @ 2006-10-03 12:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Alan Chandler

From: Alan Chandler <alan@chandlerfamily.org.uk>

This allows web sites with a header and footer standard for each page
to add them to the pages produced by gitweb.

Two new variables $site_header and $site_footer are defined (default
to null) each of which can specify a file containing the header and
footer html.

In addition, if the $stylesheet variable is undefined, a new array
@stylesheets (which defaults to a single element of gitweb.css) can be
used to specify more than one style sheet.  This allows the clasical
gitweb.css styles to be retained, but a site wide style sheet used
within the header and footer areas.

Signed-off-by: Alan Chandler <alan@chandlerfamily.org.uk>
---
 Makefile           |    4 ++++
 gitweb/gitweb.perl |   45 ++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 401b893..32a546e 100644
--- a/Makefile
+++ b/Makefile
@@ -132,6 +132,8 @@ GITWEB_HOMETEXT = indextext.html
 GITWEB_CSS = gitweb.css
 GITWEB_LOGO = git-logo.png
 GITWEB_FAVICON = git-favicon.png
+GITWEB_SITE_HEADER = 
+GITWEB_SITE_FOOTER =
 
 export prefix bindir gitexecdir template_dir GIT_PYTHON_DIR
 
@@ -675,6 +677,8 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl
 	    -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
 	    -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
 	    -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
+	    -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
+	    -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
 	    $< >$@+
 	chmod +x $@+
 	mv $@+ $@
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 44991b1..1ec4435 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -41,11 +41,19 @@ # name of your site or organization to a
 # replace this with something more descriptive for clearer bookmarks
 our $site_name = "++GITWEB_SITENAME++" || $ENV{'SERVER_NAME'} || "Untitled";
 
+# filename of html text to include at top of each page
+our $site_header = "++GITWEB_SITE_HEADER++";
 # html text to include at home page
 our $home_text = "++GITWEB_HOMETEXT++";
+# filename of html text to include at bottom of each page
+our $site_footer = "++GITWEB_SITE_FOOTER++";
+
+# URI of stylesheets
+our @stylesheets = ("++GITWEB_CSS++");
+our $stylesheet;
+# default is not to define style sheet, but it can be overwritten later
+undef $stylesheet;
 
-# URI of default stylesheet
-our $stylesheet = "++GITWEB_CSS++";
 # URI of GIT logo
 our $logo = "++GITWEB_LOGO++";
 # URI of GIT favicon, assumed to be image/png type
@@ -1351,8 +1359,17 @@ sub git_header_html {
 <meta name="generator" content="gitweb/$version git/$git_version"/>
 <meta name="robots" content="index, nofollow"/>
 <title>$title</title>
-<link rel="stylesheet" type="text/css" href="$stylesheet"/>
 EOF
+# print out each stylesheet that exist
+	if (defined $stylesheet) {
+#provides backwards capability for those people who define style sheet in a config file
+		print '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'"/>'."\n";
+	} else {
+		foreach my $stylesheet (@stylesheets) {
+			next unless $stylesheet;
+			print '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'"/>'."\n";
+		}
+	}
 	if (defined $project) {
 		printf('<link rel="alternate" title="%s log" '.
 		       'href="%s" type="application/rss+xml"/>'."\n",
@@ -1370,8 +1387,15 @@ EOF
 	}
 
 	print "</head>\n" .
-	      "<body>\n" .
-	      "<div class=\"page_header\">\n" .
+	      "<body>\n";
+	      
+	if (-f $site_header) {
+		open (my $fd, $site_header);
+		print <$fd>;
+		close $fd;
+	}
+	
+	print "<div class=\"page_header\">\n" .
 	      "<a href=\"http://www.kernel.org/pub/software/scm/git/docs/\" title=\"git documentation\">" .
 	      "<img src=\"$logo\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/>" .
 	      "</a>\n";
@@ -1422,8 +1446,15 @@ sub git_footer_html {
 		print $cgi->a({-href => href(project=>undef, action=>"project_index"),
 		              -class => "rss_logo"}, "TXT") . "\n";
 	}
-	print "</div>\n" .
-	      "</body>\n" .
+	print "</div>\n" ;
+	
+	if (-f $site_footer) {
+		open (my $fd, $site_footer);
+		print <$fd>;
+		close $fd;
+	}
+	
+	print "</body>\n" .
 	      "</html>";
 }
 
-- 
1.4.2.1

^ permalink raw reply related

* git-fetch --update-head-ok ?
From: Martin Waitz @ 2006-10-03 12:34 UTC (permalink / raw)
  To: git

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

hoi :)

I have no idea why there is a --update-head-ok, but the code looks
like it has a typo:

diff --git a/git-fetch.sh b/git-fetch.sh
index 09a5d6c..5843639 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -433,7 +433,7 @@ esac
 # If the original head was empty (i.e. no "master" yet), or
 # if we were told not to worry, we do not have to check.
 case ",$update_head_ok,$orig_head," in
-*,, | t,* )
+*,, | ,t,* )
        ;;
 *)
        curr_head=$(git-rev-parse --verify HEAD 2>/dev/null)

-- 
Martin Waitz

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related

* Re: [PATCH] gitweb: start to generate PATH_INFO URLs.
From: Jakub Narebski @ 2006-10-03 12:18 UTC (permalink / raw)
  To: git
In-Reply-To: <20061001215748.GG2871@admingilde.org>

Martin Waitz wrote:

> +       'pathinfo' => {
> +               'override' => 0,
> +               'default' => [1]},

You should add failsafe to gitweb_check_feature for when 'sub' is not set;
for example when somebody sets $feature{'pathinfo'}{'override'} to 1.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: [PATCH] gitweb: start to generate PATH_INFO URLs
From: Jakub Narebski @ 2006-10-03 12:16 UTC (permalink / raw)
  To: git
In-Reply-To: <20060929221641.GC2871@admingilde.org>

Martin Waitz wrote:

> Instead of providing the project as a ?p= parameter it is simply appended
> to the base URI.

I have just modified href() to be able to use it for actions which don't
need the ?p= parameter... and you didn't take into consideration the case
when $params{'project'} is set, but undefined. Undefined params don't get
added, but "unless exists $params{'project'}" in the

        $params{'project'} = $project unless exists $params{'project'};

line prevents of adding 'p' param.

It is important for the project list (and equivalent) views.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: [PATCH 1/2] Move code resolving packed refs into its own function.
From: Jakub Narebski @ 2006-10-03 12:10 UTC (permalink / raw)
  To: git
In-Reply-To: <7vodsw2w9g.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:

>  - I think gitweb should be Ok; it does peek-remote on the
>    repository.  Although we would probably want to update
>    git_get_references and git_get_refs_list sub to use
>    for-each-ref there, that can be done as a later optimization.

I'd rather have gitweb use git-for-each-ref after the command
is in the official release... if not, then keep it in the 'next'
branch.

By the way, I have an idea to join the git-show-ref and git-for-each-ref:
simply add --deref option to git-for-each-ref, which would output
dereferenced tag just after the reference itself (well, perhaps with the
exception when sorting, perhaps not), with the deref name like in
git-show-ref and git-peek-remote, i.e. <ref>^{}
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: [PATCH] gitweb: tree view: eliminate redundant "blob"
From: Jakub Narebski @ 2006-10-03 10:15 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Luben Tuikov, git
In-Reply-To: <7vzmcdpwso.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:
> BTW,
> 
>  - why do we have shortlog and log twice in the top navigation
>    bar in commit view (a=commit)?

Huh? I don't have shortlog and log twice in top navigation bar
in commit view
  a=commit;h=e70866f53a8d31cde6cfff6396ba0d1f64029afb
in gitweb/v1.4.2.3-gd98896b

>  - sometimes I'd like to view my tags sorted by name not by
>    age.  Maybe we could add <sort-by> control on the age and
>    name columns for git_tags_body()?
Could be done.

-- 
Jakub Narebski
Poland

^ permalink raw reply

* Re: Why gitweb commitdiff NO diff output ?
From: Martin Waitz @ 2006-10-03  9:52 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <eft8u4$un0$2@sea.gmane.org>

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

hoi :)

On Tue, Oct 03, 2006 at 11:02:25AM +0200, Jakub Narebski wrote:
> Dongsheng Song wrote:
> > My git repository import from subversion, and the latest files has
> > correct mime-type property, but gitweb commitdiff NO diff output !
> > 
> > file:82dc767b3f1425435fa6d8fa7511718d3f614172 ->
> > file:4c7269ed65bf8691c46541497fbecc706f7d012f
> > 
> > file:6817671d9af75b9adcc439d62f9047c7b2a9adb2 ->
> > file:575d40108f550ac5965bb6ea8b6792fa9cc10536
> 
> Not enough information.

A few months ago, I got that a on kernel.org a few times, too.
After reloading the page it always got shown correctly, so I never bothered
to report it.

-- 
Martin Waitz

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* [PATCH] gitweb: prepare for repositories with packed refs.
From: Junio C Hamano @ 2006-10-03  9:36 UTC (permalink / raw)
  To: git

When a repository is initialized long time ago with symbolic
HEAD, and "git-pack-refs --prune" is run, HEAD will be a
dangling symlink to refs/heads/ somewhere.

Running -e "$dir/HEAD" to guess if $dir is a git repository does
not give us the right answer anymore in such a case.

Also factor out two places that checked if the repository can be
exported with similar code into a call to a new function,
check_export_ok.

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

 * This is to fix a real breakage (iow, not a throw-away patch).

 gitweb/gitweb.perl |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 55d1b2c..671a4e6 100644
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -180,6 +180,22 @@ sub feature_pickaxe {
 	return ($_[0]);
 }
 
+# checking HEAD file with -e is fragile if the repository was
+# initialized long time ago (i.e. symlink HEAD) and was pack-ref'ed
+# and then pruned.
+sub check_head_link {
+	my ($dir) = @_;
+	my $headfile = "$dir/HEAD";
+	return ((-e $headfile) ||
+		(-l $headfile && readlink($headfile) =~ /^refs\/heads\//));
+}
+
+sub check_export_ok {
+	my ($dir) = @_;
+	return (check_head_link($dir) &&
+		(!$export_ok || -e "$dir/$export_ok"));
+}
+
 # rename detection options for git-diff and git-diff-tree
 # - default is '-M', with the cost proportional to
 #   (number of removed files) * (number of new files).
@@ -212,7 +228,7 @@ our $project = $cgi->param('p');
 if (defined $project) {
 	if (!validate_pathname($project) ||
 	    !(-d "$projectroot/$project") ||
-	    !(-e "$projectroot/$project/HEAD") ||
+	    !check_head_link("$projectroot/$project") ||
 	    ($export_ok && !(-e "$projectroot/$project/$export_ok")) ||
 	    ($strict_export && !project_in_list($project))) {
 		undef $project;
@@ -289,7 +305,7 @@ sub evaluate_path_info {
 	# find which part of PATH_INFO is project
 	$project = $path_info;
 	$project =~ s,/+$,,;
-	while ($project && !-e "$projectroot/$project/HEAD") {
+	while ($project && !check_head_link("$projectroot/$project")) {
 		$project =~ s,/*[^/]*$,,;
 	}
 	# validate project
@@ -816,8 +832,7 @@ sub git_get_projects_list {
 
 				my $subdir = substr($File::Find::name, $pfxlen + 1);
 				# we check related file in $projectroot
-				if (-e "$projectroot/$subdir/HEAD" && (!$export_ok ||
-				    -e "$projectroot/$subdir/$export_ok")) {
+				if (check_export_ok("$projectroot/$subdir")) {
 					push @list, { path => $subdir };
 					$File::Find::prune = 1;
 				}
@@ -838,8 +853,7 @@ sub git_get_projects_list {
 			if (!defined $path) {
 				next;
 			}
-			if (-e "$projectroot/$path/HEAD" && (!$export_ok ||
-			    -e "$projectroot/$path/$export_ok")) {
+			if (check_export_ok("$projectroot/$path")) {
 				my $pr = {
 					path => $path,
 					owner => decode("utf8", $owner, Encode::FB_DEFAULT),
-- 
1.4.2.3.gd1e9e

^ 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