Git development
 help / color / mirror / Atom feed
* Re: [PATCH 1/4] engine.pl: Fix a recent breakage of the buildsystem generator
From: Ramsay Jones @ 2010-01-22 19:40 UTC (permalink / raw)
  To: Sebastian Schuberth; +Cc: Junio C Hamano, Johannes Sixt, GIT Mailing-list
In-Reply-To: <4B5789AD.2080807@gmail.com>

Sebastian Schuberth wrote:
> On 20.01.2010 20:23, Ramsay Jones wrote:
> 
>  > '-o' or connective. This resulted in the buildsystem generator
>  > mistaking the conditional 'rm' for a linker command. In order
> 
> Thanks for spotting the cause of this! Some comments:
> 
> 1. How about deleting lines 183-185 in same run? That commented out 
> code, too, is missing the escapes for the pipes that Pete mentioned anyway.
> 
> -#        } elsif ($text =~ /^test / && $text =~ /|| rm -f /) {
> -#            # commands removing executables, if they exist
> -#

OK, will do.

> 
> 2. Couldn't we reduce the test to just
> 
> +        if ($text =~ /^test /) {
> +            # options to test may be mistaken for linker options
> +            next;
> +        }
> +

Yes, good idea.  I will send a new version of the patch soon.

Thanks!

ATB,
Ramsay Jones

^ permalink raw reply

* [PATCH v2 1/4] engine.pl: Fix a recent breakage of the buildsystem generator
From: Ramsay Jones @ 2010-01-22 20:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Sixt, sschuberth, GIT Mailing-list, pgit


Commit ade2ca0c (Do not try to remove directories when removing
old links, 27-10-2009) added an expression to a 'test' using an
'-o' or connective. This resulted in the buildsystem generator
mistaking a conditional 'rm' for a linker command. In order to
fix the breakage, we filter out all 'test' commands before then
attempting to identify the commands of interest.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

Changes from v1, in response to comments from Pete Harlan and
Sebastian Schuberth:

    - remove second (useless) regex from condition in filter code
    - remove the commented out version of the original filter code
    - re-worded commit message to reflect the above changes

ATB,
Ramsay Jones

 contrib/buildsystems/engine.pl |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/contrib/buildsystems/engine.pl b/contrib/buildsystems/engine.pl
index d506717..8f890fb 100644
--- a/contrib/buildsystems/engine.pl
+++ b/contrib/buildsystems/engine.pl
@@ -135,6 +135,11 @@ sub parseMakeOutput
             }
         } while($ate_next);
 
+        if ($text =~ /^test /) {
+            # options to test (eg -o) may be mistaken for linker options
+            next;
+        }
+
         if($text =~ / -c /) {
             # compilation
             handleCompileLine($text, $line);
@@ -180,9 +185,6 @@ sub parseMakeOutput
 #        } elsif ($text =~ /generate-cmdlist\.sh/) {
 #            # command for generating list of commands
 #
-#        } elsif ($text =~ /^test / && $text =~ /|| rm -f /) {
-#            # commands removing executables, if they exist
-#
 #        } elsif ($text =~ /new locations or Tcl/) {
 #            # command for detecting Tcl/Tk changes
 #
-- 
1.6.6

^ permalink raw reply related

* Re: [PATCH 4/4] msvc: Add a definition of NORETURN compatible with msvc compiler
From: Ramsay Jones @ 2010-01-22 19:35 UTC (permalink / raw)
  To: kusmabite; +Cc: Junio C Hamano, Johannes Sixt, GIT Mailing-list
In-Reply-To: <40aa078e1001201345p1cf9dfbbm651f1ba7244a340f@mail.gmail.com>

Erik Faye-Lund wrote:
> On Wed, Jan 20, 2010 at 8:45 PM, Ramsay Jones
> <ramsay@ramsay1.demon.co.uk> wrote:
>> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
>> ---
>>
>> I thought that Erik had already submitted this patch along with
>> those that resulted in commits a4f3131c and 18660bc9. However, I
>> don't seem to be able to find it anywhere! (maybe I only imagined
>> it).
>>
>> If you find Erik's patch, please apply that instead...
> 
> I don't think I ever sent one - I haven't bothered to set up msvc for
> git compilation, so I only did the preparation (and I think I sent a
> comment about how it could be done).

Ah, so maybe it's this comment that I (mis-)remembered then! (yeah, my
memory is not what it used to be ;-)). Thanks for doing the preparation
work!

ATB,
Ramsay Jones

^ permalink raw reply

* Re: [PATCH 0/4] misc. msvc patches
From: Ramsay Jones @ 2010-01-22 19:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Sixt, GIT Mailing-list
In-Reply-To: <7vmy081okq.fsf@alter.siamese.dyndns.org>

Junio C Hamano wrote:
> I only looked at regex/regex.c and it really is a real bugfix as the
> structure fields are of pointer type ;-).

Hmmm, well ... I would call it a typo fixup rather than a bugfix, since
(luckily) there is no actual bug here.

The expression on the rhs of the assignment is a valid null pointer
expression; since regoff_t is an alias for int the expression amounts
to '(int) 0', so the cast is a no-op and is equivalent to an "integer
constant with value zero". In C, an "integer constant with value zero
(or any such constant cast to void *)" is a null pointer constant.
(Many people wish it wasn't...)

Having said that, I would be *very* surprised if the original author
had intended to type anything other than '(regoff_t *) 0'. Hence I
suspect this is a typo.

[Hmm, I haven't actually looked at the assembler to check that the
generated object code is correct, but not even msvc could get this
wrong ... :-P ]

ATB,
Ramsay Jones

^ permalink raw reply

* Re: [PATCH 1/4] engine.pl: Fix a recent breakage of the buildsystem generator
From: Ramsay Jones @ 2010-01-22 18:58 UTC (permalink / raw)
  To: Pete Harlan; +Cc: Junio C Hamano, Johannes Sixt, sschuberth, GIT Mailing-list
In-Reply-To: <4B576E38.5080604@pcharlan.com>

Pete Harlan wrote:
> On 01/20/2010 11:23 AM, Ramsay Jones wrote:
>> diff --git a/contrib/buildsystems/engine.pl b/contrib/buildsystems/engine.pl
>> index d506717..245af73 100644
>> --- a/contrib/buildsystems/engine.pl
>> +++ b/contrib/buildsystems/engine.pl
>> @@ -135,6 +135,11 @@ sub parseMakeOutput
>>              }
>>          } while($ate_next);
>>  
>> +        if ($text =~ /^test / && $text =~ /|| rm -f /) {
> 
> That test on the right needs to escape its pipes or it will always match.

Heh, well spotted!
As you may have already noticed, I copy/pasted the code from the comment
further down in this function, but didn't take enough care in doing so...
Oops! ;-)

