Git development
 help / color / mirror / Atom feed
* Re: Fix UTF Encoding issue
From: Wincent Colaiuta @ 2007-12-04 10:11 UTC (permalink / raw)
  To: Ismail Dönmez
  Cc: Martin Koegler, Jakub Narebski, Junio C Hamano,
	Alexandre Julliard, Benjamin Close, git,
	Perl Unicode Mailing List, Dan Kogai
In-Reply-To: <200712041055.41593.ismail@pardus.org.tr>

El 4/12/2007, a las 9:55, Ismail Dönmez escribió:

> Tuesday 04 December 2007 10:47:39 Ismail Dönmez yazmıştı:
>> Tuesday 04 December 2007 10:44:12 Martin Koegler yazmıştı:
>>> On Tue, Dec 04, 2007 at 10:33:39AM +0200, Ismail Dönmez wrote:
>>>> Following to_utf8 function works for me :
>>>
>>> For me too (Debian sarge+etch).
>>
>> Thanks for testing.
>
> Use Perl built-in utf8 function for UTF-8 decoding.
>
> Signed-off-by: İsmail Dönmez <ismail@pardus.org.tr>
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index ff5daa7..db255c1 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -695,10 +695,9 @@ sub validate_refname {
> # in utf-8 thanks to "binmode STDOUT, ':utf8'" at beginning
> sub to_utf8 {
> 	my $str = shift;
> -	my $res;
> -	eval { $res = decode_utf8($str, Encode::FB_CROAK); };
> -	if (defined $res) {
> -		return $res;
> +        if (utf8::valid($str)) {
> +                utf8::decode($str);
> +                return $str;

This is good as it fixes another problem which some may have  
encountered. On at least one distro that I use (Red Hat Enterprise  
Linux 3) the Encode module is very old (it's 1.83; the latest release  
is 2.23), and so gitweb won't even run, dying during compilation with  
this:

	Too many arguments for Encode::decode_utf8 at gitweb.cgi line 686,  
near "Encode::FB_CROAK)"

Of course, the workaround is to install a newer version of the module,  
but this patch eliminates that dependency which is IMO a good thing.

Cheers,
Wincent

^ permalink raw reply

* msysGit on FAT32 (was: What's cooking in git.git (topics))
From: Jakub Narebski @ 2007-12-04 10:08 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Johannes Schindelin, git
In-Reply-To: <47552084.3070601@viscovery.net>

Johannes Sixt <j.sixt@viscovery.net> writes:

> BTW, we do use hardlinks on Windows; even the MsysGit installer
> creates them (as long as the filesystem is NTFS). So, the fallout you
> are expecting/hoping for will not be in the first round of MinGW port
> patches. ;)

Would it be possible to add option to an installer to _not_ install
git-cmd form for builtins when installing on FAT28^W FAT32?

-- 
Jakub Narebski
ShadeHawk on #git
Poland

^ permalink raw reply

* Re: What's cooking in git.git (topics)
From: Johannes Sixt @ 2007-12-04  9:40 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vy7ca6ea9.fsf@gitster.siamese.dyndns.org>

Junio C Hamano schrieb:
> * sp/refspec-match (Sun Nov 11 15:01:48 2007 +0100) 4 commits
>  + refactor fetch's ref matching to use refname_match()
>  + push: use same rules as git-rev-parse to resolve refspecs
>  + add refname_match()
>  + push: support pushing HEAD to real branch name
> 
> The last one changes the semantics to somewhat less safe:
> 
>     * We did not allow fetching outside refs/ (except HEAD), but now we
>       allow any random string.
> 
>     * We used to restrict fetching names that do not begin with refs/ to
>       heads, tags and remotes, but now the code grabs anything underneath
>       refs/.
> 
> which could invite mistakes by letting typos slip through, but I won't
> be a good judge, as I probably "fetch" much less often than other people
> do and these may be non issues in the real-world usecases.  It could be
> that I am worried too much needlessly.  If anybody who is following
> 'next' has been bitten by the change, please speak up.  Otherwise this
> will go in soon.

Forks on repo.or.cz use the namespace refs/forkee that lists everything that 
the forkee has below refs/. So this change might indeed be annoying. (But 
I'm not using next, so I can't tell, yet.)

> Incidentally, if we do not install dashed form of built-ins anywhere
> (which is not this series is about --- this is just moving them out of
> user's PATH), "git help -a" will stop showing them.  I am not enthused
> about removing the hardlinks to built-ins to begin with, but people who
> want such a change need to first modify help.c:list_commands() to pick
> up builtins without having git-foo hardlinks in gitexecdir.  This may
> need to happen anyway as mingw fallouts, though ;-).

Heh. 'git help -a' currently shows nothing. But it has nothing to do with 
hardlinks. It's because the test for the executable bit fails :-(

BTW, we do use hardlinks on Windows; even the MsysGit installer creates them 
(as long as the filesystem is NTFS). So, the fallout you are 
expecting/hoping for will not be in the first round of MinGW port patches. ;)

-- Hannes

^ permalink raw reply

* Re: [PATCH] Set OLD_ICONV on Cygwin.
From: Andreas Ericsson @ 2007-12-04  9:32 UTC (permalink / raw)
  To: Pascal Obry; +Cc: Pascal Obry, git
In-Reply-To: <47544FC7.3070100@obry.net>

Pascal Obry wrote:
> I pretty well understand that this patch is not very important but since
> I got no reply I'm wondering if there is something wrong with it ?
> 

Only one, insofar as I can see; You didn't CC Junio. He probably missed it.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply

* Re: [PATCH] Allow HTTP proxy to be overridden in config
From: Sam Vilain @ 2007-12-04  9:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, francois
In-Reply-To: <7vodd66dzw.fsf@gitster.siamese.dyndns.org>

Junio C Hamano wrote:
>> Subject: [PATCH] Add remote.<name>.proxy
>> As well as allowing a default proxy option, allow it to be set
>> per-remote.
> 
> Thanks.
> 
> I was very tempted to rename them to remote.*.httpproxy, but ended up
> keeping the name of the variable.  We might want to allow tunnelling the
> git native transport over the named proxy when remote.*.url is native
> transport.

Also, it controls proxy for all of the curl-based git transports, not
just http.

Sam.

^ permalink raw reply

* Re: Fix UTF Encoding issue
From: Jakub Narebski @ 2007-12-04  9:07 UTC (permalink / raw)
  To: Ismail Dönmez
  Cc: Martin Koegler, Junio C Hamano, Alexandre Julliard,
	Benjamin Close, git
In-Reply-To: <200712041055.41593.ismail@pardus.org.tr>

On Tue, 4 Dec 2007, Ismail Dönmez wrote:

> Use Perl built-in utf8 function for UTF-8 decoding.
> 
> Signed-off-by: İsmail Dönmez <ismail@pardus.org.tr>
 
Looks nice. I have not tested it, but if it works: Ack.
-- 
Jakub Narebski
Poland

^ permalink raw reply

* Re: Fix UTF Encoding issue
From: Ismail Dönmez @ 2007-12-04  8:55 UTC (permalink / raw)
  To: Martin Koegler
  Cc: Jakub Narebski, Junio C Hamano, Alexandre Julliard,
	Benjamin Close, git, Perl Unicode Mailing List, Dan Kogai
In-Reply-To: <200712041047.39340.ismail@pardus.org.tr>

Tuesday 04 December 2007 10:47:39 Ismail Dönmez yazmıştı:
> Tuesday 04 December 2007 10:44:12 Martin Koegler yazmıştı:
> > On Tue, Dec 04, 2007 at 10:33:39AM +0200, Ismail Dönmez wrote:
> > > Following to_utf8 function works for me :
> >
> > For me too (Debian sarge+etch).
>
> Thanks for testing.

Use Perl built-in utf8 function for UTF-8 decoding.

Signed-off-by: İsmail Dönmez <ismail@pardus.org.tr>

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ff5daa7..db255c1 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -695,10 +695,9 @@ sub validate_refname {
 # in utf-8 thanks to "binmode STDOUT, ':utf8'" at beginning
 sub to_utf8 {
 	my $str = shift;
-	my $res;
-	eval { $res = decode_utf8($str, Encode::FB_CROAK); };
-	if (defined $res) {
-		return $res;
+        if (utf8::valid($str)) {
+                utf8::decode($str);
+                return $str;
 	} else {
 		return decode($fallback_encoding, $str, Encode::FB_DEFAULT);
 	}



-- 
Never learn by your mistakes, if you do you may never dare to try again.

^ permalink raw reply related

* Re: [PATCH] Allow HTTP proxy to be overridden in config
From: Junio C Hamano @ 2007-12-04  8:49 UTC (permalink / raw)
  To: Sam Vilain; +Cc: git, francois
In-Reply-To: <475479C6.3050506@catalyst.net.nz>

Sam Vilain <sam.vilain@catalyst.net.nz> writes:

> Subject: [PATCH] Add remote.<name>.proxy
>
> As well as allowing a default proxy option, allow it to be set
> per-remote.

Thanks.

I was very tempted to rename them to remote.*.httpproxy, but ended up
keeping the name of the variable.  We might want to allow tunnelling the
git native transport over the named proxy when remote.*.url is native
transport.

^ permalink raw reply

* Re: Fix UTF Encoding issue
From: Ismail Dönmez @ 2007-12-04  8:47 UTC (permalink / raw)
  To: Martin Koegler
  Cc: Jakub Narebski, Junio C Hamano, Alexandre Julliard,
	Benjamin Close, git, Perl Unicode Mailing List, Dan Kogai
In-Reply-To: <20071204084412.GA19597@auto.tuwien.ac.at>

Tuesday 04 December 2007 10:44:12 Martin Koegler yazmıştı:
> On Tue, Dec 04, 2007 at 10:33:39AM +0200, Ismail Dönmez wrote:
> > Following to_utf8 function works for me :
>
> For me too (Debian sarge+etch).

Thanks for testing.

> > sub to_utf8 {
> > ·   my $str = shift;
> >
> >     if(utf8::valid($str))
> >     {
> >         utf8::decode($str);
> >     }
> > ·
> >     return $str;
>
> In the original thread, there was some discussion, that some people
> might want a different fallback endcoding. So mayme you should
> keep the second call to decode for the fallback encoding.

Probably, I just wanted to fix this damn UTF-8 bug surfacing over and over =)

Regards,
ismail

-- 
Never learn by your mistakes, if you do you may never dare to try again.

^ permalink raw reply

* Re: Fix UTF Encoding issue
From: Martin Koegler @ 2007-12-04  8:44 UTC (permalink / raw)
  To: Ismail Dönmez
  Cc: Jakub Narebski, Junio C Hamano, Alexandre Julliard,
	Benjamin Close, git, Perl Unicode Mailing List, Dan Kogai
In-Reply-To: <200712041033.39579.ismail@pardus.org.tr>

On Tue, Dec 04, 2007 at 10:33:39AM +0200, Ismail Dönmez wrote:
> Following to_utf8 function works for me :

For me too (Debian sarge+etch).

> sub to_utf8 {
> ·   my $str = shift;
> 
>     if(utf8::valid($str))
>     {
>         utf8::decode($str);
>     }
> ·
>     return $str;

In the original thread, there was some discussion, that some people
might want a different fallback endcoding. So mayme you should 
keep the second call to decode for the fallback encoding.

> }

mfg Martin Kögler

^ permalink raw reply

* What's in git.git (stable)
From: Junio C Hamano @ 2007-12-04  8:43 UTC (permalink / raw)
  To: git
In-Reply-To: <7v63zjgoel.fsf@gitster.siamese.dyndns.org>

Nothing exciting on 'maint' since 1.5.3.7.

On the 'master' front, we will soon be in feature freeze for 1.5.4.
Many topics that have been cooking in 'next' has been pushed out.  This
round it is a rather large batch but hopefully it will not destabilize
it too much.  Knock wood.

 * "git pull --rebase" is a different way to integrate what you fetched
   into your current branch.

 * "git fast-export" produces datastream that can be fed to fast-import
   to reproduce the history recorded in a git repository.

 * gitk is now merged as a subdirectory of git.git project, in
   preparation for its i18n.

 * Value "true" for color.diff and color.status configuration used to
   mean "always" (even when the output is not going to a terminal).
   This has been corrected to mean the same thing as "auto".

 * "git commit --allow-empty" allows you to create a single-parent
   commit that records the same tree as its parent, overriding the usual
   safety valve.

 * "git stash random-text" does not create a new stash anymore.  It was
   a UI mistake.  Use "git stash save random-text", or "git stash"
   (without extra args) for that.

 * HTTP proxy can be specified per remote repository using
   remote.*.proxy configuration, or global http.proxy configuration
   variable.

 * "git rebase -i" also triggers rerere to help you repeated merges.

 * "git prune --expire <time>" can exempt young loose objects from
   getting pruned.

 * "git branch --contains <commit>" can list branches that are
   descendants of a given commit.

----------------------------------------------------------------

* The 'maint' branch has these fixes since the last announcement.

Jeff King (1):
  t9600: test cvsimport from CVS working tree

Junio C Hamano (2):
  Fix typo in t4008 test title
  GIT 1.5.3.7


* The 'master' branch has these since the last announcement
  in addition to the above.

Andy Whitcroft (1):
  git-svn: add support for pulling author from From: and Signed-off-by:

Carlos Rica (1):
  Make builtin-tag.c use parse_options.

Christian Couder (2):
  Documentation: add a new man page for "git-help"
  Trace and quote with argv: get rid of unneeded count argument.

David D. Kilzer (1):
  git-svn: Remove unnecessary Git::SVN::Util package

David Symonds (1):
  Mention that git-rm can be an appropriate resolution as well as git-add.

Denis Cheng (1):
  gitweb: the commitdiff is very commonly used, it's needed on search page,
    too

Gustaf Hendeby (1):
  git-svn now reads settings even if called in subdirectory

Jakub Narebski (1):
  gitweb: Update and improve gitweb/README file

Jeff King (2):
  git-tag: test that -s implies an annotated tag
  Enable rewrite as well as rename detection in git-status

Johannes Schindelin (7):
  Replace instances of export VAR=VAL with VAR=VAL; export VAR
  Teach 'git pull' about --rebase
  rebase -i: give rerere a chance
  Add "--expire <time>" option to 'git prune'
  Add 'git fast-export', the sister of 'git fast-import'
  fast-export: rename the signed tag mode 'ignore' to 'verbatim'
  Allow ':/<oneline-prefix>' syntax to work with save_commit_buffer == 0

Johannes Sixt (1):
  git-commit: Allow to amend a merge commit that does not change the tree

Junio C Hamano (17):
  Move gitk to its own subdirectory
  git-branch --contains=commit
  git-branch --contains: doc and test
  builtin-tag: accept and process multiple -m just like git-commit
  "git-tag -s" should create a signed annotated tag
  "color.diff = true" is not "always" anymore.
  git-config --get-color: get configured color
  Update draft release notes for 1.5.4
  Resurrect peek-remote
  Consolidate command list to one.
  Update draft release notes for 1.5.4
  rename: Break filepairs with different types.
  git-am: catch missing author date early.
  git-commit --allow-empty
  git-commit documentation: fix unfinished sentence.
  Add git-fast-export to list of commands.
  Update draft release notes for 1.5.4

Kevin Leung (1):
  git-stash: Display help message if git-stash is run with wrong
    sub-commands

Pierre Habouzit (1):
  parse-options: Allow to hide options from the default usage.

Robert Schiele (1):
  install-sh from automake does not like -m without delimiting space

Sam Vilain (2):
  Allow HTTP proxy to be overridden in config
  Add remote.<name>.proxy

Steven Grimm (1):
  git-svn: Don't create a "master" branch every time rebase is run

Theodore Ts'o (2):
  Make the list of common commands more exclusive
  Remove hint to use "git help -a"

Vineet Kumar (1):
  git-svn: add a show-externals command.

Wincent Colaiuta (1):
  revert/cherry-pick: Allow overriding the help text by the calling
    Porcelain

^ permalink raw reply

* What's cooking in git.git (topics)
From: Junio C Hamano @ 2007-12-04  8:43 UTC (permalink / raw)
  To: git
In-Reply-To: <7vzlwv6sxr.fsf@gitster.siamese.dyndns.org>

Here are the topics that have been cooking.  Commits prefixed
with '-' are only in 'pu' while commits prefixed with '+' are
in 'next'.  The topics list the commits in reverse chronological
order.

----------------------------------------------------------------
[Graduated to 'master']

* cr/tag-options (Sun Nov 25 23:50:58 2007 -0500) 4 commits
* jc/branch-contains (Sun Nov 18 22:22:00 2007 -0800) 3 commits
* jc/move-gitk (Sat Nov 17 10:51:16 2007 -0800) 1 commit
* tt/help (Sun Nov 11 19:57:57 2007 -0500) 2 commits
* jc/color (Tue Nov 27 22:41:05 2007 -0800) 2 commits

----------------------------------------------------------------
[New Topics]

* cc/help (Tue Dec 4 06:44:29 2007 +0100) 2 commits
 + Documentation: describe -i/--info option to "git-help"
 + git-help: add -i|--info option to display info page.

There are two additional patches I didn't queue for -w (web) in this
series.

----------------------------------------------------------------
[Will cook further in 'next' and then merge to 'master' soon]

* jc/docmake-perl (Fri Nov 30 18:36:34 2007 -0800) 1 commit
 + Run the specified perl in Documentation/

Tired of waiting for Ack from Merlyn, I merged this to 'next'.

* sp/refspec-match (Sun Nov 11 15:01:48 2007 +0100) 4 commits
 + refactor fetch's ref matching to use refname_match()
 + push: use same rules as git-rev-parse to resolve refspecs
 + add refname_match()
 + push: support pushing HEAD to real branch name

The last one changes the semantics to somewhat less safe:

    * We did not allow fetching outside refs/ (except HEAD), but now we
      allow any random string.

    * We used to restrict fetching names that do not begin with refs/ to
      heads, tags and remotes, but now the code grabs anything underneath
      refs/.

which could invite mistakes by letting typos slip through, but I won't
be a good judge, as I probably "fetch" much less often than other people
do and these may be non issues in the real-world usecases.  It could be
that I am worried too much needlessly.  If anybody who is following
'next' has been bitten by the change, please speak up.  Otherwise this
will go in soon.

* kh/commit (Mon Dec 3 00:03:10 2007 -0800) 33 commits
 + git-commit --allow-empty
 + git-commit: Allow to amend a merge commit that does not change the
   tree
 + quote_path: fix collapsing of relative paths
 + Make git status usage say git status instead of git commit
 + Fix --signoff in builtin-commit differently.
 + git-commit: clean up die messages
 + Do not generate full commit log message if it is not going to be
   used
 + Remove git-status from list of scripts as it is builtin
 + Fix off-by-one error when truncating the diff out of the commit
   message.
 + builtin-commit.c: export GIT_INDEX_FILE for launch_editor as well.
 + Add a few more tests for git-commit
 + builtin-commit: Include the diff in the commit message when
   verbose.
 + builtin-commit: fix partial-commit support
 + Fix add_files_to_cache() to take pathspec, not user specified list
   of files
 + Export three helper functions from ls-files
 + builtin-commit: run commit-msg hook with correct message file
 + builtin-commit: do not color status output shown in the message
   template
 + file_exists(): dangling symlinks do exist
 + Replace "runstatus" with "status" in the tests
 + t7501-commit: Add test for git commit <file> with dirty index.
 + builtin-commit: Clean up an unused variable and a debug fprintf().
 + Call refresh_cache() when updating the user index for --only
   commits.
 + builtin-commit: Add newline when showing which commit was created
 + builtin-commit: resurrect behavior for multiple -m options
 + builtin-commit --s: add a newline if the last line was not a S-o-b
 + builtin-commit: fix --signoff
 + git status: show relative paths when run in a subdirectory
 + builtin-commit: Refresh cache after adding files.
 + builtin-commit: fix reflog message generation
 + launch_editor(): read the file, even when EDITOR=:
 + Port git commit to C.
 + Export launch_editor() and make it accept ':' as a no-op editor.
 + Add testcase for amending and fixing author in git commit.

This should be production ready, but commit is so central, so let's wait
a bit longer until the bugfixes completely stop flowing in.  The
earliest will be next Wednesday.

* wc/add-i (Mon Dec 3 09:09:43 2007 +0100) 34 commits
 + git-add -i: add help text for list-and-choose UI
 + add -i: allow prefix highlighting for "Add untracked" as well.
 + Highlight keyboard shortcuts in git-add--interactive
 + Document all help keys in "git add -i" patch mode.
 + Add "--patch" option to git-add--interactive
 + add -i: Fix running from a subdirectory
 + builtin-add: fix command line building to call interactive
 + Merge branch 'kh/commit' into wc/add-i
 + Add a few more tests for git-commit
 + git-add -i: allow multiple selection in patch subcommand
 + builtin-commit: Include the diff in the commit message when
   verbose.
 + builtin-commit: fix partial-commit support
 + Fix add_files_to_cache() to take pathspec, not user specified list
   of files
 + Export three helper functions from ls-files
 + builtin-commit: run commit-msg hook with correct message file
 + builtin-commit: do not color status output shown in the message
   template
 + file_exists(): dangling symlinks do exist
 + Replace "runstatus" with "status" in the tests
 + t7501-commit: Add test for git commit <file> with dirty index.
 + builtin-commit: Clean up an unused variable and a debug fprintf().
 + Call refresh_cache() when updating the user index for --only
   commits.
 + builtin-commit: Add newline when showing which commit was created
 + builtin-commit: resurrect behavior for multiple -m options
 + builtin-commit --s: add a newline if the last line was not a S-o-b
 + builtin-commit: fix --signoff
 + git status: show relative paths when run in a subdirectory
 + builtin-commit: Refresh cache after adding files.
 + builtin-commit: fix reflog message generation
 + launch_editor(): read the file, even when EDITOR=:
 + Port git commit to C.
 + Export launch_editor() and make it accept ':' as a no-op editor.
 + Add testcase for amending and fixing author in git commit.
 + Add path-limiting to git-add--interactive
 + Teach builtin-add to pass multiple paths to git-add--interactive

This looks larger than it really is, as I merged in the builtin commit
series near the tip (they interact with each other somewhat).  Will
merge to 'master' along with the "commit in C" series above.

----------------------------------------------------------------
[Actively cooking]

* jc/spht (Sat Nov 24 11:57:41 2007 -0800) 6 commits
 + core.whitespace: documentation updates.
 + builtin-apply: teach whitespace_rules
 + builtin-apply: rename "whitespace" variables and fix styles
 + core.whitespace: add test for diff whitespace error highlighting
 + git-diff: complain about >=8 consecutive spaces in initial indent
 + War on whitespace: first, a bit of retreat.

Now apply also knows about the customizable definition of what
whitespace breakages are, and I was reasonably happy. But Bruce kicked
it back from "scheduled to merge" to "still cooking" status, reminding
that we would want to have this not a tree-wide configuration but
per-path attribute.  And I agree with him.

* jc/api-doc (Sat Nov 24 23:48:04 2007 -0800) 1 commit
 - Start preparing the API documents.

The primary reason of this series is because I think we made the system
a lot less approachable by losing hackability.  Although we still have
sample scripts in contrib/example for use of plumbing in scripts, they
will not help aspiring git-hacker-wannabees when our primary attention
has already shifted to moving things to C.

This currently consists of mostly stubs, although I wrote about a few
topics as examples.

* nd/maint-work-tree-fix (Thu Nov 29 19:21:39 2007 +0700) 2 commits
 + Do check_repository_format() early
 + Add missing inside_work_tree setting in setup_git_directory_gently

The tip one needs test script.

* jk/builtin-alias (Fri Nov 30 11:22:58 2007 -0500) 1 commit
 + Support builtin aliases

Cute hack.  I'd like to have "git less" here.

----------------------------------------------------------------
[Stalled]

* jc/dashless (Sat Dec 1 22:09:22 2007 -0800) 2 commits
 - Prepare execv_git_cmd() for removal of builtins from the
   filesystem
 - git-shell: accept "git foo" form

We do not plan to remove git-foo form completely from the filesystem at
this point, so these are not strictly necessary.

* mw/cvsserver (Fri Nov 23 04:12:54 2007 -0500) 1 commit
 - git-cvsserver runs hooks/post-receive

Queue in 'pu', but lacks a corresponding support for hooks/post-update,
which we haven't declared deprecation.

* nd/dashless (Wed Nov 28 23:21:57 2007 +0700) 1 commit
 - Move all dashed-form commands to libexecdir

I think this is a sane thing to do in the longer term.  Will be in
'next' after v1.5.4.  I think "leave porcelain on PATH" might be also a
good thing as a transition measure.

Incidentally, if we do not install dashed form of built-ins anywhere
(which is not this series is about --- this is just moving them out of
user's PATH), "git help -a" will stop showing them.  I am not enthused
about removing the hardlinks to built-ins to begin with, but people who
want such a change need to first modify help.c:list_commands() to pick
up builtins without having git-foo hardlinks in gitexecdir.  This may
need to happen anyway as mingw fallouts, though ;-).

* js/reflog-delete (Wed Oct 17 02:50:45 2007 +0100) 1 commit
 + Teach "git reflog" a subcommand to delete single entries

* dz/color-addi (Sat Nov 10 18:03:44 2007 -0600) 3 commits
 . Added diff hunk coloring to git-add--interactive
 . Let git-add--interactive read colors from .gitconfig
 . Added basic color support to git add --interactive

There were many good suggestions by Jeff to the updated series;
hopefully we can have replacements of these three that incorporate
Jeff's suggestions, and build on the "git-config --get-color" series.

* jc/diff-pathspec (Sun Nov 25 10:03:48 2007 -0800) 1 commit
 - Making ce_path_match() more useful by accepting globs

This was to allow "git diff-files -- '*.h'" (currently diff family
knows only the leading directory match and not fileglobs), but was shot
down by Alex.  I tend to agree with him.

* jc/pathspec (Thu Sep 13 13:38:19 2007 -0700) 3 commits
 . pathspec_can_match(): move it from builtin-ls-tree.c to tree.c
 . ls-tree.c: refactor show_recursive() and rename it.
 . tree-diff.c: split out a function to match a single pattern.

* jc/nu (Sun Oct 14 22:07:34 2007 -0700) 3 commits
 . merge-nu: a new merge backend without using unpack_trees()
 . read_tree: take an explicit index structure
 . gcc 4.2.1 -Werror -Wall -ansi -pedantic -std=c99: minimum fix

* jc/cherry-pick (Tue Nov 13 12:38:51 2007 -0800) 1 commit
 . revert/cherry-pick: start refactoring call to merge_recursive

^ permalink raw reply

* Re: [PATCH] Documentation: add a new man page for "git-help" and -i|--info option.
From: Junio C Hamano @ 2007-12-04  8:43 UTC (permalink / raw)
  To: Christian Couder; +Cc: git
In-Reply-To: <20071204064429.1b5007b2.chriscool@tuxfamily.org>

Christian Couder <chriscool@tuxfamily.org> writes:

> Option -i|--info for "git-help" is documented only in the new
> "git-help.txt" man page, but this new man page is referenced
> from the "--help" option documentation in the "git.txt" man page.
>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>

I like the addition of git-help manpage, but this ties the new manual
page to inclusion of your "git help -i" series.

For now, I'd strip the description of -i and apply the remainder.  Let's
cook -i / -w / -x enhancement idea a bit more on the list before going
ahead with it.

^ permalink raw reply

* Re: Fix UTF Encoding issue
From: Ismail Dönmez @ 2007-12-04  8:33 UTC (permalink / raw)
  To: Martin Koegler
  Cc: Jakub Narebski, Junio C Hamano, Alexandre Julliard,
	Benjamin Close, git, Perl Unicode Mailing List, Dan Kogai
In-Reply-To: <200712041028.59185.ismail@pardus.org.tr>

Tuesday 04 December 2007 10:28:59 Ismail Dönmez yazmıştı:
> Tuesday 04 December 2007 10:16:34 Martin Koegler yazmıştı:
> [...]
>
> > print t("#öäü");
> > print t("#ÀöÌ");
> > print "\n";
>
> How about this one, doesn't even use Encode, uses just built-in utf8
> function :
>
> [~]> cat test.pl
> binmode STDOUT, ':utf8';
>
> my $str = "#öäü";
>
> if (utf8::valid($str))
> {
>     utf8::decode($str);
> }
>
> print $str."\n";
>
> [~]> perl test.pl
> #öäü

Following to_utf8 function works for me :

sub to_utf8 {
·   my $str = shift;

    if(utf8::valid($str))
    {
        utf8::decode($str);
    }
·
    return $str;
}

Regards,
ismail

-- 
Never learn by your mistakes, if you do you may never dare to try again.

^ permalink raw reply

* Re: git-svn: .git/svn disk usage
From: Karl Hasselström @ 2007-12-04  8:29 UTC (permalink / raw)
  To: Ollie Wild; +Cc: Pascal Obry, git
In-Reply-To: <65dd6fd50712030935p242895fvc2e4576448868403@mail.gmail.com>

On 2007-12-03 09:35:22 -0800, Ollie Wild wrote:

> I'm seeing the following breakdown:
>
> 4.3G index
> 77M  unhandled.log
> 5.5G .rev_db.138bc75d-0d04-0410-961f-82ee72b054a4
>
> What exactly are the index and .rev_db files used for?

The indexes are just normal git index files, one for each branch and
tag. They're used to speed up importing new commits to the branch or
tag.

My guess is that the performance impact of deleting them between
git-svn runs would be very small, since recreating an index is cheap,
and we'd still get the speed benefit when importing several revisions
to a branch in the same run. And it'd be a very small code change too,
I think.

If nothing else, it's insane to keep the index for the tags. :-)

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply

* Re: Fix UTF Encoding issue
From: Ismail Dönmez @ 2007-12-04  8:28 UTC (permalink / raw)
  To: Martin Koegler
  Cc: Jakub Narebski, Junio C Hamano, Alexandre Julliard,
	Benjamin Close, git, Perl Unicode Mailing List, Dan Kogai
In-Reply-To: <20071204081634.GD31042@auto.tuwien.ac.at>

Tuesday 04 December 2007 10:16:34 Martin Koegler yazmıştı:
[...]
> print t("#öäü");
> print t("#ÀöÌ");
> print "\n";

How about this one, doesn't even use Encode, uses just built-in utf8 
function :

[~]> cat test.pl
binmode STDOUT, ':utf8';

my $str = "#öäü";

if (utf8::valid($str))
{
    utf8::decode($str);
}

print $str."\n";

[~]> perl test.pl
#öäü

Regards,
ismail

-- 
Never learn by your mistakes, if you do you may never dare to try again.

^ permalink raw reply

* Re: Fix UTF Encoding issue
From: Martin Koegler @ 2007-12-04  8:20 UTC (permalink / raw)
  To: Ismail Dönmez
  Cc: Benjamin Close, Jakub Narebski, Junio C Hamano,
	Alexandre Julliard, git, Perl Unicode Mailing List, Dan Kogai
In-Reply-To: <200712041012.50935.ismail@pardus.org.tr>

On Tue, Dec 04, 2007 at 10:12:50AM +0200, Ismail Dönmez wrote:
> I think just a better method is to use (not tested):
> 
> if( is_utf8($str) ) 
> {
> 	return decode_utf8($str);
> }
> else {
> 	return decode($str);
> }

I already tried this function. It does not test, if a string is
really UTF-8. It seems to be to intended to check, if perl stores
the string internally in a multi byte encoding.

mfg Martin Kögler.

^ permalink raw reply

* Re: Fix UTF Encoding issue
From: Martin Koegler @ 2007-12-04  8:16 UTC (permalink / raw)
  To: Ismail Dönmez
  Cc: Jakub Narebski, Junio C Hamano, Alexandre Julliard,
	Benjamin Close, git, Perl Unicode Mailing List, Dan Kogai
In-Reply-To: <200712040955.04655.ismail@pardus.org.tr>

On Tue, Dec 04, 2007 at 09:55:04AM +0200, Ismail Dönmez wrote:
> Tuesday 04 December 2007 Tarihinde 09:50:28 yazm????t??:
> > The bug affects old versions of perl (Debian sarge = oldstable).
> > As it works on the newer Debian etch, do you really think, that it is
> > a good idea to report issue?
> 
> Same problem here with v5.8.8 which is latest stable perl5 release.

I have put together a small perl script, which tests the various ways
of decoding, which have been posted on the list. The first test is
wrong by design. A working decoding method should result in
"#öäü#äöü".

Debian sarge:
#öäü#ÀöÌ
##äöü
##äöü
##äöü

Debian etch, OpenSuSE 10.2, Fedora 7:
#öäü#ÀöÌ
#öäü#äöü
#öäü#äöü
#öäü#äöü

mfg Martin Kögler

#!/usr/bin/perl
use Encode;

sub t {
my $str = shift;
my ($res);
eval { return ($res = decode_utf8($str, Encode::FB_CROAK)); };
return decode("latin1", $str, Encode::FB_DEFAULT);
}
sub t1 {
my $str = shift;
my ($res);
eval { ($res = decode_utf8($str, Encode::FB_CROAK)); };
if ($@) {
return decode("latin1", $str, Encode::FB_DEFAULT); }
else
{ return $res; }
}

sub t2 {
my $str = shift;
my ($res);

eval { $res = decode_utf8($str, Encode::FB_CROAK); };
 if (defined $res) {
        return $res;
} else {
        return decode("latin1", $str, Encode::FB_DEFAULT);
}
}

sub t3 {
	my $str = shift;
	my $res;
	eval { $res = decode_utf8 ($str, 1); };
	return $res || decode('latin1', $str);
}

print t("#öäü");
print t("#ÀöÌ");
print "\n";
print t1("#öäü");
print t1("#ÀöÌ");
print "\n";
print t2("#öäü");
print t2("#ÀöÌ");
print "\n";
print t3("#öäü");
print t3("#ÀöÌ");
print "\n";

^ permalink raw reply

* Re: Fix UTF Encoding issue
From: Ismail Dönmez @ 2007-12-04  8:12 UTC (permalink / raw)
  To: Martin Koegler
  Cc: Benjamin Close, Jakub Narebski, Junio C Hamano,
	Alexandre Julliard, git, Perl Unicode Mailing List, Dan Kogai
In-Reply-To: <20071204080407.GC31042@auto.tuwien.ac.at>

Tuesday 04 December 2007 10:04:07 Martin Koegler yazmıştı:
> On Tue, Dec 04, 2007 at 08:16:24AM +1030, Benjamin Close wrote:
> > Jakub Narebski wrote:
> > >On Mon, 3 Dec 2007, Martin Koegler wrote:
> > >>On Mon, Dec 03, 2007 at 04:06:48AM -0800, Jakub Narebski wrote:
> > >>>Ismail Dönmez <ismail@pardus.org.tr> writes:
> > >>>>Monday 03 December 2007 Tarihinde 12:14:43 yazm??t?:
> > >>>>>Benjamin Close <Benjamin.Close@clearchain.com> writes:
> > >>>>>>-	eval { $res = decode_utf8($str, Encode::FB_CROAK); };
> > >>>>>>-	if (defined $res) {
> > >>>>>>-		return $res;
> > >>>>>>-	} else {
> > >>>>>>-		return decode($fallback_encoding, $str,
> > >>>>>>Encode::FB_DEFAULT);
> > >>>>>>-	}
> > >>>>>>+	eval { return ($res = decode_utf8($str, Encode::FB_CROAK));
> > >>>>>>};
> > >>>>>>+	return decode($fallback_encoding, $str, Encode::FB_DEFAULT);
> > >>>>>> }
> > >>
> > >>This version is broken on Debian sarge and etch. Feeding a UTF-8 and a
> > >>latin1
> > >>encoding of the same character sequence yields to different results.
> >
> > For the record, this was on a debian sid machine.
> >
> > #perl --version
> > This is perl, v5.8.8 built for x86_64-linux-gnu-thread-multi
> >
> > and the result of not using the original patch was:
> >
> > <h1>Software error:</h1>
> > <pre>Cannot decode string with wide characters at
> > /usr/lib/perl/5.8/Encode.pm line 166.
> > </pre>
> >
> >
> > I haven't tried the other solutions tested here.
>
> Debian etch also has v5.8.8.
>
> My main question is, why is the error not catched?
>
> I'm not a perl programmer, but in your patch the first line is a
> NOP. The return in eval seems to only returns from the eval block, so
> any text is decoded as latin1 with the second statement.
>
> In the original version, decode($fallback_encoding, $str,
> Encode::FB_DEFAULT) can not emit an error, else it would in your
> version too.
>
> In your version, eval is able to surpress the error of
> decode_utf8($str, Encode::FB_CROAK);, but not in the original version.

I think just a better method is to use (not tested):

if( is_utf8($str) ) 
{
	return decode_utf8($str);
}
else {
	return decode($str);
}

Regards,
ismail

-- 
Never learn by your mistakes, if you do you may never dare to try again.

^ permalink raw reply

* Re: Fix UTF Encoding issue
From: Martin Koegler @ 2007-12-04  8:04 UTC (permalink / raw)
  To: Benjamin Close
  Cc: Jakub Narebski, Ismail Dönmez, Junio C Hamano,
	Alexandre Julliard, git, Perl Unicode Mailing List, Dan Kogai
In-Reply-To: <47547930.5070603@clearchain.com>

On Tue, Dec 04, 2007 at 08:16:24AM +1030, Benjamin Close wrote:
> Jakub Narebski wrote:
> >On Mon, 3 Dec 2007, Martin Koegler wrote:
> >>On Mon, Dec 03, 2007 at 04:06:48AM -0800, Jakub Narebski wrote:
> >>>Ismail Dönmez <ismail@pardus.org.tr> writes:
> >>>>Monday 03 December 2007 Tarihinde 12:14:43 yazm??t?:
> >>>>>Benjamin Close <Benjamin.Close@clearchain.com> writes:
> >>>>>>-	eval { $res = decode_utf8($str, Encode::FB_CROAK); };
> >>>>>>-	if (defined $res) {
> >>>>>>-		return $res;
> >>>>>>-	} else {
> >>>>>>-		return decode($fallback_encoding, $str, 
> >>>>>>Encode::FB_DEFAULT);
> >>>>>>-	}
> >>>>>>+	eval { return ($res = decode_utf8($str, Encode::FB_CROAK)); 
> >>>>>>};
> >>>>>>+	return decode($fallback_encoding, $str, Encode::FB_DEFAULT);
> >>>>>> }
> >>>>>>            
> >>This version is broken on Debian sarge and etch. Feeding a UTF-8 and a 
> >>latin1
> >>encoding of the same character sequence yields to different results.
>
> For the record, this was on a debian sid machine.
> 
> #perl --version
> This is perl, v5.8.8 built for x86_64-linux-gnu-thread-multi
> 
> and the result of not using the original patch was:
> 
> <h1>Software error:</h1>
> <pre>Cannot decode string with wide characters at 
> /usr/lib/perl/5.8/Encode.pm line 166.
> </pre>
> 
> 
> I haven't tried the other solutions tested here.

Debian etch also has v5.8.8.

My main question is, why is the error not catched?

I'm not a perl programmer, but in your patch the first line is a
NOP. The return in eval seems to only returns from the eval block, so
any text is decoded as latin1 with the second statement.

In the original version, decode($fallback_encoding, $str,
Encode::FB_DEFAULT) can not emit an error, else it would in your
version too. 

In your version, eval is able to surpress the error of
decode_utf8($str, Encode::FB_CROAK);, but not in the original version.

Strange.

mfg Martin Kögler

^ permalink raw reply

* Re: Fix UTF Encoding issue
From: Ismail Dönmez @ 2007-12-04  7:55 UTC (permalink / raw)
  To: Martin Koegler
  Cc: Jakub Narebski, Junio C Hamano, Alexandre Julliard,
	Benjamin Close, git, Perl Unicode Mailing List, Dan Kogai
In-Reply-To: <20071204075028.GB31042@auto.tuwien.ac.at>

Tuesday 04 December 2007 Tarihinde 09:50:28 yazmıştı:
> The bug affects old versions of perl (Debian sarge = oldstable).
> As it works on the newer Debian etch, do you really think, that it is
> a good idea to report issue?

Same problem here with v5.8.8 which is latest stable perl5 release.

Regards,
ismail

-- 
Never learn by your mistakes, if you do you may never dare to try again.

^ permalink raw reply

* Re: Fix UTF Encoding issue
From: Martin Koegler @ 2007-12-04  7:50 UTC (permalink / raw)
  To: Jakub Narebski
  Cc: Ismail Dönmez, Junio C Hamano, Alexandre Julliard,
	Benjamin Close, git, Perl Unicode Mailing List, Dan Kogai
In-Reply-To: <200712031802.55514.jnareb@gmail.com>

On Mon, Dec 03, 2007 at 06:02:54PM +0100, Jakub Narebski wrote:
> On Mon, 3 Dec 2007, Martin Koegler wrote:
> > eval { $res = decode_utf8(...); }
> > if ($@) 
> >      return decode(...);
> > return $res
> > 
> > or
> > 
> > eval { $res = decode_utf8(...); }
> > if (defined $res)
> >       return $res;
> > else
> >     return decode(...);
> > 
> > show the same (wrong) behaviour on Debian sarge. They do not always
> > decode non UTF-8 characters correctly, eg.
> > #öäü does not work
> > #äöüä does work
> > 
> > On Debian etch, both versions are working.
> 
> I don't know enough Perl to decide if it is a bug in gitweb usage
> of decode_utf8, if it is a bug in your version of Encode, or if it
> is bug in Encode.
> 
> Send copy of this mail to maintainers of Encode perl module.

The bug affects old versions of perl (Debian sarge = oldstable).
As it works on the newer Debian etch, do you really think, that it is
a good idea to report issue? 

How would you handle a bug report, which reports a bug for gitweb in GIT
1.4, and tells you, that a newer versions works?

As Debian sarge has reached its end of life, the distribution will
probable also issue no update.

mfg Martin Kögler

^ permalink raw reply

* Re: [BUG] Pulling tags no longer works in 1.5.3.4...
From: Junio C Hamano @ 2007-12-04  7:41 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Git Mailing List
In-Reply-To: <4754B4AF.8070408@garzik.org>

Jeff Garzik <jeff@garzik.org> writes:

> 	git pull ../linux-2.6
> 	git pull --tags ../linux-2.6

This is tricky, and in order to decide the right course of action, we
need to understand some background.

"git pull" is defined as "fetch the history missing at this end from the
remote, and integrate the remote change to the current branch".

    Side note. Historically, "integrate ... to the current branch" was
    defined as "merge", so I would have phrased the above as "pull is
    fetch followed by merge", but I am being a bit careful here.
    Upcoming 1.5.4 will optionally allow you to rebase on top of what
    was fetched instead of merging.

Now, your second "git pull --tags" is about fetching the tags but what
is it integrating?  Nothing.  What you wanted to would have been
expressed much better with "git fetch --tags".

    Side note.  My conclusion at the end would NOT be "so your usage is
    wrong, do not complain", so swallow the "I do not care.  This has
    always worked!" for a while and read on.

    Side note.  For a long time, the first "git pull" from a repository
    you track with tracking branches followed the tags automatically,
    and there shouldn't be any reason to do a separate "fetch --tags"
    these days.

Now, what is integrated by "integration of remote change into the
current branch" step has long been defined as "merge refspec explicitly
given from the command line (if exists), otherwise use the first Pull:
line in .git/remotes/ file or corresponding remote.*.fetch line in
.git/config", no matter which branch you are on.  This traditional
definition was fine as long as the puller stayed on the primary
integration branch.

Then people started using multiple branches in a single repository a lot
more than before.  Running "git pull" when you are on a branch that is
not your primary integration branch still merged the default branch you
get from the remote into your current branch.  This behaviour was
unpopular.  Users, especially with ones with shared repository workflow,
wanted to have branches A and B at the remote to correspond to their
local branches A and B, and wanted to merge A from the remote when they
issued "git pull" while on branch A and remote B while on branch B.

This was made possible by allowing branch.*.merge configuration variable
set for each branch to specify what remote branch to merge in during
git-pull.  Everybody was happier.  But the default stayed the same to
help old timers (like us).  Without such a configuration, "first refspec
configured" rule still apply.

Now, some users ran "git pull" without configuring branch.*.merge and
got the default (typically, "master") remote branch merged into the
branch they happened to have checked out.  Again this was unpopular.

So there was an additional safety devised, early December 2006.  If
branch.*.merge is not configured, "git-pull" may not find any remote
branch to merge to the current branch without being told explicitly from
the command line (i.e. "git pull $there master").  For such a case, the
help message you saw is issued, instead of silently failing, to instruct
the user about the configuration variable.  This message, from the point
of view of users who complained about the unpopular behaviour described
above, was a bugfix.  The earlier behaviour of not issuing any help
message when you did "git pull --tags" was a bug.

Now with that long background story in mind...

Still, it does not make sense to "integrate the changes reachable from
the tags to my current branch" at all.  While we could argue that use of
"git pull --tags" is a nonsense to begin with, we can also argue that
the command line is saying "I am not interested in integrating anything
I got from the remote with this fetch" explicitly from the command line.

We could just honor that and be silent in such a case, instead of giving
the message you saw.

We could do something like the following patch, but it does feel like a
special hack to keep "traditional misuse" working, doesn't it?

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

diff --git a/git-pull.sh b/git-pull.sh
index 74bfc16..00f73d1 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -97,6 +97,13 @@ case "$merge_head" in
 	esac
 	curr_branch=${curr_branch#refs/heads/}
 
+	nontag=$(sed -e '/	not-for-merge	tag/d' "$GIT_DIR/FETCH_HEAD")
+	case "$nontag" in
+	'')
+		exit 0 ;# git pull --tags
+		;;
+	esac
+
 	echo >&2 "You asked me to pull without telling me which branch you"
 	echo >&2 "want to merge with, and 'branch.${curr_branch}.merge' in"
 	echo >&2 "your configuration file does not tell me either.  Please"

^ permalink raw reply related

* [PATCH] Rewrite builtin-fetch option parsing to use parse_options().
From: Kristian Høgsberg @ 2007-12-04  7:25 UTC (permalink / raw)
  To: gitster; +Cc: git, Kristian Høgsberg
In-Reply-To: <1196753147-20073-1-git-send-email-krh@redhat.com>

This gets a little tricky because of the way --tags and --no-tags
are handled, and the "tag <name>" syntax needs a little hand-holding too.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
---
 builtin-fetch.c |  123 ++++++++++++++++++++----------------------------------
 1 files changed, 46 insertions(+), 77 deletions(-)

diff --git a/builtin-fetch.c b/builtin-fetch.c
index f6d16fe..320e235 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -9,14 +9,45 @@
 #include "remote.h"
 #include "transport.h"
 #include "run-command.h"
+#include "parse-options.h"
 
-static const char fetch_usage[] = "git-fetch [-a | --append] [--upload-pack <upload-pack>] [-f | --force] [--no-tags] [-t | --tags] [-k | --keep] [-u | --update-head-ok] [--depth <depth>] [-v | --verbose] [<repository> <refspec>...]";
+static const char * const builtin_fetch_usage[] = {
+	"git-fetch [options] [<repository> <refspec>...]",
+	NULL
+};
 
-static int append, force, tags, no_tags, update_head_ok, verbose, quiet;
+enum {
+	TAGS_UNSET = 0,
+	TAGS_DEFAULT = 1,
+	TAGS_SET = 2
+};
+
+static int append, force, keep, update_head_ok, verbose, quiet;
+static int tags = TAGS_DEFAULT;
 static const char *depth;
+static const char *upload_pack;
 static struct strbuf default_rla = STRBUF_INIT;
 static struct transport *transport;
 
+static struct option builtin_fetch_options[] = {
+	OPT__QUIET(&quiet),
+	OPT__VERBOSE(&verbose),
+	OPT_BOOLEAN('a', "append", &append,
+		    "append to .git/FETCH_HEAD instead of overwriting"),
+	OPT_STRING(0, "upload-pack", &upload_pack, "PATH",
+		   "path to upload pack on remote end"),
+	OPT_BOOLEAN('f', "force", &force,
+		    "force overwrite of local branch"),
+	OPT_SET_INT('t', "tags", &tags,
+		    "fetch all tags and associated objects", TAGS_SET),
+	OPT_BOOLEAN('k', "keep", &keep, "keep downloaded pack"),
+	OPT_BOOLEAN('u', "update-head-ok", &update_head_ok,
+		    "allow updating of HEAD ref"),
+	OPT_STRING(0, "depth", &depth, "DEPTH",
+		   "deepen history of shallow clone"),
+	OPT_END()
+};
+
 static void unlock_pack(void)
 {
 	if (transport)
@@ -81,7 +112,7 @@ static struct ref *get_ref_map(struct transport *transport,
 
 	const struct ref *remote_refs = transport_get_remote_refs(transport);
 
-	if (ref_count || tags) {
+	if (ref_count || tags == TAGS_SET) {
 		for (i = 0; i < ref_count; i++) {
 			get_fetch_map(remote_refs, &refs[i], &tail, 0);
 			if (refs[i].dst && refs[i].dst[0])
@@ -90,7 +121,7 @@ static struct ref *get_ref_map(struct transport *transport,
 		/* Merge everything on the command line, but not --tags */
 		for (rm = ref_map; rm; rm = rm->next)
 			rm->merge = 1;
-		if (tags) {
+		if (tags == TAGS_SET) {
 			struct refspec refspec;
 			refspec.src = "refs/tags/";
 			refspec.dst = "refs/tags/";
@@ -482,10 +513,10 @@ static int do_fetch(struct transport *transport,
 	struct ref *ref_map, *fetch_map;
 	struct ref *rm;
 	int autotags = (transport->remote->fetch_tags == 1);
-	if (transport->remote->fetch_tags == 2 && !no_tags)
-		tags = 1;
+	if (transport->remote->fetch_tags == 2 && tags != TAGS_UNSET)
+		tags = TAGS_SET;
 	if (transport->remote->fetch_tags == -1)
-		no_tags = 1;
+		tags = TAGS_UNSET;
 
 	if (!transport->get_refs_list || !transport->fetch)
 		die("Don't know how to fetch from %s", transport->url);
@@ -515,7 +546,7 @@ static int do_fetch(struct transport *transport,
 
 	/* if neither --no-tags nor --tags was specified, do automated tag
 	 * following ... */
-	if (!(tags || no_tags) && autotags) {
+	if (tags == TAGS_DEFAULT && autotags) {
 		ref_map = find_non_local_tags(transport, fetch_map);
 		if (ref_map) {
 			transport_set_option(transport, TRANS_OPT_DEPTH, "0");
@@ -546,80 +577,19 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 	int i;
 	static const char **refs = NULL;
 	int ref_nr = 0;
-	const char *upload_pack = NULL;
-	int keep = 0;
 
 	/* Record the command line for the reflog */
 	strbuf_addstr(&default_rla, "fetch");
 	for (i = 1; i < argc; i++)
 		strbuf_addf(&default_rla, " %s", argv[i]);
 
-	for (i = 1; i < argc; i++) {
-		const char *arg = argv[i];
-
-		if (arg[0] != '-')
-			break;
-		if (!strcmp(arg, "--append") || !strcmp(arg, "-a")) {
-			append = 1;
-			continue;
-		}
-		if (!prefixcmp(arg, "--upload-pack=")) {
-			upload_pack = arg + 14;
-			continue;
-		}
-		if (!strcmp(arg, "--upload-pack")) {
-			i++;
-			if (i == argc)
-				usage(fetch_usage);
-			upload_pack = argv[i];
-			continue;
-		}
-		if (!strcmp(arg, "--force") || !strcmp(arg, "-f")) {
-			force = 1;
-			continue;
-		}
-		if (!strcmp(arg, "--no-tags")) {
-			no_tags = 1;
-			continue;
-		}
-		if (!strcmp(arg, "--tags") || !strcmp(arg, "-t")) {
-			tags = 1;
-			continue;
-		}
-		if (!strcmp(arg, "--keep") || !strcmp(arg, "-k")) {
-			keep = 1;
-			continue;
-		}
-		if (!strcmp(arg, "--update-head-ok") || !strcmp(arg, "-u")) {
-			update_head_ok = 1;
-			continue;
-		}
-		if (!prefixcmp(arg, "--depth=")) {
-			depth = arg + 8;
-			continue;
-		}
-		if (!strcmp(arg, "--depth")) {
-			i++;
-			if (i == argc)
-				usage(fetch_usage);
-			depth = argv[i];
-			continue;
-		}
-		if (!strcmp(arg, "--quiet") || !strcmp(arg, "-q")) {
-			quiet = 1;
-			continue;
-		}
-		if (!strcmp(arg, "--verbose") || !strcmp(arg, "-v")) {
-			verbose++;
-			continue;
-		}
-		usage(fetch_usage);
-	}
+	argc = parse_options(argc, argv,
+			     builtin_fetch_options, builtin_fetch_usage, 0);
 
-	if (i == argc)
+	if (argc == 0)
 		remote = remote_get(NULL);
 	else
-		remote = remote_get(argv[i++]);
+		remote = remote_get(argv[0]);
 
 	transport = transport_get(remote, remote->url[0]);
 	if (verbose >= 2)
@@ -636,10 +606,10 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 	if (!transport->url)
 		die("Where do you want to fetch from today?");
 
-	if (i < argc) {
+	if (argc > 1) {
 		int j = 0;
-		refs = xcalloc(argc - i + 1, sizeof(const char *));
-		while (i < argc) {
+		refs = xcalloc(argc + 1, sizeof(const char *));
+		for (i = 1; i < argc; i++) {
 			if (!strcmp(argv[i], "tag")) {
 				char *ref;
 				i++;
@@ -651,7 +621,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 				refs[j++] = ref;
 			} else
 				refs[j++] = argv[i];
-			i++;
 		}
 		refs[j] = NULL;
 		ref_nr = j;
-- 
1.5.3.4

^ permalink raw reply related

* [PATCH] Use a strbuf for copying the command line for the reflog.
From: Kristian Høgsberg @ 2007-12-04  7:25 UTC (permalink / raw)
  To: gitster; +Cc: git, Kristian Høgsberg

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
---
 builtin-fetch.c |   24 ++++++++----------------
 1 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/builtin-fetch.c b/builtin-fetch.c
index de9947e..f6d16fe 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -14,7 +14,7 @@ static const char fetch_usage[] = "git-fetch [-a | --append] [--upload-pack <upl
 
 static int append, force, tags, no_tags, update_head_ok, verbose, quiet;
 static const char *depth;
-static char *default_rla = NULL;
+static struct strbuf default_rla = STRBUF_INIT;
 static struct transport *transport;
 
 static void unlock_pack(void)
@@ -142,7 +142,7 @@ static int s_update_ref(const char *action,
 	static struct ref_lock *lock;
 
 	if (!rla)
-		rla = default_rla;
+		rla = default_rla.buf;
 	snprintf(msg, sizeof(msg), "%s: %s", rla, action);
 	lock = lock_any_ref_for_update(ref->name,
 				       check_old ? ref->old_sha1 : NULL, 0);
@@ -543,16 +543,19 @@ static void set_option(const char *name, const char *value)
 int cmd_fetch(int argc, const char **argv, const char *prefix)
 {
 	struct remote *remote;
-	int i, j, rla_offset;
+	int i;
 	static const char **refs = NULL;
 	int ref_nr = 0;
-	int cmd_len = 0;
 	const char *upload_pack = NULL;
 	int keep = 0;
 
+	/* Record the command line for the reflog */
+	strbuf_addstr(&default_rla, "fetch");
+	for (i = 1; i < argc; i++)
+		strbuf_addf(&default_rla, " %s", argv[i]);
+
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
-		cmd_len += strlen(arg);
 
 		if (arg[0] != '-')
 			break;
@@ -613,17 +616,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 		usage(fetch_usage);
 	}
 
-	for (j = i; j < argc; j++)
-		cmd_len += strlen(argv[j]);
-
-	default_rla = xmalloc(cmd_len + 5 + argc + 1);
-	sprintf(default_rla, "fetch");
-	rla_offset = strlen(default_rla);
-	for (j = 1; j < argc; j++) {
-		sprintf(default_rla + rla_offset, " %s", argv[j]);
-		rla_offset += strlen(argv[j]) + 1;
-	}
-
 	if (i == argc)
 		remote = remote_get(NULL);
 	else
-- 
1.5.3.4

^ 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