Git development
 help / color / mirror / Atom feed
* Re: [CFH] Remotes conversion script
From: Jakub Narebski @ 2006-09-24 22:57 UTC (permalink / raw)
  To: git
In-Reply-To: <Pine.LNX.4.63.0609242347090.25371@wbgn013.biozentrum.uni-wuerzburg.de>

Johannes Schindelin wrote:

> On Sun, 24 Sep 2006, Jakub Narebski wrote:
> 
>> If I remember correctly currently only some functionality provided by
>> remotes file can be provided by [remote] and [branch] sections of git
>> config.
> 
> ... and what might the lacking functionality be?
> 
> .git/remotes/<name>    config
> 
> URL:                   remote.<name>.url
> Pull:                  remote.<name>.fetch
> Push:                  remote.<name>.push
> 
> You can even have multiple entries in the config, and it behaves as if you 
> had multiple lines in .git/remotes/<name>.

Hmmm... strange, in 'next' branch.<name>.* are documented in
Documentation/config.txt, but the remote.<name>.* are not.

Neither is documented [branch "funky name"] syntax (branch."funky name").

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: [PATCH] branch: write branch properties
From: Santi Béjar @ 2006-09-24 23:00 UTC (permalink / raw)
  To: git
In-Reply-To: <87r6y06g5h.fsf@gmail.com>

Santi Béjar <sbejar@gmail.com> writes:

> If you want to work in the 'next' branch of git.git:
>
> $ git clone --use-separate-remote git://git.kernel.org/pub/scm/git/git.git
> $ cd git
> $ git branch next origin next

this has to be: git branch next origin refs/heads/next

and then you work as usual with:

... work
$ git pull

and it does the right thing.

Please use this instead:

-- >8 --
[PATCH] branch: write branch properties

If you want to work in the 'next' branch of git.git:

$ git clone --use-separate-remote git://git.kernel.org/pub/scm/git/git.git
$ cd git
$ git branch next origin refs/heads/next
... work/edit/commit ...
$ git pull

and it merges from branch 'refs/heads/next' of origin.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
---
 Documentation/git-branch.txt |    7 +++++--
 git-branch.sh                |   17 +++++++++++++++--
 git-parse-remote.sh          |   21 +++++++++++++++++++++
 3 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index d43ef1d..de2889d 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git-branch' [-r]
-'git-branch' [-l] [-f] <branchname> [<start-point>]
+'git-branch' [-l] [-f] <branchname> [<start-point> | <remote> <remotebranch>]
 'git-branch' (-d | -D) <branchname>...
 
 DESCRIPTION
@@ -18,9 +18,12 @@ With no arguments given (or just `-r`) a
 will be shown, the current branch will be highlighted with an asterisk.
 
 In its second form, a new branch named <branchname> will be created.
-It will start out with a head equal to the one given as <start-point>.
+It will start out with a head equal to the one given as <start-point>,
+or from branch <remotebranch> of the repository <remote>.
 If no <start-point> is given, the branch will be created with a head
 equal to that of the currently checked out branch.
+In the form <remote> <remotebranch> it will also record the branch
+properties `branch.<branchname>.remote` and `branch.<branchname>.merge`.
 
 With a `-d` or `-D` option, `<branchname>` will be deleted.  You may
 specify more than one branch for deletion.  If the branch currently
diff --git a/git-branch.sh b/git-branch.sh
index e0501ec..94dd157 100755
--- a/git-branch.sh
+++ b/git-branch.sh
@@ -1,9 +1,10 @@
 #!/bin/sh
 
-USAGE='[-l] [(-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r'
+USAGE='[-l] [(-d | -D) <branchname>] | [[-f] <branchname> [<start-point> | <remote> <remotebranch>]] | -r'
 LONG_USAGE='If no arguments, show available branches and mark current branch with a star.
 If one argument, create a new branch <branchname> based off of current HEAD.
-If two arguments, create a new branch <branchname> based off of <start-point>.'
+If two arguments, create a new branch <branchname> based off of <start-point>.
+If three arguments, create a new branch <branchname> based off the branch <remotebranch> of the repository <remote>, writing the branch properties for fetch.'
 
 SUBDIRECTORY_OK='Yes'
 . git-sh-setup
@@ -104,6 +105,12 @@ case "$#" in
 	head=HEAD ;;
 2)
 	head="$2^0" ;;
+3)
+	remote="$2"
+	remote_branch="$3"
+	. ./git-parse-remote.sh
+	ref=$(get_ref_for_remote_branch "$2" "$3")
+	head="$ref^0";;
 esac
 branchname="$1"
 
@@ -128,3 +135,9 @@ then
 	touch "$GIT_DIR/logs/refs/heads/$branchname"
 fi
 git update-ref -m "branch: Created from $head" "refs/heads/$branchname" $rev
+
+if test -n "$ref"
+then
+	git repo-config branch."$branchname".remote "$remote"
+	git repo-config branch."$branchname".merge "$remote_branch"
+fi
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 187f088..51f3b9b 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -209,3 +209,24 @@ resolve_alternates () {
 		esac
 	done
 }
+
+get_ref_for_remote_branch (){
+	data_source=$(get_data_source "$1")
+	case "$data_source" in
+	'' | config-partial | branches | branches-partial)
+		;;
+	config)
+		ref=$(git-repo-config --get-all "remote.$1.fetch" |\
+			grep "^$2:")
+		expr "z$ref" : 'z[^:]*:\(.*\)'
+		;;
+	remotes)
+		ref=$(sed -ne '/^Pull: */{
+				s///p
+			}' "$GIT_DIR/remotes/$1" | grep "$2:")
+		expr "z$ref" : 'z[^:]*:\(.*\)'
+		;;
+	*)
+		die "internal error: get-ref-for-remote-branch $1 $2" ;;
+	esac
+}
-- 
1.4.2.1.g279b

^ permalink raw reply related

* Re: [CFH] Remotes conversion script
From: Jakub Narebski @ 2006-09-24 23:04 UTC (permalink / raw)
  To: git
In-Reply-To: <20060924224017.GC20017@pasky.or.cz>

Petr Baudis wrote:

> Dear diary, on Mon, Sep 25, 2006 at 12:34:24AM CEST, I got a letter
> where Santi <sbejar@gmail.com> said that...
>> It could be I'm wrong (for sure, I miss something), but I see the
>> branches/ files like [remote] sections files with just one fetch:
>> 
>> .git/branches/git:
>> git://...../git.gi
>> 
>> would be:
>> 
>> [remote "git"]
>> url=git://...../git.git
>> fetch=refs/heads/master:refs/heads/git
> 
> That's basically right, the point is that with moving to remotes
> support, we will make each remote live in its own separate namespace,

Which is overkill if we fetch only from one directory. Besides using
separate remotes (hmmm, we should add support for refs/remotes/ in gitweb)
is a policy decision.

On somewhat unrelated issue: should git-clone create [remote] section
(and perhaps [branch] sections) instead of remotes file?
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: [CFH] Remotes conversion script
From: Jakub Narebski @ 2006-09-24 23:06 UTC (permalink / raw)
  To: git
In-Reply-To: <Pine.LNX.4.63.0609242347090.25371@wbgn013.biozentrum.uni-wuerzburg.de>

Johannes Schindelin wrote:

> On Sun, 24 Sep 2006, Jakub Narebski wrote:
> 
>> If I remember correctly currently only some functionality provided by
>> remotes file can be provided by [remote] and [branch] sections of git
>> config.
> 
> ... and what might the lacking functionality be?

What about
        Pull: +refs/heads/pu:refs/heads/pu
functionality, i.e. allowing force-update (non fast-forward) fetches?

> .git/remotes/<name>    config
> 
> URL:                   remote.<name>.url
> Pull:                  remote.<name>.fetch
> Push:                  remote.<name>.push
> 
> You can even have multiple entries in the config, and it behaves as if you 
> had multiple lines in .git/remotes/<name>.

And first pull line is default branch to merge, all the rest is marked
as not-for-merge?

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: [CFH] Remotes conversion script
From: Petr Baudis @ 2006-09-24 23:11 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <ef72ts$dk9$2@sea.gmane.org>

Dear diary, on Mon, Sep 25, 2006 at 01:04:41AM CEST, I got a letter
where Jakub Narebski <jnareb@gmail.com> said that...
> Petr Baudis wrote:
> 
> > Dear diary, on Mon, Sep 25, 2006 at 12:34:24AM CEST, I got a letter
> > where Santi <sbejar@gmail.com> said that...
> >> It could be I'm wrong (for sure, I miss something), but I see the
> >> branches/ files like [remote] sections files with just one fetch:
> >> 
> >> .git/branches/git:
> >> git://...../git.gi
> >> 
> >> would be:
> >> 
> >> [remote "git"]
> >> url=git://...../git.git
> >> fetch=refs/heads/master:refs/heads/git
> > 
> > That's basically right, the point is that with moving to remotes
> > support, we will make each remote live in its own separate namespace,
> 
> Which is overkill if we fetch only from one directory.

Why?

> Besides using separate remotes (hmmm, we should add support for
> refs/remotes/ in gitweb) is a policy decision.

Cogito's designed so that users don't have to _care_ about the policy at
this level and it will just magically work for them, sensibly. If you
care enough, you can just modify the config file manually.

> On somewhat unrelated issue: should git-clone create [remote] section
> (and perhaps [branch] sections) instead of remotes file?