The obvious solution, also suggested later by Sebastion, is to simply
remove the second regex from the test since it does not alter the
outcome (and still fixes the problem)...

ATB,
Ramsay Jones

^ permalink raw reply

* Re: git-svn question: adding a branch to a local clone of an upstream  git-svn clone
From: Jay Soffian @ 2010-01-22 20:03 UTC (permalink / raw)
  To: git
In-Reply-To: <76718491001221115r56c1f6e4qbf6cecc30ce4af58@mail.gmail.com>

On Fri, Jan 22, 2010 at 2:15 PM, Jay Soffian <jaysoffian@gmail.com> wrote:

> $ git checkout -b 249 bf6f4ed
> ...
> [svn-remote "svn"]
>        url = http://src.chromium.org/svn
>        fetch = branches/249/src:refs/remotes/branches/249

Also tried this:

$ git update-ref refs/remotes/branches/249 bf6f4ed
$ git svn fetch
Done rebuilding
.git/svn/refs/remotes/branches/249/.rev_map.4ff67af0-8c30-449e-8e8b-ad334ec8d88c
Done rebuilding
.git/svn/refs/remotes/branches/249/.rev_map.4ff67af0-8c30-449e-8e8b-ad334ec8d88c
Done rebuilding
.git/svn/refs/remotes/branches/249/.rev_map.4ff67af0-8c30-449e-8e8b-ad334ec8d88c
[... lots of these as it works its way through 30k revisions...]
Found possible branch point: http://src.chromium.org/svn/trunk/src =>
http://src.chromium.org/svn/branches/249/src, 32041
Initializing parent: refs/remotes/branches/249@32041
r3 = c14d891d44f0afff64e56ed7c9702df1d807b1ee (refs/remotes/branches/249@32041)
...

So, no help either. :-(

j.

^ permalink raw reply

* git-svn question: adding a branch to a local clone of an upstream  git-svn clone
From: Jay Soffian @ 2010-01-22 19:15 UTC (permalink / raw)
  To: git

I have a clone of a repo that is itself a git-svn clone:

git://git.chromium.org/chromium.git

So my .git/config has (obviously):

[remote "origin"]
	url = git://git.chromium.org/chromium.git
	fetch = +refs/heads/*:refs/remotes/origin/*

The upstream repo has only trunk. I want to use git-svn to add an
additional branch:

http://src.chromium.org/svn/branches/249/

So I added this to my .git/config:

[svn-remote "svn"]
	url = http://src.chromium.org/svn
	fetch = branches/249/src:refs/remotes/branches/249

I looked up the branch point for 249 and created a new branch:

$ svn log http://src.chromium.org/svn/branches/249
------------------------------------------------------------------------
r32060 | laforge@chromium.org | 2009-11-16 11:34:43 -0500 (Mon, 16 Nov
2009) | 1 line

Branching for 249 @32041
------------------------------------------------------------------------
$ git rev2sha | grep src@32041
bf6f4ed svn://svn.chromium.org/chrome/trunk/src@32041
$ git checkout -b 249 bf6f4ed

And then attempted a git svn fetch. Which wanted to grab the entire
svn history. I then realized that the origin git clone is from a
different upstream URL (to which I don't have access), so I tried
adding rewriteRoot:

[svn-remote "svn"]
	url = http://src.chromium.org/svn
	fetch = branches/249/src:refs/remotes/branches/249
	rewriteRoot = svn://svn.chromium.org/chrome

Same problem. Ah, UUID is also different. Unfortunately, git-svn
doesn't have a "rewriteUUID" config (I'm working on a patch), but I
did try hacking .git/svn/.metadata to look like this:

[svn-remote "svn"]
	reposRoot = http://src.chromium.org/svn
	uuid = 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
	svnsync-uuid = 0039d316-1c4b-4281-b951-d872f2087c98
	svnsync-url = svn://svn.chromium.org/chrome

Then changed my .git/config to:

[svn-remote "svn"]
	url = http://src.chromium.org/svn
	fetch = branches/249/src:refs/remotes/branches/249
	useSvnsyncProps = true

I blew away .git/svn/refs and tried again:

$ git svn fetch
Found possible branch point: http://src.chromium.org/svn/trunk/src =>
http://src.chromium.org/svn/branches/249/src, 32041
Initializing parent: refs/remotes/branches/249@32041
r3 = c14d891d44f0afff64e56ed7c9702df1d807b1ee (refs/remotes/branches/249@32041)

Sadly, git svn is still trying to fetch the entire history.

Hmpfh. Any suggestions? Maybe I should just not worry about trying to
have a connected history locally (I'll never be dcomitting) and just
use git svn fetch -r 32041:HEAD ?

j.

^ permalink raw reply

* Re: From git repository to server
From: Bill Lear @ 2010-01-22 19:01 UTC (permalink / raw)
  To: Timothy Murphy; +Cc: git
In-Reply-To: <201001221837.21862.gayleard@eircom.net>

On Friday, January 22, 2010 at 18:37:21 (+0000) Timothy Murphy writes:
>I want to set up a GIT repository for a project on machine A ("alfred"),
>but I'd like it to be accessible on my web-server B ("helen").
>What is the simplest way to set this up?

You might try gitolite.  Easy to set up, administer, and provides
ssl-based security.w


Bill

^ permalink raw reply

* From git repository to server
From: Timothy Murphy @ 2010-01-22 18:37 UTC (permalink / raw)
  To: git

I want to set up a GIT repository for a project on machine A ("alfred"),
but I'd like it to be accessible on my web-server B ("helen").
What is the simplest way to set this up?

-- 
Timothy Murphy  
e-mail: gayleard /at/ eircom.net
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland

^ permalink raw reply

* Re: [PATCH] git-mv: Fix error with multiple sources.
From: Johannes Sixt @ 2010-01-22 18:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: David Rydh, git
In-Reply-To: <7vr5pi8x6z.fsf@alter.siamese.dyndns.org>

On Freitag, 22. Januar 2010, Junio C Hamano wrote:
> Why does '/' matter in builtin-mv.c that needed b8f2626, but we can
> compare with '/' [in make_relative_path()]?

We should be using is_dir_sep() in make_relative_path() as well (see the fixup 
that I posted in response to your patch). The thing is that the incorrect 
result does not matter from a correctness-POV for the only caller of this 
routine.

-- Hannes

^ permalink raw reply

* Re: [PATCH 3/5] make "git unpack-file" a built-in
From: Linus Torvalds @ 2010-01-22 18:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <7vmy06vwvy.fsf@alter.siamese.dyndns.org>



On Fri, 22 Jan 2010, Junio C Hamano wrote:
> >  {
> >  	unsigned char sha1[20];
> >  
> > -	git_extract_argv0_path(argv[0]);
> > -
> >  	if (argc != 2 || !strcmp(argv[1], "-h"))
> >  		usage("git unpack-file <sha1>");
> >  	if (get_sha1(argv[1], sha1))
> >  		die("Not a valid object name %s", argv[1]);
> >  
> > -	setup_git_directory();
> 
> This will now require "git unpack-file -h" to be run in a git controlled
> directory, so strictly speaking it changes behaviour.
> 
> Not that anybody would care that much, though.

Heh. You didn't notice the same change in the merge-tree conversion that 
you already accepted ;)

Yeah, any usage messages will now run after setup for the commands that do 
the whole RUN_SETUP thing. That's pack-redundant, unpack-file, mktag, 
merge-index and merge-tree. So they'll now report "Not a git repository" 
before they report invalid arguments.

			Linus

^ permalink raw reply

* Re: git-archive ignores export-ignore
From: Todd A. Jacobs @ 2010-01-22 18:07 UTC (permalink / raw)
  To: git
In-Reply-To: <7vocknhs70.fsf@alter.siamese.dyndns.org>

On Thu, Jan 21, 2010 at 04:57:39PM -0800, Junio C Hamano wrote:

> There is something that is different in my failed attempt to reproduce it
> from your problem description, but I cannot tell what it is.
> 
> Do you have some garbage character immediately after "e" in "-ignore"?

No, but it turns out that juniperxml.cfg is actually a symlink in this
repository. I'm not sure that should make a difference, but perhaps
that's the missing element in recreating the problem.

I wouldn't think so, because the reason it's a symlink is because I was
unable to get git-archive to ignore the actual file on export, so I
moved it elsewhere and replaced it with a symlink so that the contents
of the file weren't exported.

Hope that helps!

-- 
"Oh, look: rocks!"
	-- Doctor Who, "Destiny of the Daleks"

^ permalink raw reply

* Re: [PATCH 3/5] make "git unpack-file" a built-in
From: Junio C Hamano @ 2010-01-22 18:04 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.1001220826230.13231@localhost.localdomain>

Linus Torvalds <torvalds@linux-foundation.org> writes:

> From: Linus Torvalds <torvalds@linux-foundation.org>
> Date: Fri, 22 Jan 2010 07:38:03 -0800
>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> ---
> Again.. No surprises.
> ...
> diff --git a/unpack-file.c b/builtin-unpack-file.c
> similarity index 89%
> rename from unpack-file.c
> rename to builtin-unpack-file.c
> index e9d8934..608590a 100644
> --- a/unpack-file.c
> +++ b/builtin-unpack-file.c
> @@ -22,18 +22,15 @@ static char *create_temp_file(unsigned char *sha1)
>  	return path;
>  }
>  
> -int main(int argc, char **argv)
> +int cmd_unpack_file(int argc, const char **argv, const char *prefix)
>  {
>  	unsigned char sha1[20];
>  
> -	git_extract_argv0_path(argv[0]);
> -
>  	if (argc != 2 || !strcmp(argv[1], "-h"))
>  		usage("git unpack-file <sha1>");
>  	if (get_sha1(argv[1], sha1))
>  		die("Not a valid object name %s", argv[1]);
>  
> -	setup_git_directory();

This will now require "git unpack-file -h" to be run in a git controlled
directory, so strictly speaking it changes behaviour.

Not that anybody would care that much, though.

^ permalink raw reply

* Re: [PATCH] git-mv: Fix error with multiple sources.
From: David Rydh @ 2010-01-22 17:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Sixt
In-Reply-To: <7vr5pi8x6z.fsf@alter.siamese.dyndns.org>

On Jan 21, 2010, at 10:34 PM, Junio C Hamano wrote:

> Junio C Hamano <gitster@pobox.com> writes:
> 
>> Given that basename(3) is allowed to modify its parameter, I think the
>> above code is still not portable.  casting constness away and feeding
>> result[i], especially when we didn't obtain our own copy by calling
>> xmemdupz(), is especially problematic.
>> 
>> Perhaps something ugly like this?
>> 
>> 	for (i = 0; i < count; i++) {
>> 		int length = strlen(result[i]);
>> 		int to_copy = length;
>>                while (to_copy > 0 && is_dir_sep(result[i][to_copy - 1]))
>> 			to_copy--;
>> 		if (to_copy != length || basename) {
>>                	char *it = xmemdupz(result[i], to_copy);
>>                        result[i] = base_name ? strdup(basename(it)) : it;
>> 		}
>> 	}

This looks fine. Currently we have the odd behavior

> git mv -n dir/ new-dir
Checking rename of 'dir' to 'new-dir'
Checking rename of 'dir/a.txt' to 'new-dir/a.txt'
Checking rename of 'dir/b.txt' to 'new-dir/b.txt'

> git mv -n dir// new-dir
Checking rename of 'dir/' to 'new-dir'
fatal: source directory is empty, source=dir/, destination=new-dir

Note that at the end of copy_pathspec we call get_pathspec which squashes multiple slashes (even if prefix=NULL) but does not remove a trailing slash so it is necessary to squash them all as above.

^ permalink raw reply

* Re: [PATCH] git-mv: Fix error with multiple sources.
From: David Rydh @ 2010-01-22 16:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Sixt
In-Reply-To: <7vhbqeacjm.fsf@alter.siamese.dyndns.org>


On Jan 21, 2010, at 10:17 PM, Junio C Hamano wrote:

> "David Rydh" <dary@math.berkeley.edu> writes:
> 
>> This commit also fixed two potentially dangerous uses of
>> prefix_filename() -- which returns static storage space -- in
>> builtin-config.c and hash-object.c.
> 
> This should probably be a separate patch.  builtin-hash-object.c also uses
> prefix_filename() first to obtain vpath without strdup() and then uses the
> function to create arg, which seems to be unsafe to me.  I've looked at
> all the hits from 
> 
>    $ git grep -n -e prefix_filename\( -- '*.c'
> 
> and other places seem to be Ok.


Yes, this was how I found these two places. Do you agree that strdup'ing vpath as I did in the patch fixes this flaw? (I assume that builtin-hash-object.c = hash-object.c) I'll split it up into two patches.

^ permalink raw reply

* Re: [PATCH] git-mv: Fix error with multiple sources.
From: David Rydh @ 2010-01-22 16:41 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Sixt
In-Reply-To: <7v8wbqbs26.fsf@alter.siamese.dyndns.org>

On Jan 21, 2010, at 9:57 PM, Junio C Hamano wrote:

>> diff --git a/setup.c b/setup.c
>> index 710e2f3..80cf535 100644
>> --- a/setup.c
>> +++ b/setup.c
>> @@ -132,8 +132,8 @@ const char **get_pathspec(const char *prefix, const char **pathspec)
>> 		return NULL;
>> 
>> 	if (!entry) {
>> -		static const char *spec[2];
>> -		spec[0] = prefix;
>> +		const char **spec = xmalloc(sizeof(char *) * 2);
>> +		spec[0] = xstrdup(prefix);
>> 		spec[1] = NULL;
>> 		return spec;
>> 	}
> 
> I don't understand this change.  Because elements of returned pathspec
> from this function are often simply the pathspec argument itself (which in
> turn is often argv[] of the calling program), and other times allocated by
> this function, the callers are never going to free() them.

The xstrdup of prefix is for good measure. The important change is the removal of the static spec-array. Two invocations of get_pathspec with different prefixes could invalidate the contents of a pathspec in use.

When called with a non-empty pathspec, all the entries are allocated so I think it is reasonable to allocate them in the degenerate case as well. My impression of the git-code is that it is leaking quite a bit when it comes to strings anyway.

^ permalink raw reply

* Re: [PATCH] merge-tree: remove unnecessary call of git_extract_argv0_path
From: Linus Torvalds @ 2010-01-22 16:40 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junio C Hamano, Shawn O. Pearce, git
In-Reply-To: <1264160879-26079-1-git-send-email-j6t@kdbg.org>



On Fri, 22 Jan 2010, Johannes Sixt wrote:
>
> This call should have been removed when the utility was made a builtin by
> 907a7cb.

Ack.

			Linus

^ permalink raw reply

* [PATCHv2] Make difftool.prompt fall back to mergetool.prompt
From: Sebastian Schuberth @ 2010-01-22 16:36 UTC (permalink / raw)
  To: git; +Cc: David Aguilar

The documentation states that "git-difftool falls back to git-mergetool
config variables when the difftool equivalents have not been defined".
Until now, this was not the case for "difftool.prompt".

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
---
 git-difftool--helper.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-difftool--helper.sh b/git-difftool--helper.sh
index 57e8e32..3438aba 100755
--- a/git-difftool--helper.sh
+++ b/git-difftool--helper.sh
@@ -12,7 +12,8 @@ TOOL_MODE=diff
 # difftool.prompt controls the default prompt/no-prompt behavior
 # and is overridden with $GIT_DIFFTOOL*_PROMPT.
 should_prompt () {
-	prompt=$(git config --bool difftool.prompt || echo true)
+	prompt_merge=$(git config --bool mergetool.prompt || echo true)
+	prompt=$(git config --bool difftool.prompt || echo $prompt_merge)
 	if test "$prompt" = true; then
 		test -z "$GIT_DIFFTOOL_NO_PROMPT"
 	else
-- 
1.6.6.265.ga0f40

^ permalink raw reply related

* Re: PATCH 2/5] make "mktag" a built-in
From: Linus Torvalds @ 2010-01-22 16:33 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.1001220825190.13231@localhost.localdomain>


Oops, I screwed up the subject line on this one (obvious missing opening 
brace, since I'm a tool and can't cut-and-paste correctly). So please fix 
that before applying.

		Linus

^ permalink raw reply

* [PATCH 5/5] make "index-pack" a built-in
From: Linus Torvalds @ 2010-01-22 16:31 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.1001220827140.13231@localhost.localdomain>


From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Fri, 22 Jan 2010 07:55:19 -0800

This required some fairly trivial packfile function 'const' cleanup,
since the builtin commands get a const char *argv[] array.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---

I say "fairly trivial", but I have to admit to hating the moron people who 
decided that 'free()' takes a "void *", not a "const void *". So now we 
have three new casts like this

	free((void *)ptr)

just to avoid a compiler warning due to incompetent standards people.

Oh well. I didn't feel it was worth an 'xfree()'.

 Makefile                             |    2 +-
 index-pack.c => builtin-index-pack.c |   16 +++++++---------
 builtin-pack-objects.c               |    5 +++--
 builtin.h                            |    1 +
 git.c                                |    1 +
 pack-write.c                         |    4 ++--
 pack.h                               |    2 +-
 7 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index 33f9870..c0dbee2 100644
--- a/Makefile
+++ b/Makefile
@@ -388,7 +388,6 @@ EXTRA_PROGRAMS =
 PROGRAMS += $(EXTRA_PROGRAMS)
 PROGRAMS += git-fast-import$X
 PROGRAMS += git-imap-send$X
-PROGRAMS += git-index-pack$X
 PROGRAMS += git-shell$X
 PROGRAMS += git-show-index$X
 PROGRAMS += git-upload-pack$X
@@ -653,6 +652,7 @@ BUILTIN_OBJS += builtin-gc.o
 BUILTIN_OBJS += builtin-grep.o
 BUILTIN_OBJS += builtin-hash-object.o
 BUILTIN_OBJS += builtin-help.o
+BUILTIN_OBJS += builtin-index-pack.o
 BUILTIN_OBJS += builtin-init-db.o
 BUILTIN_OBJS += builtin-log.o
 BUILTIN_OBJS += builtin-ls-files.o
diff --git a/index-pack.c b/builtin-index-pack.c
similarity index 98%
rename from index-pack.c
rename to builtin-index-pack.c
index 190f372..b4cf8c5 100644
--- a/index-pack.c
+++ b/builtin-index-pack.c
@@ -166,7 +166,7 @@ static void use(int bytes)
 	consumed_bytes += bytes;
 }
 
-static char *open_pack_file(char *pack_name)
+static const char *open_pack_file(const char *pack_name)
 {
 	if (from_stdin) {
 		input_fd = 0;
@@ -870,18 +870,16 @@ static int git_index_pack_config(const char *k, const char *v, void *cb)
 	return git_default_config(k, v, cb);
 }
 
-int main(int argc, char **argv)
+int cmd_index_pack(int argc, const char **argv, const char *prefix)
 {
 	int i, fix_thin_pack = 0;
-	char *curr_pack, *pack_name = NULL;
-	char *curr_index, *index_name = NULL;
+	const char *curr_pack, *curr_index;
+	const char *index_name = NULL, *pack_name = NULL;
 	const char *keep_name = NULL, *keep_msg = NULL;
 	char *index_name_buf = NULL, *keep_name_buf = NULL;
 	struct pack_idx_entry **idx_objects;
 	unsigned char pack_sha1[20];
 
-	git_extract_argv0_path(argv[0]);
-
 	if (argc == 2 && !strcmp(argv[1], "-h"))
 		usage(index_pack_usage);
 
@@ -906,7 +904,7 @@ int main(int argc, char **argv)
 	}
 
 	for (i = 1; i < argc; i++) {
-		char *arg = argv[i];
+		const char *arg = argv[i];
 
 		if (*arg == '-') {
 			if (!strcmp(arg, "--stdin")) {
@@ -1039,9 +1037,9 @@ int main(int argc, char **argv)
 	free(index_name_buf);
 	free(keep_name_buf);
 	if (pack_name == NULL)
-		free(curr_pack);
+		free((void *) curr_pack);
 	if (index_name == NULL)
-		free(curr_index);
+		free((void *) curr_index);
 
 	return 0;
 }
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 59b07fe..b0887d7 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -525,7 +525,8 @@ static void write_pack_file(void)
 		if (!pack_to_stdout) {
 			mode_t mode = umask(0);
 			struct stat st;
-			char *idx_tmp_name, tmpname[PATH_MAX];
+			const char *idx_tmp_name;
+			char tmpname[PATH_MAX];
 
 			umask(mode);
 			mode = 0444 & ~mode;
@@ -569,7 +570,7 @@ static void write_pack_file(void)
 			if (rename(idx_tmp_name, tmpname))
 				die_errno("unable to rename temporary index file");
 
-			free(idx_tmp_name);
+			free((void *) idx_tmp_name);
 			free(pack_tmp_name);
 			puts(sha1_to_hex(sha1));
 		}
diff --git a/builtin.h b/builtin.h
index bd7f737..e8202f3 100644
--- a/builtin.h
+++ b/builtin.h
@@ -58,6 +58,7 @@ extern int cmd_grep(int argc, const char **argv, const char *prefix);
 extern int cmd_hash_object(int argc, const char **argv, const char *prefix);
 extern int cmd_help(int argc, const char **argv, const char *prefix);
 extern int cmd_http_fetch(int argc, const char **argv, const char *prefix);
+extern int cmd_index_pack(int argc, const char **argv, const char *prefix);
 extern int cmd_init_db(int argc, const char **argv, const char *prefix);
 extern int cmd_log(int argc, const char **argv, const char *prefix);
 extern int cmd_log_reflog(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index 6cc1eba..b3e23f1 100644
--- a/git.c
+++ b/git.c
@@ -320,6 +320,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "grep", cmd_grep, USE_PAGER },
 		{ "hash-object", cmd_hash_object },
 		{ "help", cmd_help },
+		{ "index-pack", cmd_index_pack },
 		{ "init", cmd_init_db },
 		{ "init-db", cmd_init_db },
 		{ "log", cmd_log, RUN_SETUP | USE_PAGER },
diff --git a/pack-write.c b/pack-write.c
index 741efcd..9f47cf9 100644
--- a/pack-write.c
+++ b/pack-write.c
@@ -17,8 +17,8 @@ static int sha1_compare(const void *_a, const void *_b)
  * the SHA1 hash of sorted object names. The objects array passed in
  * will be sorted by SHA1 on exit.
  */
-char *write_idx_file(char *index_name, struct pack_idx_entry **objects,
-		     int nr_objects, unsigned char *sha1)
+const char *write_idx_file(const char *index_name, struct pack_idx_entry **objects,
+			   int nr_objects, unsigned char *sha1)
 {
 	struct sha1file *f;
 	struct pack_idx_entry **sorted_by_sha, **list, **last;
diff --git a/pack.h b/pack.h
index a883334..b759a23 100644
--- a/pack.h
+++ b/pack.h
@@ -55,7 +55,7 @@ struct pack_idx_entry {
 	off_t offset;
 };
 
-extern char *write_idx_file(char *index_name, struct pack_idx_entry **objects, int nr_objects, unsigned char *sha1);
+extern const char *write_idx_file(const char *index_name, struct pack_idx_entry **objects, int nr_objects, unsigned char *sha1);
 extern int check_pack_crc(struct packed_git *p, struct pack_window **w_curs, off_t offset, off_t len, unsigned int nr);
 extern int verify_pack(struct packed_git *);
 extern void fixup_pack_header_footer(int, unsigned char *, const char *, uint32_t, unsigned char *, off_t);
-- 
1.6.6.1.399.g73128

^ permalink raw reply related

* [PATCH 4/5] make "git pack-redundant" a built-in
From: Linus Torvalds @ 2010-01-22 16:28 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.1001220826230.13231@localhost.localdomain>


From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Fri, 22 Jan 2010 07:42:14 -0800

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
This has one function that now needed a 'const char *' argument 
conversion, but it's the next one that actually affects other files..

 Makefile                                     |    2 +-
 pack-redundant.c => builtin-pack-redundant.c |    8 ++------
 builtin.h                                    |    1 +
 git.c                                        |    1 +
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 88e2f8f..33f9870 100644
--- a/Makefile
+++ b/Makefile
@@ -389,7 +389,6 @@ PROGRAMS += $(EXTRA_PROGRAMS)
 PROGRAMS += git-fast-import$X
 PROGRAMS += git-imap-send$X
 PROGRAMS += git-index-pack$X
-PROGRAMS += git-pack-redundant$X
 PROGRAMS += git-shell$X
 PROGRAMS += git-show-index$X
 PROGRAMS += git-upload-pack$X
@@ -673,6 +672,7 @@ BUILTIN_OBJS += builtin-mktree.o
 BUILTIN_OBJS += builtin-mv.o
 BUILTIN_OBJS += builtin-name-rev.o
 BUILTIN_OBJS += builtin-pack-objects.o
+BUILTIN_OBJS += builtin-pack-redundant.o
 BUILTIN_OBJS += builtin-pack-refs.o
 BUILTIN_OBJS += builtin-patch-id.o
 BUILTIN_OBJS += builtin-prune-packed.o
diff --git a/pack-redundant.c b/builtin-pack-redundant.c
similarity index 99%
rename from pack-redundant.c
rename to builtin-pack-redundant.c
index 21c61db..41e1615 100644
--- a/pack-redundant.c
+++ b/builtin-pack-redundant.c
@@ -568,7 +568,7 @@ static struct pack_list * add_pack(struct packed_git *p)
 		return pack_list_insert(&altodb_packs, &l);
 }
 
-static struct pack_list * add_pack_file(char *filename)
+static struct pack_list * add_pack_file(const char *filename)
 {
 	struct packed_git *p = packed_git;
 
@@ -593,7 +593,7 @@ static void load_all(void)
 	}
 }
 