Ideally, I would hope for .git/remotes/ to be officially deprecated...
(perhaps after the next release?)

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)

^ permalink raw reply

* Re: [CFH] Remotes conversion script
From: Santi @ 2006-09-24 23:18 UTC (permalink / raw)
  To: git
In-Reply-To: <ef730t$dk9$3@sea.gmane.org>

2006/9/25, Jakub Narebski <jnareb@gmail.com>:
> Johannes Schindelin wrote:
>
> > On Sun, 24 Sep 2006, Jakub Narebski wrote:
> >
> >> If I remember correctly currently only some functionality provided by
> >> remotes file can be provided by [remote] and [branch] sections of git
> >> config.
> >
> > ... and what might the lacking functionality be?
>
> What about
>         Pull: +refs/heads/pu:refs/heads/pu
> functionality, i.e. allowing force-update (non fast-forward) fetches?

[remote "git"]
url = git://.../git.git
fetch = +refs/heads/pu:refs/heads/pu

>
> > .git/remotes/<name>    config
> >
> > URL:                   remote.<name>.url
> > Pull:                  remote.<name>.fetch
> > Push:                  remote.<name>.push
> >
> > You can even have multiple entries in the config, and it behaves as if you
> > had multiple lines in .git/remotes/<name>.
>
> And first pull line is default branch to merge, all the rest is marked
> as not-for-merge?

The same way as with .git/remotes/.

the .git/remotes/ files and the [remote] sections are equivalent, modulo bugs.

   Santi

^ permalink raw reply

* Git - Fast Version Control System
From: Peter Dyballa @ 2006-09-24 23:19 UTC (permalink / raw)
  To: git

Hello!

In git 1.4.2.1 there seems to be a problem with 'make doc' – at least  
on Mac OS X 10.4.7:

(from the *compilation* buffer)

	asciidoc -b xhtml11 git-tools.txt
	cat glossary.txt | \
	perl sort_glossary.pl | \
	asciidoc -b xhtml11 - > glossary.html
	rm -f howto/revert-branch-rebase.html+ howto/revert-branch-rebase.html
	sed -e '1,/^$/d' howto/revert-branch-rebase.txt asciidoc.conf |  
asciidoc -b xhtml11 - >howto/revert-branch-rebase.html+
	WARNING: <stdin>: line 200: missing [paradef-default] attributes- 
style entry
	WARNING: <stdin>: line 224: missing [paradef-default] gitlink- 
inlinemacro-style entry
	mv howto/revert-branch-rebase.html+ howto/revert-branch-rebase.html
	asciidoc -b docbook -d manpage -f asciidoc.conf git-add.txt
	xmlto -m callouts.xsl man git-add.xml

and here an excerpt from a dired buffer:

	  /Users/pete/Quellen/git-1.4.2.1/Documentation:
	  insgesamt 2492
	  drwxr-xr-x 284 pete pete  9656 2006-09-24 23:52 .
	  -rw-r--r--   1 pete pete  4146 2006-09-24 23:52 git-add.xml
	  drwxr-xr-x  13 pete pete   442 2006-09-24 23:52 howto
	  -rw-r--r--   1 pete pete 28486 2006-09-24 23:52 glossary.html

Since more than one hour xmlto (0.0.18) is running and consuming up  
to 100 % of CPU power ...

pstree -p 27354
-+= 00001 root /sbin/launchd -v
\-+= 00131 windowse /System/Library/Frameworks/ 
ApplicationServices.framework/F
    \-+- 11292 pete /Applications/Utilities/X11.app/Contents/MacOS/ 
X11 -psn_0_61
      \-+- 11294 pete sh /Users/pete/.xinitrc
        \-+- 11308 pete /usr/local/bin/emacs-23.0.0 -geometry 100x57 
+666+44
          \-+= 27122 pete -bin/tcsh -c time nice +11 make -k doc
            \-+- 27128 pete make -k doc
              \-+- 27157 pete make -C Documentation all
                \--- 27354 pete /bin/bash /sw/bin/xmlto -m  
callouts.xsl man git-

--
Greetings

   Pete

Sometimes I think the surest sign that intelligent life exists  
elsewhere in the universe is that none of it has tried to contact us.
                     -- Bill Watterson, in his comic strip Calvin and  
Hobbes

^ permalink raw reply

* [ANNOUNCE] tig 0.5
From: Jonas Fonseca @ 2006-09-24 23:31 UTC (permalink / raw)
  To: git

Hello,

After a long break a few changes have started to accumulate so here is
version 0.5 of tig. It adds some basic features like searching and
support for keybindings (see tigrc(5)). Additionally, It fixes most of
the things I would have hoped to include in this release. I tried to fix
the problems reported with terminal encoding by using iconv, but earlier
tonight I found that it needs some more work.

Looking forward, better input support is much desired, plus I'd like to
review the drawing code to see if it can be optimized to do fewer
updates. Also, a blame view is in the pipeline and I have a proof of
concept implementation of revision graph rendering (it is available in
the new/rev-graph branch).

A list of tig resources:

 - Homepage: http://jonas.nitro.dk/tig/
 - Releases: http://jonas.nitro.dk/tig/releases/
 - Git URL:  http://jonas.nitro.dk/tig/tig.git or
             git://repo.or.cz/tig.git
 - Gitweb:   http://repo.or.cz/?p=tig.git;a=summary

Tarballs contain all the generated documentation, as do the #release
branch of the git repository.

-- 
Jonas Fonseca

^ permalink raw reply

* Re: [CFH] Remotes conversion script
From: Jakub Narebski @ 2006-09-24 23:40 UTC (permalink / raw)
  To: git
In-Reply-To: <20060924231108.GE20017@pasky.or.cz>

Petr Baudis wrote:

> Dear diary, on Mon, Sep 25, 2006 at 01:04:41AM CEST, I got a letter
> where Jakub Narebski <jnareb@gmail.com> said that...
>> Petr Baudis wrote:
>> 
>> > Dear diary, on Mon, Sep 25, 2006 at 12:34:24AM CEST, I got a letter
>> > where Santi <sbejar@gmail.com> said that...
>> >> It could be I'm wrong (for sure, I miss something), but I see the
>> >> branches/ files like [remote] sections files with just one fetch:
>> >> 
>> >> .git/branches/git:
>> >> git://...../git.gi
>> >> 
>> >> would be:
>> >> 
>> >> [remote "git"]
>> >> url=git://...../git.git
>> >> fetch=refs/heads/master:refs/heads/git
>> > 
>> > That's basically right, the point is that with moving to remotes
>> > support, we will make each remote live in its own separate namespace,
>> 
>> Which is overkill if we fetch only from one directory.
> 
> Why?

s/directory/repository/ of course. And as of why: I'd rather have 'next',
'maint, 'html', 'man' in main namespace (with 'origin' substituting
'master') instead of remotes/origin/next etc.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: [CFH] Remotes conversion script
From: Petr Baudis @ 2006-09-24 23:50 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <ef750s$jg4$1@sea.gmane.org>

Dear diary, on Mon, Sep 25, 2006 at 01:40:26AM CEST, I got a letter
where Jakub Narebski <jnareb@gmail.com> said that...
> s/directory/repository/ of course. And as of why: I'd rather have 'next',
> 'maint, 'html', 'man' in main namespace (with 'origin' substituting
> 'master') instead of remotes/origin/next etc.

Well, I don't know. Cogito should stay simple (and stupid) and if you
introduce too much choice, you will lose that. Especially if the choice
is in something already so confusing as branching. And for larger
repositories or more complex distributed branching situations, the
separated-remotes model is clearly superior, so I'd rather keep it for
the simpler cases as well, since if it introduces any hassle, I believe
it's only very minor (and pays off in the long run for the simpler
setups as well, I believe).

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)

^ permalink raw reply

* Re: [PATCH] branch: write branch properties
From: Santi Béjar @ 2006-09-25  0:41 UTC (permalink / raw)
  To: git
In-Reply-To: <877izs98eu.fsf@gmail.com>

Hi *,

>
> Please use this instead:
>

or even this, sorry:

* . ./git-parse-remotes.sh?
* not a bug, but test for $remote and $remote_branch instead of $ref.

-- >8 --
[PATCH] branch: write branch properties

If you want to work in the 'next' branch of git.git:

$ git clone --use-separate-remote git://git.kernel.org/pub/scm/git/git.git
$ cd git
$ git branch next origin refs/heads/next
... work/edit/commit ...
$ git pull

and it merges from branch 'refs/heads/next' of origin.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
---
 Documentation/git-branch.txt |    7 +++++--
 git-branch.sh                |   17 +++++++++++++++--
 git-parse-remote.sh          |   21 +++++++++++++++++++++
 3 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index d43ef1d..de2889d 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git-branch' [-r]
-'git-branch' [-l] [-f] <branchname> [<start-point>]
+'git-branch' [-l] [-f] <branchname> [<start-point> | <remote> <remotebranch>]
 'git-branch' (-d | -D) <branchname>...
 
 DESCRIPTION
@@ -18,9 +18,12 @@ With no arguments given (or just `-r`) a
 will be shown, the current branch will be highlighted with an asterisk.
 
 In its second form, a new branch named <branchname> will be created.
-It will start out with a head equal to the one given as <start-point>.
+It will start out with a head equal to the one given as <start-point>,
+or from branch <remotebranch> of the repository <remote>.
 If no <start-point> is given, the branch will be created with a head
 equal to that of the currently checked out branch.