-int main(int argc, char **argv)
+int cmd_pack_redundant(int argc, const char **argv, const char *prefix)
 {
 	int i;
 	struct pack_list *min, *red, *pl;
@@ -601,13 +601,9 @@ int main(int argc, char **argv)
 	unsigned char *sha1;
 	char buf[42]; /* 40 byte sha1 + \n + \0 */
 
-	git_extract_argv0_path(argv[0]);
-
 	if (argc == 2 && !strcmp(argv[1], "-h"))
 		usage(pack_redundant_usage);
 
-	setup_git_directory();
-
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
 		if (!strcmp(arg, "--")) {
diff --git a/builtin.h b/builtin.h
index d4fec89..bd7f737 100644
--- a/builtin.h
+++ b/builtin.h
@@ -78,6 +78,7 @@ extern int cmd_mktree(int argc, const char **argv, const char *prefix);
 extern int cmd_mv(int argc, const char **argv, const char *prefix);
 extern int cmd_name_rev(int argc, const char **argv, const char *prefix);
 extern int cmd_pack_objects(int argc, const char **argv, const char *prefix);
+extern int cmd_pack_redundant(int argc, const char **argv, const char *prefix);
 extern int cmd_patch_id(int argc, const char **argv, const char *prefix);
 extern int cmd_pickaxe(int argc, const char **argv, const char *prefix);
 extern int cmd_prune(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index 832bd2d..6cc1eba 100644
--- a/git.c
+++ b/git.c
@@ -343,6 +343,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "mv", cmd_mv, RUN_SETUP | NEED_WORK_TREE },
 		{ "name-rev", cmd_name_rev, RUN_SETUP },
 		{ "pack-objects", cmd_pack_objects, RUN_SETUP },
+		{ "pack-redundant", cmd_pack_redundant, RUN_SETUP },
 		{ "patch-id", cmd_patch_id },
 		{ "peek-remote", cmd_ls_remote },
 		{ "pickaxe", cmd_blame, RUN_SETUP },
-- 
1.6.6.1.399.g73128

^ permalink raw reply related

* [PATCH 3/5] make "git unpack-file" a built-in
From: Linus Torvalds @ 2010-01-22 16:27 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.1001220825190.13231@localhost.localdomain>


From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Fri, 22 Jan 2010 07:38:03 -0800

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
Again.. No surprises.

 Makefile                               |    2 +-
 unpack-file.c => builtin-unpack-file.c |    5 +----
 builtin.h                              |    1 +
 git.c                                  |    1 +
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index c5a1190..88e2f8f 100644
--- a/Makefile
+++ b/Makefile
@@ -392,7 +392,6 @@ PROGRAMS += git-index-pack$X
 PROGRAMS += git-pack-redundant$X
 PROGRAMS += git-shell$X
 PROGRAMS += git-show-index$X
-PROGRAMS += git-unpack-file$X
 PROGRAMS += git-upload-pack$X
 PROGRAMS += git-http-backend$X
 
@@ -698,6 +697,7 @@ BUILTIN_OBJS += builtin-stripspace.o
 BUILTIN_OBJS += builtin-symbolic-ref.o
 BUILTIN_OBJS += builtin-tag.o
 BUILTIN_OBJS += builtin-tar-tree.o
+BUILTIN_OBJS += builtin-unpack-file.o
 BUILTIN_OBJS += builtin-unpack-objects.o
 BUILTIN_OBJS += builtin-update-index.o
 BUILTIN_OBJS += builtin-update-ref.o
diff --git a/unpack-file.c b/builtin-unpack-file.c
similarity index 89%
rename from unpack-file.c
rename to builtin-unpack-file.c
index e9d8934..608590a 100644
--- a/unpack-file.c
+++ b/builtin-unpack-file.c
@@ -22,18 +22,15 @@ static char *create_temp_file(unsigned char *sha1)
 	return path;
 }
 
-int main(int argc, char **argv)
+int cmd_unpack_file(int argc, const char **argv, const char *prefix)
 {
 	unsigned char sha1[20];
 
-	git_extract_argv0_path(argv[0]);
-
 	if (argc != 2 || !strcmp(argv[1], "-h"))
 		usage("git unpack-file <sha1>");
 	if (get_sha1(argv[1], sha1))
 		die("Not a valid object name %s", argv[1]);
 
-	setup_git_directory();
 	git_config(git_default_config, NULL);
 
 	puts(create_temp_file(sha1));
diff --git a/builtin.h b/builtin.h
index 2aaef74..d4fec89 100644
--- a/builtin.h
+++ b/builtin.h
@@ -103,6 +103,7 @@ extern int cmd_stripspace(int argc, const char **argv, const char *prefix);
 extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);
 extern int cmd_tag(int argc, const char **argv, const char *prefix);
 extern int cmd_tar_tree(int argc, const char **argv, const char *prefix);
+extern int cmd_unpack_file(int argc, const char **argv, const char *prefix);
 extern int cmd_unpack_objects(int argc, const char **argv, const char *prefix);
 extern int cmd_update_index(int argc, const char **argv, const char *prefix);
 extern int cmd_update_ref(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index 0b8f8a7..832bd2d 100644
--- a/git.c
+++ b/git.c
@@ -370,6 +370,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
 		{ "tag", cmd_tag, RUN_SETUP },
 		{ "tar-tree", cmd_tar_tree },
+		{ "unpack-file", cmd_unpack_file, RUN_SETUP },
 		{ "unpack-objects", cmd_unpack_objects, RUN_SETUP },
 		{ "update-index", cmd_update_index, RUN_SETUP },
 		{ "update-ref", cmd_update_ref, RUN_SETUP },
-- 
1.6.6.1.399.g73128

^ permalink raw reply related

* PATCH 2/5] make "mktag" a built-in
From: Linus Torvalds @ 2010-01-22 16:26 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.1001220822560.13231@localhost.localdomain>


From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Fri, 22 Jan 2010 07:34:44 -0800

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
Another trivial one.

 Makefile                   |    2 +-
 mktag.c => builtin-mktag.c |    6 +-----
 builtin.h                  |    1 +
 git.c                      |    1 +
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 70ac4b3..c5a1190 100644
--- a/Makefile
+++ b/Makefile
@@ -389,7 +389,6 @@ PROGRAMS += $(EXTRA_PROGRAMS)
 PROGRAMS += git-fast-import$X
 PROGRAMS += git-imap-send$X
 PROGRAMS += git-index-pack$X
-PROGRAMS += git-mktag$X
 PROGRAMS += git-pack-redundant$X
 PROGRAMS += git-shell$X
 PROGRAMS += git-show-index$X
@@ -670,6 +669,7 @@ BUILTIN_OBJS += builtin-merge-index.o
 BUILTIN_OBJS += builtin-merge-ours.o
 BUILTIN_OBJS += builtin-merge-recursive.o
 BUILTIN_OBJS += builtin-merge-tree.o
+BUILTIN_OBJS += builtin-mktag.o
 BUILTIN_OBJS += builtin-mktree.o
 BUILTIN_OBJS += builtin-mv.o
 BUILTIN_OBJS += builtin-name-rev.o
diff --git a/mktag.c b/builtin-mktag.c
similarity index 98%
rename from mktag.c
rename to builtin-mktag.c
index a3b4270..1cb0f3f 100644
--- a/mktag.c
+++ b/builtin-mktag.c
@@ -153,7 +153,7 @@ static int verify_tag(char *buffer, unsigned long size)
 
 #undef PD_FMT
 
-int main(int argc, char **argv)
+int cmd_mktag(int argc, const char **argv, const char *prefix)
 {
 	struct strbuf buf = STRBUF_INIT;
 	unsigned char result_sha1[20];
@@ -161,10 +161,6 @@ int main(int argc, char **argv)
 	if (argc != 1)
 		usage("git mktag < signaturefile");
 
-	git_extract_argv0_path(argv[0]);
-
-	setup_git_directory();
-
 	if (strbuf_read(&buf, 0, 4096) < 0) {
 		die_errno("could not read from stdin");
 	}
diff --git a/builtin.h b/builtin.h
index e961b33..2aaef74 100644
--- a/builtin.h
+++ b/builtin.h
@@ -73,6 +73,7 @@ extern int cmd_merge_ours(int argc, const char **argv, const char *prefix);
 extern int cmd_merge_file(int argc, const char **argv, const char *prefix);
 extern int cmd_merge_recursive(int argc, const char **argv, const char *prefix);
 extern int cmd_merge_tree(int argc, const char **argv, const char *prefix);
+extern int cmd_mktag(int argc, const char **argv, const char *prefix);
 extern int cmd_mktree(int argc, const char **argv, const char *prefix);
 extern int cmd_mv(int argc, const char **argv, const char *prefix);
 extern int cmd_name_rev(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index eae12e3..0b8f8a7 100644
--- a/git.c
+++ b/git.c
@@ -338,6 +338,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "merge-recursive-theirs", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },
 		{ "merge-subtree", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },
 		{ "merge-tree", cmd_merge_tree, RUN_SETUP },
+		{ "mktag", cmd_mktag, RUN_SETUP },
 		{ "mktree", cmd_mktree, RUN_SETUP },
 		{ "mv", cmd_mv, RUN_SETUP | NEED_WORK_TREE },
 		{ "name-rev", cmd_name_rev, RUN_SETUP },
-- 
1.6.6.1.399.g73128

^ permalink raw reply related

* [PATCH 1/5] make "merge-index" a built-in
From: Linus Torvalds @ 2010-01-22 16:25 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.1001220804550.13231@localhost.localdomain>


From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
Totally trivial. Famous last words.

 Makefile                               |    2 +-
 merge-index.c => builtin-merge-index.c |    7 ++-----
 builtin.h                              |    1 +
 git.c                                  |    1 +
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index e1c7ae5..70ac4b3 100644
--- a/Makefile
+++ b/Makefile
@@ -389,7 +389,6 @@ PROGRAMS += $(EXTRA_PROGRAMS)
 PROGRAMS += git-fast-import$X
 PROGRAMS += git-imap-send$X
 PROGRAMS += git-index-pack$X
-PROGRAMS += git-merge-index$X
 PROGRAMS += git-mktag$X
 PROGRAMS += git-pack-redundant$X
 PROGRAMS += git-shell$X
@@ -667,6 +666,7 @@ BUILTIN_OBJS += builtin-mailsplit.o
 BUILTIN_OBJS += builtin-merge.o
 BUILTIN_OBJS += builtin-merge-base.o
 BUILTIN_OBJS += builtin-merge-file.o
+BUILTIN_OBJS += builtin-merge-index.o
 BUILTIN_OBJS += builtin-merge-ours.o
 BUILTIN_OBJS += builtin-merge-recursive.o
 BUILTIN_OBJS += builtin-merge-tree.o
diff --git a/merge-index.c b/builtin-merge-index.c
similarity index 94%
rename from merge-index.c
rename to builtin-merge-index.c
index 19ddd03..2c4cf5e 100644
--- a/merge-index.c
+++ b/builtin-merge-index.c
@@ -66,7 +66,7 @@ static void merge_all(void)
 	}
 }
 