+In the form <remote> <remotebranch> it will also record the branch
+properties `branch.<branchname>.remote` and `branch.<branchname>.merge`.
 
 With a `-d` or `-D` option, `<branchname>` will be deleted.  You may
 specify more than one branch for deletion.  If the branch currently
diff --git a/git-branch.sh b/git-branch.sh
index e0501ec..78e2c92 100755
--- a/git-branch.sh
+++ b/git-branch.sh
@@ -1,9 +1,10 @@
 #!/bin/sh
 
-USAGE='[-l] [(-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r'
+USAGE='[-l] [(-d | -D) <branchname>] | [[-f] <branchname> [<start-point> | <remote> <remotebranch>]] | -r'
 LONG_USAGE='If no arguments, show available branches and mark current branch with a star.
 If one argument, create a new branch <branchname> based off of current HEAD.
-If two arguments, create a new branch <branchname> based off of <start-point>.'
+If two arguments, create a new branch <branchname> based off of <start-point>.
+If three arguments, create a new branch <branchname> based off the branch <remotebranch> of the repository <remote>, writing the branch properties for fetch.'
 
 SUBDIRECTORY_OK='Yes'
 . git-sh-setup
@@ -104,6 +105,12 @@ case "$#" in
 	head=HEAD ;;
 2)
 	head="$2^0" ;;
+3)
+	remote="$2"
+	remote_branch="$3"
+	. git-parse-remote
+	ref=$(get_ref_for_remote_branch "$2" "$3")
+	head="$ref^0";;
 esac
 branchname="$1"
 
@@ -128,3 +135,9 @@ then
 	touch "$GIT_DIR/logs/refs/heads/$branchname"
 fi
 git update-ref -m "branch: Created from $head" "refs/heads/$branchname" $rev
+
+if test -n "$remote" && test -n "$remote_branch"
+then
+	git repo-config branch."$branchname".remote "$remote"
+	git repo-config branch."$branchname".merge "$remote_branch"
+fi
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 187f088..51f3b9b 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -209,3 +209,24 @@ resolve_alternates () {
 		esac
 	done
 }
+
+get_ref_for_remote_branch (){
+	data_source=$(get_data_source "$1")
+	case "$data_source" in
+	'' | config-partial | branches | branches-partial)
+		;;
+	config)
+		ref=$(git-repo-config --get-all "remote.$1.fetch" |\
+			grep "^$2:")
+		expr "z$ref" : 'z[^:]*:\(.*\)'
+		;;
+	remotes)
+		ref=$(sed -ne '/^Pull: */{
+				s///p
+			}' "$GIT_DIR/remotes/$1" | grep "$2:")
+		expr "z$ref" : 'z[^:]*:\(.*\)'
+		;;
+	*)
+		die "internal error: get-ref-for-remote-branch $1 $2" ;;
+	esac
+}
-- 
1.4.2.1.gf2ca-dirty

^ permalink raw reply related

* [PATCH/RESEND] git-repack: allow git-repack to run in subdirectory
From: Jeff King @ 2006-09-25  2:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <fcaeb9bf0609220221w3a65af24u9db1da4e1be0d1eb@mail.gmail.com>

Now that we explicitly create all tmpfiles below $GIT_DIR, there's no reason
to care about which directory we're in.

Signed-off-by: Jeff King <peff@peff.net>
---
There was no response on this; is there any reason not to allow this, or
did it just get dropped?

 git-repack.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/git-repack.sh b/git-repack.sh
index 9ae5092..f2c9071 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -4,6 +4,7 @@ # Copyright (c) 2005 Linus Torvalds
 #
 
 USAGE='[-a] [-d] [-f] [-l] [-n] [-q]'
+SUBDIRECTORY_OK='Yes'
 . git-sh-setup
 
 no_update_info= all_into_one= remove_redundant=
-- 
1.4.2.1.gb6052-dirty

^ permalink raw reply related

* [PATCH] Allow 'svn fetch' on '(no date)' revisions in Subversion.
From: Shawn Pearce @ 2006-09-25  2:50 UTC (permalink / raw)
  To: git

Added --ignore-nodate to allow 'git svn fetch' to import revisions
from Subversion which have '(no date)' listed as the date of the
revision.  By default 'git svn fetch' will crash with an error
when encountering such a revision.  The user may restart the fetch
operation by adding --ignore-nodate if they want to continue tracking
that repository.

I'm not entirely sure why a centralized version control system such
as Subversion permits revisions to be created with absolutely no
date/time associated with it but it apparently is possible as one
of the Subversion repositories that I'm tracking with 'git svn'
created such a revision on '(no date)' and by '(no user)'.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 Uhhh.  Riiiiight.  Getting garbage from a version control system
 is always a good feature for it to have.  Especially a centralized
 one where nobody should be able to subvert the server's concept
 of what time it is.  *sigh*

 Documentation/git-svn.txt |   12 ++++++++++++
 git-svn.perl              |    5 ++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index b7b63f7..1cfa3e3 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -244,6 +244,18 @@ doing.
 
 repo-config key: svn.noignoreexternals
 
+--ignore-nodate::
+Only used with the 'fetch' command.
+
+By default git-svn will crash if it tries to import a revision
+from SVN which has '(no date)' listed as the date of the revision.
+This is repository corruption on SVN's part, plain and simple.
+But sometimes you really need those revisions anyway.
+
+If supplied git-svn will convert '(no date)' entries to the UNIX
+epoch (midnight on Jan. 1, 1970).  Yes, that's probably very wrong.
+SVN was very wrong.
+
 --
 
 Basic Examples
diff --git a/git-svn.perl b/git-svn.perl
index 0290850..8a2ef99 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -52,7 +52,7 @@ my ($_revision,$_stdin,$_no_ignore_ext,$
 	$_template, $_shared, $_no_default_regex, $_no_graft_copy,
 	$_limit, $_verbose, $_incremental, $_oneline, $_l_fmt, $_show_commit,
 	$_version, $_upgrade, $_authors, $_branch_all_refs, @_opt_m,
-	$_merge, $_strategy, $_dry_run);
+	$_merge, $_strategy, $_dry_run, $_ignore_nodate);
 my (@_branch_from, %tree_map, %users, %rusers, %equiv);
 my ($_svn_co_url_revs, $_svn_pg_peg_revs);
 my @repo_path_split_cache;
@@ -65,6 +65,7 @@ my %fc_opts = ( 'no-ignore-externals' =>
 		'repack:i' => \$_repack,
 		'no-metadata' => \$_no_metadata,
 		'quiet|q' => \$_q,
+		'ignore-nodate' => \$_ignore_nodate,
 		'repack-flags|repack-args|repack-opts=s' => \$_repack_flags);
 
 my ($_trunk, $_tags, $_branches);