-int main(int argc, char **argv)
+int cmd_merge_index(int argc, const char **argv, const char *prefix)
 {
 	int i, force_file = 0;
 
@@ -78,9 +78,6 @@ int main(int argc, char **argv)
 	if (argc < 3)
 		usage("git merge-index [-o] [-q] <merge-program> (-a | [--] <filename>*)");
 
-	git_extract_argv0_path(argv[0]);
-
-	setup_git_directory();
 	read_cache();
 
 	i = 1;
@@ -94,7 +91,7 @@ int main(int argc, char **argv)
 	}
 	pgm = argv[i++];
 	for (; i < argc; i++) {
-		char *arg = argv[i];
+		const char *arg = argv[i];
 		if (!force_file && *arg == '-') {
 			if (!strcmp(arg, "--")) {
 				force_file = 1;
diff --git a/builtin.h b/builtin.h
index cb8489f..e961b33 100644
--- a/builtin.h
+++ b/builtin.h
@@ -68,6 +68,7 @@ extern int cmd_mailinfo(int argc, const char **argv, const char *prefix);
 extern int cmd_mailsplit(int argc, const char **argv, const char *prefix);
 extern int cmd_merge(int argc, const char **argv, const char *prefix);
 extern int cmd_merge_base(int argc, const char **argv, const char *prefix);
+extern int cmd_merge_index(int argc, const char **argv, const char *prefix);
 extern int cmd_merge_ours(int argc, const char **argv, const char *prefix);
 extern int cmd_merge_file(int argc, const char **argv, const char *prefix);
 extern int cmd_merge_recursive(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index b60999c..eae12e3 100644
--- a/git.c
+++ b/git.c
@@ -331,6 +331,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "merge", cmd_merge, RUN_SETUP | NEED_WORK_TREE },
 		{ "merge-base", cmd_merge_base, RUN_SETUP },
 		{ "merge-file", cmd_merge_file },
+		{ "merge-index", cmd_merge_index, RUN_SETUP },
 		{ "merge-ours", cmd_merge_ours, RUN_SETUP },
 		{ "merge-recursive", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },
 		{ "merge-recursive-ours", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },
-- 
1.6.6.1.399.g73128.dirty

^ permalink raw reply related

* [Patch 0/5] make more commands built-in
From: Linus Torvalds @ 2010-01-22 16:22 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List


Ok, so since I was working on this yesterday, I decided to just continue 
until I was done with all the trivial files.

This series makes five more commands built-in: 'merge-index', 'mktag', 
'unpack-file', 'pack-redundant' and 'index-pack'. It further shrinks my 
git install footprint by about 20%:

	[torvalds@nehalem git]$ du -s /home/torvalds/libexec/git-core
	21424	/home/torvalds/libexec/git-core (before)
	16920	/home/torvalds/libexec/git-core (after)

and if we didn't default to having debug info enabled, it would look 
almost acceptable:

	[torvalds@nehalem git]$ du -s /home/torvalds/libexec/git-core
	5728	/home/torvalds/libexec/git-core (with "-g" removed)
	5108	/home/torvalds/libexec/git-core (with -Os and no debugging)

There still remains a few big git commands after this, but this takes care 
of most of the core ones. 

All of these patches are trivial, the only one that has _any_ changes 
apart from the obvious builtin conversion is 'pack-redundant' which 
required some of the pack creation interfaces to now take 'const' index 
pathnames etc.

But as you can see, it removes more lines than it adds, and considering 
that yesterday the 'du' reported ~40MB of disk space for the git install, 
the shrinking certainly matters (of course, I suspect most distros 
wouldn't ship with debug info, so for most people it's about a few MB 
rather than a few tens of MB, but still).

		Linus
---
Linus Torvalds (5):
  make "merge-index" a built-in
  make "mktag" a built-in
  make "git unpack-file" a built-in
  make "git pack-redundant" a built-in
  make "index-pack" a built-in

 Makefile                                     |   10 +++++-----
 index-pack.c => builtin-index-pack.c         |   16 +++++++---------
 merge-index.c => builtin-merge-index.c       |    7 ++-----
 mktag.c => builtin-mktag.c                   |    6 +-----
 builtin-pack-objects.c                       |    5 +++--
 pack-redundant.c => builtin-pack-redundant.c |    8 ++------
 unpack-file.c => builtin-unpack-file.c       |    5 +----
 builtin.h                                    |    5 +++++
 git.c                                        |    5 +++++
 pack-write.c                                 |    4 ++--
 pack.h                                       |    2 +-
 11 files changed, 34 insertions(+), 39 deletions(-)
 rename index-pack.c => builtin-index-pack.c (98%)
 rename merge-index.c => builtin-merge-index.c (94%)
 rename mktag.c => builtin-mktag.c (98%)
 rename pack-redundant.c => builtin-pack-redundant.c (99%)
 rename unpack-file.c => builtin-unpack-file.c (89%)

^ 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