@@ -1734,6 +1735,8 @@ sub next_log_entry {
 			my $rev = $1;
 			my ($author, $date, $lines) = split(/\s*\|\s*/, $_, 3);
 			($lines) = ($lines =~ /(\d+)/);
+			$date = '1970-01-01 00:00:00 +0000'
+				if ($_ignore_nodate && $date eq '(no date)');
 			my ($Y,$m,$d,$H,$M,$S,$tz) = ($date =~
 					/(\d{4})\-(\d\d)\-(\d\d)\s
 					 (\d\d)\:(\d\d)\:(\d\d)\s([\-\+]\d+)/x)
-- 
1.4.2.1.ga6af-dirty

^ permalink raw reply related

* [PATCH] Allow '(no author)' in git-svn's authors file.
From: Shawn Pearce @ 2006-09-25  3:04 UTC (permalink / raw)
  To: git

When trying to import an SVN revision which has no author the Git
user may desire to relabel '(no author)' to another name and email
address with their svn.authorsfile.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 git-svn.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 8a2ef99..017f45a 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2171,7 +2171,7 @@ sub load_authors {
 	open my $authors, '<', $_authors or die "Can't open $_authors $!\n";
 	while (<$authors>) {
 		chomp;
-		next unless /^(\S+?)\s*=\s*(.+?)\s*<(.+)>\s*$/;
+		next unless /^(\S+?|\(no author\))\s*=\s*(.+?)\s*<(.+)>\s*$/;
 		my ($user, $name, $email) = ($1, $2, $3);
 		$users{$user} = [$name, $email];
 	}
-- 
1.4.2.1.gde2b2-dirty

^ permalink raw reply related

* Re: [PATCH/RESEND] git-repack: allow git-repack to run in subdirectory
From: Junio C Hamano @ 2006-09-25  3:16 UTC (permalink / raw)
  To: Jeff King; +Cc: git
In-Reply-To: <20060925023111.GA14003@coredump.intra.peff.net>

Jeff King <peff@peff.net> writes:

> Now that we explicitly create all tmpfiles below $GIT_DIR, there's no reason
> to care about which directory we're in.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> There was no response on this; is there any reason not to allow this, or
> did it just get dropped?

Simply forgotten; it might be _correct_ but it is not important.

While it may technically be correct that the command could be
run from anywhere, repack is a whole repository operation, and
it is an operation performed not that often.  There is no reason
to forbid it to run from subdirectories, but it does not hurt
users much if it did.

Will queue for "next" and push it out before 1.4.3 if I do not
forget it again ;-).

^ permalink raw reply

* [PATCH] Cleaned up git-daemon virtual hosting support.
From: Jon Loeliger @ 2006-09-25  4:04 UTC (permalink / raw)
  To: git

Standardized on lowercase hostnames from client.

Added interpolation values for the IP address, Port
and canoncial hostname of the server as it is contacted
and named by the client.

Added --host=host_or_ipaddr option suport.

Documented mutual exclusivity of --inetd option with
    --user, --group, --host and --port options.

Added compat_inet_pton from Paul Vixie as needed.

Small memory leaks need to be cleaned up still.

Signed-off-by: Jon Loeliger <jdl@jdl.com>

---

Junio,

This is on top of my previous patch in the next branch.
This makes virtual host support way, way less stupid.
I'll follow up with another patch to clean up the small leaks.

Thanks,
jdl


 Documentation/git-daemon.txt |   45 +++++++--
 Makefile                     |    3 +
 compat/inet_pton.c           |  220 ++++++++++++++++++++++++++++++++++++++++++
 daemon.c                     |  146 ++++++++++++++++++++++++----
 4 files changed, 387 insertions(+), 27 deletions(-)

diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt
index 87444b4..422cc37 100644
--- a/Documentation/git-daemon.txt
+++ b/Documentation/git-daemon.txt
@@ -8,14 +8,15 @@ git-daemon - A really simple server for 
 SYNOPSIS
 --------
 [verse]
-'git-daemon' [--verbose] [--syslog] [--inetd | --port=n] [--export-all]
+'git-daemon' [--verbose] [--syslog] [--export-all]
              [--timeout=n] [--init-timeout=n] [--strict-paths]
              [--base-path=path] [--user-path | --user-path=path]
              [--interpolated-path=pathtemplate]
+             [--reuseaddr] [--detach] [--pid-file=file]
              [--enable=service] [--disable=service]
 	     [--allow-override=service] [--forbid-override=service]
-             [--reuseaddr] [--detach] [--pid-file=file]
-             [--user=user [--group=group]] [directory...]
+	     [--inetd | [--host=host_or_ipaddr] [--port=n] [--user=user [--group=group]]
+	     [directory...]
 
 DESCRIPTION
 -----------
@@ -54,8 +55,12 @@ OPTIONS
 --interpolated-path=pathtemplate::
 	To support virtual hosting, an interpolated path template can be
 	used to dynamically construct alternate paths.  The template
-	supports %H for the target hostname as supplied by the client,
-	and %D for the absolute path of the named repository.	
+	supports %H for the target hostname as supplied by the client but
+	converted to all lowercase, %CH for the canonical hostname,
+	%IP for the server's IP address, %P for the port number,
+	and %D for the absolute path of the named repository.
+	After interpolation, the path is validated against the directory
+	whitelist.
 
 --export-all::
 	Allow pulling from all directories that look like GIT repositories
@@ -64,9 +69,17 @@ OPTIONS
 
 --inetd::
 	Have the server run as an inetd service. Implies --syslog.
+	Incompatible with --port, --host, --user and --group options.
+
+--host=host_or_ipaddr::
+	Listen on an a specific IP address or hostname.  IP addresses can
+	be either an IPv4 address or an IPV6 address if supported.  If IPv6
+	is not supported, then --host=hostname is also not supported and
+	--host must be given an IPv4 address.
+	Incompatible with '--inetd' option.
 
---port::
-	Listen on an alternative port.
+--port=n::
+	Listen on an alternative port.  Incompatible with '--inetd' option.
 
 --init-timeout::
 	Timeout between the moment the connection is established and the
@@ -182,6 +195,24 @@ clients, a symlink from `/software` into
 default repository could be made as well.
 
 
+git-daemon as regular daemon for virtual hosts::
+	To set up `git-daemon` as a regular, non-inetd service that
+	handles repositories for multiple virtual hosts based on
+	their IP addresses, start the daemon like this:
++
+------------------------------------------------
+	git-daemon --verbose --export-all
+		--interpolated-path=/pub/%IP/%D
+		/pub/192.168.1.200/software
+		/pub/10.10.220.23/software
+------------------------------------------------
++
+In this example, the root-level directory `/pub` will contain
+a subdirectory for each virtual host IP address supported.
+Repositories can still be accessed by hostname though, assuming
+they correspond to these IP addresses.
+
+
 Author
 ------
 Written by Linus Torvalds <torvalds@osdl.org>, YOSHIFUJI Hideaki
diff --git a/Makefile b/Makefile
index 673ba2d..bae4822 100644
--- a/Makefile
+++ b/Makefile
@@ -520,6 +520,9 @@ endif
 ifdef NO_INET_NTOP
 	LIB_OBJS += compat/inet_ntop.o
 endif
+ifdef NO_INET_PTON
+	LIB_OBJS += compat/inet_pton.o
+endif
 
 ifdef NO_ICONV
 	ALL_CFLAGS += -DNO_ICONV
diff --git a/compat/inet_pton.c b/compat/inet_pton.c
new file mode 100644
index 0000000..5704e0d
--- /dev/null
+++ b/compat/inet_pton.c
@@ -0,0 +1,220 @@
+/*
+ * Copyright (C) 1996-2001  Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdio.h>
+#include <string.h>
+
+#ifndef NS_INT16SZ
+#define NS_INT16SZ       2
+#endif
+
+#ifndef NS_INADDRSZ
+#define NS_INADDRSZ      4
+#endif
+
+#ifndef NS_IN6ADDRSZ
+#define NS_IN6ADDRSZ    16
+#endif
+
+/*
+ * WARNING: Don't even consider trying to compile this on a system where
+ * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
+ */
+
+static int inet_pton4(const char *src, unsigned char *dst);
+static int inet_pton6(const char *src, unsigned char *dst);
+
+/* int
+ * inet_pton4(src, dst)
+ *      like inet_aton() but without all the hexadecimal and shorthand.
+ * return:
+ *      1 if `src' is a valid dotted quad, else 0.
+ * notice:
+ *      does not touch `dst' unless it's returning 1.
+ * author:
+ *      Paul Vixie, 1996.
+ */
+static int
+inet_pton4(const char *src, unsigned char *dst)
+{
+        static const char digits[] = "0123456789";
+        int saw_digit, octets, ch;
+        unsigned char tmp[NS_INADDRSZ], *tp;
+
+        saw_digit = 0;
+        octets = 0;
+        *(tp = tmp) = 0;
+        while ((ch = *src++) != '\0') {
+                const char *pch;
+
+                if ((pch = strchr(digits, ch)) != NULL) {
+                        unsigned int new = *tp * 10 + (pch - digits);
+
+                        if (new > 255)
+                                return (0);
+                        *tp = new;
+                        if (! saw_digit) {
+                                if (++octets > 4)
+                                        return (0);
+                                saw_digit = 1;
+                        }
+                } else if (ch == '.' && saw_digit) {
+                        if (octets == 4)
+                                return (0);
+                        *++tp = 0;
+                        saw_digit = 0;
+                } else
+                        return (0);
+        }
+        if (octets < 4)
+                return (0);
+        memcpy(dst, tmp, NS_INADDRSZ);
+        return (1);
+}
+
+/* int
+ * inet_pton6(src, dst)
+ *      convert presentation level address to network order binary form.
+ * return:
+ *      1 if `src' is a valid [RFC1884 2.2] address, else 0.
+ * notice:
+ *      (1) does not touch `dst' unless it's returning 1.
+ *      (2) :: in a full address is silently ignored.
+ * credit:
+ *      inspired by Mark Andrews.
+ * author:
+ *      Paul Vixie, 1996.
+ */
+
+#ifndef NO_IPV6
+static int
+inet_pton6(const char *src, unsigned char *dst)
+{
+        static const char xdigits_l[] = "0123456789abcdef",
+                          xdigits_u[] = "0123456789ABCDEF";
+        unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
+        const char *xdigits, *curtok;
+        int ch, saw_xdigit;
+        unsigned int val;
+
+        memset((tp = tmp), '\0', NS_IN6ADDRSZ);
+        endp = tp + NS_IN6ADDRSZ;
+        colonp = NULL;
+        /* Leading :: requires some special handling. */
+        if (*src == ':')
+                if (*++src != ':')
+                        return (0);
+        curtok = src;
+        saw_xdigit = 0;
+        val = 0;
+        while ((ch = *src++) != '\0') {
+                const char *pch;
+
+                if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
+                        pch = strchr((xdigits = xdigits_u), ch);
+                if (pch != NULL) {
+                        val <<= 4;
+                        val |= (pch - xdigits);
+                        if (val > 0xffff)
+                                return (0);
+                        saw_xdigit = 1;
+                        continue;
+                }
+                if (ch == ':') {
+                        curtok = src;
+                        if (!saw_xdigit) {
+                                if (colonp)
+                                        return (0);
+                                colonp = tp;
+                                continue;
+                        }
+                        if (tp + NS_INT16SZ > endp)
+                                return (0);
+                        *tp++ = (unsigned char) (val >> 8) & 0xff;
+                        *tp++ = (unsigned char) val & 0xff;
+                        saw_xdigit = 0;
+                        val = 0;
+                        continue;
+                }
+                if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
+                    inet_pton4(curtok, tp) > 0) {
+                        tp += NS_INADDRSZ;
+                        saw_xdigit = 0;
+                        break;  /* '\0' was seen by inet_pton4(). */
+                }
+                return (0);
+        }
+        if (saw_xdigit) {
+                if (tp + NS_INT16SZ > endp)
+                        return (0);
+                *tp++ = (unsigned char) (val >> 8) & 0xff;
+                *tp++ = (unsigned char) val & 0xff;
+        }
+        if (colonp != NULL) {
+                /*
+                 * Since some memmove()'s erroneously fail to handle
+                 * overlapping regions, we'll do the shift by hand.
+                 */
+                const int n = tp - colonp;
+                int i;
+
+                for (i = 1; i <= n; i++) {
+                        endp[- i] = colonp[n - i];
+                        colonp[n - i] = 0;
+                }
+                tp = endp;
+        }
+        if (tp != endp)
+                return (0);
+        memcpy(dst, tmp, NS_IN6ADDRSZ);
+        return (1);
+}
+#endif
+
+/* int
+ * isc_net_pton(af, src, dst)
+ *      convert from presentation format (which usually means ASCII printable)
+ *      to network format (which is usually some kind of binary format).
+ * return:
+ *      1 if the address was valid for the specified address family
+ *      0 if the address wasn't valid (`dst' is untouched in this case)
+ *      -1 if some other error occurred (`dst' is untouched in this case, too)
+ * author:
+ *      Paul Vixie, 1996.
+ */
+int
+inet_pton(int af, const char *src, void *dst)
+{
+        switch (af) {
+        case AF_INET:
+                return (inet_pton4(src, dst));
+#ifndef NO_IPV6
+        case AF_INET6:
+                return (inet_pton6(src, dst));
+#endif
+        default:
+                errno = EAFNOSUPPORT;
+                return (-1);
+        }
+        /* NOTREACHED */
+}
diff --git a/daemon.c b/daemon.c
index ef3a955..5f01184 100644
--- a/daemon.c
+++ b/daemon.c
@@ -9,6 +9,7 @@ #include <arpa/inet.h>
 #include <syslog.h>
 #include <pwd.h>
 #include <grp.h>
+#include <limits.h>
 #include "pkt-line.h"
 #include "cache.h"
 #include "exec_cmd.h"
@@ -19,13 +20,14 @@ static int verbose;
 static int reuseaddr;
 
 static const char daemon_usage[] =
-"git-daemon [--verbose] [--syslog] [--inetd | --port=n] [--export-all]\n"
+"git-daemon [--verbose] [--syslog] [--export-all]\n"
 "           [--timeout=n] [--init-timeout=n] [--strict-paths]\n"
 "           [--base-path=path] [--user-path | --user-path=path]\n"
 "           [--interpolated-path=path]\n"
 "           [--reuseaddr] [--detach] [--pid-file=file]\n"
 "           [--[enable|disable|allow-override|forbid-override]=service]\n"
-"           [--user=user [[--group=group]] [directory...]";
+"           [--inetd | [--host=host_or_ipaddr] [--port=n] [--user=user [--group=group]]\n"
+"           [directory...]";
 
 /* List of acceptable pathname prefixes */
 static char **ok_paths;
@@ -56,11 +58,17 @@ static unsigned int init_timeout;
  * Feel free to make dynamic as needed.
  */
 #define INTERP_SLOT_HOST	(0)
-#define INTERP_SLOT_DIR		(1)
-#define INTERP_SLOT_PERCENT	(2)
+#define INTERP_SLOT_CANON_HOST	(1)
+#define INTERP_SLOT_IP		(2)
+#define INTERP_SLOT_PORT	(3)
+#define INTERP_SLOT_DIR		(4)
+#define INTERP_SLOT_PERCENT	(5)
 
 static struct interp interp_table[] = {
 	{ "%H", 0},
+	{ "%CH", 0},
+	{ "%IP", 0},
+	{ "%P", 0},
 	{ "%D", 0},
 	{ "%%", "%"},
 };
@@ -401,9 +409,17 @@ static void parse_extra_args(char *extra
 			val = extra_args + 5;
 			vallen = strlen(val) + 1;
 			if (*val) {
-				char *save = xmalloc(vallen);
+				char *port;
+				char *save = xmalloc(vallen);	/* FIXME: Leak */
+
 				interp_table[INTERP_SLOT_HOST].value = save;
 				strlcpy(save, val, vallen);
+				port = strrchr(save, ':');
+				if (port) {
+					*port = 0;
+					port++;
+					interp_table[INTERP_SLOT_PORT].value = port;
+				}
 			}
 			/* On to the next one */
 			extra_args = val + vallen;
@@ -411,6 +427,73 @@ static void parse_extra_args(char *extra
 	}
 }
 
+void fill_in_extra_table_entries(struct interp *itable)
+{
+	char *hp;
+	char *canon_host = NULL;
+	char *ipaddr = NULL;
+
+	/*
+	 * Replace literal host with lowercase-ized hostname.
+	 */
+	hp = interp_table[INTERP_SLOT_HOST].value;
+	for ( ; *hp; hp++)
+		*hp = tolower(*hp);
+
+	/*
+	 * Locate canonical hostname and its IP address.
+	 */
+#ifndef NO_IPV6
+	{
+		struct addrinfo hints;
+		struct addrinfo *ai, *ai0;
+		int gai;
+		static char addrbuf[HOST_NAME_MAX + 1];
+
+		memset(&hints, 0, sizeof(hints));
+		hints.ai_flags = AI_CANONNAME;
+
+		gai = getaddrinfo(interp_table[INTERP_SLOT_HOST].value, 0, &hints, &ai0);
+		if (!gai) {
+			for (ai = ai0; ai; ai = ai->ai_next) {
+				struct sockaddr_in *sin_addr = (void *)ai->ai_addr;
+
+				canon_host = xstrdup(ai->ai_canonname);
+				inet_ntop(AF_INET, &sin_addr->sin_addr,
+					  addrbuf, sizeof(addrbuf));
+				ipaddr = addrbuf;
+				break;
+			}
+			freeaddrinfo(ai0);
+		}
+	}
+#else
+	{
+		struct hostent *hent;
+		struct sockaddr_in sa;
+		char **ap;
+		static char addrbuf[HOST_NAME_MAX + 1];
+
+		hent = gethostbyname(interp_table[INTERP_SLOT_HOST].value);
+		canon_host = xstrdup(hent->h_name);
+
+		ap = hent->h_addr_list;
+		memset(&sa, 0, sizeof sa);
+		sa.sin_family = hent->h_addrtype;
+		sa.sin_port = htons(0);
+		memcpy(&sa.sin_addr, *ap, hent->h_length);
+			
+		inet_ntop(hent->h_addrtype, &sa.sin_addr,
+			  addrbuf, sizeof(addrbuf));
+		ipaddr = addrbuf;
+	}
+#endif
+
+	interp_table[INTERP_SLOT_CANON_HOST].value = canon_host;	/* FIXME: Leak */
+	interp_table[INTERP_SLOT_IP].value = xstrdup(ipaddr);		/* FIXME: Leak */
+}
+
+
 static int execute(struct sockaddr *addr)
 {
 	static char line[1000];
@@ -451,8 +534,10 @@ #endif
 	if (len && line[len-1] == '\n')
 		line[--len] = 0;
 
-	if (len != pktlen)
+	if (len != pktlen) {
 	    parse_extra_args(line + len + 1, pktlen - len - 1);
+	    fill_in_extra_table_entries(interp_table);
+	}
 
 	for (i = 0; i < ARRAY_SIZE(daemon_service); i++) {
 		struct daemon_service *s = &(daemon_service[i]);
@@ -656,12 +741,11 @@ static int set_reuse_addr(int sockfd)
 
 #ifndef NO_IPV6
 
-static int socksetup(int port, int **socklist_p)
+static int socksetup(char *host, int port, int **socklist_p)
 {
 	int socknum = 0, *socklist = NULL;
 	int maxfd = -1;
 	char pbuf[NI_MAXSERV];
-
 	struct addrinfo hints, *ai0, *ai;
 	int gai;
 
@@ -672,7 +756,7 @@ static int socksetup(int port, int **soc
 	hints.ai_protocol = IPPROTO_TCP;
 	hints.ai_flags = AI_PASSIVE;
 
-	gai = getaddrinfo(NULL, pbuf, &hints, &ai0);
+	gai = getaddrinfo(host, pbuf, &hints, &ai0);
 	if (gai)
 		die("getaddrinfo() failed: %s\n", gai_strerror(gai));
 
@@ -726,20 +810,27 @@ #endif
 
 #else /* NO_IPV6 */
 
-static int socksetup(int port, int **socklist_p)
+static int socksetup(char *host, int port, int **socklist_p)
 {
 	struct sockaddr_in sin;
 	int sockfd;
 
-	sockfd = socket(AF_INET, SOCK_STREAM, 0);
-	if (sockfd < 0)
-		return 0;
-
 	memset(&sin, 0, sizeof sin);
 	sin.sin_family = AF_INET;
-	sin.sin_addr.s_addr = htonl(INADDR_ANY);
 	sin.sin_port = htons(port);
 
+	if (host) {
+		/* Well, host better be an IP address here. */
+		if (inet_pton(AF_INET, host, &sin.sin_addr.s_addr) <= 0)
+			return 0;
+	} else {
+		sin.sin_addr.s_addr = htonl(INADDR_ANY);
+	}
+
+	sockfd = socket(AF_INET, SOCK_STREAM, 0);
+	if (sockfd < 0)
+		return 0;
+
 	if (set_reuse_addr(sockfd)) {
 		close(sockfd);
 		return 0;
@@ -848,13 +939,14 @@ static void store_pid(const char *path)
 	fclose(f);
 }
 
-static int serve(int port, struct passwd *pass, gid_t gid)
+static int serve(char *host, int port, struct passwd *pass, gid_t gid)
 {
 	int socknum, *socklist;
 
-	socknum = socksetup(port, &socklist);
+	socknum = socksetup(host, port, &socklist);
 	if (socknum == 0)
-		die("unable to allocate any listen sockets on port %u", port);
+		die("unable to allocate any listen sockets on host %s port %u",
+		    host, port);
 
 	if (pass && gid &&
 	    (initgroups(pass->pw_name, gid) || setgid (gid) ||
@@ -866,7 +958,8 @@ static int serve(int port, struct passwd
 
 int main(int argc, char **argv)
 {
-	int port = DEFAULT_GIT_PORT;
+	int port = 0;
+	char *host = NULL;
 	int inetd_mode = 0;
 	const char *pid_file = NULL, *user_name = NULL, *group_name = NULL;
 	int detach = 0;
@@ -883,6 +976,14 @@ int main(int argc, char **argv)
 	for (i = 1; i < argc; i++) {
 		char *arg = argv[i];
 
+		if (!strncmp(arg, "--host=", 7)) {
+		    char *p = arg + 7;
+		    char *ph = host = xmalloc(strlen(arg + 7) + 1);
+		    while (*p)
+			*ph++ = tolower(*p++);
+		    *ph = 0;		    
+		    continue;
+		}
 		if (!strncmp(arg, "--port=", 7)) {
 			char *end;
 			unsigned long n;
@@ -988,6 +1089,11 @@ int main(int argc, char **argv)
 	if (inetd_mode && (group_name || user_name))
 		die("--user and --group are incompatible with --inetd");
 
+	if (inetd_mode && (port || host))
+		die("--host= and --port= are incompatible with --inetd");
+	else if (port == 0)
+		port = DEFAULT_GIT_PORT;
+
 	if (group_name && !user_name)
 		die("--group supplied without --user");
 
@@ -1036,5 +1142,5 @@ int main(int argc, char **argv)
 	if (pid_file)
 		store_pid(pid_file);
 
-	return serve(port, pass, gid);
+	return serve(host, port, pass, gid);
 }
-- 
1.4.2.1.g85d8-dirty

^ permalink raw reply related

* [PATCH] Introduce git-mirror, a tool for exactly mirroring another repository.
From: Shawn Pearce @ 2006-09-25  4:46 UTC (permalink / raw)
  To: Petr Baudis, Junio C Hamano; +Cc: git

Sometimes its handy to be able to efficiently backup or mirror one
Git repository to another Git repository by employing the native
Git object transfer protocol.  But when mirroring or backing up a
repository you really want:

  1) Every object in the source to go to the mirror.
  2) Every ref in the source to go to the mirror.
  3) Any ref removed from the source to be removed from the mirror.
  4) Automatically repack and prune the mirror when necessary.

and since git-fetch doesn't do 2, 3, and 4 here's a tool that does.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 Since 'git fetch --mirror-all' wasn't quite ready here's something
 slightly more polished.

 I'm hoping this gets accepted as I'm thinking it would be very
 useful for backing up a user's repository to another host on a
 regular basis, not to mention also useful for Pasky's mirroring
 service.  I'm planning on using it for backups, especially of
 repositories where branches are frequently being added and deleted.

 .gitignore                   |    1 
 Documentation/git-mirror.txt |   64 ++++++++++++++++++++++++
 Makefile                     |    2 -
 git-mirror.perl              |  111 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 177 insertions(+), 1 deletions(-)

diff --git a/.gitignore b/.gitignore
index 78a3a3d..5f99149 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,6 +68,7 @@ git-merge-recur
 git-merge-recursive
 git-merge-resolve
 git-merge-stupid
+git-mirror
 git-mktag
 git-mktree
 git-name-rev
diff --git a/Documentation/git-mirror.txt b/Documentation/git-mirror.txt
new file mode 100644
index 0000000..27e5167
--- /dev/null
+++ b/Documentation/git-mirror.txt
@@ -0,0 +1,64 @@
+git-mirror(1)
+============
+
+NAME
+----
+git-mirror - Exactly mirror another repository.
+
+
+SYNOPSIS
+--------
+'git-mirror' <repository>
+
+
+DESCRIPTION
+-----------
+Completely mirrors another repository into the local repository.
+
+All heads and tags from the other repository are copied to the
+local repository without any regard for merging.  This means
+that all heads and tags will be forcibly changed in the local
+repository to make them match the other repository.  Any local
+ref or tags which has been deleted from the other repository
+will also be deleted from the local repository.
+
+After mirroring is complete the 'HEAD' symref will point at
+any branch in 'refs/heads' which has the same SHA1 as the other
+repository's 'HEAD' contained when 'git-mirror' started.  This
+is simply a rough guess and may not always be accurate.
+
+This command will also invoke 'git-repack' and 'git-prune' if
+the number of loose objects exceeds the configured threshold.
+As a result this command may cause the local repository to lose
+commits that have been removed from the other repository.
+
+
+CONFIGURATION
+-------------
+
+Prior to updating the local repository 'git-mirror' requires
+that the user set 'mirror.allowed' to a true value in the local
+repository's config file.  This is considered to be a safety
+feature which is intended to prevent accidental overwriting of
+the local repository.
+
+After updating the local repository 'git-mirror' will run
+'git-repack -a -d' and 'git-prune' if the number of loose objects
+exceeds the limit specified in the configuration file by
+'mirror.maxlooseobjects' (default 100).
+
+
+SEE ALSO
+--------
+gitlink:git-fetch[1]
+gitlink:git-prune[1]
+gitlink:git-repack[1]
+
+
+Author
+------
+Written by Shawn Pearce <spearce@spearce.org>
+
+GIT
+---
+Part of the gitlink:git[7] suite
diff --git a/Makefile b/Makefile
index 9a1f23f..08fb714 100644
--- a/Makefile
+++ b/Makefile
@@ -181,7 +181,7 @@ SCRIPT_PERL = \
 	git-shortlog.perl git-rerere.perl \
 	git-annotate.perl git-cvsserver.perl \
 	git-svnimport.perl git-cvsexportcommit.perl \
-	git-send-email.perl git-svn.perl
+	git-send-email.perl git-svn.perl git-mirror.perl
 
 SCRIPT_PYTHON = \
 	git-merge-recursive.py
diff --git a/git-mirror.perl b/git-mirror.perl
new file mode 100755
index 0000000..bff2003
--- /dev/null
+++ b/git-mirror.perl
@@ -0,0 +1,111 @@
+#!/usr/bin/env perl
+# Copyright (C) 2006, Shawn Pearce <spearce@spearce.org>
+# This file is licensed under the GPL v2, or a later version
+# at the discretion of Linus.
+
+use warnings;
+use strict;
+use Git;
+
+sub ls_refs ($$);
+
+my $remote = shift || 'origin';
+my $repo = Git->repository();
+
+# Verify its OK to execute in this repository.
+#
+my $mirror_ok = $repo->config('mirror.allowed') || 0;
+unless ($mirror_ok =~ /^(?:true|t|yes|y|1)$/i) {
+	print STDERR <<EOF;
+error: mirror.allowed is false.
+error:
+error: For safety reasons please set mirror.allowed in this repository's
+error: config before using this command.
+error:
+error: Unless you are using this repository ONLY for mirroring another
+error: repository you probably don't want to do this.
+EOF
+	exit 1;
+}
+
+# Build our list of refs.
+#
+my $remote_refs = ls_refs($repo, $remote);
+my $local_refs = ls_refs($repo, $repo->repo_path());
+my $remote_HEAD = $remote_refs->{'HEAD'};
+delete $remote_refs->{'HEAD'};
+delete $local_refs->{'HEAD'};
+
+# Delete any local refs which the server no longer contains.
+#
+foreach my $ref (keys %$local_refs) {
+	next if $remote_refs->{$ref};
+	print "removing $ref\n";
+	my $log = "logs/$ref";
+	unlink($repo->repo_path() . '/' . $ref);
+	unlink($repo->repo_path() . '/' . $log);
+	rmdir($repo->repo_path() . '/' . $ref) while $ref =~ s,/[^/]*$,,;
+	rmdir($repo->repo_path() . '/' . $log) while $log =~ s,/[^/]*$,,;
+}
+
+# Execute the fetch for any refs which differ from our own.
+# We don't worry about trying to optimize for rewinds or
+# exact branch copies as they are rather uncommon.
+#
+my @to_fetch;
+while (my ($ref, $hash) = each %$remote_refs) {
+	push(@to_fetch, "$ref:$ref")
+		if (!$local_refs->{$ref} || $local_refs->{$ref} ne $hash);
+}
+if (@to_fetch) {
+	git_cmd_try {
+		$repo->command_noisy('fetch',
+			'--force',
+			'--update-head-ok',
+			$remote, sort @to_fetch);
+	} '%s failed w/ code %d';
+} else {
+	print "No changed refs.  Skipping fetch.\n";
+}
+
+# See what the remote has HEAD pointing at and update our local
+# HEAD to point at the any ref which points at the same hash.
+#
+my %by_hash = map {$remote_refs->{$_} => $_}
+	grep {m,^refs/heads/,}
+	keys %$remote_refs;
+my $HEAD = $by_hash{$remote_HEAD} || 'refs/heads/master';
+print "Setting HEAD to $HEAD\n";
+print "                ($remote_HEAD)\n";
+git_cmd_try {
+	$repo->command_noisy('symbolic-ref', 'HEAD', $HEAD);
+} '%s failed w/ code %d';
+
+# Repack if we have a large number of loose objects.
+#
+if (@to_fetch) {
+	my $count_output = $repo->command('count-objects');
+	my ($cur_loose) = ($count_output =~ /^(\d+) objects/);
+	my $max_loose = $repo->config('mirror.maxlooseobjects') || 100;
+	if ($cur_loose >= $max_loose) {
+		git_cmd_try {
+			$repo->command_noisy('repack', '-a', '-d');
+			$repo->command_noisy('prune');
+		} '%s failed w/ code %d';
+	}
+}
+
+sub ls_refs ($$) {
+	my $repo = shift;
+	my $name = shift;
+	my ($fh, $c) = $repo->command_output_pipe('ls-remote', $name);
+	my %refs;
+	while (<$fh>) {
+		chomp;
+		next if /\^{}$/;
+		my ($hash, $ref) = split(/\t/, $_, 2);
+		$refs{$ref} = $hash if ($ref eq 'HEAD' || $ref =~ m,^refs/,);
+	}
+	$repo->command_close_pipe($fh, $c);
+	\%refs;
+}
-- 
1.4.2.1.gde2b2-dirty

^ permalink raw reply related

* [PATCH] Allow git-checkout when on a non-existant branch.
From: Shawn Pearce @ 2006-09-25  5:24 UTC (permalink / raw)
  To: git

I've seen some users get into situtations where their HEAD
symbolic-ref is pointing at a non-existant ref.  (Sometimes this
happens during clone when the remote repository lacks a 'master'
branch.)  If this happens the user is unable to use git-checkout
to switch branches as there is no prior commit to merge from.

So instead of giving the user low-level errors about how HEAD
can't be resolved and how not a single revision was given change
the type of checkout to be a force and go through with the user's
request anyway.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 git-checkout.sh |    9 ++++++++-
 t/t7201-co.sh   |    9 +++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/git-checkout.sh b/git-checkout.sh
index f03620b..119bca1 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -4,8 +4,8 @@ USAGE='[-f] [-b <new_branch>] [-m] [<bra
 SUBDIRECTORY_OK=Sometimes
 . git-sh-setup
 
-old=$(git-rev-parse HEAD)
 old_name=HEAD
+old=$(git-rev-parse --verify $old_name 2>/dev/null)
 new=
 new_name=
 force=
@@ -140,6 +140,13 @@ # what we already had
 	die "git checkout: to checkout the requested commit you need to specify 
               a name for a new branch which is created and switched to"
 
+if [ "X$old" = X ]
+then
+	echo "warning: You do not appear to currently be on a branch." >&2
+	echo "warning: Forcing checkout of $new_name." >&2
+	force=1
+fi
+
 if [ "$force" ]
 then
     git-read-tree --reset -u $new
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index b64e8b7..085d4a0 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -31,6 +31,15 @@ test_expect_success setup '
 	git checkout master
 '
 
+test_expect_success "checkout from non-existing branch" '
+
+	git checkout -b delete-me master &&
+	rm .git/refs/heads/delete-me &&
+	test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&
+	git checkout master &&
+	test refs/heads/master = "$(git symbolic-ref HEAD)"
+'
+
 test_expect_success "checkout with dirty tree without -m" '
 
 	fill 0 1 2 3 4 5 >one &&
-- 
1.4.2.1.g7a39b

^ permalink raw reply related

* Re: The GPL: No shelter for the Linux kernel?
From: Jan Engelhardt @ 2006-09-25  5:59 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Petr Baudis, David Schwartz, linux-kernel, git
In-Reply-To: <Pine.LNX.4.64.0609240923331.4388@g5.osdl.org>

>> Would every file that does not contain an explicit license (this 
>> excludes MODULE_LICENSE) falls under COPYING?
>
>[...]
>If a file doesn't have a license mentioned, it doesn't mean that it's 
>"free for all" or not copyrighted, it just means that you need to find out 
>what the license is some other way (and if you can't find out, you 
>shouldn't be copying that file ;)
>
>Of course, for clarity, a lot of projects end up adding at least a minimal 
>copyright header license everywhere, just to cover their *sses. It's not 
>required, but maybe it avoids some confusion, especially if that file is 
>later copied into some other project with other basic rules (but if you 
>do that, you really _should_ have added the information at that point!).
>[...]

Though I strongly agree with you, some GNU folks (such as 
savannah.nongnu.org) seem to explicitly require it, even for files 
that do not make up a single program (i.e. like coreutils/ls.c).



Jan Engelhardt
-- 

^ permalink raw reply

* On ref locking
From: Junio C Hamano @ 2006-09-25  9:26 UTC (permalink / raw)
  To: Christian Couder
  Cc: git, Linus Torvalds, Daniel Barkalow, Johannes Schindelin
In-Reply-To: <200609240645.54467.chriscool@tuxfamily.org>

The comments you added to the strawman I sent suggested use of
rather heavyweight locks, which made me feel we were somehow
going in a wrong direction.  Before going into the details of
branch removing, let's first see if we can summarize what kind
of guarantee we would want from ref updates.  The current
locking scheme is very carefully and nicely done by Linus and
Daniel Barkalow around June last year, and I do not want to lose
good property of it.

 - When reading and/or listing refs you do not need to acquire
   any lock.

 - When you are going to update an existing $ref, you create
   $ref.lock, and do a compare-and-swap.

What the latter means is that an updater:

 (1) first learns the current value of the $ref, without
     locking;

 (2) decides based on the knowledge from (1) what the next value
     should be;

 (3) gets $ref.lock, makes sure $ref still is the value it
     learned in (1), updates it to the desired value and
     releases the lock.

The above 3-step sequence prevents updater-updater races with an
extremely short critical section.  We only need to hold the lock
while we do compare and swap.

The mandatory "fast-forward" check by receive-pack introduced by
Johannes (see receive-pack.c::update()) does exactly the above.
The program reads the current value of refs involved very early,
and verifies fast-forward-ness of the update here.  After doing
that, it gets the lock, makes sure the refs are still the same
as we read earlier (meaning, nobody else updated the ref while
we were doing other things, thereby invalidating the checks
we've done earlier) and then finally unlocks it.

Side note: we might want to move the call to run_update_hook()
before creating the lock for the same reason as we do the new
fast-forwards test before acquiring the lock.

I am not sure if the current code in receive-pack is doing the
right thing to prevent creator-creator race, though.  While
creating a new ref, verify_old_ref() is called with 0{40} as the
old value (meaning, "we are creating this ref and setting it to
this value, based on our previous knowledge that it did not
exist").  It happily returns without checking anything in this
case, but I think it should make sure nobody created the ref
while we were looking the other way.  With the current code, we
would allow overwriting somebody else's push.  And the race
window is not so small -- the check that the ref is a new one we
are about to create is performed during the initial protocol
handshake, and then we can spend quite some time unpacking the
pack stream until we get to verify_old_ref().

The same 3-step sequence is done by refs.c::lock_ref_sha1() and
lock_any_ref_for_update() API and Porcelains are expected to use
git-update-ref.  You call them with the current value of the ref
as you learned earlier, and you would get a lock.  If you get a
lock successfully, you write the new value out.

Side note: I think the same issue of creator-creator race exists
in verify_lock(), by the way.  I think we can fix this by
accepting 0{40} SHA1 to git-update-ref to mean "I am creating
this based on the assumption that it does not exist yet -- that
is my understanding from my earlier check".

We are very relaxed about deleting refs right now, compared to
the updates described above.  "git branch -d" barfs if the ref
it wanted to delete is not an ancestor of the current branch,
but it does not have any lock between the time it checks and the
time it actually deletes it.

There are very loosely written ref updates in Porcelains. "git
tag" and "git branch" barf if the ref they wanted to create
exists, but both have rather large race window without the
protection of any lock.  Especially "git tag" race window is
large -- it lets you open an editor to type the tag message and
runs gpg to sign the message after checking if you are not
overwriting an existing tag X-<.  These should be fixed, and I
think we can do so by the above fix to git-update-ref I
mentioned in the above side note.

We might need to update the ref locking to adjust to packed
refs, and getting locks around ref deletion right becomes more
important if we want to do the funky .git/deleted-refs/$ref~ref
business.  But we should try to stick to the same 3-step
sequence.  What this means is that a deleter:

 (1) first learns the current value of the $ref, without
     locking;

 (2) decides based on the knowledge from (1) it indeed wants to
     delete it;

 (3) gets the $ref.lock, makes sure $ref still has the value it
     learned in (1), and deletes it.  As a special case, if $ref
     no longer exists, that does not have to be an error.
     Somebody else deleted it while we were looking the other
     way, but a delete is a delete is a delete, and we are
     simply happy that the ref is gone.

This should protect us from deleter-updater race.  $ref.lock
would protect us from deleter-creator race.  So I do not think
we would need to take .git/packed-refs.lock while deleting a
ref.  Even if you implement "(3) ... deletes it" with the
proposed .git/deleted-refs/$ref~ref file.

I think the way Linus did git-pack-refs protects us from
packer-packer race, and packer-updater, packer-creator, and
packer-deleter race does not exist, because pack-refs:

 (0) takes .git/packed-refs.lock

 (1) learns the current value of all refs without any further locking;

 (2) writes out the current values;

 (3) releases .git/packed-refs.lock.

If somebody else creates or updates a ref while the above is
running, the new result from loose refs will be used by later
user, making the entry in packed-refs obsolete.  So there is no
packer-updater or packer-creator race here.  If we do the
proposed .git/deleted-refs/$ref~ref to mark deletion, that would
also override whatever is in the resulting packed-refs, so we do
not have to worry about packer-deleter race either.

I am reasonably sure there is no pruner-updater and pruner-creator
races.  "pack-refs --prune":

 (1) learns the current value of all refs without any locking,
     as part of the packing operation during the same run.

     For each ref:

 (2) takes $ref.lock, makes sure $ref still has the value it
     learned from (1), and deletes .git/$ref (because the same
     value is recorded in .git/packed-refs), and then unlocks
     $ref.lock

I haven't thought through packer-pruner race (pruner needs to
unlock .git/packed-refs.lock first -- otherwise if it dies in
the middle of pruning we would lose refs that are stashed in the
.git/packed-refs.lock file, that hasn't made to its final
location), but I think we do not have any problem.

^ permalink raw reply

* [PATCH] perl bindings fix compilation errors
From: Andy Whitcroft @ 2006-09-25 10:03 UTC (permalink / raw)
  To: git

perl bindings: fix compilation errors

With the introduction of Makefile.PL to the perl bindings we no
longer seem to pass in either the definition of SHA1_HEADER or
GIT_VERSION.  It seems we no longer pass over the BASIC_FLAGS into
the compilation.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
diff --git a/Makefile b/Makefile
index d705e06..d32f4c4 100644
--- a/Makefile
+++ b/Makefile
@@ -603,7 +603,7 @@ all: $(ALL_PROGRAMS) $(BUILT_INS) git$X 
 	git-merge-recur$X
 
 all: perl/Makefile
-	$(MAKE) -C perl
+	$(MAKE) -C perl GIT_VERSION='$(GIT_VERSION)' BASIC_CFLAGS="$(BASIC_CFLAGS)"
 	$(MAKE) -C templates
 
 strip: $(PROGRAMS) git$X
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
index de73235..00fc779 100644
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -5,6 +5,8 @@ sub MY::postamble {
 instlibdir:
 	@echo '$(INSTALLSITELIB)'
 
+CCFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"' $(BASIC_CFLAGS)
+
 MAKE_FRAG
 }
 

^ permalink raw reply related

* Re: [PATCH] perl bindings fix compilation errors
From: Johannes Schindelin @ 2006-09-25 10:25 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: git
In-Reply-To: <20060925100319.GA1655@shadowen.org>

Hi,

On Mon, 25 Sep 2006, Andy Whitcroft wrote:

> With the introduction of Makefile.PL to the perl bindings we no
> longer seem to pass in either the definition of SHA1_HEADER or
> GIT_VERSION.  It seems we no longer pass over the BASIC_FLAGS into
> the compilation.

You probably got bitten by the fact that earlier runs left Git.c in the 
perl/ directory. Go to perl/, "make distclean", and make git again.

Hth,
Dscho

^ permalink raw reply

* Re: [PATCH 1/2] Remove git-zip-tree
From: Franck Bui-Huu @ 2006-09-25 10:31 UTC (permalink / raw)
  To: Rene Scharfe; +Cc: Junio C Hamano, Franck Bui-Huu, Git Mailing List
In-Reply-To: <45154D63.8030107@lsrfire.ath.cx>

Rene Scharfe wrote:
> git-zip-tree can be safely removed because it was never part of a formal
> release.  This patch makes 'git-archive --format=zip' the one and only git
> ZIP file creation command.  
> 
[snip]
> -
> -Currently git-zip-tree can handle only files and directories, symbolic
> -links are not supported.
> -
> -OPTIONS
> --------
> -
> --0::
> -	Store the files instead of deflating them.
> -
> --9::
> -	Highest and slowest compression level.  You can specify any
> -	number from 1 to 9 to adjust compression speed and ratio.
> -

We should keep these options documented somewhere... What about this ?

-- >8 --

Subject: [PATCH] git-archive: update documentation

This patch documents zip backend options.

It also adds git-archive command into the main git manual
page.

Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
---
 Documentation/git-archive.txt |   13 +++++++++++++
 Documentation/git.txt         |    3 +++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
index 913528d..031fcd5 100644
--- a/Documentation/git-archive.txt
+++ b/Documentation/git-archive.txt
@@ -40,6 +40,7 @@ OPTIONS
 
 <extra>::
 	This can be any options that the archiver backend understand.
+	See next section.
 
 --remote=<repo>::
 	Instead of making a tar archive from local repository,
@@ -52,6 +53,18 @@ path::
 	If one or more paths are specified, include only these in the
 	archive, otherwise include all files and subdirectories.
 
+BACKEND EXTRA OPTIONS
+---------------------
+
+zip
+~~~
+-0::
+	Store the files instead of deflating them.
+-9::
+	Highest and slowest compression level.  You can specify any
+	number from 1 to 9 to adjust compression speed and ratio.
+
+
 CONFIGURATION
 -------------
 By default, file and directories modes are set to 0666 or 0777 in tar
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 1bf5ef5..2135b65 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -266,6 +266,9 @@ gitlink:git-am[1]::
 gitlink:git-applymbox[1]::
 	Apply patches from a mailbox, original version by Linus.
 
+gitlink:git-archive[1]::
+	Creates an archive of files from a named tree.
+
 gitlink:git-bisect[1]::
 	Find the change that introduced a bug by binary search.
 
-- 
1.4.2.1

^ permalink raw reply related

* [PATCH] svnimport add support for parsing From lines for author
From: Andy Whitcroft @ 2006-09-25 11:08 UTC (permalink / raw)
  To: git

svnimport: add support for parsing From: lines for author

When commiting a non-signed off contribution you cannot just add
a Signed-off-by: from the author as they did not sign it off.
But if you then commit it, and necessarily sign it off yourself,
the change appears to be yours.  In this case it is common to use
the following form:

	Commentry

	From: originator <email>
	Signed-of-by: me <my email>

Now that we have support for parsing Signed-off-by: for author
information it makes sense to handle From: as well.  This patch
adds a new -F which will handle From: lines in the comments.  It
may be used in combination with -S.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
diff --git a/git-svnimport.perl b/git-svnimport.perl
index ed62897..988514e 100755
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
@@ -31,7 +31,7 @@ die "Need SVN:Core 1.2.1 or better" if $
 $ENV{'TZ'}="UTC";
 
 our($opt_h,$opt_o,$opt_v,$opt_u,$opt_C,$opt_i,$opt_m,$opt_M,$opt_t,$opt_T,
-    $opt_b,$opt_r,$opt_I,$opt_A,$opt_s,$opt_l,$opt_d,$opt_D,$opt_S);
+    $opt_b,$opt_r,$opt_I,$opt_A,$opt_s,$opt_l,$opt_d,$opt_D,$opt_S,$opt_F);
 
 sub usage() {
 	print STDERR <<END;
@@ -39,12 +39,12 @@ Usage: ${\basename $0}     # fetch/updat
        [-o branch-for-HEAD] [-h] [-v] [-l max_rev]
        [-C GIT_repository] [-t tagname] [-T trunkname] [-b branchname]
        [-d|-D] [-i] [-u] [-r] [-I ignorefilename] [-s start_chg]
-       [-m] [-M regex] [-A author_file] [-S] [SVN_URL]
+       [-m] [-M regex] [-A author_file] [-S] [-F] [SVN_URL]
 END
 	exit(1);
 }
 
-getopts("A:b:C:dDhiI:l:mM:o:rs:t:T:Suv") or usage();
+getopts("A:b:C:dDFhiI:l:mM:o:rs:t:T:Suv") or usage();
 usage if $opt_h;
 
 my $tag_name = $opt_t || "tags";
@@ -548,8 +548,12 @@ sub commit {
 		$committer_name = $committer_email = $author;
 	}
 
-	if ($opt_S && $message =~ /Signed-off-by:\s+(.*?)\s+<(.*)>\s*\n/) {
+	if ($opt_F && $message =~ /From:\s+(.*?)\s+<(.*)>\s*\n/) {
 		($author_name, $author_email) = ($1, $2);
+		print "Author from From: $1 <$2>\n" if ($opt_v);;
+	} elsif ($opt_S && $message =~ /Signed-off-by:\s+(.*?)\s+<(.*)>\s*\n/) {
+		($author_name, $author_email) = ($1, $2);
+		print "Author from Signed-off-by: $1 <$2>\n" if ($opt_v);;
 	} else {
 		$author_name = $committer_name;
 		$author_email = $committer_email;

^ permalink raw reply related

* Re: [PATCH] perl bindings fix compilation errors
From: Andy Whitcroft @ 2006-09-25 11:34 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0609251223590.25371@wbgn013.biozentrum.uni-wuerzburg.de>

Johannes Schindelin wrote:
> Hi,
> 
> On Mon, 25 Sep 2006, Andy Whitcroft wrote:
> 
>> With the introduction of Makefile.PL to the perl bindings we no
>> longer seem to pass in either the definition of SHA1_HEADER or
>> GIT_VERSION.  It seems we no longer pass over the BASIC_FLAGS into
>> the compilation.
> 
> You probably got bitten by the fact that earlier runs left Git.c in the 
> perl/ directory. Go to perl/, "make distclean", and make git again.

Hmmm that sucks.  Yes, I had to make distclean more than once, but it
seems to fix things.

I am somewhat unhappy that a make clean at the top level and remake was
not sufficient to get a working tree.

-apw

^ 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