git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] Basic Zsh completion support
@ 2006-03-18 14:53  5% Fredrik Kuivinen
  0 siblings, 0 replies; 200+ results
From: Fredrik Kuivinen @ 2006-03-18 14:53 UTC (permalink / raw)
  To: git; +Cc: junkio


Based on the completion code for quilt in the Zsh distribution.

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>

---

 .gitignore            |    1 +
 Makefile              |    8 +++++++-
 generate-zsh-compl.sh |   26 ++++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/.gitignore b/.gitignore
index b4355b9..1cf6ac0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -133,3 +133,4 @@ libgit.a
 *.py[co]
 config.mak
 git-blame
+_git
diff --git a/Makefile b/Makefile
index 8a20c76..85c5e2d 100644
--- a/Makefile
+++ b/Makefile
@@ -96,6 +96,7 @@ bindir = $(prefix)/bin
 gitexecdir = $(bindir)
 template_dir = $(prefix)/share/git-core/templates/
 GIT_PYTHON_DIR = $(prefix)/share/git-core/python
+ZSH_COMPL_DIR = $(prefix)/share/zsh/site-functions
 # DESTDIR=
 
 CC = gcc
@@ -438,13 +439,14 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_P
 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
 PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
 GIT_PYTHON_DIR_SQ = $(subst ','\'',$(GIT_PYTHON_DIR))
+ZSH_COMPL_DIR_SQ = $(subst ','\'',$(ZSH_COMPL_DIR))
 
 ALL_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS)
 LIB_OBJS += $(COMPAT_OBJS)
 export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
 ### Build rules
 
-all: $(ALL_PROGRAMS) git$X gitk
+all: $(ALL_PROGRAMS) git$X gitk _git
 
 all:
 	$(MAKE) -C templates
@@ -553,6 +555,8 @@ $(LIB_FILE): $(LIB_OBJS)
 doc:
 	$(MAKE) -C Documentation all
 
+_git: generate-zsh-compl.sh
+	./generate-zsh-compl.sh version help $(ALL_PROGRAMS) > _git
 
 ### Testing rules
 
@@ -586,6 +590,8 @@ install: all
 	$(MAKE) -C templates install
 	$(INSTALL) -d -m755 '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
 	$(INSTALL) $(PYMODULES) '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
+	$(INSTALL) -d -m755 $(ZSH_COMPL_DIR)
+	$(INSTALL) -m644 _git '$(DESTDIR_SQ)$(ZSH_COMPL_DIR_SQ)'
 
 install-doc:
 	$(MAKE) -C Documentation install
diff --git a/generate-zsh-compl.sh b/generate-zsh-compl.sh
new file mode 100755
index 0000000..f8c80de
--- /dev/null
+++ b/generate-zsh-compl.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+cmds=$(echo "$@" | sed s/git-//g | sed "s/\\.[^ ]*//g")
+
+cat <<EOF
+#compdef git
+
+# Automatically generated by $0
+
+local _git_subcommands expl curcontext="$curcontext"
+
+_arguments \
+  '--version' \
+  '--exec-path=:Git exec path:_path_files' \
+  '--help' \
+  '*::git command:->subcmd' && return 0
+
+ _git_subcommands=($cmds)
+
+if (( CURRENT == 1 )); then
+  _describe -t subcommand 'subcommand' _git_subcommands
+else
+  # this part should be tailored for subcmds
+  _files
+fi
+EOF

^ permalink raw reply related	[relevance 5%]

* Re: [RFC/PATCH] drop vcs-svn experiment
  @ 2018-08-18 15:03  5%   ` Jeff King
  0 siblings, 0 replies; 200+ results
From: Jeff King @ 2018-08-18 15:03 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git

On Fri, Aug 17, 2018 at 10:26:05PM -0700, Jonathan Nieder wrote:

> > We also ship contrib/svn-fe, which builds on the vcs-svn
> > work. However, it does not seem to build out of the box for
> > me, as the link step misses some required libraries for
> > using libgit.a.
> 
> What libraries do you mean?  It builds and runs fine for me with
> 
>  $ git diff
>  diff --git i/contrib/svn-fe/Makefile w/contrib/svn-fe/Makefile
>  index e8651aaf4b5..bd709f8d83b 100644
>  --- i/contrib/svn-fe/Makefile
>  +++ w/contrib/svn-fe/Makefile
>  @@ -4,7 +4,7 @@ CC = cc
>   RM = rm -f
>   MV = mv
>  
>  -CFLAGS = -g -O2 -Wall
>  +CFLAGS = -g -O2 -Wall -pthread
>   LDFLAGS =
>   EXTLIBS = -lz
> 
> which appears to be platform related, not due to some internal change
> in Git.

Yes, it works for me with that, too[1]. So clearly there's some system
dependence. But I suspect it's broken for every system with pthreads,
which is most of them. And older versions _do_ compile out of the box,
even on my modern system. For completeness, here's what I dug up:

 - it builds fine up through v1.8.2

 - after eff80a9fd9 (Allow custom "comment char", 2013-01-16), it breaks
   with a ton of undefined references during the link stage, including
   SHA1_* and some xdl_* functions. I still have no idea why, as that
   commit is fairly mundane, but I guess it just somehow tickles
   something in the linker or the way we build libgit.a.

 - after da011cb0e7 (contrib/svn-fe: fix Makefile, 2014-08-28), the
   error becomes:

     /usr/bin/ld: ../../libgit.a(sha1_file.o): undefined reference to symbol 'SHA1_Update@@OPENSSL_1_1_0'
     /usr/bin/ld: //usr/lib/x86_64-linux-gnu/libcrypto.so.1.1: error adding symbols: DSO missing from command line

   Presumably this did work for the author at the time. It's seems quite
   plausible that older versions of openssl did not exhibit this
   problem, and that it's system-specific. Or that it was possible to
   build with BLK_SHA1.

 - after e6b07da278 (Makefile: make DC_SHA1 the default, 2017-03-17),
   the openssl error goes away (naturally), but is replaced with:

     /usr/bin/ld: ../../libgit.a(run-command.o): undefined reference to symbol 'pthread_sigmask@@GLIBC_2.2.5'
     /usr/bin/ld: //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line

   If I go back to 2014-era and start building with NO_OPENSSL, then
   even da011cb0e7 fails with:

     /usr/bin/ld: ../../libgit.a(run-command.o): undefined reference to symbol 'pthread_setspecific@@GLIBC_2.2.5'

   So again, assuming it worked back then for the author of that commit,
   that's something that has changed on the system, and we can't figure
   out through bisecting git when that became common.

So that does mean it's possible that it works for some people on some
systems today (though it was also probably broken for everybody for a
year and a half in 2013 with nobody noticing).

[1] That patch actually doesn't quite work out of the box, because we
    also include config.mak, and mine overrides CFLAGS. It also doesn't
    seem to work with USE_LIBPCRE. But those are only evidence that the
    Makefile is not very mature, not that people aren't using it for
    out-of-the-box config.

> > Of course, I could be completely wrong about people using this. Maybe
> > svn-fe builds are just completely broken on my system, and maybe people
> > really do use testsvn::. But if so, they certainly aren't talking about
> > it on the mailing list. :)
> 
> My take:
> 
>  - svn-fe works fine and has been useful to me, though its Makefile
>    could likely be simplified and made more user-friendly
> 
>  - I've benefited from the test coverage of having this in-tree
> 
>  - testsvn:: is a demo and at a minimum we ought not to install it
>    with "make install"
> 
>  - keeping this in-tree for the benefit of just one user is excessive,
>    so removing it is probably the right thing

Thanks, all of that sounds sensible to me.

>  - it would be nice if the commit removing this code from Git includes
>    a note to help people find its new home
> 
> Would you mind holding off until I'm able to arrange that last bit?

Not at all. This patch was mostly meant to start the discussion. Mission
accomplished. ;)

-Peff

^ permalink raw reply	[relevance 5%]

* Re: [PATCH] contrib: remote-helpers: add move warnings (v2.0)
  @ 2014-05-13 22:02  5% ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2014-05-13 22:02 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: git

Felipe Contreras <felipe.contreras@gmail.com> writes:

> The tools are now maintained out-of-tree, and they have a regression in
> v2.0.

You seem not to understand at all what a regression is.

My understanding is that versions of remote-hg shipped with all
versions of Git did not work with Hg 3.0, so not working with Hg 3.0
is a regression in v2.0 at all.  A recent report was about Hg 3.0
not working with 1.9.3, but I think you earlier said all versions of
Git does not work with Hg 3.0, and I can believe it.  That is hardly
a regression.

You could argue that Hg has a new regression to its external users
of its API when it went to 3.0.  We actually had a similar breakage
in 1.5.4, where it was reported late in the cycle after -rc0 [*1*]
that cgit that linked with our internal API libgit.a was broken by a
change on our side, which resulted in us fixing the breakage (even
though technically you may be able to say that it was cgit's fault
to link with libgit.a in the first place) with 18125644 (Move
sha1_file_to_archive into libgit, 2008-01-14) very late in the
cycle.  Calling that a regression in cgit would have been insane,
even if we did not patch our side up to accomodate it.

Stop this idiocy.


[References]

*1* http://thread.gmane.org/gmane.comp.version-control.git/70117/focus=71064

^ permalink raw reply	[relevance 5%]

* Re: [PATCH] build: get rid of the notion of a git library
  @ 2013-06-09 17:32  5%                     ` John Keeping
  0 siblings, 0 replies; 200+ results
From: John Keeping @ 2013-06-09 17:32 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: Ramkumar Ramachandra, git, Junio C Hamano, Jonathan Nieder,
	Jeff King, Duy Nguyen

On Sun, Jun 09, 2013 at 12:13:41PM -0500, Felipe Contreras wrote:
> On Sun, Jun 9, 2013 at 12:03 PM, Ramkumar Ramachandra
> <artagnon@gmail.com> wrote:
> > John Keeping wrote:
> >> Calling across from one builtin/*.c file to another is just as wrong as
> >> calling into a builtin/*.c file from a top-level file but the build
> >> system happens not to enforce the former.
> >
> > So libgit.a is a collection of everything that is shared between
> > builtins?  Does that correspond to reality?

I think that's *precisely* what libgit.a is.  It doesn't currently
correspond exactly to reality, but that's mostly for historic reasons
(see below).

> >   $ ls *.h | sed 's/.h$/.c/' | xargs file
> >
> > An example violation: builtin/log.c uses functions defined in
> > builtin/shortlog.c.
> >
> > What is the point of all this separation, if no external scripts are
> > ever going to use libgit.a?

Why do we structure code in a certain way at all?  The reason libgit.a
was introduced (according to commit 0a02ce7) is:

    This introduces the concept of git "library" objects that
    the real programs use, and makes it easier to add such
    things to a "libgit.a".

> And all the functions should be static, which doesn't seem to be the case:
> 
> 00000000000003c0 T add_files_to_cache
> 0000000000000530 T interactive_add
> 0000000000000410 T run_add_interactive
> 0000000000001920 T textconv_object
> 00000000000005b0 T fmt_merge_msg
> 0000000000000090 T fmt_merge_msg_config
> 0000000000000c00 T init_db
> 0000000000000b40 T set_git_dir_init
> 0000000000000360 T overlay_tree_on_cache
> 0000000000000500 T report_path_error
> 00000000000011a0 T copy_note_for_rewrite
> 0000000000001210 T finish_copy_notes_for_rewrite
> 0000000000001060 T init_copy_notes_for_rewrite
> 0000000000000000 T prune_packed_objects
> 0000000000000510 T shortlog_add_commit
> 00000000000006b0 T shortlog_init
> 0000000000000780 T shortlog_output
> 0000000000000000 T stripspace

A quick check with "git log -S..." shows that most of these have barely
been touched since the builtin/ directory was created.  So the reason
they're not static is most likely because no one has tidied them up
since the division between builtins was introduced.

It is a fact of life that as we live and work with a system we realise
that there may be a better way of doing something.  This doesn't mean
that someone needs to immediately convert everything to the new way,
it is often sufficient to do new things in the new way and slowly move
existing things across as and when they are touched for other reasons.

^ permalink raw reply	[relevance 5%]

* Re: [PATCH] build: get rid of the notion of a git library
  @ 2013-06-08 18:22  5%   ` Felipe Contreras
    0 siblings, 1 reply; 200+ results
From: Felipe Contreras @ 2013-06-08 18:22 UTC (permalink / raw)
  To: Ramkumar Ramachandra
  Cc: git, Junio C Hamano, Jonathan Nieder, Jeff King, Duy Nguyen

On Sat, Jun 8, 2013 at 1:02 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
> Felipe Contreras wrote:
>> There's no libgit, and there will never be, every object file in Git is
>> the same, and there's wish to organize them in any way; they are *all*
>> for the 'git' binary and its builtin commands.
>
> Nice joke patch to illustrate your point ;)

It's not a joke. This is seriously the direction the others say is the
correct one.

One direction or the other, the problem that top-level objects can't
access code from builtin objects must be fixed. And if the others
don't want to fix it by properly splitting code between library-like
objects, and builtin objects, there's only one other way to fix it;
this way.

> On a more serious note, please be a little more patient while everyone
> copes with what you're attempting.

I don't think patience will help. What do you suggest? Wait until the
problem fixes itself? (I'll be waiting until the end times). Wait
until somebody changed their opinion by themselves? (I don't see that
happening).

> I've already made it clear that
> I'm in favor of moving forward with your plan to lib'ify git.

Unfortunately you are the only one.

> The
> problem is that you're sending your changes in fragmented comments and
> diffs, and nobody is able to piece together what the big picture is.
>
> Please write one cogent email (preferably with code included)
> explaining your plan.

The plan is simple; make libgit.a a proper library, starting by
clarifying what goes into libgit.a, and what doesn't. If there's any
hopes of ever having a public library, it's clear what code doesn't
belong in libgit.a; code that is meant for builtins, that code belongs
in builtins/lib.a, or similar.

But to be honest, I don't really care, all I want is the problem of
the bogus split to be solved. One way to solve it is going the proper
library way, but the other is to stash everything together into git.a.
Both ways solve the problem.

Give this a try:

--- a/sequencer.c
+++ b/sequencer.c
@@ -14,6 +14,7 @@
 #include "merge-recursive.h"
 #include "refs.h"
 #include "argv-array.h"
+#include "builtin.h"

 #define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"

@@ -102,6 +103,17 @@ static int has_conforming_footer(struct strbuf
*sb, struct strbuf *sob,
        return 1;
 }

+static void copy_notes(const char *name)
+{
+       struct notes_rewrite_cfg *cfg;
+
+       cfg = init_copy_notes_for_rewrite(name);
+       if (!cfg)
+               return;
+
+       finish_copy_notes_for_rewrite(cfg);
+}
+
 static void remove_sequencer_state(void)
 {
        struct strbuf seq_dir = STRBUF_INIT;
@@ -997,6 +1009,8 @@ static int pick_commits(struct commit_list
*todo_list, struct replay_opts *opts)
                        return res;
        }

+       copy_notes("cherry-pick");
+
        /*
         * Sequence of picks finished successfully; cleanup by
         * removing the .git/sequencer directory

What happens?

libgit.a(sequencer.o): In function `copy_notes':
/home/felipec/dev/git/sequencer.c:110: undefined reference to
`init_copy_notes_for_rewrite'
/home/felipec/dev/git/sequencer.c:114: undefined reference to
`finish_copy_notes_for_rewrite'

It is not the first time, nor the last that top-level code needs
builtin code, and the solution is easy; organize the code. Alas, this
simple solution reject on the basis that we shouldn't organize the
code, because the code is not meant to be organized.

Cheers.

-- 
Felipe Contreras

^ permalink raw reply	[relevance 5%]

* Re: [PATCH] build: get rid of the notion of a git library
  2013-06-10 22:06  5%                 ` Jeff King
@ 2013-06-10 22:22  5%                   ` Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2013-06-10 22:22 UTC (permalink / raw)
  To: Jeff King
  Cc: Vincent van Ravesteijn, John Keeping, Ramkumar Ramachandra, git,
	Junio C Hamano, Jonathan Nieder, Duy Nguyen

On Mon, Jun 10, 2013 at 5:06 PM, Jeff King <peff@peff.net> wrote:
> On Mon, Jun 10, 2013 at 04:52:57PM -0500, Felipe Contreras wrote:
>
>> On Mon, Jun 10, 2013 at 4:45 PM, Jeff King <peff@peff.net> wrote:
>>
>> > That is what libgit.a _is_ now.  I do not mean to imply any additional
>> > judgement on what it could be. But if the goal is to make libgit.a
>> > "functions that programs outside git.git would want, and nothing else",
>> > we may want to additionally split out a "libgit-internal.a" consisting
>> > of code that is used by multiple externals in git, but which would not
>> > be appropriate for clients to use.
>>
>> That might make sense, but that still doesn't clarify what belongs in
>> ./*.o, and what belongs in ./builtin/*.o. And right now that creates a
>> mess where you have code shared between ./builtin/*.o that is defined
>> in cache.h (overlay_tree_on_cache), and some in builtin.h
>> (init_copy_notes_for_rewrite). And it's not clear what should be done
>> when code in ./*.o needs to access functionality in ./builtin/*.o,
>> specially if that code is only useful for git builtins, and nothing
>> else.
>
> My general impression of the goal of our current code organization is:
>
>   1. builtin/*.c should each contain a single builtin command and its
>      supporting static functions. Each file gets linked into git.o to
>      make the "main" git executable.

We already know this is not the case. Maybe this should be fixed by
moving all the shared code between builtins to libgit.a, but maybe we
already know at some level this is not wise, and that's why we haven't
done so.

> If we want to start caring, then we probably need to create a separate
> "kitchen sink"-like library, with the rule that things in libgit.a
> cannot depend on it. In other words, a support library for Git's
> commands, for the parts that are not appropriate to expose as part of a
> library API.

Yes, that's clearly what we should be doing, which is precisely what
my patch that creates builtin/lib.a does.

So we have two options:

a) Do what we clearly should do; create builtin/lib.a, and move code
there that is specific to builtin commands.

b) Do what we think we have been doing; and move _all_ shared code to
libgit.a (which shouldn't be called libgit, because it's not really a
library), and cleanup builtin/*.c so they don't share anything among
themselves directly.

I vote for a), not only because we already know that's what we
_should_ do, but because we are basically already there.

Leaving things as they are is not really an option; that's a mess.

-- 
Felipe Contreras

^ permalink raw reply	[relevance 5%]

* Re: Libification project (SoC)
  @ 2007-03-19  1:43  5%                     ` Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2007-03-19  1:43 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Rocco Rutte, git

Hi,

On Mon, 19 Mar 2007, Petr Baudis wrote:

> On Mon, Mar 19, 2007 at 12:48:27AM CET, Johannes Schindelin wrote:
> > On Sun, 18 Mar 2007, Petr Baudis wrote:
> > 
> > > [...] if you look at the UNIX history, you'll notice that first 
> > > people started with non-reentrant stuff because it was "good enough" 
> > > and then came back later and added reentrant versions anyway. Let's 
> > > learn from history. It's question of probability but it's very 
> > > likely this will happen to us as well.
> > 
> > Yes, let's learn from history. Start with a libgit that is good 
> > enough. And when somebody actually needs it to behave a little 
> > differently, or more sophisticated, then let that somebody work on it!
> 
>   I was talking about the API. The API has to be designed to be 
> reentrant. And you get pretty much stuck with the API. And requiring 
> reentrance isn't that far off once libgit is there, as I tried to point 
> out; it's not really any obscure requirement.

I don't see _any_ problem in making an API which works with _one_ repo 
first. This has several advantages:

- most users (if any!) will work that way,

- it is easier to implement,

- you are more likely to get that right than the more complex thing you 
  seem to want already in the first version, and

- it is easy enough to extend the API later, _retaining_ the small and 
  beautiful functions.

As for the memory problems I was pointing out to you on IRC: if you do 
some operation on one repo, and run out of memory, okay, there is not much 
you can do about it. Tough luck.

If you cache different repos in the _same_ process, and run out of memory, 
you should free the caches of the _other_ repos first, instead of just 
erroring out. This is not entirely trivial, likely to make libgit fragile, 
and quite possibly a performance hit (making libgit unattractive for 
plumbing, which would take away the best test case for libgit).

Also, when you cache different repos, you want to avoid duplicating 
identical objects in different caches, which makes the cache handling no 
easier.

But even if these issues would not exist, isn't it obvious that you should 
start with something _simple_?

Ciao,
Dscho

^ permalink raw reply	[relevance 5%]

* Re: Libification project (SoC)
  @ 2007-03-16 21:07  5%                     ` Marco Costalba
  2007-03-16 23:24  5%                       ` Johannes Schindelin
  0 siblings, 1 reply; 200+ results
From: Marco Costalba @ 2007-03-16 21:07 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: Johannes Schindelin, Rocco Rutte, git

On 3/16/07, Nicolas Pitre <nico@cam.org> wrote:
> On Fri, 16 Mar 2007, Marco Costalba wrote:
>
> > On 3/16/07, Marco Costalba <mcostalba@gmail.com> wrote:
> > >
> > > *The most important thing for a libgit to be used by qgit is reentrancy*
> > >
> >
> > Another crtitical feature is that this call to git-rev-list-like
> > function MUST be non-blocking.
>
> I'm not sure I agree.
>
> The non-blockingness can be (and probably should be) handled at a higher
> level with your own threading facility of choice.  Making GIT
> restartable has the potential for making the core code much too complex.
>

The fact is that the solution is complex anyway, moving the complex
code at higher level doesn't simplify the whole issue, it just *moves*
the issue somewhere else.

BTW now qgit is single-threaded (as gitk), you suggest that linking
with libgit it will involve to go on the multi threading side and I
think you are right. But it will be not that easy.

Currently we have both single threaded GUI tools and blocking git
commands and it works nicely not because it's simple but because the
'complex code' is hidden inside the OS process handling and scheduling
stuff.

Linking with a synchronous libgit it means, roughly speaking, take the
'complex code' out from the OS and put somewhere in user space, or in
libgit or in the user GUI tool linked with the library.

Now, it happens that Qt has a good multi thread support, but this is
just incidental and of course cannot be taken as granted by a git
library that aims to be broadly and possibly easily used.

Because we are just speaking (well, writing ;-) ) about a possible
library I think we could take in account what would involve to
foreseen a callback mechanism in the API, at least for the slowest
ones.

    Marco

^ permalink raw reply	[relevance 5%]

* [PATCH 2/4 v2] Move pack_refs() and friends into libgit
  @ 2008-06-15 21:27  5%     ` Johan Herland
  0 siblings, 0 replies; 200+ results
From: Johan Herland @ 2008-06-15 21:27 UTC (permalink / raw)
  To: Jeff King; +Cc: git, Junio C Hamano, Daniel Barkalow

This moves pack_refs() and underlying functionality into the library,
to make pack-refs functionality easily available to all git programs.

Most of builtin-pack-refs.c has been moved verbatim into a new file
pack-refs.c that is compiled into libgit.a. A corresponding header
file, pack-refs.h, has also been added, declaring pack_refs() and
the #defines associated with the flags parameter to pack_refs().

This patch introduces no other changes in functionality.

Signed-off-by: Johan Herland <johan@herland.net>
---

On Sunday 15 June 2008, Jeff King wrote:
> This patch would have been a lot easier to read, btw, if it had been
> generated with '-C' (then patch to pack-refs.c is based on
> builtin-pack-refs instead of /dev/null).

Sorry about that. Here you go.

...Johan	


 Makefile                           |    2 +
 builtin-pack-refs.c                |  121 +-----------------------------------
 builtin-pack-refs.c => pack-refs.c |   27 +--------
 pack-refs.h                        |   18 +++++
 4 files changed, 23 insertions(+), 145 deletions(-)
 copy builtin-pack-refs.c => pack-refs.c (80%)
 create mode 100644 pack-refs.h

diff --git a/Makefile b/Makefile
index 1937507..4a78388 100644
--- a/Makefile
+++ b/Makefile
@@ -354,6 +354,7 @@ LIB_H += log-tree.h
 LIB_H += mailmap.h
 LIB_H += object.h
 LIB_H += pack.h
+LIB_H += pack-refs.h
 LIB_H += pack-revindex.h
 LIB_H += parse-options.h
 LIB_H += patch-ids.h
@@ -429,6 +430,7 @@ LIB_OBJS += merge-file.o
 LIB_OBJS += name-hash.o
 LIB_OBJS += object.o
 LIB_OBJS += pack-check.o
+LIB_OBJS += pack-refs.o
 LIB_OBJS += pack-revindex.o
 LIB_OBJS += pack-write.o
 LIB_OBJS += pager.o
diff --git a/builtin-pack-refs.c b/builtin-pack-refs.c
index 1aaa76d..ff90aef 100644
--- a/builtin-pack-refs.c
+++ b/builtin-pack-refs.c
@@ -1,125 +1,6 @@
-#include "builtin.h"
 #include "cache.h"
-#include "refs.h"
-#include "object.h"
-#include "tag.h"
 #include "parse-options.h"
-
-struct ref_to_prune {
-	struct ref_to_prune *next;
-	unsigned char sha1[20];
-	char name[FLEX_ARRAY];
-};
-
-#define PACK_REFS_PRUNE	0x0001
-#define PACK_REFS_ALL	0x0002
-
-struct pack_refs_cb_data {
-	unsigned int flags;
-	struct ref_to_prune *ref_to_prune;
-	FILE *refs_file;
-};
-
-static int do_not_prune(int flags)
-{
-	/* If it is already packed or if it is a symref,
-	 * do not prune it.
-	 */
-	return (flags & (REF_ISSYMREF|REF_ISPACKED));
-}
-
-static int handle_one_ref(const char *path, const unsigned char *sha1,
-			  int flags, void *cb_data)
-{
-	struct pack_refs_cb_data *cb = cb_data;
-	int is_tag_ref;
-
-	/* Do not pack the symbolic refs */
-	if ((flags & REF_ISSYMREF))
-		return 0;
-	is_tag_ref = !prefixcmp(path, "refs/tags/");
-
-	/* ALWAYS pack refs that were already packed or are tags */
-	if (!(cb->flags & PACK_REFS_ALL) && !is_tag_ref && !(flags & REF_ISPACKED))
-		return 0;
-
-	fprintf(cb->refs_file, "%s %s\n", sha1_to_hex(sha1), path);
-	if (is_tag_ref) {
-		struct object *o = parse_object(sha1);
-		if (o->type == OBJ_TAG) {
-			o = deref_tag(o, path, 0);
-			if (o)
-				fprintf(cb->refs_file, "^%s\n",
-					sha1_to_hex(o->sha1));
-		}
-	}
-
-	if ((cb->flags & PACK_REFS_PRUNE) && !do_not_prune(flags)) {
-		int namelen = strlen(path) + 1;
-		struct ref_to_prune *n = xcalloc(1, sizeof(*n) + namelen);
-		hashcpy(n->sha1, sha1);
-		strcpy(n->name, path);
-		n->next = cb->ref_to_prune;
-		cb->ref_to_prune = n;
-	}
-	return 0;
-}
-
-/* make sure nobody touched the ref, and unlink */
-static void prune_ref(struct ref_to_prune *r)
-{
-	struct ref_lock *lock = lock_ref_sha1(r->name + 5, r->sha1);
-
-	if (lock) {
-		unlink(git_path("%s", r->name));
-		unlock_ref(lock);
-	}
-}
-
-static void prune_refs(struct ref_to_prune *r)
-{
-	while (r) {
-		prune_ref(r);
-		r = r->next;
-	}
-}
-
-static struct lock_file packed;
-
-static int pack_refs(unsigned int flags)
-{
-	int fd;
-	struct pack_refs_cb_data cbdata;
-
-	memset(&cbdata, 0, sizeof(cbdata));
-	cbdata.flags = flags;
-
-	fd = hold_lock_file_for_update(&packed, git_path("packed-refs"), 1);
-	cbdata.refs_file = fdopen(fd, "w");
-	if (!cbdata.refs_file)
-		die("unable to create ref-pack file structure (%s)",
-		    strerror(errno));
-
-	/* perhaps other traits later as well */
-	fprintf(cbdata.refs_file, "# pack-refs with: peeled \n");
-
-	for_each_ref(handle_one_ref, &cbdata);
-	if (ferror(cbdata.refs_file))
-		die("failed to write ref-pack file");
-	if (fflush(cbdata.refs_file) || fsync(fd) || fclose(cbdata.refs_file))
-		die("failed to write ref-pack file (%s)", strerror(errno));
-	/*
-	 * Since the lock file was fdopen()'ed and then fclose()'ed above,
-	 * assign -1 to the lock file descriptor so that commit_lock_file()
-	 * won't try to close() it.
-	 */
-	packed.fd = -1;
-	if (commit_lock_file(&packed) < 0)
-		die("unable to overwrite old ref-pack file (%s)", strerror(errno));
-	if (cbdata.flags & PACK_REFS_PRUNE)
-		prune_refs(cbdata.ref_to_prune);
-	return 0;
-}
+#include "pack-refs.h"
 
 static char const * const pack_refs_usage[] = {
 	"git-pack-refs [options]",
diff --git a/builtin-pack-refs.c b/pack-refs.c
similarity index 80%
copy from builtin-pack-refs.c
copy to pack-refs.c
index 1aaa76d..848d311 100644
--- a/builtin-pack-refs.c
+++ b/pack-refs.c
@@ -1,9 +1,7 @@
-#include "builtin.h"
 #include "cache.h"
 #include "refs.h"
-#include "object.h"
 #include "tag.h"
-#include "parse-options.h"
+#include "pack-refs.h"
 
 struct ref_to_prune {
 	struct ref_to_prune *next;
@@ -11,9 +9,6 @@ struct ref_to_prune {
 	char name[FLEX_ARRAY];
 };
 
-#define PACK_REFS_PRUNE	0x0001
-#define PACK_REFS_ALL	0x0002
-
 struct pack_refs_cb_data {
 	unsigned int flags;
 	struct ref_to_prune *ref_to_prune;
@@ -86,7 +81,7 @@ static void prune_refs(struct ref_to_prune *r)
 
 static struct lock_file packed;
 
-static int pack_refs(unsigned int flags)
+int pack_refs(unsigned int flags)
 {
 	int fd;
 	struct pack_refs_cb_data cbdata;
@@ -120,21 +115,3 @@ static int pack_refs(unsigned int flags)
 		prune_refs(cbdata.ref_to_prune);
 	return 0;
 }
-
-static char const * const pack_refs_usage[] = {
-	"git-pack-refs [options]",
-	NULL
-};
-
-int cmd_pack_refs(int argc, const char **argv, const char *prefix)
-{
-	unsigned int flags = PACK_REFS_PRUNE;
-	struct option opts[] = {
-		OPT_BIT(0, "all",   &flags, "pack everything", PACK_REFS_ALL),
-		OPT_BIT(0, "prune", &flags, "prune loose refs (default)", PACK_REFS_PRUNE),
-		OPT_END(),
-	};
-	if (parse_options(argc, argv, opts, pack_refs_usage, 0))
-		usage_with_options(pack_refs_usage, opts);
-	return pack_refs(flags);
-}
diff --git a/pack-refs.h b/pack-refs.h
new file mode 100644
index 0000000..518acfb
--- /dev/null
+++ b/pack-refs.h
@@ -0,0 +1,18 @@
+#ifndef PACK_REFS_H
+#define PACK_REFS_H
+
+/*
+ * Flags for controlling behaviour of pack_refs()
+ * PACK_REFS_PRUNE: Prune loose refs after packing
+ * PACK_REFS_ALL:   Pack _all_ refs, not just tags and already packed refs
+ */
+#define PACK_REFS_PRUNE 0x0001
+#define PACK_REFS_ALL   0x0002
+
+/*
+ * Write a packed-refs file for the current repository.
+ * flags: Combination of the above PACK_REFS_* flags.
+ */
+int pack_refs(unsigned int flags);
+
+#endif /* PACK_REFS_H */
-- 
1.5.6.rc2.128.gf64ae

^ permalink raw reply related	[relevance 5%]

* [PATCH v10 02/15] scalar: create a rudimentary executable
  @ 2021-12-03 13:34  5%                   ` Johannes Schindelin via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2021-12-03 13:34 UTC (permalink / raw)
  To: git
  Cc: Derrick Stolee, Eric Sunshine,
	Ævar Arnfjörð Bjarmason, Elijah Newren,
	Bagas Sanjaya, Theodore Ts'o, Matt Rogers,
	Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The idea of Scalar (https://github.com/microsoft/scalar), and before
that, of VFS for Git, has always been to prove that Git _can_ scale, and
to upstream whatever strategies have been demonstrated to help.

With this patch, we start the journey from that C# project to move what
is left to Git's own `contrib/` directory, reimplementing it in pure C,
with the intention to facilitate integrating the functionality into core
Git all while maintaining backwards-compatibility for existing Scalar
users (which will be much easier when both live in the same worktree).
It has always been the plan to contribute all of the proven strategies
back to core Git.

For example, while the virtual filesystem provided by VFS for Git helped
the team developing the Windows operating system to move onto Git, while
trying to upstream it we realized that it cannot be done: getting the
virtual filesystem to work (which we only managed to implement fully on
Windows, but not on, say, macOS or Linux), and the required server-side
support for the GVFS protocol, made this not quite feasible.

The Scalar project learned from that and tackled the problem with
different tactics: instead of pretending to Git that the working
directory is fully populated, it _specifically_ teaches Git about
partial clone (which is based on VFS for Git's cache server), about
sparse checkout (which VFS for Git tried to do transparently, in the
file system layer), and regularly runs maintenance tasks to keep the
repository in a healthy state.

With partial clone, sparse checkout and `git maintenance` having been
upstreamed, there is little left that `scalar.exe` does which `git.exe`
cannot do. One such thing is that `scalar clone <url>` will
automatically set up a partial, sparse clone, and configure
known-helpful settings from the start.

So let's bring this convenience into Git's tree.

The idea here is that you can (optionally) build Scalar via

	make -C contrib/scalar/

This will build the `scalar` executable and put it into the
contrib/scalar/ subdirectory.

The slightly awkward addition of the `contrib/scalar/*` bits to the
top-level `Makefile` are actually really required: we want to link to
`libgit.a`, which means that we will need to use the very same `CFLAGS`
and `LDFLAGS` as the rest of Git.

An early development version of this patch tried to replicate all the
conditional code in `contrib/scalar/Makefile` (e.g. `NO_POLL`) just like
`contrib/svn-fe/Makefile` used to do before it was retired. It turned
out to be quite the whack-a-mole game: the SHA-1-related flags, the
flags enabling/disabling `compat/poll/`, `compat/regex/`,
`compat/win32mmap.c` & friends depending on the current platform... To
put it mildly: it was a major mess.

Instead, this patch makes minimal changes to the top-level `Makefile` so
that the bits in `contrib/scalar/` can be compiled and linked, and
adds a `contrib/scalar/Makefile` that uses the top-level `Makefile` in a
most minimal way to do the actual compiling.

Note: With this commit, we only establish the infrastructure, no
Scalar functionality is implemented yet; We will do that incrementally
over the next few commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                  |  9 +++++++++
 contrib/scalar/.gitignore |  2 ++
 contrib/scalar/Makefile   | 34 ++++++++++++++++++++++++++++++++++
 contrib/scalar/scalar.c   | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 81 insertions(+)
 create mode 100644 contrib/scalar/.gitignore
 create mode 100644 contrib/scalar/Makefile
 create mode 100644 contrib/scalar/scalar.c

diff --git a/Makefile b/Makefile
index 12be39ac497..fe898aeea08 100644
--- a/Makefile
+++ b/Makefile
@@ -2456,6 +2456,11 @@ OBJECTS += $(FUZZ_OBJS)
 ifndef NO_CURL
 	OBJECTS += http.o http-walker.o remote-curl.o
 endif
+
+SCALAR_SOURCES := contrib/scalar/scalar.c
+SCALAR_OBJECTS := $(SCALAR_SOURCES:c=o)
+OBJECTS += $(SCALAR_OBJECTS)
+
 .PHONY: objects
 objects: $(OBJECTS)
 
@@ -2589,6 +2594,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
 
+contrib/scalar/scalar$X: $(SCALAR_OBJECTS) GIT-LDFLAGS $(GITLIBS)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
+		$(filter %.o,$^) $(LIBS)
+
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
diff --git a/contrib/scalar/.gitignore b/contrib/scalar/.gitignore
new file mode 100644
index 00000000000..ff3d47e84d0
--- /dev/null
+++ b/contrib/scalar/.gitignore
@@ -0,0 +1,2 @@
+/*.exe
+/scalar
diff --git a/contrib/scalar/Makefile b/contrib/scalar/Makefile
new file mode 100644
index 00000000000..f6f0036f0fa
--- /dev/null
+++ b/contrib/scalar/Makefile
@@ -0,0 +1,34 @@
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring s,$(MAKEFLAGS)),s)
+ifndef V
+	QUIET_SUBDIR0  = +@subdir=
+	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+			 $(MAKE) $(PRINT_DIR) -C $$subdir
+else
+	export V
+endif
+endif
+
+all:
+
+include ../../config.mak.uname
+-include ../../config.mak.autogen
+-include ../../config.mak
+
+TARGETS = scalar$(X) scalar.o
+GITLIBS = ../../common-main.o ../../libgit.a ../../xdiff/lib.a
+
+all: scalar$(X)
+
+$(GITLIBS):
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(subst ../../,,$@)
+
+$(TARGETS): $(GITLIBS) scalar.c
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(patsubst %,contrib/scalar/%,$@)
+
+clean:
+	$(RM) $(TARGETS)
+
+.PHONY: $(GITLIBS) all clean FORCE
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c
new file mode 100644
index 00000000000..7cff29e0fcd
--- /dev/null
+++ b/contrib/scalar/scalar.c
@@ -0,0 +1,36 @@
+/*
+ * The Scalar command-line interface.
+ */
+
+#include "cache.h"
+#include "gettext.h"
+#include "parse-options.h"
+
+static struct {
+	const char *name;
+	int (*fn)(int, const char **);
+} builtins[] = {
+	{ NULL, NULL},
+};
+
+int cmd_main(int argc, const char **argv)
+{
+	struct strbuf scalar_usage = STRBUF_INIT;
+	int i;
+
+	if (argc > 1) {
+		argv++;
+		argc--;
+
+		for (i = 0; builtins[i].name; i++)
+			if (!strcmp(builtins[i].name, argv[0]))
+				return !!builtins[i].fn(argc, argv);
+	}
+
+	strbuf_addstr(&scalar_usage,
+		      N_("scalar <command> [<options>]\n\nCommands:\n"));
+	for (i = 0; builtins[i].name; i++)
+		strbuf_addf(&scalar_usage, "\t%s\n", builtins[i].name);
+
+	usage(scalar_usage.buf);
+}
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* [PATCH v9 02/17] scalar: create a rudimentary executable
  @ 2021-11-30 11:54  5%                 ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2021-11-30 11:54 UTC (permalink / raw)
  To: git
  Cc: Derrick Stolee, Eric Sunshine,
	Ævar Arnfjörð Bjarmason, Elijah Newren,
	Bagas Sanjaya, Theodore Ts'o, Matt Rogers,
	Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The idea of Scalar (https://github.com/microsoft/scalar), and before
that, of VFS for Git, has always been to prove that Git _can_ scale, and
to upstream whatever strategies have been demonstrated to help.

With this patch, we start the journey from that C# project to move what
is left to Git's own `contrib/` directory, reimplementing it in pure C,
with the intention to facilitate integrating the functionality into core
Git all while maintaining backwards-compatibility for existing Scalar
users (which will be much easier when both live in the same worktree).
It has always been the plan to contribute all of the proven strategies
back to core Git.

For example, while the virtual filesystem provided by VFS for Git helped
the team developing the Windows operating system to move onto Git, while
trying to upstream it we realized that it cannot be done: getting the
virtual filesystem to work (which we only managed to implement fully on
Windows, but not on, say, macOS or Linux), and the required server-side
support for the GVFS protocol, made this not quite feasible.

The Scalar project learned from that and tackled the problem with
different tactics: instead of pretending to Git that the working
directory is fully populated, it _specifically_ teaches Git about
partial clone (which is based on VFS for Git's cache server), about
sparse checkout (which VFS for Git tried to do transparently, in the
file system layer), and regularly runs maintenance tasks to keep the
repository in a healthy state.

With partial clone, sparse checkout and `git maintenance` having been
upstreamed, there is little left that `scalar.exe` does which `git.exe`
cannot do. One such thing is that `scalar clone <url>` will
automatically set up a partial, sparse clone, and configure
known-helpful settings from the start.

So let's bring this convenience into Git's tree.

The idea here is that you can (optionally) build Scalar via

	make -C contrib/scalar/

This will build the `scalar` executable and put it into the
contrib/scalar/ subdirectory.

The slightly awkward addition of the `contrib/scalar/*` bits to the
top-level `Makefile` are actually really required: we want to link to
`libgit.a`, which means that we will need to use the very same `CFLAGS`
and `LDFLAGS` as the rest of Git.

An early development version of this patch tried to replicate all the
conditional code in `contrib/scalar/Makefile` (e.g. `NO_POLL`) just like
`contrib/svn-fe/Makefile` used to do before it was retired. It turned
out to be quite the whack-a-mole game: the SHA-1-related flags, the
flags enabling/disabling `compat/poll/`, `compat/regex/`,
`compat/win32mmap.c` & friends depending on the current platform... To
put it mildly: it was a major mess.

Instead, this patch makes minimal changes to the top-level `Makefile` so
that the bits in `contrib/scalar/` can be compiled and linked, and
adds a `contrib/scalar/Makefile` that uses the top-level `Makefile` in a
most minimal way to do the actual compiling.

Note: With this commit, we only establish the infrastructure, no
Scalar functionality is implemented yet; We will do that incrementally
over the next few commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                  |  9 +++++++++
 contrib/scalar/.gitignore |  2 ++
 contrib/scalar/Makefile   | 34 ++++++++++++++++++++++++++++++++++
 contrib/scalar/scalar.c   | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 81 insertions(+)
 create mode 100644 contrib/scalar/.gitignore
 create mode 100644 contrib/scalar/Makefile
 create mode 100644 contrib/scalar/scalar.c

diff --git a/Makefile b/Makefile
index 12be39ac497..fe898aeea08 100644
--- a/Makefile
+++ b/Makefile
@@ -2456,6 +2456,11 @@ OBJECTS += $(FUZZ_OBJS)
 ifndef NO_CURL
 	OBJECTS += http.o http-walker.o remote-curl.o
 endif
+
+SCALAR_SOURCES := contrib/scalar/scalar.c
+SCALAR_OBJECTS := $(SCALAR_SOURCES:c=o)
+OBJECTS += $(SCALAR_OBJECTS)
+
 .PHONY: objects
 objects: $(OBJECTS)
 
@@ -2589,6 +2594,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
 
+contrib/scalar/scalar$X: $(SCALAR_OBJECTS) GIT-LDFLAGS $(GITLIBS)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
+		$(filter %.o,$^) $(LIBS)
+
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
diff --git a/contrib/scalar/.gitignore b/contrib/scalar/.gitignore
new file mode 100644
index 00000000000..ff3d47e84d0
--- /dev/null
+++ b/contrib/scalar/.gitignore
@@ -0,0 +1,2 @@
+/*.exe
+/scalar
diff --git a/contrib/scalar/Makefile b/contrib/scalar/Makefile
new file mode 100644
index 00000000000..f6f0036f0fa
--- /dev/null
+++ b/contrib/scalar/Makefile
@@ -0,0 +1,34 @@
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring s,$(MAKEFLAGS)),s)
+ifndef V
+	QUIET_SUBDIR0  = +@subdir=
+	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+			 $(MAKE) $(PRINT_DIR) -C $$subdir
+else
+	export V
+endif
+endif
+
+all:
+
+include ../../config.mak.uname
+-include ../../config.mak.autogen
+-include ../../config.mak
+
+TARGETS = scalar$(X) scalar.o
+GITLIBS = ../../common-main.o ../../libgit.a ../../xdiff/lib.a
+
+all: scalar$(X)
+
+$(GITLIBS):
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(subst ../../,,$@)
+
+$(TARGETS): $(GITLIBS) scalar.c
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(patsubst %,contrib/scalar/%,$@)
+
+clean:
+	$(RM) $(TARGETS)
+
+.PHONY: $(GITLIBS) all clean FORCE
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c
new file mode 100644
index 00000000000..7cff29e0fcd
--- /dev/null
+++ b/contrib/scalar/scalar.c
@@ -0,0 +1,36 @@
+/*
+ * The Scalar command-line interface.
+ */
+
+#include "cache.h"
+#include "gettext.h"
+#include "parse-options.h"
+
+static struct {
+	const char *name;
+	int (*fn)(int, const char **);
+} builtins[] = {
+	{ NULL, NULL},
+};
+
+int cmd_main(int argc, const char **argv)
+{
+	struct strbuf scalar_usage = STRBUF_INIT;
+	int i;
+
+	if (argc > 1) {
+		argv++;
+		argc--;
+
+		for (i = 0; builtins[i].name; i++)
+			if (!strcmp(builtins[i].name, argv[0]))
+				return !!builtins[i].fn(argc, argv);
+	}
+
+	strbuf_addstr(&scalar_usage,
+		      N_("scalar <command> [<options>]\n\nCommands:\n"));
+	for (i = 0; builtins[i].name; i++)
+		strbuf_addf(&scalar_usage, "\t%s\n", builtins[i].name);
+
+	usage(scalar_usage.buf);
+}
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* [PATCH v8 02/17] scalar: create a rudimentary executable
  @ 2021-11-19 23:03  5%               ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2021-11-19 23:03 UTC (permalink / raw)
  To: git
  Cc: Derrick Stolee, Eric Sunshine,
	Ævar Arnfjörð Bjarmason, Elijah Newren,
	Bagas Sanjaya, Theodore Ts'o, Matt Rogers,
	Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The idea of Scalar (https://github.com/microsoft/scalar), and before
that, of VFS for Git, has always been to prove that Git _can_ scale, and
to upstream whatever strategies have been demonstrated to help.

With this patch, we start the journey from that C# project to move what
is left to Git's own `contrib/` directory, reimplementing it in pure C,
with the intention to facilitate integrating the functionality into core
Git all while maintaining backwards-compatibility for existing Scalar
users (which will be much easier when both live in the same worktree).
It has always been the plan to contribute all of the proven strategies
back to core Git.

For example, while the virtual filesystem provided by VFS for Git helped
the team developing the Windows operating system to move onto Git, while
trying to upstream it we realized that it cannot be done: getting the
virtual filesystem to work (which we only managed to implement fully on
Windows, but not on, say, macOS or Linux), and the required server-side
support for the GVFS protocol, made this not quite feasible.

The Scalar project learned from that and tackled the problem with
different tactics: instead of pretending to Git that the working
directory is fully populated, it _specifically_ teaches Git about
partial clone (which is based on VFS for Git's cache server), about
sparse checkout (which VFS for Git tried to do transparently, in the
file system layer), and regularly runs maintenance tasks to keep the
repository in a healthy state.

With partial clone, sparse checkout and `git maintenance` having been
upstreamed, there is little left that `scalar.exe` does which `git.exe`
cannot do. One such thing is that `scalar clone <url>` will
automatically set up a partial, sparse clone, and configure
known-helpful settings from the start.

So let's bring this convenience into Git's tree.

The idea here is that you can (optionally) build Scalar via

	make -C contrib/scalar/

This will build the `scalar` executable and put it into the
contrib/scalar/ subdirectory.

The slightly awkward addition of the `contrib/scalar/*` bits to the
top-level `Makefile` are actually really required: we want to link to
`libgit.a`, which means that we will need to use the very same `CFLAGS`
and `LDFLAGS` as the rest of Git.

An early development version of this patch tried to replicate all the
conditional code in `contrib/scalar/Makefile` (e.g. `NO_POLL`) just like
`contrib/svn-fe/Makefile` used to do before it was retired. It turned
out to be quite the whack-a-mole game: the SHA-1-related flags, the
flags enabling/disabling `compat/poll/`, `compat/regex/`,
`compat/win32mmap.c` & friends depending on the current platform... To
put it mildly: it was a major mess.

Instead, this patch makes minimal changes to the top-level `Makefile` so
that the bits in `contrib/scalar/` can be compiled and linked, and
adds a `contrib/scalar/Makefile` that uses the top-level `Makefile` in a
most minimal way to do the actual compiling.

Note: With this commit, we only establish the infrastructure, no
Scalar functionality is implemented yet; We will do that incrementally
over the next few commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                  |  9 +++++++++
 contrib/scalar/.gitignore |  2 ++
 contrib/scalar/Makefile   | 34 ++++++++++++++++++++++++++++++++++
 contrib/scalar/scalar.c   | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 81 insertions(+)
 create mode 100644 contrib/scalar/.gitignore
 create mode 100644 contrib/scalar/Makefile
 create mode 100644 contrib/scalar/scalar.c

diff --git a/Makefile b/Makefile
index 12be39ac497..fe898aeea08 100644
--- a/Makefile
+++ b/Makefile
@@ -2456,6 +2456,11 @@ OBJECTS += $(FUZZ_OBJS)
 ifndef NO_CURL
 	OBJECTS += http.o http-walker.o remote-curl.o
 endif
+
+SCALAR_SOURCES := contrib/scalar/scalar.c
+SCALAR_OBJECTS := $(SCALAR_SOURCES:c=o)
+OBJECTS += $(SCALAR_OBJECTS)
+
 .PHONY: objects
 objects: $(OBJECTS)
 
@@ -2589,6 +2594,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
 
+contrib/scalar/scalar$X: $(SCALAR_OBJECTS) GIT-LDFLAGS $(GITLIBS)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
+		$(filter %.o,$^) $(LIBS)
+
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
diff --git a/contrib/scalar/.gitignore b/contrib/scalar/.gitignore
new file mode 100644
index 00000000000..ff3d47e84d0
--- /dev/null
+++ b/contrib/scalar/.gitignore
@@ -0,0 +1,2 @@
+/*.exe
+/scalar
diff --git a/contrib/scalar/Makefile b/contrib/scalar/Makefile
new file mode 100644
index 00000000000..f6f0036f0fa
--- /dev/null
+++ b/contrib/scalar/Makefile
@@ -0,0 +1,34 @@
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring s,$(MAKEFLAGS)),s)
+ifndef V
+	QUIET_SUBDIR0  = +@subdir=
+	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+			 $(MAKE) $(PRINT_DIR) -C $$subdir
+else
+	export V
+endif
+endif
+
+all:
+
+include ../../config.mak.uname
+-include ../../config.mak.autogen
+-include ../../config.mak
+
+TARGETS = scalar$(X) scalar.o
+GITLIBS = ../../common-main.o ../../libgit.a ../../xdiff/lib.a
+
+all: scalar$(X)
+
+$(GITLIBS):
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(subst ../../,,$@)
+
+$(TARGETS): $(GITLIBS) scalar.c
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(patsubst %,contrib/scalar/%,$@)
+
+clean:
+	$(RM) $(TARGETS)
+
+.PHONY: $(GITLIBS) all clean FORCE
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c
new file mode 100644
index 00000000000..7cff29e0fcd
--- /dev/null
+++ b/contrib/scalar/scalar.c
@@ -0,0 +1,36 @@
+/*
+ * The Scalar command-line interface.
+ */
+
+#include "cache.h"
+#include "gettext.h"
+#include "parse-options.h"
+
+static struct {
+	const char *name;
+	int (*fn)(int, const char **);
+} builtins[] = {
+	{ NULL, NULL},
+};
+
+int cmd_main(int argc, const char **argv)
+{
+	struct strbuf scalar_usage = STRBUF_INIT;
+	int i;
+
+	if (argc > 1) {
+		argv++;
+		argc--;
+
+		for (i = 0; builtins[i].name; i++)
+			if (!strcmp(builtins[i].name, argv[0]))
+				return !!builtins[i].fn(argc, argv);
+	}
+
+	strbuf_addstr(&scalar_usage,
+		      N_("scalar <command> [<options>]\n\nCommands:\n"));
+	for (i = 0; builtins[i].name; i++)
+		strbuf_addf(&scalar_usage, "\t%s\n", builtins[i].name);
+
+	usage(scalar_usage.buf);
+}
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* Re: Libification project (SoC)
    2007-03-18 14:08  5%               ` Petr Baudis
@ 2007-03-16 18:20  5%               ` Marco Costalba
    1 sibling, 1 reply; 200+ results
From: Marco Costalba @ 2007-03-16 18:20 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Rocco Rutte, git

On 3/16/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> > Porting things like qgit to it or writting proper perl/python bindings
> > is wasted time since you'd have to rewrite all of it once you decided
> > which functions to expose and which structures to use (calling the
> > main() routines of builtin's doesn't count as real libifaction, it would
> > rather be a performance improvement only).
>
> Nope. It is _not_ a complete rewrite. More likely, it is minimal
> adjustments. It's not like we will replace apples with cars...
>

IMHO probably the truth is in the middle. I wouldn't call it a trivial
porting, at least for me, but anyway it would be interesting to have
fun with linking libgit.

*The most important thing for a libgit to be used by qgit is reentrancy*

Currently an unlimited number of tabs could be open in qgit, I'm not
talking about tabs open on different repos, but different views on the
same repo: main view, file history of file A, file history of file B,
tree view, i.e. select some files/directory from directory tree and
view the revisions that modified that repo subset, and so on. Other
different views could be added in the future. Because each view has a
dedicated tab and each tab calls _his_ 'git rev-list' instance (could
be called also at the same time) this libgit thing should be able to
support many instance of the libified git-rev-list function running at
the same time.

Perhaps currently this need is only for qgit among the GUI browsers,
but it would be not too difficult to foreseen a multi view GUI
interface as a relative common feature in the future also for the
remaining crop of git tools.

    Marco

^ permalink raw reply	[relevance 5%]

* Re: [PATCH 07/12] Git.pm: Better error handling
  @ 2006-06-24  8:37  5%   ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2006-06-24  8:37 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Petr Baudis <pasky@suse.cz> writes:

> +int
> +error_xs(const char *err, va_list params)
> +{

You said in git-compat-util.h that set_error_routine takes a
function that returns void, so this gives unnecessary type
clash.

--------------------------------
In file included from /usr/lib/perl/5.8/CORE/perl.h:756,
                 from Git.xs:15:
/usr/lib/perl/5.8/CORE/embed.h:4193:1: warning: "die" redefined
Git.xs:11:1: warning: this is the location of the previous definition
Git.xs: In function 'boot_Git':
Git.xs:57: warning: passing argument 1 of 'set_error_routine' from incompatible pointer type
Git.xs:58: warning: passing argument 1 of 'set_die_routine' makes qualified function pointer from unqualified
--------------------------------

Other troubles I saw with the v4 series while compiling:

--------------------------------
usage.c:35: warning: initialization makes qualified function pointer from unqualified
usage.c:36: warning: initialization makes qualified function pointer from unqualified

I'd fix it with this

diff --git a/usage.c b/usage.c
index b781b00..52c2e96 100644
--- a/usage.c
+++ b/usage.c
@@ -12,19 +12,19 @@ static void report(const char *prefix, c
 	fputs("\n", stderr);
 }
 
-void usage_builtin(const char *err)
+static NORETURN void usage_builtin(const char *err)
 {
 	fprintf(stderr, "usage: %s\n", err);
 	exit(129);
 }
 
-void die_builtin(const char *err, va_list params)
+static NORETURN void die_builtin(const char *err, va_list params)
 {
 	report("fatal: ", err, params);
 	exit(128);
 }
 
-void error_builtin(const char *err, va_list params)
+static void error_builtin(const char *err, va_list params)
 {
 	report("error: ", err, params);
 }

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

(cd perl && /usr/bin/perl Makefile.PL \
                PREFIX="/home/junio/git-test" \
                DEFINE="-O2 -Wall -Wdeclaration-after-statement
                -g -DSHA1_HEADER='<openssl/sha.h>'
                -DGIT_VERSION=\\\"1.4.1.rc1.gab0df\\\"" \
                LIBS="libgit.a xdiff/lib.a -lz  -lcrypto")
Unrecognized argument in LIBS ignored: 'libgit.a'
Unrecognized argument in LIBS ignored: 'xdiff/lib.a'

Do you need to pass LIBS, and if so maybe this is not a way
Makefile.PL expects it to be passed perhaps?

--------------------------------
Makefile out-of-date with respect to Makefile.PL
Cleaning current config before rebuilding Makefile...
make -f Makefile.old clean > /dev/null 2>&1
/usr/bin/perl Makefile.PL "PREFIX=/home/junio/git-test" "DEFINE=-O2 -Wall -Wdeclaration-after-statement -g -DSHA1_HEADER='<openssl/sha.h>'  -DGIT_VERSION=\"1.4.1.rc1.gab0df\"" "LIBS=libgit.a xdiff/lib.a -lz  -lcrypto"
Unrecognized argument in LIBS ignored: 'libgit.a'
Unrecognized argument in LIBS ignored: 'xdiff/lib.a'
Writing Makefile for Git
==> Your Makefile has been rebuilt. <==
==> Please rerun the make command.  <==
false
make[1]: *** [Makefile] Error 1
--------------------------------

The latter is what Perl's build mechanism does so it is not
strictly your fault, but it nevertheless is irritating that we
have to say make clean twice.

^ permalink raw reply related	[relevance 5%]

* [PATCH v7 02/17] scalar: create a rudimentary executable
  @ 2021-11-17 14:19  5%             ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2021-11-17 14:19 UTC (permalink / raw)
  To: git
  Cc: Derrick Stolee, Eric Sunshine,
	Ævar Arnfjörð Bjarmason, Elijah Newren,
	Bagas Sanjaya, Theodore Ts'o, Johannes Schindelin,
	Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The idea of Scalar (https://github.com/microsoft/scalar), and before
that, of VFS for Git, has always been to prove that Git _can_ scale, and
to upstream whatever strategies have been demonstrated to help.

With this patch, we start the journey from that C# project to move what
is left to Git's own `contrib/` directory, reimplementing it in pure C,
with the intention to facilitate integrating the functionality into core
Git all while maintaining backwards-compatibility for existing Scalar
users (which will be much easier when both live in the same worktree).
It has always been the plan to contribute all of the proven strategies
back to core Git.

For example, while the virtual filesystem provided by VFS for Git helped
the team developing the Windows operating system to move onto Git, while
trying to upstream it we realized that it cannot be done: getting the
virtual filesystem to work (which we only managed to implement fully on
Windows, but not on, say, macOS or Linux), and the required server-side
support for the GVFS protocol, made this not quite feasible.

The Scalar project learned from that and tackled the problem with
different tactics: instead of pretending to Git that the working
directory is fully populated, it _specifically_ teaches Git about
partial clone (which is based on VFS for Git's cache server), about
sparse checkout (which VFS for Git tried to do transparently, in the
file system layer), and regularly runs maintenance tasks to keep the
repository in a healthy state.

With partial clone, sparse checkout and `git maintenance` having been
upstreamed, there is little left that `scalar.exe` does which `git.exe`
cannot do. One such thing is that `scalar clone <url>` will
automatically set up a partial, sparse clone, and configure
known-helpful settings from the start.

So let's bring this convenience into Git's tree.

The idea here is that you can (optionally) build Scalar via

	make -C contrib/scalar/

This will build the `scalar` executable and put it into the
contrib/scalar/ subdirectory.

The slightly awkward addition of the `contrib/scalar/*` bits to the
top-level `Makefile` are actually really required: we want to link to
`libgit.a`, which means that we will need to use the very same `CFLAGS`
and `LDFLAGS` as the rest of Git.

An early development version of this patch tried to replicate all the
conditional code in `contrib/scalar/Makefile` (e.g. `NO_POLL`) just like
`contrib/svn-fe/Makefile` used to do before it was retired. It turned
out to be quite the whack-a-mole game: the SHA-1-related flags, the
flags enabling/disabling `compat/poll/`, `compat/regex/`,
`compat/win32mmap.c` & friends depending on the current platform... To
put it mildly: it was a major mess.

Instead, this patch makes minimal changes to the top-level `Makefile` so
that the bits in `contrib/scalar/` can be compiled and linked, and
adds a `contrib/scalar/Makefile` that uses the top-level `Makefile` in a
most minimal way to do the actual compiling.

Note: With this commit, we only establish the infrastructure, no
Scalar functionality is implemented yet; We will do that incrementally
over the next few commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                  |  9 +++++++++
 contrib/scalar/.gitignore |  2 ++
 contrib/scalar/Makefile   | 34 ++++++++++++++++++++++++++++++++++
 contrib/scalar/scalar.c   | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 81 insertions(+)
 create mode 100644 contrib/scalar/.gitignore
 create mode 100644 contrib/scalar/Makefile
 create mode 100644 contrib/scalar/scalar.c

diff --git a/Makefile b/Makefile
index 12be39ac497..fe898aeea08 100644
--- a/Makefile
+++ b/Makefile
@@ -2456,6 +2456,11 @@ OBJECTS += $(FUZZ_OBJS)
 ifndef NO_CURL
 	OBJECTS += http.o http-walker.o remote-curl.o
 endif
+
+SCALAR_SOURCES := contrib/scalar/scalar.c
+SCALAR_OBJECTS := $(SCALAR_SOURCES:c=o)
+OBJECTS += $(SCALAR_OBJECTS)
+
 .PHONY: objects
 objects: $(OBJECTS)
 
@@ -2589,6 +2594,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
 
+contrib/scalar/scalar$X: $(SCALAR_OBJECTS) GIT-LDFLAGS $(GITLIBS)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
+		$(filter %.o,$^) $(LIBS)
+
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
diff --git a/contrib/scalar/.gitignore b/contrib/scalar/.gitignore
new file mode 100644
index 00000000000..ff3d47e84d0
--- /dev/null
+++ b/contrib/scalar/.gitignore
@@ -0,0 +1,2 @@
+/*.exe
+/scalar
diff --git a/contrib/scalar/Makefile b/contrib/scalar/Makefile
new file mode 100644
index 00000000000..f6f0036f0fa
--- /dev/null
+++ b/contrib/scalar/Makefile
@@ -0,0 +1,34 @@
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring s,$(MAKEFLAGS)),s)
+ifndef V
+	QUIET_SUBDIR0  = +@subdir=
+	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+			 $(MAKE) $(PRINT_DIR) -C $$subdir
+else
+	export V
+endif
+endif
+
+all:
+
+include ../../config.mak.uname
+-include ../../config.mak.autogen
+-include ../../config.mak
+
+TARGETS = scalar$(X) scalar.o
+GITLIBS = ../../common-main.o ../../libgit.a ../../xdiff/lib.a
+
+all: scalar$(X)
+
+$(GITLIBS):
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(subst ../../,,$@)
+
+$(TARGETS): $(GITLIBS) scalar.c
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(patsubst %,contrib/scalar/%,$@)
+
+clean:
+	$(RM) $(TARGETS)
+
+.PHONY: $(GITLIBS) all clean FORCE
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c
new file mode 100644
index 00000000000..7cff29e0fcd
--- /dev/null
+++ b/contrib/scalar/scalar.c
@@ -0,0 +1,36 @@
+/*
+ * The Scalar command-line interface.
+ */
+
+#include "cache.h"
+#include "gettext.h"
+#include "parse-options.h"
+
+static struct {
+	const char *name;
+	int (*fn)(int, const char **);
+} builtins[] = {
+	{ NULL, NULL},
+};
+
+int cmd_main(int argc, const char **argv)
+{
+	struct strbuf scalar_usage = STRBUF_INIT;
+	int i;
+
+	if (argc > 1) {
+		argv++;
+		argc--;
+
+		for (i = 0; builtins[i].name; i++)
+			if (!strcmp(builtins[i].name, argv[0]))
+				return !!builtins[i].fn(argc, argv);
+	}
+
+	strbuf_addstr(&scalar_usage,
+		      N_("scalar <command> [<options>]\n\nCommands:\n"));
+	for (i = 0; builtins[i].name; i++)
+		strbuf_addf(&scalar_usage, "\t%s\n", builtins[i].name);
+
+	usage(scalar_usage.buf);
+}
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* Compilation troubles
@ 2005-07-12 18:33  5% Dan Kohn
  0 siblings, 0 replies; 200+ results
From: Dan Kohn @ 2005-07-12 18:33 UTC (permalink / raw)
  To: git

I apologize for what are probably obvious compilation questions, but I
suspect other newbies are encountering them as well.  I'm having trouble
installing cogito 0.12.1 on both a vanilla Ubuntu box and on my account
on a FreeBSD machine.  I'm used to autoconf-built programs, so there's
probably just some simple library path I'm not setting up right.  But
I'd appreciate your suggestions, and perhaps we can add the answer to
the INSTALL file.

UBUNTU 5.04

I used synaptics to install openssl, zlib, and curl, but cogito can't
seem to see them.

root@ubuntu-dan-kohn:/usr/local/src/cogito-0.12.1 # make
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o read-cache.o
read-cache.c
In file included from read-cache.c:6:
cache.h:21:21: openssl/sha.h: No such file or directory
cache.h:22:18: zlib.h: No such file or directory
In file included from read-cache.c:6:
cache.h:169: error: syntax error before '*' token
read-cache.c: In function `verify_hdr':
read-cache.c:339: error: `SHA_CTX' undeclared (first use in this
function)
read-cache.c:339: error: (Each undeclared identifier is reported only
once
read-cache.c:339: error: for each function it appears in.)
read-cache.c:339: error: syntax error before "c"
read-cache.c:346: warning: implicit declaration of function `SHA1_Init'
read-cache.c:346: error: `c' undeclared (first use in this function)
read-cache.c:347: warning: implicit declaration of function
`SHA1_Update'
read-cache.c:348: warning: implicit declaration of function `SHA1_Final'
read-cache.c: At top level:
read-cache.c:408: error: syntax error before '*' token
read-cache.c: In function `ce_write':
read-cache.c:410: error: `len' undeclared (first use in this function)
read-cache.c:415: error: `data' undeclared (first use in this function)
read-cache.c:418: error: `context' undeclared (first use in this
function)
read-cache.c:419: error: `fd' undeclared (first use in this function)
read-cache.c: At top level:
read-cache.c:430: error: syntax error before '*' token
read-cache.c: In function `ce_flush':
read-cache.c:436: error: `context' undeclared (first use in this
function)
read-cache.c:442: error: `fd' undeclared (first use in this function)
read-cache.c: In function `write_cache':
read-cache.c:449: error: `SHA_CTX' undeclared (first use in this
function)
read-cache.c:449: error: syntax error before "c"
read-cache.c:461: error: `c' undeclared (first use in this function)
make: *** [read-cache.o] Error 1
root@ubuntu-dan-kohn:/usr/local/src/cogito-0.12.1 # locate openssl
/etc/ssl/openssl.cnf
[long list of python and docs elided]
/usr/share/man/man1/openssl.1ssl.gz
/usr/bin/openssl
/usr/bin/openssl_fips_fingerprint
/usr/lib/libgnutls-openssl.so.11.1.16
/usr/lib/libgnutls-openssl.so.11
/usr/lib/ssl/openssl.cnf
/usr/local/ssl/man/man1/openssl.1
/usr/local/ssl/bin/openssl
/usr/local/ssl/lib/pkgconfig/openssl.pc
/usr/local/ssl/include/openssl
/usr/local/ssl/include/openssl/e_os2.h
/usr/local/ssl/include/openssl/crypto.h
/usr/local/ssl/include/openssl/tmdiff.h
/usr/local/ssl/include/openssl/opensslv.h
/usr/local/ssl/include/openssl/opensslconf.h
/usr/local/ssl/include/openssl/ebcdic.h
/usr/local/ssl/include/openssl/symhacks.h
/usr/local/ssl/include/openssl/ossl_typ.h
/usr/local/ssl/include/openssl/objects.h
/usr/local/ssl/include/openssl/obj_mac.h
/usr/local/ssl/include/openssl/md2.h
/usr/local/ssl/include/openssl/md4.h
/usr/local/ssl/include/openssl/md5.h
/usr/local/ssl/include/openssl/sha.h
/usr/local/ssl/include/openssl/hmac.h
/usr/local/ssl/include/openssl/ripemd.h
/usr/local/ssl/include/openssl/des.h
/usr/local/ssl/include/openssl/des_old.h
/usr/local/ssl/include/openssl/aes.h
/usr/local/ssl/include/openssl/rc2.h
/usr/local/ssl/include/openssl/rc4.h
/usr/local/ssl/include/openssl/idea.h
/usr/local/ssl/include/openssl/blowfish.h
/usr/local/ssl/include/openssl/cast.h
/usr/local/ssl/include/openssl/bn.h
/usr/local/ssl/include/openssl/ec.h
/usr/local/ssl/include/openssl/rsa.h
/usr/local/ssl/include/openssl/dsa.h
/usr/local/ssl/include/openssl/ecdsa.h
/usr/local/ssl/include/openssl/dh.h
/usr/local/ssl/include/openssl/ecdh.h
/usr/local/ssl/include/openssl/dso.h
/usr/local/ssl/include/openssl/engine.h
/usr/local/ssl/include/openssl/buffer.h
/usr/local/ssl/include/openssl/bio.h
/usr/local/ssl/include/openssl/stack.h
/usr/local/ssl/include/openssl/safestack.h
/usr/local/ssl/include/openssl/lhash.h
/usr/local/ssl/include/openssl/rand.h
/usr/local/ssl/include/openssl/err.h
/usr/local/ssl/include/openssl/evp.h
/usr/local/ssl/include/openssl/asn1.h
/usr/local/ssl/include/openssl/asn1_mac.h
/usr/local/ssl/include/openssl/asn1t.h
/usr/local/ssl/include/openssl/pem.h
/usr/local/ssl/include/openssl/pem2.h
/usr/local/ssl/include/openssl/x509.h
/usr/local/ssl/include/openssl/x509_vfy.h
/usr/local/ssl/include/openssl/x509v3.h
/usr/local/ssl/include/openssl/conf.h
/usr/local/ssl/include/openssl/conf_api.h
/usr/local/ssl/include/openssl/txt_db.h
/usr/local/ssl/include/openssl/pkcs7.h
/usr/local/ssl/include/openssl/pkcs12.h
/usr/local/ssl/include/openssl/comp.h
/usr/local/ssl/include/openssl/ocsp.h
/usr/local/ssl/include/openssl/ui.h
/usr/local/ssl/include/openssl/ui_compat.h
/usr/local/ssl/include/openssl/krb5_asn.h
/usr/local/ssl/include/openssl/store.h
/usr/local/ssl/include/openssl/pqueue.h
/usr/local/ssl/include/openssl/pq_compat.h
/usr/local/ssl/include/openssl/ssl.h
/usr/local/ssl/include/openssl/ssl2.h
/usr/local/ssl/include/openssl/ssl3.h
/usr/local/ssl/include/openssl/ssl23.h
/usr/local/ssl/include/openssl/tls1.h
/usr/local/ssl/include/openssl/dtls1.h
/usr/local/ssl/include/openssl/kssl.h
/usr/local/ssl/openssl.cnf
root@ubuntu-dan-kohn:/usr/local/src/cogito-0.12.1 # locate zlib
1.9.79/program/python-core-2.3.4/lib/encodings/zlib_codec.py
1.9.79/program/python-core-2.3.4/lib/test/test_zlib.py
/media/windows/Program Files/Trillian/zlib1.dll
/var/lib/dpkg/info/zlib1g.postinst
/var/lib/dpkg/info/zlib1g.list
/var/lib/dpkg/info/zlib1g.preinst
/var/lib/dpkg/info/zlib1g.shlibs
/var/lib/dpkg/info/zlib1g.md5sums
/var/cache/apt/archives/zlib1g_1%3a1.2.2-4ubuntu1.1_i386.deb
/usr/share/doc/zlib1g
/usr/share/doc/zlib1g/changelog.gz
/usr/share/doc/zlib1g/README.gz
/usr/share/doc/zlib1g/README.Debian
/usr/share/doc/zlib1g/copyright
/usr/share/doc/zlib1g/changelog.Debian.gz
/usr/share/doc/python2.4/examples/Demo/zlib
/usr/share/doc/python2.4/examples/Demo/zlib/minigzip.py
/usr/share/doc/python2.4/examples/Demo/zlib/zlibdemo.py
/usr/include/linux/zlib.h
/usr/lib/python2.4/lib-dynload/zlib.so
/usr/lib/python2.4/encodings/zlib_codec.py
/usr/lib/python2.4/encodings/zlib_codec.pyc
/usr/lib/python2.4/encodings/zlib_codec.pyo
/usr/lib/win32/avizlib.dll
/lib/modules/2.6.10-5-386/kernel/lib/zlib_deflate
/lib/modules/2.6.10-5-386/kernel/lib/zlib_deflate/zlib_deflate.ko
root@ubuntu-dan-kohn:/usr/local/src/cogito-0.12.1 #




FREEBSD

I believe I need to modify the Makefile to find my libcurl, but I don't
know how.  Also, it's probably worth mentioning in INSTALL that gmake is
necessary, for those machines that have both.

[emlis:~/src/cogito-0.12.1]$ make
"Makefile", line 109: Need an operator
"Makefile", line 112: Need an operator
"Makefile", line 115: Need an operator
"Makefile", line 116: Need an operator
"Makefile", line 119: Need an operator
"Makefile", line 120: Need an operator
"Makefile", line 123: Need an operator
"Makefile", line 126: Need an operator
"Makefile", line 127: Need an operator
"Makefile", line 162: Missing dependency operator
"Makefile", line 165: Need an operator
make: fatal errors encountered -- cannot continue
[emlis:~/src/cogito-0.12.1]$ gmake
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o read-cache.o
read-cache.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o sha1_file.o
sha1_file.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o usage.o usage.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o object.o
object.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o commit.o
commit.c
commit.c: In function `add_user_info':
commit.c:244: warning: field width is not type int (arg 4)
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o tree.o tree.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o blob.o blob.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o tag.o tag.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o date.o date.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o index.o index.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o diff-delta.o
diff-delta.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o patch-delta.o
patch-delta.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o entry.o entry.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o path.o path.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o epoch.o epoch.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o refs.o refs.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o csum-file.o
csum-file.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o pack-check.o
pack-check.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o pkt-line.o
pkt-line.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o connect.o
connect.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o strbuf.o
strbuf.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o quote.o quote.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o diff.o diff.c
diff.c: In function `parse_num':
diff.c:702: warning: value computed is not used
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o
diffcore-rename.o diffcore-rename.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o
diffcore-pickaxe.o diffcore-pickaxe.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o
diffcore-pathspec.o diffcore-pathspec.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o
diffcore-break.o diffcore-break.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o
diffcore-order.o diffcore-order.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o count-delta.o
count-delta.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o gitenv.o
gitenv.c
ar rcs libgit.a read-cache.o sha1_file.o usage.o object.o commit.o
tree.o blob.o tag.o date.o index.o diff-delta.o patch-delta.o entry.o
path.o epoch.o refs.o csum-file.o pack-check.o pkt-line.o connect.o
strbuf.o quote.o  diff.o diffcore-rename.o diffcore-pickaxe.o
diffcore-pathspec.o diffcore-break.o diffcore-order.o count-delta.o
gitenv.o epoch.o
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o update-cache.o
update-cache.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-update-cache
update-cache.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o diff-files.o
diff-files.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-diff-files
diff-files.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o init-db.o
init-db.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-init-db
init-db.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o write-tree.o
write-tree.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-write-tree
write-tree.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o read-tree.o
read-tree.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-read-tree
read-tree.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o commit-tree.o
commit-tree.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-commit-tree
commit-tree.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o cat-file.o
cat-file.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-cat-file
cat-file.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o fsck-cache.o
fsck-cache.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-fsck-cache
fsck-cache.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o
checkout-cache.o checkout-cache.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-checkout-cache
checkout-cache.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o diff-tree.o
diff-tree.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-diff-tree
diff-tree.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o rev-tree.o
rev-tree.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-rev-tree
rev-tree.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o ls-files.o
ls-files.c
ls-files.c: In function `show_files':
ls-files.c:270: warning: unsigned int format, u_long arg (arg 3)
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-ls-files
ls-files.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o check-files.o
check-files.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-check-files
check-files.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o ls-tree.o
ls-tree.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-ls-tree
ls-tree.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o merge-base.o
merge-base.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-merge-base
merge-base.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o merge-cache.o
merge-cache.c
merge-cache.c: In function `merge_entry':
merge-cache.c:62: warning: unsigned int format, long unsigned int arg
(arg 3)
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-merge-cache
merge-cache.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o unpack-file.o
unpack-file.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-unpack-file
unpack-file.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o export.o
export.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-export export.o
libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o diff-cache.o
diff-cache.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-diff-cache
diff-cache.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o convert-cache.o
convert-cache.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>' -o git-convert-cache
convert-cache.o libgit.a -lz -lcrypto
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o pull.o pull.c
cc -g -O2 -Wall  '-DSHA1_HEADER=<openssl/sha.h>'   -c -o http-pull.o
http-pull.c
http-pull.c:6: curl/curl.h: No such file or directory
http-pull.c:7: curl/easy.h: No such file or directory
gmake: *** [http-pull.o] Error 1
rm cat-file.o diff-files.o rev-tree.o fsck-cache.o convert-cache.o
unpack-file.o diff-cache.o checkout-cache.o update-cache.o diff-tree.o
export.o read-tree.o write-tree.o merge-base.o ls-tree.o check-files.o
commit-tree.o merge-cache.o ls-files.o init-db.o
[emlis:~/src/cogito-0.12.1]$ which curl
/usr/local/bin/curl
[emlis:~/src/cogito-0.12.1]$ locate libcurl
/usr/local/lib/comprex/scheme/libcurlscm.a
/usr/local/lib/comprex/scheme/libcurlscm.la
/usr/local/lib/comprex/scheme/libcurlscm.so
/usr/local/lib/libcurl.a
/usr/local/lib/libcurl.la
/usr/local/lib/libcurl.so
/usr/local/lib/libcurl.so.2
/usr/local/man/man3/libcurl-errors.3
/usr/local/man/man3/libcurl-multi.3
/usr/local/man/man3/libcurl.3
/usr/local/share/doc/curl/libcurl
/usr/local/share/doc/curl/libcurl/Makefile
/usr/local/share/doc/curl/libcurl/Makefile.am
/usr/local/share/doc/curl/libcurl/Makefile.in
/usr/local/share/doc/curl/libcurl/curl_easy_cleanup.3
/usr/local/share/doc/curl/libcurl/curl_easy_cleanup.html
/usr/local/share/doc/curl/libcurl/curl_easy_cleanup.pdf
/usr/local/share/doc/curl/libcurl/curl_easy_duphandle.3
/usr/local/share/doc/curl/libcurl/curl_easy_duphandle.html
/usr/local/share/doc/curl/libcurl/curl_easy_duphandle.pdf
/usr/local/share/doc/curl/libcurl/curl_easy_getinfo.3
/usr/local/share/doc/curl/libcurl/curl_easy_getinfo.html
/usr/local/share/doc/curl/libcurl/curl_easy_getinfo.pdf
/usr/local/share/doc/curl/libcurl/curl_easy_init.3
/usr/local/share/doc/curl/libcurl/curl_easy_init.html
/usr/local/share/doc/curl/libcurl/curl_easy_init.pdf
/usr/local/share/doc/curl/libcurl/curl_easy_perform.3
/usr/local/share/doc/curl/libcurl/curl_easy_perform.html
/usr/local/share/doc/curl/libcurl/curl_easy_perform.pdf
/usr/local/share/doc/curl/libcurl/curl_easy_setopt.3
/usr/local/share/doc/curl/libcurl/curl_easy_setopt.html
/usr/local/share/doc/curl/libcurl/curl_easy_setopt.pdf
/usr/local/share/doc/curl/libcurl/curl_escape.3
/usr/local/share/doc/curl/libcurl/curl_escape.html
/usr/local/share/doc/curl/libcurl/curl_escape.pdf
/usr/local/share/doc/curl/libcurl/curl_formadd.3
/usr/local/share/doc/curl/libcurl/curl_formadd.html
/usr/local/share/doc/curl/libcurl/curl_formadd.pdf
/usr/local/share/doc/curl/libcurl/curl_formfree.3
/usr/local/share/doc/curl/libcurl/curl_formfree.html
/usr/local/share/doc/curl/libcurl/curl_formfree.pdf
/usr/local/share/doc/curl/libcurl/curl_formparse.3
/usr/local/share/doc/curl/libcurl/curl_formparse.html
/usr/local/share/doc/curl/libcurl/curl_formparse.pdf
/usr/local/share/doc/curl/libcurl/curl_free.3
/usr/local/share/doc/curl/libcurl/curl_free.html
/usr/local/share/doc/curl/libcurl/curl_free.pdf
/usr/local/share/doc/curl/libcurl/curl_getdate.3
/usr/local/share/doc/curl/libcurl/curl_getdate.html
/usr/local/share/doc/curl/libcurl/curl_getdate.pdf
/usr/local/share/doc/curl/libcurl/curl_getenv.3
/usr/local/share/doc/curl/libcurl/curl_getenv.html
/usr/local/share/doc/curl/libcurl/curl_getenv.pdf
/usr/local/share/doc/curl/libcurl/curl_global_cleanup.3
/usr/local/share/doc/curl/libcurl/curl_global_cleanup.html
/usr/local/share/doc/curl/libcurl/curl_global_cleanup.pdf
/usr/local/share/doc/curl/libcurl/curl_global_init.3
/usr/local/share/doc/curl/libcurl/curl_global_init.html
/usr/local/share/doc/curl/libcurl/curl_global_init.pdf
/usr/local/share/doc/curl/libcurl/curl_mprintf.3
/usr/local/share/doc/curl/libcurl/curl_mprintf.html
/usr/local/share/doc/curl/libcurl/curl_mprintf.pdf
/usr/local/share/doc/curl/libcurl/curl_multi_add_handle.3
/usr/local/share/doc/curl/libcurl/curl_multi_add_handle.html
/usr/local/share/doc/curl/libcurl/curl_multi_add_handle.pdf
/usr/local/share/doc/curl/libcurl/curl_multi_cleanup.3
/usr/local/share/doc/curl/libcurl/curl_multi_cleanup.html
/usr/local/share/doc/curl/libcurl/curl_multi_cleanup.pdf
/usr/local/share/doc/curl/libcurl/curl_multi_fdset.3
/usr/local/share/doc/curl/libcurl/curl_multi_fdset.html
/usr/local/share/doc/curl/libcurl/curl_multi_fdset.pdf
/usr/local/share/doc/curl/libcurl/curl_multi_info_read.3
/usr/local/share/doc/curl/libcurl/curl_multi_info_read.html
/usr/local/share/doc/curl/libcurl/curl_multi_info_read.pdf
/usr/local/share/doc/curl/libcurl/curl_multi_init.3
/usr/local/share/doc/curl/libcurl/curl_multi_init.html
/usr/local/share/doc/curl/libcurl/curl_multi_init.pdf
/usr/local/share/doc/curl/libcurl/curl_multi_perform.3
/usr/local/share/doc/curl/libcurl/curl_multi_perform.html
/usr/local/share/doc/curl/libcurl/curl_multi_perform.pdf
/usr/local/share/doc/curl/libcurl/curl_multi_remove_handle.3
/usr/local/share/doc/curl/libcurl/curl_multi_remove_handle.html
/usr/local/share/doc/curl/libcurl/curl_multi_remove_handle.pdf
/usr/local/share/doc/curl/libcurl/curl_slist_append.3
/usr/local/share/doc/curl/libcurl/curl_slist_append.html
/usr/local/share/doc/curl/libcurl/curl_slist_append.pdf
/usr/local/share/doc/curl/libcurl/curl_slist_free_all.3
/usr/local/share/doc/curl/libcurl/curl_slist_free_all.html
/usr/local/share/doc/curl/libcurl/curl_slist_free_all.pdf
/usr/local/share/doc/curl/libcurl/curl_strequal.3
/usr/local/share/doc/curl/libcurl/curl_strequal.html
/usr/local/share/doc/curl/libcurl/curl_strequal.pdf
/usr/local/share/doc/curl/libcurl/curl_strnequal.3
/usr/local/share/doc/curl/libcurl/curl_strnequal.html
/usr/local/share/doc/curl/libcurl/curl_strnequal.pdf
/usr/local/share/doc/curl/libcurl/curl_unescape.3
/usr/local/share/doc/curl/libcurl/curl_unescape.html
/usr/local/share/doc/curl/libcurl/curl_unescape.pdf
/usr/local/share/doc/curl/libcurl/curl_version.3
/usr/local/share/doc/curl/libcurl/curl_version.html
/usr/local/share/doc/curl/libcurl/curl_version.pdf
/usr/local/share/doc/curl/libcurl/curl_version_info.3
/usr/local/share/doc/curl/libcurl/curl_version_info.html
/usr/local/share/doc/curl/libcurl/curl_version_info.pdf
/usr/local/share/doc/curl/libcurl/index.html
/usr/local/share/doc/curl/libcurl/libcurl-errors.3
/usr/local/share/doc/curl/libcurl/libcurl-errors.html
/usr/local/share/doc/curl/libcurl/libcurl-errors.pdf
/usr/local/share/doc/curl/libcurl/libcurl-multi.3
/usr/local/share/doc/curl/libcurl/libcurl-multi.html
/usr/local/share/doc/curl/libcurl/libcurl-multi.pdf
/usr/local/share/doc/curl/libcurl/libcurl.3
/usr/local/share/doc/curl/libcurl/libcurl.html
/usr/local/share/doc/curl/libcurl/libcurl.pdf
/usr/local/share/doc/curl/libcurl-the-guide
[emlis:~/src/cogito-0.12.1]$ curl-config --version
libcurl 7.10.5

          - dan
--
Dan Kohn <mailto:dan@dankohn.com>
<http://www.dankohn.com/>  <tel:+1-650-327-2600>

^ permalink raw reply	[relevance 5%]

* Re: Libification project (SoC)
  2007-03-16 21:07  5%                     ` Marco Costalba
@ 2007-03-16 23:24  5%                       ` Johannes Schindelin
  2007-03-17  7:04  5%                         ` Marco Costalba
  0 siblings, 1 reply; 200+ results
From: Johannes Schindelin @ 2007-03-16 23:24 UTC (permalink / raw)
  To: Marco Costalba; +Cc: Nicolas Pitre, Rocco Rutte, git

Hi,

On Fri, 16 Mar 2007, Marco Costalba wrote:

> On 3/16/07, Nicolas Pitre <nico@cam.org> wrote:
> > On Fri, 16 Mar 2007, Marco Costalba wrote:
> > 
> > > On 3/16/07, Marco Costalba <mcostalba@gmail.com> wrote:
> > > >
> > > > *The most important thing for a libgit to be used by qgit is 
> > > > reentrancy*
> > > >
> > >
> > > Another crtitical feature is that this call to git-rev-list-like
> > > function MUST be non-blocking.
> > 
> > I'm not sure I agree.

I am sure I don't agree.

> > The non-blockingness can be (and probably should be) handled at a 
> > higher level with your own threading facility of choice.  Making GIT 
> > restartable has the potential for making the core code much too 
> > complex.
> 
> The fact is that the solution is complex anyway, moving the complex code 
> at higher level doesn't simplify the whole issue, it just *moves* the 
> issue somewhere else.

It not only *moves* the issue somewhere else, but it also cleanly 
separates the issues.

> BTW now qgit is single-threaded (as gitk), you suggest that linking with 
> libgit it will involve to go on the multi threading side and I think you 
> are right. But it will be not that easy.

Why?

First, it _is_ multi-threaded, since it calls external programs. That is 
even more than a thread. It is a process.

Second, it _would_ be easy to just use the threads provided by Qt.

> Because we are just speaking (well, writing ;-) ) about a possible 
> library I think we could take in account what would involve to foreseen 
> a callback mechanism in the API, at least for the slowest ones.

We are talking about libgit. Which should make access to certain common 
functions on Git repositories easy. Nothing more than that.

If you need to do that asynchronously, do _not_ fiddle with libgit. Just 
imagine what this would involve: you'd have to have timeouts (since there 
is _NO_ other way to find out when to return with empty hands, instead of 
blocking), which is _not_ portable. You'd soon be in the same _mess_ we 
are talking about with respect to exceptions.

Also, you would make _all_ operations expensive, since they _would_ have 
to store state to be restartable.

The common solution for your problem _is_ to use threads.

And you have to admit that _only_ viewers would need asynchronous access 
anyway. I doubt that other tools -- which could take their advantage of a 
libgit -- would need such an access.

Ciao,
Dscho

^ permalink raw reply	[relevance 5%]

* [PATCH v6 01/15] scalar: create a rudimentary executable
  @ 2021-10-27  8:27  5%           ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2021-10-27  8:27 UTC (permalink / raw)
  To: git
  Cc: Derrick Stolee, Eric Sunshine,
	Ævar Arnfjörð Bjarmason, Elijah Newren,
	Bagas Sanjaya, Theodore Ts'o, Johannes Schindelin,
	Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The idea of Scalar (https://github.com/microsoft/scalar), and before
that, of VFS for Git, has always been to prove that Git _can_ scale, and
to upstream whatever strategies have been demonstrated to help.

With this patch, we start the journey from that C# project to move what
is left to Git's own `contrib/` directory, reimplementing it in pure C,
with the intention to facilitate integrating the functionality into core
Git all while maintaining backwards-compatibility for existing Scalar
users (which will be much easier when both live in the same worktree).
It has always been the plan to contribute all of the proven strategies
back to core Git.

For example, while the virtual filesystem provided by VFS for Git helped
the team developing the Windows operating system to move onto Git, while
trying to upstream it we realized that it cannot be done: getting the
virtual filesystem to work (which we only managed to implement fully on
Windows, but not on, say, macOS or Linux), and the required server-side
support for the GVFS protocol, made this not quite feasible.

The Scalar project learned from that and tackled the problem with
different tactics: instead of pretending to Git that the working
directory is fully populated, it _specifically_ teaches Git about
partial clone (which is based on VFS for Git's cache server), about
sparse checkout (which VFS for Git tried to do transparently, in the
file system layer), and regularly runs maintenance tasks to keep the
repository in a healthy state.

With partial clone, sparse checkout and `git maintenance` having been
upstreamed, there is little left that `scalar.exe` does which `git.exe`
cannot do. One such thing is that `scalar clone <url>` will
automatically set up a partial, sparse clone, and configure
known-helpful settings from the start.

So let's bring this convenience into Git's tree.

The idea here is that you can (optionally) build Scalar via

	make -C contrib/scalar/

This will build the `scalar` executable and put it into the
contrib/scalar/ subdirectory.

The slightly awkward addition of the `contrib/scalar/*` bits to the
top-level `Makefile` are actually really required: we want to link to
`libgit.a`, which means that we will need to use the very same `CFLAGS`
and `LDFLAGS` as the rest of Git.

An early development version of this patch tried to replicate all the
conditional code in `contrib/scalar/Makefile` (e.g. `NO_POLL`) just like
`contrib/svn-fe/Makefile` used to do before it was retired. It turned
out to be quite the whack-a-mole game: the SHA-1-related flags, the
flags enabling/disabling `compat/poll/`, `compat/regex/`,
`compat/win32mmap.c` & friends depending on the current platform... To
put it mildly: it was a major mess.

Instead, this patch makes minimal changes to the top-level `Makefile` so
that the bits in `contrib/scalar/` can be compiled and linked, and
adds a `contrib/scalar/Makefile` that uses the top-level `Makefile` in a
most minimal way to do the actual compiling.

Note: With this commit, we only establish the infrastructure, no
Scalar functionality is implemented yet; We will do that incrementally
over the next few commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                  |  9 +++++++++
 contrib/scalar/.gitignore |  2 ++
 contrib/scalar/Makefile   | 34 ++++++++++++++++++++++++++++++++++
 contrib/scalar/scalar.c   | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 81 insertions(+)
 create mode 100644 contrib/scalar/.gitignore
 create mode 100644 contrib/scalar/Makefile
 create mode 100644 contrib/scalar/scalar.c

diff --git a/Makefile b/Makefile
index c3565fc0f8f..a12cac1b68b 100644
--- a/Makefile
+++ b/Makefile
@@ -2444,6 +2444,11 @@ OBJECTS += $(FUZZ_OBJS)
 ifndef NO_CURL
 	OBJECTS += http.o http-walker.o remote-curl.o
 endif
+
+SCALAR_SOURCES := contrib/scalar/scalar.c
+SCALAR_OBJECTS := $(SCALAR_SOURCES:c=o)
+OBJECTS += $(SCALAR_OBJECTS)
+
 .PHONY: objects
 objects: $(OBJECTS)
 
@@ -2586,6 +2591,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
 
+contrib/scalar/scalar$X: $(SCALAR_OBJECTS) GIT-LDFLAGS $(GITLIBS)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
+		$(filter %.o,$^) $(LIBS)
+
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
diff --git a/contrib/scalar/.gitignore b/contrib/scalar/.gitignore
new file mode 100644
index 00000000000..ff3d47e84d0
--- /dev/null
+++ b/contrib/scalar/.gitignore
@@ -0,0 +1,2 @@
+/*.exe
+/scalar
diff --git a/contrib/scalar/Makefile b/contrib/scalar/Makefile
new file mode 100644
index 00000000000..f6f0036f0fa
--- /dev/null
+++ b/contrib/scalar/Makefile
@@ -0,0 +1,34 @@
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring s,$(MAKEFLAGS)),s)
+ifndef V
+	QUIET_SUBDIR0  = +@subdir=
+	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+			 $(MAKE) $(PRINT_DIR) -C $$subdir
+else
+	export V
+endif
+endif
+
+all:
+
+include ../../config.mak.uname
+-include ../../config.mak.autogen
+-include ../../config.mak
+
+TARGETS = scalar$(X) scalar.o
+GITLIBS = ../../common-main.o ../../libgit.a ../../xdiff/lib.a
+
+all: scalar$(X)
+
+$(GITLIBS):
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(subst ../../,,$@)
+
+$(TARGETS): $(GITLIBS) scalar.c
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(patsubst %,contrib/scalar/%,$@)
+
+clean:
+	$(RM) $(TARGETS)
+
+.PHONY: $(GITLIBS) all clean FORCE
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c
new file mode 100644
index 00000000000..7cff29e0fcd
--- /dev/null
+++ b/contrib/scalar/scalar.c
@@ -0,0 +1,36 @@
+/*
+ * The Scalar command-line interface.
+ */
+
+#include "cache.h"
+#include "gettext.h"
+#include "parse-options.h"
+
+static struct {
+	const char *name;
+	int (*fn)(int, const char **);
+} builtins[] = {
+	{ NULL, NULL},
+};
+
+int cmd_main(int argc, const char **argv)
+{
+	struct strbuf scalar_usage = STRBUF_INIT;
+	int i;
+
+	if (argc > 1) {
+		argv++;
+		argc--;
+
+		for (i = 0; builtins[i].name; i++)
+			if (!strcmp(builtins[i].name, argv[0]))
+				return !!builtins[i].fn(argc, argv);
+	}
+
+	strbuf_addstr(&scalar_usage,
+		      N_("scalar <command> [<options>]\n\nCommands:\n"));
+	for (i = 0; builtins[i].name; i++)
+		strbuf_addf(&scalar_usage, "\t%s\n", builtins[i].name);
+
+	usage(scalar_usage.buf);
+}
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* [PATCH v5 01/15] scalar: create a rudimentary executable
  @ 2021-10-07 10:58  5%         ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2021-10-07 10:58 UTC (permalink / raw)
  To: git
  Cc: Derrick Stolee, Eric Sunshine,
	Ævar Arnfjörð Bjarmason, Elijah Newren,
	Bagas Sanjaya, Theodore Ts'o, Johannes Schindelin,
	Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The idea of Scalar (https://github.com/microsoft/scalar), and before
that, of VFS for Git, has always been to prove that Git _can_ scale, and
to upstream whatever strategies have been demonstrated to help.

With this patch, we start the journey from that C# project to move what
is left to Git's own `contrib/` directory, reimplementing it in pure C,
with the intention to facilitate integrating the functionality into core
Git all while maintaining backwards-compatibility for existing Scalar
users (which will be much easier when both live in the same worktree).
It has always been the plan to contribute all of the proven strategies
back to core Git.

For example, while the virtual filesystem provided by VFS for Git helped
the team developing the Windows operating system to move onto Git, while
trying to upstream it we realized that it cannot be done: getting the
virtual filesystem to work (which we only managed to implement fully on
Windows, but not on, say, macOS or Linux), and the required server-side
support for the GVFS protocol, made this not quite feasible.

The Scalar project learned from that and tackled the problem with
different tactics: instead of pretending to Git that the working
directory is fully populated, it _specifically_ teaches Git about
partial clone (which is based on VFS for Git's cache server), about
sparse checkout (which VFS for Git tried to do transparently, in the
file system layer), and regularly runs maintenance tasks to keep the
repository in a healthy state.

With partial clone, sparse checkout and `git maintenance` having been
upstreamed, there is little left that `scalar.exe` does which `git.exe`
cannot do. One such thing is that `scalar clone <url>` will
automatically set up a partial, sparse clone, and configure
known-helpful settings from the start.

So let's bring this convenience into Git's tree.

The idea here is that you can (optionally) build Scalar via

	make -C contrib/scalar/Makefile

This will build the `scalar` executable and put it into the
contrib/scalar/ subdirectory.

The slightly awkward addition of the `contrib/scalar/*` bits to the
top-level `Makefile` are actually really required: we want to link to
`libgit.a`, which means that we will need to use the very same `CFLAGS`
and `LDFLAGS` as the rest of Git.

An early development version of this patch tried to replicate all the
conditional code in `contrib/scalar/Makefile` (e.g. `NO_POLL`) just like
`contrib/svn-fe/Makefile` used to do before it was retired. It turned
out to be quite the whack-a-mole game: the SHA-1-related flags, the
flags enabling/disabling `compat/poll/`, `compat/regex/`,
`compat/win32mmap.c` & friends depending on the current platform... To
put it mildly: it was a major mess.

Instead, this patch makes minimal changes to the top-level `Makefile` so
that the bits in `contrib/scalar/` can be compiled and linked, and
adds a `contrib/scalar/Makefile` that uses the top-level `Makefile` in a
most minimal way to do the actual compiling.

Note: With this commit, we only establish the infrastructure, no
Scalar functionality is implemented yet; We will do that incrementally
over the next few commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                  |  9 +++++++++
 contrib/scalar/.gitignore |  2 ++
 contrib/scalar/Makefile   | 34 ++++++++++++++++++++++++++++++++++
 contrib/scalar/scalar.c   | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 81 insertions(+)
 create mode 100644 contrib/scalar/.gitignore
 create mode 100644 contrib/scalar/Makefile
 create mode 100644 contrib/scalar/scalar.c

diff --git a/Makefile b/Makefile
index c3565fc0f8f..a12cac1b68b 100644
--- a/Makefile
+++ b/Makefile
@@ -2444,6 +2444,11 @@ OBJECTS += $(FUZZ_OBJS)
 ifndef NO_CURL
 	OBJECTS += http.o http-walker.o remote-curl.o
 endif
+
+SCALAR_SOURCES := contrib/scalar/scalar.c
+SCALAR_OBJECTS := $(SCALAR_SOURCES:c=o)
+OBJECTS += $(SCALAR_OBJECTS)
+
 .PHONY: objects
 objects: $(OBJECTS)
 
@@ -2586,6 +2591,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
 
+contrib/scalar/scalar$X: $(SCALAR_OBJECTS) GIT-LDFLAGS $(GITLIBS)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
+		$(filter %.o,$^) $(LIBS)
+
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
diff --git a/contrib/scalar/.gitignore b/contrib/scalar/.gitignore
new file mode 100644
index 00000000000..ff3d47e84d0
--- /dev/null
+++ b/contrib/scalar/.gitignore
@@ -0,0 +1,2 @@
+/*.exe
+/scalar
diff --git a/contrib/scalar/Makefile b/contrib/scalar/Makefile
new file mode 100644
index 00000000000..40c03ad10e1
--- /dev/null
+++ b/contrib/scalar/Makefile
@@ -0,0 +1,34 @@
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring s,$(MAKEFLAGS)),s)
+ifndef V
+	QUIET_SUBDIR0  = +@subdir=
+	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+			 $(MAKE) $(PRINT_DIR) -C $$subdir
+else
+	export V
+endif
+endif
+
+all:
+
+include ../../config.mak.uname
+-include ../../config.mak.autogen
+-include ../../config.mak
+
+TARGETS = scalar$(X) scalar.o
+GITLIBS = ../../common-main.o ../../libgit.a ../../xdiff/lib.a
+
+all: scalar$X
+
+$(GITLIBS):
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(subst ../../,,$@)
+
+$(TARGETS): $(GITLIBS) scalar.c
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(patsubst %,contrib/scalar/%,$@)
+
+clean:
+	$(RM) $(TARGETS)
+
+.PHONY: all clean FORCE
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c
new file mode 100644
index 00000000000..7cff29e0fcd
--- /dev/null
+++ b/contrib/scalar/scalar.c
@@ -0,0 +1,36 @@
+/*
+ * The Scalar command-line interface.
+ */
+
+#include "cache.h"
+#include "gettext.h"
+#include "parse-options.h"
+
+static struct {
+	const char *name;
+	int (*fn)(int, const char **);
+} builtins[] = {
+	{ NULL, NULL},
+};
+
+int cmd_main(int argc, const char **argv)
+{
+	struct strbuf scalar_usage = STRBUF_INIT;
+	int i;
+
+	if (argc > 1) {
+		argv++;
+		argc--;
+
+		for (i = 0; builtins[i].name; i++)
+			if (!strcmp(builtins[i].name, argv[0]))
+				return !!builtins[i].fn(argc, argv);
+	}
+
+	strbuf_addstr(&scalar_usage,
+		      N_("scalar <command> [<options>]\n\nCommands:\n"));
+	for (i = 0; builtins[i].name; i++)
+		strbuf_addf(&scalar_usage, "\t%s\n", builtins[i].name);
+
+	usage(scalar_usage.buf);
+}
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* [PATCH v3 01/15] scalar: create a rudimentary executable
  @ 2021-09-08 19:24  5%     ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2021-09-08 19:24 UTC (permalink / raw)
  To: git
  Cc: Derrick Stolee, Eric Sunshine,
	Ævar Arnfjörð Bjarmason, Elijah Newren,
	Bagas Sanjaya, Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The idea of Scalar (https://github.com/microsoft/scalar), and before
that, of VFS for Git, has always been to prove that Git _can_ scale, and
to upstream whatever strategies have been demonstrated to help.

With this patch, we start the journey from that C# project to move what
is left to Git's own `contrib/` directory, reimplementing it in pure C,
with the intention to facilitate integrating the functionality into core
Git all while maintaining backwards-compatibility for existing Scalar
users (which will be much easier when both live in the same worktree).
It was always to plan to contribute all of the proven strategies back to
core Git.

For example, while the virtual filesystem provided by VFS for Git helped
the team developing the Windows operating system to move onto Git, while
trying to upstream it we realized that it cannot be done: getting the
virtual filesystem to work (which we only managed to implement fully on
Windows, but not on, say, macOS or Linux), and the required server-side
support for the GVFS protocol, made this not quite feasible.

The Scalar project learned from that and tackled the problem with
different tactics: instead of pretending to Git that the working
directory is fully populated, it _specifically_ teaches Git about
partial clone (which is based on VFS for Git's cache server), about
sparse checkout (which VFS for Git tried to do transparently, in the
file system layer), and regularly runs maintenance tasks to keep the
repository in a healthy state.

With partial clone, sparse checkout and `git maintenance` having been
upstreamed, there is little left that `scalar.exe` does that which
`git.exe` cannot do. One such thing is that `scalar clone <url>` will
automatically set up a partial, sparse clone, and configure
known-helpful settings from the start.

So let's bring this convenience into Git's tree.

The idea here is that you can (optionally) build Scalar via

	make -C contrib/scalar/Makefile

This will build the `scalar` executable and put it into the
contrib/scalar/ subdirectory.

The slightly awkward addition of the `contrib/scalar/*` bits to the
top-level `Makefile` are actually really required: we want to link to
`libgit.a`, which means that we will need to use the very same `CFLAGS`
and `LDFLAGS` as the rest of Git.

An early development version of this patch tried to replicate all the
conditional code in `contrib/scalar/Makefile` (e.g. `NO_POLL`) just like
`contrib/svn-fe/Makefile` used to do before it was retired. It turned
out to be quite the whack-a-mole game: the SHA-1-related flags, the
flags enabling/disabling `compat/poll/`, `compat/regex/`,
`compat/win32mmap.c` & friends depending on the current platform... To
put it mildly: it was a major mess.

Instead, this patch makes minimal changes to the top-level `Makefile` so
that the bits in `contrib/scalar/` can be compiled and linked, and
adds a `contrib/scalar/Makefile` that uses the top-level `Makefile` in a
most minimal way to do the actual compiling.

Note: With this commit, we only establish the infrastructure, no
Scalar functionality is implemented yet; We will do that incrementally
over the next few commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                  |  8 ++++++++
 contrib/scalar/.gitignore |  2 ++
 contrib/scalar/Makefile   | 34 ++++++++++++++++++++++++++++++++++
 contrib/scalar/scalar.c   | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 80 insertions(+)
 create mode 100644 contrib/scalar/.gitignore
 create mode 100644 contrib/scalar/Makefile
 create mode 100644 contrib/scalar/scalar.c

diff --git a/Makefile b/Makefile
index c3565fc0f8f..2d5c822f7a8 100644
--- a/Makefile
+++ b/Makefile
@@ -2447,6 +2447,10 @@ endif
 .PHONY: objects
 objects: $(OBJECTS)
 
+SCALAR_SOURCES := contrib/scalar/scalar.c
+SCALAR_OBJECTS := $(SCALAR_SOURCES:c=o)
+OBJECTS += $(SCALAR_OBJECTS)
+
 dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
 dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
 
@@ -2586,6 +2590,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
 
+contrib/scalar/scalar$X: $(SCALAR_OBJECTS) GIT-LDFLAGS $(GITLIBS)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
+		$(filter %.o,$^) $(LIBS)
+
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
diff --git a/contrib/scalar/.gitignore b/contrib/scalar/.gitignore
new file mode 100644
index 00000000000..ff3d47e84d0
--- /dev/null
+++ b/contrib/scalar/.gitignore
@@ -0,0 +1,2 @@
+/*.exe
+/scalar
diff --git a/contrib/scalar/Makefile b/contrib/scalar/Makefile
new file mode 100644
index 00000000000..40c03ad10e1
--- /dev/null
+++ b/contrib/scalar/Makefile
@@ -0,0 +1,34 @@
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring s,$(MAKEFLAGS)),s)
+ifndef V
+	QUIET_SUBDIR0  = +@subdir=
+	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+			 $(MAKE) $(PRINT_DIR) -C $$subdir
+else
+	export V
+endif
+endif
+
+all:
+
+include ../../config.mak.uname
+-include ../../config.mak.autogen
+-include ../../config.mak
+
+TARGETS = scalar$(X) scalar.o
+GITLIBS = ../../common-main.o ../../libgit.a ../../xdiff/lib.a
+
+all: scalar$X
+
+$(GITLIBS):
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(subst ../../,,$@)
+
+$(TARGETS): $(GITLIBS) scalar.c
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(patsubst %,contrib/scalar/%,$@)
+
+clean:
+	$(RM) $(TARGETS)
+
+.PHONY: all clean FORCE
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c
new file mode 100644
index 00000000000..7cff29e0fcd
--- /dev/null
+++ b/contrib/scalar/scalar.c
@@ -0,0 +1,36 @@
+/*
+ * The Scalar command-line interface.
+ */
+
+#include "cache.h"
+#include "gettext.h"
+#include "parse-options.h"
+
+static struct {
+	const char *name;
+	int (*fn)(int, const char **);
+} builtins[] = {
+	{ NULL, NULL},
+};
+
+int cmd_main(int argc, const char **argv)
+{
+	struct strbuf scalar_usage = STRBUF_INIT;
+	int i;
+
+	if (argc > 1) {
+		argv++;
+		argc--;
+
+		for (i = 0; builtins[i].name; i++)
+			if (!strcmp(builtins[i].name, argv[0]))
+				return !!builtins[i].fn(argc, argv);
+	}
+
+	strbuf_addstr(&scalar_usage,
+		      N_("scalar <command> [<options>]\n\nCommands:\n"));
+	for (i = 0; builtins[i].name; i++)
+		strbuf_addf(&scalar_usage, "\t%s\n", builtins[i].name);
+
+	usage(scalar_usage.buf);
+}
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* [PATCH v4 01/15] scalar: create a rudimentary executable
  @ 2021-09-14 14:39  5%       ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2021-09-14 14:39 UTC (permalink / raw)
  To: git
  Cc: Derrick Stolee, Eric Sunshine,
	Ævar Arnfjörð Bjarmason, Elijah Newren,
	Bagas Sanjaya, Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The idea of Scalar (https://github.com/microsoft/scalar), and before
that, of VFS for Git, has always been to prove that Git _can_ scale, and
to upstream whatever strategies have been demonstrated to help.

With this patch, we start the journey from that C# project to move what
is left to Git's own `contrib/` directory, reimplementing it in pure C,
with the intention to facilitate integrating the functionality into core
Git all while maintaining backwards-compatibility for existing Scalar
users (which will be much easier when both live in the same worktree).
It has always been the plan to contribute all of the proven strategies
back to core Git.

For example, while the virtual filesystem provided by VFS for Git helped
the team developing the Windows operating system to move onto Git, while
trying to upstream it we realized that it cannot be done: getting the
virtual filesystem to work (which we only managed to implement fully on
Windows, but not on, say, macOS or Linux), and the required server-side
support for the GVFS protocol, made this not quite feasible.

The Scalar project learned from that and tackled the problem with
different tactics: instead of pretending to Git that the working
directory is fully populated, it _specifically_ teaches Git about
partial clone (which is based on VFS for Git's cache server), about
sparse checkout (which VFS for Git tried to do transparently, in the
file system layer), and regularly runs maintenance tasks to keep the
repository in a healthy state.

With partial clone, sparse checkout and `git maintenance` having been
upstreamed, there is little left that `scalar.exe` does which `git.exe`
cannot do. One such thing is that `scalar clone <url>` will
automatically set up a partial, sparse clone, and configure
known-helpful settings from the start.

So let's bring this convenience into Git's tree.

The idea here is that you can (optionally) build Scalar via

	make -C contrib/scalar/Makefile

This will build the `scalar` executable and put it into the
contrib/scalar/ subdirectory.

The slightly awkward addition of the `contrib/scalar/*` bits to the
top-level `Makefile` are actually really required: we want to link to
`libgit.a`, which means that we will need to use the very same `CFLAGS`
and `LDFLAGS` as the rest of Git.

An early development version of this patch tried to replicate all the
conditional code in `contrib/scalar/Makefile` (e.g. `NO_POLL`) just like
`contrib/svn-fe/Makefile` used to do before it was retired. It turned
out to be quite the whack-a-mole game: the SHA-1-related flags, the
flags enabling/disabling `compat/poll/`, `compat/regex/`,
`compat/win32mmap.c` & friends depending on the current platform... To
put it mildly: it was a major mess.

Instead, this patch makes minimal changes to the top-level `Makefile` so
that the bits in `contrib/scalar/` can be compiled and linked, and
adds a `contrib/scalar/Makefile` that uses the top-level `Makefile` in a
most minimal way to do the actual compiling.

Note: With this commit, we only establish the infrastructure, no
Scalar functionality is implemented yet; We will do that incrementally
over the next few commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                  |  8 ++++++++
 contrib/scalar/.gitignore |  2 ++
 contrib/scalar/Makefile   | 34 ++++++++++++++++++++++++++++++++++
 contrib/scalar/scalar.c   | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 80 insertions(+)
 create mode 100644 contrib/scalar/.gitignore
 create mode 100644 contrib/scalar/Makefile
 create mode 100644 contrib/scalar/scalar.c

diff --git a/Makefile b/Makefile
index c3565fc0f8f..2d5c822f7a8 100644
--- a/Makefile
+++ b/Makefile
@@ -2447,6 +2447,10 @@ endif
 .PHONY: objects
 objects: $(OBJECTS)
 
+SCALAR_SOURCES := contrib/scalar/scalar.c
+SCALAR_OBJECTS := $(SCALAR_SOURCES:c=o)
+OBJECTS += $(SCALAR_OBJECTS)
+
 dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
 dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
 
@@ -2586,6 +2590,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
 
+contrib/scalar/scalar$X: $(SCALAR_OBJECTS) GIT-LDFLAGS $(GITLIBS)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
+		$(filter %.o,$^) $(LIBS)
+
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
diff --git a/contrib/scalar/.gitignore b/contrib/scalar/.gitignore
new file mode 100644
index 00000000000..ff3d47e84d0
--- /dev/null
+++ b/contrib/scalar/.gitignore
@@ -0,0 +1,2 @@
+/*.exe
+/scalar
diff --git a/contrib/scalar/Makefile b/contrib/scalar/Makefile
new file mode 100644
index 00000000000..40c03ad10e1
--- /dev/null
+++ b/contrib/scalar/Makefile
@@ -0,0 +1,34 @@
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring s,$(MAKEFLAGS)),s)
+ifndef V
+	QUIET_SUBDIR0  = +@subdir=
+	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+			 $(MAKE) $(PRINT_DIR) -C $$subdir
+else
+	export V
+endif
+endif
+
+all:
+
+include ../../config.mak.uname
+-include ../../config.mak.autogen
+-include ../../config.mak
+
+TARGETS = scalar$(X) scalar.o
+GITLIBS = ../../common-main.o ../../libgit.a ../../xdiff/lib.a
+
+all: scalar$X
+
+$(GITLIBS):
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(subst ../../,,$@)
+
+$(TARGETS): $(GITLIBS) scalar.c
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(patsubst %,contrib/scalar/%,$@)
+
+clean:
+	$(RM) $(TARGETS)
+
+.PHONY: all clean FORCE
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c
new file mode 100644
index 00000000000..7cff29e0fcd
--- /dev/null
+++ b/contrib/scalar/scalar.c
@@ -0,0 +1,36 @@
+/*
+ * The Scalar command-line interface.
+ */
+
+#include "cache.h"
+#include "gettext.h"
+#include "parse-options.h"
+
+static struct {
+	const char *name;
+	int (*fn)(int, const char **);
+} builtins[] = {
+	{ NULL, NULL},
+};
+
+int cmd_main(int argc, const char **argv)
+{
+	struct strbuf scalar_usage = STRBUF_INIT;
+	int i;
+
+	if (argc > 1) {
+		argv++;
+		argc--;
+
+		for (i = 0; builtins[i].name; i++)
+			if (!strcmp(builtins[i].name, argv[0]))
+				return !!builtins[i].fn(argc, argv);
+	}
+
+	strbuf_addstr(&scalar_usage,
+		      N_("scalar <command> [<options>]\n\nCommands:\n"));
+	for (i = 0; builtins[i].name; i++)
+		strbuf_addf(&scalar_usage, "\t%s\n", builtins[i].name);
+
+	usage(scalar_usage.buf);
+}
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* [PATCH v2 01/15] scalar: create a rudimentary executable
  @ 2021-09-03 17:54  5%   ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2021-09-03 17:54 UTC (permalink / raw)
  To: git
  Cc: Derrick Stolee, Eric Sunshine,
	Ævar Arnfjörð Bjarmason, Elijah Newren,
	Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The idea of Scalar (https://github.com/microsoft/scalar), and before
that, of VFS for Git, has always been to prove that Git _can_ scale, and
to upstream whatever strategies have been demonstrated to help.

With this patch, we start the journey from that C# project to move what
is left to Git's own `contrib/` directory, reimplementing it in pure C,
with the intention to facilitate integrating the functionality into core
Git all while maintaining backwards-compatibility for existing Scalar
users (which will be much easier when both live in the same worktree).
It was always to plan to contribute all of the proven strategies back to
core Git.

For example, while the virtual filesystem provided by VFS for Git helped
the team developing the Windows operating system to move onto Git, while
trying to upstream it we realized that it cannot be done: getting the
virtual filesystem to work (which we only managed to implement fully on
Windows, but not on, say, macOS or Linux), and the required server-side
support for the GVFS protocol, made this not quite feasible.

The Scalar project learned from that and tackled the problem with
different tactics: instead of pretending to Git that the working
directory is fully populated, it _specifically_ teaches Git about
partial clone (which is based on VFS for Git's cache server), about
sparse checkout (which VFS for Git tried to do transparently, in the
file system layer), and regularly runs maintenance tasks to keep the
repository in a healthy state.

With partial clone, sparse checkout and `git maintenance` having been
upstreamed, there is little left that `scalar.exe` does that which
`git.exe` cannot do. One such thing is that `scalar clone <url>` will
automatically set up a partial, sparse clone, and configure
known-helpful settings from the start.

So let's bring this convenience into Git's tree.

The idea here is that you can (optionally) build Scalar via

	make -C contrib/scalar/Makefile

This will build the `scalar` executable and put it into the
contrib/scalar/ subdirectory.

The slightly awkward addition of the `contrib/scalar/*` bits to the
top-level `Makefile` are actually really required: we want to link to
`libgit.a`, which means that we will need to use the very same `CFLAGS`
and `LDFLAGS` as the rest of Git.

An early development version of this patch tried to replicate all the
conditional code in `contrib/scalar/Makefile` (e.g. `NO_POLL`) just like
`contrib/svn-fe/Makefile` used to do before it was retired. It turned
out to be quite the whack-a-mole game: the SHA-1-related flags, the
flags enabling/disabling `compat/poll/`, `compat/regex/`,
`compat/win32mmap.c` & friends depending on the current platform... To
put it mildly: it was a major mess.

Instead, this patch makes minimal changes to the top-level `Makefile` so
that the bits in `contrib/scalar/` can be compiled and linked, and
adds a `contrib/scalar/Makefile` that uses the top-level `Makefile` in a
most minimal way to do the actual compiling.

Note: With this commit, we only establish the infrastructure, no
Scalar functionality is implemented yet; We will do that incrementally
over the next few commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                  |  8 ++++++++
 contrib/scalar/.gitignore |  2 ++
 contrib/scalar/Makefile   | 34 ++++++++++++++++++++++++++++++++++
 contrib/scalar/scalar.c   | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 80 insertions(+)
 create mode 100644 contrib/scalar/.gitignore
 create mode 100644 contrib/scalar/Makefile
 create mode 100644 contrib/scalar/scalar.c

diff --git a/Makefile b/Makefile
index c3565fc0f8f..2d5c822f7a8 100644
--- a/Makefile
+++ b/Makefile
@@ -2447,6 +2447,10 @@ endif
 .PHONY: objects
 objects: $(OBJECTS)
 
+SCALAR_SOURCES := contrib/scalar/scalar.c
+SCALAR_OBJECTS := $(SCALAR_SOURCES:c=o)
+OBJECTS += $(SCALAR_OBJECTS)
+
 dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
 dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
 
@@ -2586,6 +2590,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
 
+contrib/scalar/scalar$X: $(SCALAR_OBJECTS) GIT-LDFLAGS $(GITLIBS)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
+		$(filter %.o,$^) $(LIBS)
+
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
diff --git a/contrib/scalar/.gitignore b/contrib/scalar/.gitignore
new file mode 100644
index 00000000000..ff3d47e84d0
--- /dev/null
+++ b/contrib/scalar/.gitignore
@@ -0,0 +1,2 @@
+/*.exe
+/scalar
diff --git a/contrib/scalar/Makefile b/contrib/scalar/Makefile
new file mode 100644
index 00000000000..40c03ad10e1
--- /dev/null
+++ b/contrib/scalar/Makefile
@@ -0,0 +1,34 @@
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring s,$(MAKEFLAGS)),s)
+ifndef V
+	QUIET_SUBDIR0  = +@subdir=
+	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+			 $(MAKE) $(PRINT_DIR) -C $$subdir
+else
+	export V
+endif
+endif
+
+all:
+
+include ../../config.mak.uname
+-include ../../config.mak.autogen
+-include ../../config.mak
+
+TARGETS = scalar$(X) scalar.o
+GITLIBS = ../../common-main.o ../../libgit.a ../../xdiff/lib.a
+
+all: scalar$X
+
+$(GITLIBS):
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(subst ../../,,$@)
+
+$(TARGETS): $(GITLIBS) scalar.c
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(patsubst %,contrib/scalar/%,$@)
+
+clean:
+	$(RM) $(TARGETS)
+
+.PHONY: all clean FORCE
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c
new file mode 100644
index 00000000000..7cff29e0fcd
--- /dev/null
+++ b/contrib/scalar/scalar.c
@@ -0,0 +1,36 @@
+/*
+ * The Scalar command-line interface.
+ */
+
+#include "cache.h"
+#include "gettext.h"
+#include "parse-options.h"
+
+static struct {
+	const char *name;
+	int (*fn)(int, const char **);
+} builtins[] = {
+	{ NULL, NULL},
+};
+
+int cmd_main(int argc, const char **argv)
+{
+	struct strbuf scalar_usage = STRBUF_INIT;
+	int i;
+
+	if (argc > 1) {
+		argv++;
+		argc--;
+
+		for (i = 0; builtins[i].name; i++)
+			if (!strcmp(builtins[i].name, argv[0]))
+				return !!builtins[i].fn(argc, argv);
+	}
+
+	strbuf_addstr(&scalar_usage,
+		      N_("scalar <command> [<options>]\n\nCommands:\n"));
+	for (i = 0; builtins[i].name; i++)
+		strbuf_addf(&scalar_usage, "\t%s\n", builtins[i].name);
+
+	usage(scalar_usage.buf);
+}
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* [PATCH] Makefile: remove archives before manipulating them with 'ar'
  @ 2021-08-18 21:36  5% ` SZEDER Gábor
  0 siblings, 0 replies; 200+ results
From: SZEDER Gábor @ 2021-08-18 21:36 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jeff King, Ævar Arnfjörð Bjarmason,
	Felipe Contreras, SZEDER Gábor

The rules creating the $(LIB_FILE) and $(XDIFF_LIB) archives used to
be:

  $(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^

until commit 7b76d6bf22 (Makefile: add and use the ".DELETE_ON_ERROR"
flag, 2021-06-29) removed the '$(RM) $@' part, claiming that "we can
rely on the "c" (create) being present in ARFLAGS", and (I presume)
assuming that it means that the named archive is created from scratch.

Unfortunately, that's not what the 'c' flag does, it merely "Suppress
the diagnostic message that is written to standard error by default
when the archive is created" [1].  Consequently, all object files that
are already present in an existing archive and are not replaced will
remain there.  This leads to linker errors in back-to-back builds of
different revisions without a 'make clean' between them if source
files going into these archives are renamed in between:

  # The last commit renaming files that go into 'libgit.a':
  # bc62692757 (hash-lookup: rename from sha1-lookup, 2020-12-31)
  #  sha1-lookup.c => hash-lookup.c | 14 +++++++-------
  #  sha1-lookup.h => hash-lookup.h | 12 ++++++------
  $ git checkout bc62692757^
  HEAD is now at 7a7d992d0d sha1-lookup: rename `sha1_pos()` as `hash_pos()`
  $ make
  [...]
  $ git checkout 7b76d6bf22
  HEAD is now at 7b76d6bf22 Makefile: add and use the ".DELETE_ON_ERROR" flag
  $ make
  [...]
      AR libgit.a
      LINK git
  /usr/bin/ld: libgit.a(hash-lookup.o): in function `bsearch_hash':
  /home/szeder/src/git/hash-lookup.c:105: multiple definition of `bsearch_hash'; libgit.a(sha1-lookup.o):/home/szeder/src/git/sha1-lookup.c:105: first defined here
  collect2: error: ld returned 1 exit status
  make: *** [Makefile:2213: git] Error 1

Restore the original make rules to first remove $(LIB_FILE) and
$(XDIFF_LIB) and then create them from scratch to avoid these build
errors.

[1] Quoting POSIX at:
    https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ar.html

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 157293b555..20a0fe6e88 100644
--- a/Makefile
+++ b/Makefile
@@ -2594,10 +2594,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
 		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
 
 $(LIB_FILE): $(LIB_OBJS)
-	$(QUIET_AR)$(AR) $(ARFLAGS) $@ $^
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
 $(XDIFF_LIB): $(XDIFF_OBJS)
-	$(QUIET_AR)$(AR) $(ARFLAGS) $@ $^
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
 export DEFAULT_EDITOR DEFAULT_PAGER
 
-- 
2.33.0.453.gc5e41af357


^ permalink raw reply related	[relevance 5%]

* Re: [PATCH/RFC] Build a shared / renamed / "stable" version of the library?
  2005-09-16 12:37 16% [PATCH/RFC] Build a shared / renamed / "stable" version of the library? Matthias Urlichs
@ 2005-09-16 18:46  5% ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2005-09-16 18:46 UTC (permalink / raw)
  To: Matthias Urlichs; +Cc: David Roundy, git

[David Roundy CC:ed because I was once asked about libgit.a ABI
 stability issues from darcs-git community, and I lost the e-mail
 address of the primary person there who is working on it; but I
 know David is nice enough to arrange the message to be forwarded
 to appropriate places.]

Matthias, I think you are solving a wrong problem.  More
precisely, solving problems in a wrong order.

As things stand, libgit.a should not be taken as "a library" but
merely as a convenient way to simplify our Makefile [*1*].
There are larger problems with what is in the current libgit.a
viewed as a library if you want to use it to do anything
remotely interesting:

 - Almost all the interesting bits of git-core are in individual
   programs (rev-list, merge-base, ...).  The functionality from
   them _could_ be moved into libgit.{a,so}, but many have the
   built-in assumption that they are run once and the mess they
   leave behind will be cleaned up by process termination.

 - Management of even the most basic data structures used in
   libgit.a shares the "run once" mentality.  I can offhand
   think of three but I am sure there are more:

   - active_cache: once you are done with the current cache, it
     is very hard to reinitialize and use it without losing
     memory [*2*];

   - alternate_odb: GIT_ALTERNATE_OBJECT_DIRECTORIES and
     info/objects/alternates are looked at only once, and
     objects are slurped from these directories afterwards; this
     means you cannot easily switch between repositories (think
     of doing gitweb in mod-perl, with the libifiled libgit.so).

   - 'struct object' and its descendants: they keep track of
     which object has been seen, and the marks used by various
     commands that do the most interesting part of what git does
     persist; this means that you cannot for example make
     merge-base libified and run two of them inside a program
     very easily [*3*] [*4*].

 - The naming clash with host programs and other libraries they
   might use, which you mentioned.

I am not saying the above problems are unsolvable, but I think
the naming conflict is the least of them.  You just slurp the
current git.git into darcs-git, run token replace patch there
and slurp the results back in, teach the git-core people to use
the new names and you are done.  However, without solving the
second one (and to a lesser extent the first one), I do not
think you can usefully use the guts of git as a library.  You
can read many blobs without spawning git-cat-file for each of
them, but that is about how far you could go.  If we were to do
the libification properly, those "run once" bits should be
updated to have "git_init" [*5*] to return the handle to a data
structure that represents their current state, and be made to
take that handle to do their work in their given 'state
sandbox', and deallocate that state when they are done.

Don't get me wrong.  I would really want to see the guts of git
libified and SWIG'ed.  That would help not just your Python
thing but also StGIT and Fredrik merge (both are Python), as
well as gitk (tcl/tk) and gitweb (Perl).  I would not even mind
seeing all the git barebone Porcelain redone in Python once we
go in that direction, ditching the shell scripts we currently
have.


[Footnote]

*1* We do not have to build and maintain list of object files
each resulting binary uses in the Makefile and we let the
linker find it out for us.

*2* Hopefully this will be fixed when Chuck is done but the work
and the discussion has just been started and I do not know how the
timeframe of this cache abstraction cleanup meshes with 1.0
timeframe.

*3* I once wanted to have 'git-rev-parse A...B' to mean
'git-rev-parse `git-merge-base A B`..B'.  In order to grok
'git-rev-parse A...B C...D', you should be able to run
merge-base twice inside of git-rev-parse.

*4* I think diffcore part is reasonably well libified -- not
because who wrote it was brilliant, but simply because it was
necessary for it to be able to get called repeatedly from
'diff-tree --stdin' form from day one.

*5* Maybe we would want separate git_init_cache,
git_init_objects, ... and be able to mix and match them.  Maybe
not.  

^ permalink raw reply	[relevance 5%]

* js/scalar, was Re: What's cooking in git.git (Oct 2021, #05; Mon, 18)
  @ 2021-10-19 12:45  5% ` Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2021-10-19 12:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Junio,

On Mon, 18 Oct 2021, Junio C Hamano wrote:

> * js/scalar (2021-10-07) 15 commits
>  - scalar: accept -C and -c options before the subcommand
>  - scalar: implement the `version` command
>  - scalar: implement the `delete` command
>  - scalar: teach 'reconfigure' to optionally handle all registered enlistments
>  - scalar: allow reconfiguring an existing enlistment
>  - scalar: implement the `run` command
>  - scalar: teach 'clone' to support the --single-branch option
>  - scalar: implement the `clone` subcommand
>  - scalar: implement 'scalar list'
>  - scalar: let 'unregister' handle a deleted enlistment directory gracefully
>  - scalar: 'unregister' stops background maintenance
>  - scalar: 'register' sets recommended config and starts maintenance
>  - scalar: create test infrastructure
>  - scalar: start documenting the command
>  - scalar: create a rudimentary executable
>
>  Add pieces from "scalar" to contrib/.
>
>  What's the status of this thing?

As far as I am concerned, the current status is: We agreed that this thing
_can_ live in contrib/, and that the `scalar` command itself should not be
integrated deeply into Git because the end game is for `git clone` (and
maybe `git maintenance`) to learn Scalar's tricks.

A concern was raised that `make -C contrib/scalar` does not rebuild
`libgit.a` whenever any of `libgit.a`'s source files were modified. In
light of the previous paragraph, I believe that my time would be better
spent on designing a new `git clone` option, though, than to spend time on
a build process that will be soon obsolete (except if I allow myself to be
distracted by things like teaching `make -C contrib/scalar` to know about
`libgit.a`'s prerequisites). In other words, it is a technical debt I
firmly believe is worth accruing.

Other than that, I heard no objections, therefore I believe that this is
ready for `next`, to be cooked in the v2.34 cycle.

Ciao,
Dscho

^ permalink raw reply	[relevance 5%]

* [PATCH] Ignore more generated files
@ 2005-10-18 14:28  5% Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2005-10-18 14:28 UTC (permalink / raw)
  To: git, junkio

Since git-status now shows the "other" files, too, bring .gitignore
up-to-date.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

---

 .gitignore |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

applies-to: c96a7218cfb074d2847d54952c8570acd8bf08a9
555ff41f8df92ebb2cf58cb9797e339175733ef7
diff --git a/.gitignore b/.gitignore
index b34a77a..975e773 100644
--- a/.gitignore
+++ b/.gitignore
@@ -86,6 +86,7 @@ git-ssh-push
 git-ssh-upload
 git-status
 git-stripspace
+git-svnimport
 git-symbolic-ref
 git-tag
 git-tar-tree
@@ -106,3 +107,5 @@ git-core-*/?*
 *.deb
 git-core.spec
 *.exe
+libgit.a
+*.o
---
0.99.8.GIT

^ permalink raw reply related	[relevance 5%]

* [RFC/PATCH 0/3] Thinning the git toplevel directory
  @ 2011-02-18  2:27  5%   ` Jonathan Nieder
  2011-02-18  2:31 28%     ` [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory Jonathan Nieder
                       ` (2 more replies)
  0 siblings, 3 replies; 200+ results
From: Jonathan Nieder @ 2011-02-18  2:27 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git, Junio C Hamano, Nicolas Pitre

Hi,

Nguyễn Thái Ngọc Duy wrote:

>  .gitignore                                         |   19 ------------
>  Makefile                                           |   30 ++++++++++----------
>  t/helper/.gitignore                                |   19 ++++++++++++
[...]
>  24 files changed, 38 insertions(+), 38 deletions(-)

Here's a variation on the theme that just moves source and .o files
(leaving questions about how to cope with breaking muscle memory for
the resulting executables for later).  What do you think?

Patch 1 moves the sources for libgit.a to a subdirectory.  This seems
appealing anyway, to encourage people to start thinking about how to
make it into a standalone and reusable library.

Patch 2 moves source for test programs like test-sha1 to a subdirectory.

Patch 3 dumps header files into an include/ subdirectory.  I'm not
thrilled with it but it does make the toplevel directory listing
shorter.

After this series:

 $ ls | wc -l
 86

which fits nicely on a 113x31 terminal (but certainly not an 80x24
one).

The change descriptions need work.  Help would be appreciated.

Thoughts?
Jonathan Nieder (3):
  Move libgit.a sources into a libgit/ subdirectory
  Move test-* into a test-programs/ subdirectory
  Move header files into a include/ subdirectory

 Makefile                                           |  418 ++++++++++----------
 [plus a bunch of renames]
 208 files changed, 212 insertions(+), 206 deletions(-)

^ permalink raw reply	[relevance 5%]

* [PATCH 01/15] scalar: create a rudimentary executable
  @ 2021-08-30 21:34  5% ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2021-08-30 21:34 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The idea of Scalar (https://github.com/microsoft/scalar), and before
that, of VFS for Git, has always been to prove that Git _can_ scale, and
to upstream whatever strategies have been demonstrated to help.

With this patch, we start the journey from that C# project to move what
is left to Git's own `contrib/` directory, reimplementing it in pure C,
with the intention to facilitate integrating the functionality into core
Git all while maintaining backwards-compatibility for existing Scalar
users (which will be much easier when both live in the same worktree).
It was always to plan to contribute all of the proven strategies back to
core Git.

For example, while the virtual filesystem provided by VFS for Git helped
the team developing the Windows operating system to move onto Git, while
trying to upstream it we realized that it cannot be done: getting the
virtual filesystem to work (which we only managed to implement fully on
Windows, but not on, say, macOS or Linux), and the required server-side
support for the GVFS protocol, made this not quite feasible.

The Scalar project learned from that and tackled the problem with
different tactics: instead of pretending to Git that the working
directory is fully populated, it _specifically_ teaches Git about
partial clone (which is based on VFS for Git's cache server), about
sparse checkout (which VFS for Git tried to do transparently, in the
file system layer), and regularly runs maintenance tasks to keep the
repository in a healthy state.

With partial clone, sparse checkout and `git maintenance` having been
upstreamed, there is little left that `scalar.exe` does that which
`git.exe` cannot do. One such thing is that `scalar clone <url>` will
automatically set up a partial, sparse clone, and configure
known-helpful settings from the start.

So let's bring this convenience into Git's tree.

The idea here is that you can (optionally) build Scalar via

	make -C contrib/scalar/Makefile

This will build the `scalar` executable and put it into the
contrib/scalar/ subdirectory.

The slightly awkward addition of the `contrib/scalar/*` bits to the
top-level `Makefile` are actually really required: we want to link to
`libgit.a`, which means that we will need to use the very same `CFLAGS`
and `LDFLAGS` as the rest of Git.

An early development version of this patch tried to replicate all the
conditional code in `contrib/scalar/Makefile` (e.g. `NO_POLL`) just like
`contrib/svn-fe/Makefile` used to do before it was retired. It turned
out to be quite the whack-a-mole game: the SHA-1-related flags, the
flags enabling/disabling `compat/poll/`, `compat/regex/`,
`compat/win32mmap.c` & friends depending on the current platform... To
put it mildly: it was a major mess.

Instead, this patch makes minimal changes to the top-level `Makefile` so
that the bits in `contrib/scalar/` can be compiled and linked, and
adds a `contrib/scalar/Makefile` that uses the top-level `Makefile` in a
most minimal way to do the actual compiling.

Note: With this commit, we only establish the infrastructure, no
Scalar functionality is implemented yet; We will do that incrementally
over the next few commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                  |  8 ++++++++
 contrib/scalar/.gitignore |  2 ++
 contrib/scalar/Makefile   | 34 ++++++++++++++++++++++++++++++++++
 contrib/scalar/scalar.c   | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 80 insertions(+)
 create mode 100644 contrib/scalar/.gitignore
 create mode 100644 contrib/scalar/Makefile
 create mode 100644 contrib/scalar/scalar.c

diff --git a/Makefile b/Makefile
index c3565fc0f8f..2d5c822f7a8 100644
--- a/Makefile
+++ b/Makefile
@@ -2447,6 +2447,10 @@ endif
 .PHONY: objects
 objects: $(OBJECTS)
 
+SCALAR_SOURCES := contrib/scalar/scalar.c
+SCALAR_OBJECTS := $(SCALAR_SOURCES:c=o)
+OBJECTS += $(SCALAR_OBJECTS)
+
 dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
 dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
 
@@ -2586,6 +2590,10 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
 
+contrib/scalar/scalar$X: $(SCALAR_OBJECTS) GIT-LDFLAGS $(GITLIBS)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
+		$(filter %.o,$^) $(LIBS)
+
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
diff --git a/contrib/scalar/.gitignore b/contrib/scalar/.gitignore
new file mode 100644
index 00000000000..ff3d47e84d0
--- /dev/null
+++ b/contrib/scalar/.gitignore
@@ -0,0 +1,2 @@
+/*.exe
+/scalar
diff --git a/contrib/scalar/Makefile b/contrib/scalar/Makefile
new file mode 100644
index 00000000000..40c03ad10e1
--- /dev/null
+++ b/contrib/scalar/Makefile
@@ -0,0 +1,34 @@
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring s,$(MAKEFLAGS)),s)
+ifndef V
+	QUIET_SUBDIR0  = +@subdir=
+	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+			 $(MAKE) $(PRINT_DIR) -C $$subdir
+else
+	export V
+endif
+endif
+
+all:
+
+include ../../config.mak.uname
+-include ../../config.mak.autogen
+-include ../../config.mak
+
+TARGETS = scalar$(X) scalar.o
+GITLIBS = ../../common-main.o ../../libgit.a ../../xdiff/lib.a
+
+all: scalar$X
+
+$(GITLIBS):
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(subst ../../,,$@)
+
+$(TARGETS): $(GITLIBS) scalar.c
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $(patsubst %,contrib/scalar/%,$@)
+
+clean:
+	$(RM) $(TARGETS)
+
+.PHONY: all clean FORCE
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c
new file mode 100644
index 00000000000..7cff29e0fcd
--- /dev/null
+++ b/contrib/scalar/scalar.c
@@ -0,0 +1,36 @@
+/*
+ * The Scalar command-line interface.
+ */
+
+#include "cache.h"
+#include "gettext.h"
+#include "parse-options.h"
+
+static struct {
+	const char *name;
+	int (*fn)(int, const char **);
+} builtins[] = {
+	{ NULL, NULL},
+};
+
+int cmd_main(int argc, const char **argv)
+{
+	struct strbuf scalar_usage = STRBUF_INIT;
+	int i;
+
+	if (argc > 1) {
+		argv++;
+		argc--;
+
+		for (i = 0; builtins[i].name; i++)
+			if (!strcmp(builtins[i].name, argv[0]))
+				return !!builtins[i].fn(argc, argv);
+	}
+
+	strbuf_addstr(&scalar_usage,
+		      N_("scalar <command> [<options>]\n\nCommands:\n"));
+	for (i = 0; builtins[i].name; i++)
+		strbuf_addf(&scalar_usage, "\t%s\n", builtins[i].name);
+
+	usage(scalar_usage.buf);
+}
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* Re: [Administrivia] On ruby and contrib/
  @ 2013-06-09  1:17  5%                     ` Felipe Contreras
    0 siblings, 1 reply; 200+ results
From: Felipe Contreras @ 2013-06-09  1:17 UTC (permalink / raw)
  To: Jeff King
  Cc: Duy Nguyen, Johannes Schindelin, Greg Troxel, Junio C Hamano,
	Git Mailing List, Jonathan Nieder, Thomas Rast, René Scharfe,
	Michael Haggerty, Matthieu Moy, Ramsay Jones, Erik Faye-Lund,
	Johannes Sixt

On Sat, Jun 8, 2013 at 7:10 PM, Jeff King <peff@peff.net> wrote:
> On Sat, Jun 08, 2013 at 12:40:19PM -0500, Felipe Contreras wrote:
>
>> > These are problems that can be solved. But there is a lot of work
>> > involved in finding these subtle bugs and coming up with fixes. I think
>> > you would be better off working on an implementation of git that was
>> > designed from scratch to work in-process, like libgit2.
>>
>> So you are in favor of never ever having an official Git library. Got it.
>
> No, I didn't say that at all.

Then you truly think libgit2 will ever reach the point where it can
replace libgit.a?

It won't. But decreeing that both projects should remain isolated, and
that libgit.a should never be a library, you are effectively
condemning the effort to fail, knowingly or not.

How many years has libgit2 been brewing? Do you think it's closer for
merging so it can be used by Git's core? No, it doesn't, and it will
not in the future, because it was never meant for that.

> I do think that it would be more work to try to slowly massage the git
> code into a library-ready form than it would be to simply start with
> more library-friendly code and pull in bits of git.git as appropriate.

It might be more effort, but the results are guaranteed by our
extensive testing infrastructure and huge user-base. Slowly but
steadily we'll get there.

Waiting for libgit2 to switch directions and reach some hypothetical
point is waiting for hell to freeze.

It won't happen. There's no incentive nor reason for it to happen.

> That is what the libgit2 project is doing.  Perhaps one day that project
> will reach a point where we start building git.git commands off of it or
> sometihng like it (for that matter, there is no reason you could not
> build external commands off of libgit2 right now).  Would it be the
> "official" Git library then? I don't know. It is not clear to me what
> that even means.

It means 'make install' installs a shared library with a clearly
defined and stable API that other projects can depend on, and it can
be used for all sort of purposes, including the git binary, and it's
builtins.

> In the meantime, I think it cannot be a bad thing for libgit2 to proceed
> along its path, and I don't see a good reason for people not to use it.

Its path will never end as an official Git library, not unless we do something.

> But hey, you don't need to listen to me. If you think it would be easier
> to make the git.git code into a library, go ahead and work on it. But I
> think you will find that there are a large number of hard-to-find bugs
> caused by implicit assumptions about global state, how file descriptors
> are used, and so forth.

That's impossible. Specially since moving irrelevant code out of
libgit.a is not permitted.

>> There's a reason why the Git project doesn't use libgit2, and for the
>> same reason the official Ruby scripts should not use it.
>
> What reason is that?

You tell me. Why isn't Git using libgit2?

>> As history indicates, the Git project will never have any pressure to
>> fix it's re-entrancy and re-run issues, so these issues will remain
>> there forever.
>>
>> Only if you allow code that exposes those issues will there ever be
>> any pressure to fix them.
>
> I think it is a matter of critical mass. If you were to start linking
> against libgit.a and 90% of it worked, you might have a reason to fix
> the other 10%. But I suspect it is more the other way around.

It doesn't matter if it's 90% or 10%, it's the only thing we have.

Unless you are in favor of including libgit2 and start using it for
Git's core *right now*, the only way forward is to improve libgit.a.

-- 
Felipe Contreras

^ permalink raw reply	[relevance 5%]

* [PATCH 1/2] Move run_hook() from builtin-commit.c into run-command.c (libgit)
@ 2009-01-15 15:00  5% Stephan Beyer
  0 siblings, 0 replies; 200+ results
From: Stephan Beyer @ 2009-01-15 15:00 UTC (permalink / raw)
  To: git
  Cc: Paolo Bonzini, Miklos Vajna, Shawn O. Pearce, Daniel Barkalow,
	Christian Couder, gitster, Stephan Beyer

A function that runs a hook is used in several Git commands.
builtin-commit.c has the one that is most general for cases without
piping. This patch moves it into libgit and lets the other builtins
use this libified run_hook().

Note: The run_hook() in receive-pack.c feeds the standard input of
the pre-receive or post-receive hook. So that function is renamed
to run_receive_hook().

Mentored-by: Daniel Barkalow <barkalow@iabervon.org>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---

	This patch exists because I needed some run_hook() in sequencer
	and I noticed that slight variations are used across other
	builtins. :-)
	Stripping out a libified version seemed better to me than
	copy and paste.

 builtin-commit.c       |   34 ----------------------------------
 builtin-gc.c           |   30 +-----------------------------
 builtin-merge.c        |   31 +------------------------------
 builtin-receive-pack.c |    6 +++---
 run-command.c          |   35 +++++++++++++++++++++++++++++++++++
 run-command.h          |    2 ++
 6 files changed, 42 insertions(+), 96 deletions(-)

diff --git a/builtin-commit.c b/builtin-commit.c
index e88b78f..6f8d9fb 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -361,40 +361,6 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
 	return s.commitable;
 }
 
-static int run_hook(const char *index_file, const char *name, ...)
-{
-	struct child_process hook;
-	const char *argv[10], *env[2];
-	char index[PATH_MAX];
-	va_list args;
-	int i;
-
-	va_start(args, name);
-	argv[0] = git_path("hooks/%s", name);
-	i = 0;
-	do {
-		if (++i >= ARRAY_SIZE(argv))
-			die ("run_hook(): too many arguments");
-		argv[i] = va_arg(args, const char *);
-	} while (argv[i]);
-	va_end(args);
-
-	snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
-	env[0] = index;
-	env[1] = NULL;
-
-	if (access(argv[0], X_OK) < 0)
-		return 0;
-
-	memset(&hook, 0, sizeof(hook));
-	hook.argv = argv;
-	hook.no_stdin = 1;
-	hook.stdout_to_stderr = 1;
-	hook.env = env;
-
-	return run_command(&hook);
-}
-
 static int is_a_merge(const unsigned char *sha1)
 {
 	struct commit *commit = lookup_commit(sha1);
diff --git a/builtin-gc.c b/builtin-gc.c
index f8eae4a..a201438 100644
--- a/builtin-gc.c
+++ b/builtin-gc.c
@@ -144,34 +144,6 @@ static int too_many_packs(void)
 	return gc_auto_pack_limit <= cnt;
 }
 
-static int run_hook(void)
-{
-	const char *argv[2];
-	struct child_process hook;
-	int ret;
-
-	argv[0] = git_path("hooks/pre-auto-gc");
-	argv[1] = NULL;
-
-	if (access(argv[0], X_OK) < 0)
-		return 0;
-
-	memset(&hook, 0, sizeof(hook));
-	hook.argv = argv;
-	hook.no_stdin = 1;
-	hook.stdout_to_stderr = 1;
-
-	ret = start_command(&hook);
-	if (ret) {
-		warning("Could not spawn %s", argv[0]);
-		return ret;
-	}
-	ret = finish_command(&hook);
-	if (ret == -ERR_RUN_COMMAND_WAITPID_SIGNAL)
-		warning("%s exited due to uncaught signal", argv[0]);
-	return ret;
-}
-
 static int need_to_gc(void)
 {
 	/*
@@ -194,7 +166,7 @@ static int need_to_gc(void)
 	else if (!too_many_loose_objects())
 		return 0;
 
-	if (run_hook())
+	if (run_hook(NULL, "pre-auto-gc", NULL))
 		return 0;
 	return 1;
 }
diff --git a/builtin-merge.c b/builtin-merge.c
index cf86975..e4555b0 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -300,35 +300,6 @@ static void squash_message(void)
 	strbuf_release(&out);
 }
 
-static int run_hook(const char *name)
-{
-	struct child_process hook;
-	const char *argv[3], *env[2];
-	char index[PATH_MAX];
-
-	argv[0] = git_path("hooks/%s", name);
-	if (access(argv[0], X_OK) < 0)
-		return 0;
-
-	snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", get_index_file());
-	env[0] = index;
-	env[1] = NULL;
-
-	if (squash)
-		argv[1] = "1";
-	else
-		argv[1] = "0";
-	argv[2] = NULL;
-
-	memset(&hook, 0, sizeof(hook));
-	hook.argv = argv;
-	hook.no_stdin = 1;
-	hook.stdout_to_stderr = 1;
-	hook.env = env;
-
-	return run_command(&hook);
-}
-
 static void finish(const unsigned char *new_head, const char *msg)
 {
 	struct strbuf reflog_message = STRBUF_INIT;
@@ -374,7 +345,7 @@ static void finish(const unsigned char *new_head, const char *msg)
 	}
 
 	/* Run a post-merge hook */
-	run_hook("post-merge");
+	run_hook(NULL, "post-merge", squash ? "1" : "0", NULL);
 
 	strbuf_release(&reflog_message);
 }
diff --git a/builtin-receive-pack.c b/builtin-receive-pack.c
index db67c31..6564a97 100644
--- a/builtin-receive-pack.c
+++ b/builtin-receive-pack.c
@@ -136,7 +136,7 @@ static int hook_status(int code, const char *hook_name)
 	}
 }
 
-static int run_hook(const char *hook_name)
+static int run_receive_hook(const char *hook_name)
 {
 	static char buf[sizeof(commands->old_sha1) * 2 + PATH_MAX + 4];
 	struct command *cmd;
@@ -358,7 +358,7 @@ static void execute_commands(const char *unpacker_error)
 		return;
 	}
 
-	if (run_hook(pre_receive_hook)) {
+	if (run_receive_hook(pre_receive_hook)) {
 		while (cmd) {
 			cmd->error_string = "pre-receive hook declined";
 			cmd = cmd->next;
@@ -627,7 +627,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
 			unlink(pack_lockfile);
 		if (report_status)
 			report(unpack_status);
-		run_hook(post_receive_hook);
+		run_receive_hook(post_receive_hook);
 		run_update_post_hook(commands);
 	}
 	return 0;
diff --git a/run-command.c b/run-command.c
index c90cdc5..602fe85 100644
--- a/run-command.c
+++ b/run-command.c
@@ -342,3 +342,38 @@ int finish_async(struct async *async)
 #endif
 	return ret;
 }
+
+int run_hook(const char *index_file, const char *name, ...)
+{
+	struct child_process hook;
+	const char *argv[10], *env[2];
+	char index[PATH_MAX];
+	va_list args;
+	int i;
+
+	va_start(args, name);
+	argv[0] = git_path("hooks/%s", name);
+	i = 0;
+	do {
+		if (++i >= ARRAY_SIZE(argv))
+			die("run_hook(): too many arguments");
+		argv[i] = va_arg(args, const char *);
+	} while (argv[i]);
+	va_end(args);
+
+	if (access(argv[0], X_OK) < 0)
+		return 0;
+
+	memset(&hook, 0, sizeof(hook));
+	hook.argv = argv;
+	hook.no_stdin = 1;
+	hook.stdout_to_stderr = 1;
+	if (index_file) {
+		snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
+		env[0] = index;
+		env[1] = NULL;
+		hook.env = env;
+	}
+
+	return run_command(&hook);
+}
diff --git a/run-command.h b/run-command.h
index a8b0c20..0211e1d 100644
--- a/run-command.h
+++ b/run-command.h
@@ -49,6 +49,8 @@ int start_command(struct child_process *);
 int finish_command(struct child_process *);
 int run_command(struct child_process *);
 
+extern int run_hook(const char *index_file, const char *name, ...);
+
 #define RUN_COMMAND_NO_STDIN 1
 #define RUN_GIT_CMD	     2	/*If this is to be git sub-command */
 #define RUN_COMMAND_STDOUT_TO_STDERR 4
-- 
1.6.1.160.gecdb

^ permalink raw reply related	[relevance 5%]

* Re: GSoC 2008 - Mentors Wanted!
  @ 2008-03-05  8:15  5%       ` Shawn O. Pearce
  0 siblings, 0 replies; 200+ results
From: Shawn O. Pearce @ 2008-03-05  8:15 UTC (permalink / raw)
  To: Imran M Yousuf; +Cc: Carlos Rica, git, Junio C Hamano

Imran M Yousuf <imyousuf@gmail.com> wrote:
> 1. GIT SCM Plugin for NetBeans (GPLv2 with CPE, same as NetBeans)
> The aim of the plugin is to integrate GIT with NetBeans using JNI so
> that any change in the implementation of GIT does not effect the SCM
> plugins way of work.
> Language: Java
> Goal: Make GIT available from IDE for NetBeans users and use GIT using
> Java Native Interfaces

Interesting, but libgit.a is *not* suitable for embedding inside of
a JVM.  Its no fun when a low level Git function suddenly calls die()
because it was fed invalid user input like a mistyped branch name.
Your whole IDE shutsdown without a chance to save files.

So that leaves you with three possible routes:

  * Use JNI and libgit.a

    Now you have three projects, not one.  You first need to make
    libgit.a embeddable.  *Then* you can work on a JNI wrapper,
    and finally you can build the UI.

  * Use jgit

    Its at least 100% pure Java and doesn't have the libgit.a issues
    I mentioned above.  Its also got some active developers and its
    userbase is growing.  We have been careful to keep jgit such
    that it runs on any J2SE system, and thus does not require an
    Eclipse environment.

  * Use java.lang.Process and pipes

    Ick.  Forking a running JVM, especially one the size of an IDE,
    is not pretty.  At least on Windows you have CreateProcess(),
    but on POSIX systems the JVM still does a fork/exec pair, and
    on Solaris that hurts hard when your address space is large.

Of these only the latter two are really viable for any time to come
(just my opinion, but that's that).  jgit is coming along and may
actually be able to do most of the critical features that an IDE
demands, especially if more people work on it.  The latter option
is obviously available today, but doesn't offer anything near the
performance or integration that jgit does.
 
> 2. distributed versioned web system backup and restoration framework
> (GPLv2 with CPE, same as NetBeans)
> [I am not sure whether this one is even qualifies or not as a GIT
> Community Project]
> Language: Java, NetBeans RCP
> Goal: Develop a framework which can backup and restore data from
> different components of web application. For example, database, ldap,
> log, images, files (PHP, JSP, PY, HTML, JS, CSS etc.). Additionally
> allow edit and propagation of configuration in distributed nature,
> system restart, data restore. Also integrate backup and repo maintain
> to Amazon S3.

Yea, I'm not sure this falls too well under the Git community either.
I don't doubt that we would have sufficient mentor experience here
to support such a project, but the outcome in terms of both code and
a student who is familiar with it would not benefit Git very well,
if at all.
 
-- 
Shawn.

^ permalink raw reply	[relevance 5%]

* Re: [PATCH v5 2/3] git-std-lib: introduce Git Standard Library
  @ 2024-02-29 17:23  5%     ` Junio C Hamano
    0 siblings, 1 reply; 200+ results
From: Junio C Hamano @ 2024-02-29 17:23 UTC (permalink / raw)
  To: Phillip Wood; +Cc: Calvin Wan, git, Jonathan Tan

Phillip Wood <phillip.wood123@gmail.com> writes:

> Hi Calvin
> On 22/02/2024 17:50, Calvin Wan wrote:

Thanks for reviewing -- I held mine back as I expected this will see
another reroll soonish, but you already have raised many points I
also had trouble with, so I do not have to ;-) 

Below, I'll liberally omit everything you wrote that I agree with.

>> +libgit.a, which is then linked against by common-main.o with other
>> +external dependencies and turned into the Git executable.
>
> I found this description a bit confusing. As I understand it to build
> git we link git.o against common-main.o, libgit.a, xdiff/lib.a,
> reftable/libreftable.a and libpcre etc.

In addition, there is no single "the Git executable", simply because
not everything is builtin command.  The purpose of using libgit.a is
because we are too lazy to list and maintain all the internal
dependencies to link final executables like 'git' (which has all the
built-in command implementations) and 'git-remote-curl' (which is a
standalone program).  Instead of feeding exact list of object files
to "$(CC) -o git" command line, we throw everything into libgit.a
and let the linker pick what is needed.  To link "git", we may
include all builtin/*.o, git.o, common-main.o, libgit.a and the
external [*] library dependencies they have.  To link "git-daemon",
we may not link builtin/*.o and git.o and link daemon.o instead.

	Side note: here I am counting xdiff/lib.a as an external
	library as it is mostly a borrowed code.

In other words, libgit.a is not a true library in the sense that it
was designed to be _used_ as a library.  It was merely a detail of
how we implemented lazy dependency management in our build process,
which happend with 0a02ce72 (Clean up the Makefile a bit.,
2005-04-18) whose commit log message uses air-quotes around the word
"library".

>> +From the above dependency graph, we can see that git-std-lib.a could be
>> +many smaller libraries rather than a singular library. So why choose a
>> +singular library when multiple libraries can be individually easier to
>> +swap and are more modular? A singular library requires less work to
>> +separate out circular dependencies within itself so it becomes a
>> +tradeoff question between work and reward. While there may be a point in
>> +the future where a file like usage.c would want its own library so that
>> +someone can have custom die() or error(), the work required to refactor
>> +out the circular dependencies in some files would be enormous due to
>> +their ubiquity so therefore I believe it is not worth the tradeoff
>
> I'm not sure if we want to use the first person in our technical
> documentation, unlike the cover letter to a patch series it is not
> immediately obvious to the reader who "I" is. This applies the
> passages in the first person below as well.

I found it highly annoying while reading it, too.  If the document
(not the commit that introduced the document) were signed and
written to state the position of one author, as opposed to spell out
the position the project will collectively take, it would have been
OK, but this document is meant to set a course of the project (and
discussion on it is the process to decide which course to take), the
first person singular "I" did not sit well for me.

Another thing to consider that I do not think you covered is the
name of the resulting .a archive.  By starting it with "lib", a
customer can find your libstdgit.a with -lstdgit on the command
line, once libstdgit.a is installed at an appropriate location (or
the build-time library path is configured to point the location you
have libstdgit.a at).  libgit.a that wasn't really designed to be
used as such a library did not have to follow the naming convention,
but if the thing being proposed is meant to be eventually used as a
library by external entities, git-std-lib.a is a rather poor name
for it.


PS.

I seem to have been hit by a power outage and am on UPS, so I'll
probably be offline until the power comes back.





^ permalink raw reply	[relevance 5%]

* Re: [PATCH 1/1] do not add common-main to lib
    2016-08-15 12:20  5% ` Johannes Schindelin
@ 2016-08-15 12:02  5% ` Jeff King
  1 sibling, 0 replies; 200+ results
From: Jeff King @ 2016-08-15 12:02 UTC (permalink / raw)
  To: Christian Hesse; +Cc: git, Christian Hesse

On Mon, Aug 15, 2016 at 09:52:07AM +0200, Christian Hesse wrote:

> From: Christian Hesse <mail@eworm.de>
> 
> Commit 08aade70 (mingw: declare main()'s argv as const) changed
> declaration of main function. This breaks linking external projects
> (e.g. cgit) to libgit.a with:
> 
> error: Multiple definition of `main'

I'd expect the culprit is actually 3f2e229 (add an extra level of
indirection to main(), 2016-07-01).

> So do not add common-main to lib and let projects have their own
> main function.

That is certainly an option, but I think it means that those projects
are potentially buggy in the same way that some git commands were prior
to the common-main series. Namely, the common main() may do some
run-time setup that parts of libgit.a assume has been done.

I would not be surprised if cgit crashes on Windows, for instance, for
the reasons detailed in 650c449 (common-main: call
git_extract_argv0_path(), 2016-07-01). I would also not be surprised if
nobody actually builds cgit on Windows. :)

The "right" way to do it (according to the way libgit.a views the world)
is for cgit's main to become cmd_main(), and let libgit.a do its
run-time startup before getting there.

-Peff

^ permalink raw reply	[relevance 5%]

* Re: [PATCH] Introduce Git.pm (v3)
  2006-06-22 23:50  6%   ` Petr Baudis
  2006-06-23 12:39  5%     ` Petr Baudis
@ 2006-06-23  0:22  5%     ` Junio C Hamano
    1 sibling, 1 reply; 200+ results
From: Junio C Hamano @ 2006-06-23  0:22 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Petr Baudis <pasky@suse.cz> writes:

>> Eek.  It does not compile for me -- maybe there is more
>> dependencies that need to be listed in INSTALL file?
>> ...
>> Git.xs: In function 'XS_Git_xs_hash_object':
>> Git.xs:27: warning: ISO C90 forbids mixed declarations and code
>> Git.xs:44: warning: passing argument 1 of 'Perl_io_close' from incompatible pointer type
>> Git.xs:44: warning: passing argument 2 of 'Perl_io_close' makes pointer from integer without a cast
>> Git.xs:44: error: too few arguments to function 'Perl_io_close'
>
> Oops, sorry. Apparently, I've digged too deep and unleashed a monster of
> unstable API. Now I've finally discovered perlapio(1) and know I
> should've just called PerlIO_close(). Below comes a fixed patch, I
> didn't bother to bump the version number.

Thanks; it compiles now with a few more glitches.

            /usr/bin/perl /usr/share/perl/5.8/ExtUtils/xsubpp  \
                    -typemap /usr/share/perl/5.8/ExtUtils/typemap  Git.xs > Git.xsc && \
                    mv Git.xsc Git.c
            Please specify prototyping behavior for Git.xs (see perlxs manual)

Says xsubpp.

        cc -c  -I. -I.. -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS \
                -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include \
                -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 \
                -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC \
                "-I/usr/lib/perl/5.8/CORE" -Wall
                -Wdeclaration-after-statement \
                -g -DSHA1_HEADER='<openssl/sha.h>' \
                -DGIT_VERSION=\"1.4.1.rc1.g01a1\" Git.c
        Git.xs: In function 'XS_Git_xs__execv_git_cmd':
        Git.xs:57: warning: passing argument 1 of 'free' discards qualifiers from pointer target type
        Git.xs: In function 'XS_Git_xs_hash_object':
        Git.xs:65: warning: ISO C90 forbids mixed declarations and code

I usually compile with -Wdeclaration-after-statement so I
probably get some more warnings than you saw; it probably is
primarily xsubpp's fault, but you could work it around by having
CODE block to be inside an extra set of braces {}.  Constness
reduction of free() is a bit annoying from the point of view of
the coder who has to cast away constness, so I won't be too
strict about that, but it would be nicer if we did not have to
see the warnings.

        rm -f blib/arch/auto/Git/Git.so
        cc  -shared -L/usr/local/lib Git.o  -o blib/arch/auto/Git/Git.so ../libgit.a	\
                   -lz -lcrypto  	\

        /usr/bin/ld: ../libgit.a(exec_cmd.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
        ../libgit.a: could not read symbols: Bad value
        collect2: ld returned 1 exit status
        make[1]: *** [blib/arch/auto/Git/Git.so] Error 1

This is a real killer.  If we compile everything with -fPIC,
this goes away, but I do not think we want -fPIC for the core
level tools.  At least not until we are ready to do libgit.so.

^ permalink raw reply	[relevance 5%]

* [PATCH] Make git compile with SUNs forte12 compiler
@ 2007-05-12 21:35  5% Thomas Glanzmann
    0 siblings, 1 reply; 200+ results
From: Thomas Glanzmann @ 2007-05-12 21:35 UTC (permalink / raw)
  To: git; +Cc: Thomas Glanzmann

This patch moves two inline functions from a header file to the corresponding c
file. Otherwise forte12 refuses to compile git with the following error:

    LINK git-convert-objects
ld: fatal: symbol `tree_entry_extract' is multiply-defined:
        (file libgit.a(sha1_name.o) type=FUNC; file libgit.a(tree.o) type=FUNC);
ld: fatal: symbol `tree_entry_extract' is multiply-defined:
        (file libgit.a(sha1_name.o) type=FUNC; file libgit.a(tree-walk.o) type=FUNC);
ld: fatal: File processing errors. No output written to git-convert-objects
gmake[1]: *** [git-convert-objects] Error 1

Signed-off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
---
 tree-walk.c |   14 ++++++++++++++
 tree-walk.h |   13 +------------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/tree-walk.c b/tree-walk.c
index cbb24eb..ef57951 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -2,6 +2,20 @@
 #include "tree-walk.h"
 #include "tree.h"
 
+inline int tree_entry_len(const char *name, const unsigned char *sha1)
+{
+	return (char *)sha1 - (char *)name - 1;
+}
+
+inline const unsigned char *tree_entry_extract(struct tree_desc *desc,
+                                     const char **pathp, unsigned int *modep)
+{
+	*pathp = desc->entry.path;
+	*modep = canon_mode(desc->entry.mode);
+	return desc->entry.sha1;
+}
+
+
 static const char *get_mode(const char *str, unsigned int *modep)
 {
 	unsigned char c;
diff --git a/tree-walk.h b/tree-walk.h
index 43458cf..984f19e 100644
--- a/tree-walk.h
+++ b/tree-walk.h
@@ -13,21 +13,10 @@ struct tree_desc {
 	unsigned int size;
 };
 
-static inline const unsigned char *tree_entry_extract(struct tree_desc *desc, const char **pathp, unsigned int *modep)
-{
-	*pathp = desc->entry.path;
-	*modep = canon_mode(desc->entry.mode);
-	return desc->entry.sha1;
-}
-
-static inline int tree_entry_len(const char *name, const unsigned char *sha1)
-{
-	return (char *)sha1 - (char *)name - 1;
-}
-
 void update_tree_entry(struct tree_desc *);
 void init_tree_desc(struct tree_desc *desc, const void *buf, unsigned long size);
 const unsigned char *tree_entry_extract(struct tree_desc *, const char **, unsigned int *);
+int tree_entry_len(const char *name, const unsigned char *sha1);
 
 /* Helper function that does both of the above and returns true for success */
 int tree_entry(struct tree_desc *, struct name_entry *);
-- 
1.5.1.3

^ permalink raw reply related	[relevance 5%]

* [RFC PATCH v2 6/7] git-std-lib: introduce git standard library
  @ 2023-08-10 16:36  5% ` Calvin Wan
  0 siblings, 0 replies; 200+ results
From: Calvin Wan @ 2023-08-10 16:36 UTC (permalink / raw)
  To: git
  Cc: Calvin Wan, nasamuffin, chooglen, jonathantanmy, linusa,
	phillip.wood123, vdye

The Git Standard Library intends to serve as the foundational library
and root dependency that other libraries in Git will be built off of.
That is to say, suppose we have libraries X and Y; a user that wants to
use X and Y would need to include X, Y, and this Git Standard Library.

Add Documentation/technical/git-std-lib.txt to further explain the
design and rationale.

Signed-off-by: Calvin Wan <calvinwan@google.com>
---
 Documentation/technical/git-std-lib.txt | 186 ++++++++++++++++++++++++
 Makefile                                |  62 +++++++-
 git-compat-util.h                       |   7 +-
 stubs/repository.c                      |   4 +
 stubs/repository.h                      |   8 +
 stubs/trace2.c                          |  22 +++
 stubs/trace2.h                          |  69 +++++++++
 symlinks.c                              |   2 +
 8 files changed, 358 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/technical/git-std-lib.txt
 create mode 100644 stubs/repository.c
 create mode 100644 stubs/repository.h
 create mode 100644 stubs/trace2.c
 create mode 100644 stubs/trace2.h

diff --git a/Documentation/technical/git-std-lib.txt b/Documentation/technical/git-std-lib.txt
new file mode 100644
index 0000000000..3d901a89b0
--- /dev/null
+++ b/Documentation/technical/git-std-lib.txt
@@ -0,0 +1,186 @@
+Git Standard Library
+================
+
+The Git Standard Library intends to serve as the foundational library
+and root dependency that other libraries in Git will be built off of.
+That is to say, suppose we have libraries X and Y; a user that wants to
+use X and Y would need to include X, Y, and this Git Standard Library.
+This does not mean that the Git Standard Library will be the only
+possible root dependency in the future, but rather the most significant
+and widely used one.
+
+Dependency graph in libified Git
+================
+
+If you look in the Git Makefile, all of the objects defined in the Git
+library are compiled and archived into a singular file, libgit.a, which
+is linked against by common-main.o with other external dependencies and
+turned into the Git executable. In other words, the Git executable has
+dependencies on libgit.a and a couple of external libraries. The
+libfication of Git will not affect this current build flow, but instead
+will provide an alternate method for building Git.
+
+With our current method of building Git, we can imagine the dependency
+graph as such:
+
+        Git
+         /\
+        /  \
+       /    \
+  libgit.a   ext deps
+
+In libifying parts of Git, we want to shrink the dependency graph to
+only the minimal set of dependencies, so libraries should not use
+libgit.a. Instead, it would look like:
+
+                Git
+                /\
+               /  \
+              /    \
+          libgit.a  ext deps
+             /\
+            /  \
+           /    \
+object-store.a  (other lib)
+      |        /
+      |       /
+      |      /
+ config.a   / 
+      |    /
+      |   /
+      |  /
+git-std-lib.a
+
+Instead of containing all of the objects in Git, libgit.a would contain
+objects that are not built by libraries it links against. Consequently,
+if someone wanted their own custom build of Git with their own custom
+implementation of the object store, they would only have to swap out
+object-store.a rather than do a hard fork of Git.
+
+Rationale behind Git Standard Library
+================
+
+The rationale behind Git Standard Library essentially is the result of
+two observations within the Git codebase: every file includes
+git-compat-util.h which defines functions in a couple of different
+files, and wrapper.c + usage.c have difficult-to-separate circular
+dependencies with each other and other files.
+
+Ubiquity of git-compat-util.h and circular dependencies
+========
+
+Every file in the Git codebase includes git-compat-util.h. It serves as
+"a compatibility aid that isolates the knowledge of platform specific
+inclusion order and what feature macros to define before including which
+system header" (Junio[1]). Since every file includes git-compat-util.h, and
+git-compat-util.h includes wrapper.h and usage.h, it would make sense
+for wrapper.c and usage.c to be a part of the root library. They have
+difficult to separate circular dependencies with each other so they
+can't be independent libraries. Wrapper.c has dependencies on parse.c,
+abspath.c, strbuf.c, which in turn also have dependencies on usage.c and
+wrapper.c -- more circular dependencies. 
+
+Tradeoff between swappability and refactoring
+========
+
+From the above dependency graph, we can see that git-std-lib.a could be
+many smaller libraries rather than a singular library. So why choose a
+singular library when multiple libraries can be individually easier to
+swap and are more modular? A singular library requires less work to
+separate out circular dependencies within itself so it becomes a
+tradeoff question between work and reward. While there may be a point in
+the future where a file like usage.c would want its own library so that
+someone can have custom die() or error(), the work required to refactor
+out the circular dependencies in some files would be enormous due to
+their ubiquity so therefore I believe it is not worth the tradeoff
+currently. Additionally, we can in the future choose to do this refactor
+and change the API for the library if there becomes enough of a reason
+to do so (remember we are avoiding promising stability of the interfaces
+of those libraries).
+
+Reuse of compatibility functions in git-compat-util.h
+========
+
+Most functions defined in git-compat-util.h are implemented in compat/
+and have dependencies limited to strbuf.h and wrapper.h so they can be
+easily included in git-std-lib.a, which as a root dependency means that
+higher level libraries do not have to worry about compatibility files in
+compat/. The rest of the functions defined in git-compat-util.h are
+implemented in top level files and are hidden behind
+an #ifdef if their implementation is not in git-std-lib.a.
+
+Rationale summary
+========
+
+The Git Standard Library allows us to get the libification ball rolling
+with other libraries in Git. By not spending many
+more months attempting to refactor difficult circular dependencies and
+instead spending that time getting to a state where we can test out
+swapping a library out such as config or object store, we can prove the
+viability of Git libification on a much faster time scale. Additionally
+the code cleanups that have happened so far have been minor and
+beneficial for the codebase. It is probable that making large movements
+would negatively affect code clarity.
+
+Git Standard Library boundary
+================
+
+While I have described above some useful heuristics for identifying
+potential candidates for git-std-lib.a, a standard library should not
+have a shaky definition for what belongs in it.
+
+ - Low-level files (aka operates only on other primitive types) that are
+   used everywhere within the codebase (wrapper.c, usage.c, strbuf.c)
+   - Dependencies that are low-level and widely used
+     (abspath.c, date.c, hex-ll.c, parse.c, utf8.c)
+ - low-level git/* files with functions defined in git-compat-util.h
+   (ctype.c)
+ - compat/*
+ - stubbed out dependencies in stubs/ (stubs/repository.c, stubs/trace2.c)
+
+There are other files that might fit this definition, but that does not
+mean it should belong in git-std-lib.a. Those files should start as
+their own separate library since any file added to git-std-lib.a loses
+its flexibility of being easily swappable.
+
+Wrapper.c and usage.c have dependencies on repository and trace2 that are
+possible to remove at the cost of sacrificing the ability for standard Git
+to be able to trace functions in those files and other files in git-std-lib.a.
+In order for git-std-lib.a to compile with those dependencies, stubbed out
+versions of those files are implemented and swapped in during compilation time.
+
+Files inside of Git Standard Library
+================
+
+The initial set of files in git-std-lib.a are:
+abspath.c
+ctype.c
+date.c
+hex-ll.c
+parse.c
+strbuf.c
+usage.c
+utf8.c
+wrapper.c
+stubs/repository.c
+stubs/trace2.c
+relevant compat/ files
+
+Pitfalls
+================
+
+There are a small amount of files under compat/* that have dependencies
+not inside of git-std-lib.a. While those functions are not called on
+Linux, other OSes might call those problematic functions. I don't see
+this as a major problem, just moreso an observation that libification in
+general may also require some minor compatibility work in the future.
+
+Testing
+================
+
+Unit tests should catch any breakages caused by changes to files in
+git-std-lib.a (i.e. introduction of a out of scope dependency) and new
+functions introduced to git-std-lib.a will require unit tests written
+for them.
+
+[1] https://lore.kernel.org/git/xmqqwn17sydw.fsf@gitster.g/
\ No newline at end of file
diff --git a/Makefile b/Makefile
index e9ad9f9ef1..82510cf50e 100644
--- a/Makefile
+++ b/Makefile
@@ -669,6 +669,7 @@ FUZZ_PROGRAMS =
 GIT_OBJS =
 LIB_OBJS =
 SCALAR_OBJS =
+STUB_OBJS =
 OBJECTS =
 OTHER_PROGRAMS =
 PROGRAM_OBJS =
@@ -956,6 +957,7 @@ COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
 
 LIB_H = $(FOUND_H_SOURCES)
 
+ifndef GIT_STD_LIB
 LIB_OBJS += abspath.o
 LIB_OBJS += add-interactive.o
 LIB_OBJS += add-patch.o
@@ -1196,6 +1198,27 @@ LIB_OBJS += write-or-die.o
 LIB_OBJS += ws.o
 LIB_OBJS += wt-status.o
 LIB_OBJS += xdiff-interface.o
+else ifdef GIT_STD_LIB
+LIB_OBJS += abspath.o
+LIB_OBJS += ctype.o
+LIB_OBJS += date.o
+LIB_OBJS += hex-ll.o
+LIB_OBJS += parse.o
+LIB_OBJS += strbuf.o
+LIB_OBJS += usage.o
+LIB_OBJS += utf8.o
+LIB_OBJS += wrapper.o
+
+ifdef STUB_REPOSITORY
+STUB_OBJS += stubs/repository.o
+endif
+
+ifdef STUB_TRACE2
+STUB_OBJS += stubs/trace2.o
+endif
+
+LIB_OBJS += $(STUB_OBJS)
+endif
 
 BUILTIN_OBJS += builtin/add.o
 BUILTIN_OBJS += builtin/am.o
@@ -2162,6 +2185,11 @@ ifdef FSMONITOR_OS_SETTINGS
 	COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
 endif
 
+ifdef GIT_STD_LIB
+	BASIC_CFLAGS += -DGIT_STD_LIB
+	BASIC_CFLAGS += -DNO_GETTEXT
+endif
+
 ifeq ($(TCLTK_PATH),)
 NO_TCLTK = NoThanks
 endif
@@ -3654,7 +3682,7 @@ clean: profile-clean coverage-clean cocciclean
 	$(RM) po/git.pot po/git-core.pot
 	$(RM) git.res
 	$(RM) $(OBJECTS)
-	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
+	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB) $(STD_LIB_FILE)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS)
 	$(RM) $(TEST_PROGRAMS)
 	$(RM) $(FUZZ_PROGRAMS)
@@ -3834,3 +3862,35 @@ $(FUZZ_PROGRAMS): all
 		$(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
 
 fuzz-all: $(FUZZ_PROGRAMS)
+
+### Libified Git rules
+
+# git-std-lib
+# `make git-std-lib GIT_STD_LIB=YesPlease STUB_REPOSITORY=YesPlease STUB_TRACE2=YesPlease`
+STD_LIB = git-std-lib.a
+
+$(STD_LIB): $(LIB_OBJS) $(COMPAT_OBJS) $(STUB_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
+
+TEMP_HEADERS = temp_headers/
+
+git-std-lib:
+# Move headers to temporary folder and replace them with stubbed headers.
+# After building, move headers and stubbed headers back.
+ifneq ($(STUB_OBJS),)
+	mkdir -p $(TEMP_HEADERS); \
+	for d in $(STUB_OBJS); do \
+		BASE=$${d%.*}; \
+		mv $${BASE##*/}.h $(TEMP_HEADERS)$${BASE##*/}.h; \
+		mv $${BASE}.h $${BASE##*/}.h; \
+	done; \
+	$(MAKE) $(STD_LIB); \
+	for d in $(STUB_OBJS); do \
+		BASE=$${d%.*}; \
+		mv $${BASE##*/}.h $${BASE}.h; \
+		mv $(TEMP_HEADERS)$${BASE##*/}.h $${BASE##*/}.h; \
+	done; \
+	rm -rf temp_headers
+else
+	$(MAKE) $(STD_LIB)
+endif
diff --git a/git-compat-util.h b/git-compat-util.h
index 481dac22b0..75aa9b263e 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -396,8 +396,8 @@ static inline int noop_core_config(const char *var UNUSED,
 #define platform_core_config noop_core_config
 #endif
 
+#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(GIT_STD_LIB)
 int lstat_cache_aware_rmdir(const char *path);
-#if !defined(__MINGW32__) && !defined(_MSC_VER)
 #define rmdir lstat_cache_aware_rmdir
 #endif
 
@@ -787,9 +787,11 @@ const char *inet_ntop(int af, const void *src, char *dst, size_t size);
 #endif
 
 #ifdef NO_PTHREADS
+#ifdef GIT_STD_LIB
 #define atexit git_atexit
 int git_atexit(void (*handler)(void));
 #endif
+#endif
 
 /*
  * Limit size of IO chunks, because huge chunks only cause pain.  OS X
@@ -951,14 +953,17 @@ int git_access(const char *path, int mode);
 # endif
 #endif
 
+#ifndef GIT_STD_LIB
 int cmd_main(int, const char **);
 
 /*
  * Intercept all calls to exit() and route them to trace2 to
  * optionally emit a message before calling the real exit().
  */
+
 int common_exit(const char *file, int line, int code);
 #define exit(code) exit(common_exit(__FILE__, __LINE__, (code)))
+#endif
 
 /*
  * You can mark a stack variable with UNLEAK(var) to avoid it being
diff --git a/stubs/repository.c b/stubs/repository.c
new file mode 100644
index 0000000000..f81520d083
--- /dev/null
+++ b/stubs/repository.c
@@ -0,0 +1,4 @@
+#include "git-compat-util.h"
+#include "repository.h"
+
+struct repository *the_repository;
diff --git a/stubs/repository.h b/stubs/repository.h
new file mode 100644
index 0000000000..18262d748e
--- /dev/null
+++ b/stubs/repository.h
@@ -0,0 +1,8 @@
+#ifndef REPOSITORY_H
+#define REPOSITORY_H
+
+struct repository { int stub; };
+
+extern struct repository *the_repository;
+
+#endif /* REPOSITORY_H */
diff --git a/stubs/trace2.c b/stubs/trace2.c
new file mode 100644
index 0000000000..efc3f9c1f3
--- /dev/null
+++ b/stubs/trace2.c
@@ -0,0 +1,22 @@
+#include "git-compat-util.h"
+#include "trace2.h"
+
+void trace2_region_enter_fl(const char *file, int line, const char *category,
+			    const char *label, const struct repository *repo, ...) { }
+void trace2_region_leave_fl(const char *file, int line, const char *category,
+			    const char *label, const struct repository *repo, ...) { }
+void trace2_data_string_fl(const char *file, int line, const char *category,
+			   const struct repository *repo, const char *key,
+			   const char *value) { }
+void trace2_cmd_ancestry_fl(const char *file, int line, const char **parent_names) { }
+void trace2_cmd_error_va_fl(const char *file, int line, const char *fmt,
+			    va_list ap) { }
+void trace2_cmd_name_fl(const char *file, int line, const char *name) { }
+void trace2_thread_start_fl(const char *file, int line,
+			    const char *thread_base_name) { }
+void trace2_thread_exit_fl(const char *file, int line) { }
+void trace2_data_intmax_fl(const char *file, int line, const char *category,
+			   const struct repository *repo, const char *key,
+			   intmax_t value) { }
+int trace2_is_enabled(void) { return 0; }
+void trace2_collect_process_info(enum trace2_process_info_reason reason) { }
diff --git a/stubs/trace2.h b/stubs/trace2.h
new file mode 100644
index 0000000000..88ad7387ff
--- /dev/null
+++ b/stubs/trace2.h
@@ -0,0 +1,69 @@
+#ifndef TRACE2_H
+#define TRACE2_H
+
+struct child_process { int stub; };
+struct repository;
+struct json_writer { int stub; };
+
+void trace2_region_enter_fl(const char *file, int line, const char *category,
+			    const char *label, const struct repository *repo, ...);
+
+#define trace2_region_enter(category, label, repo) \
+	trace2_region_enter_fl(__FILE__, __LINE__, (category), (label), (repo))
+
+void trace2_region_leave_fl(const char *file, int line, const char *category,
+			    const char *label, const struct repository *repo, ...);
+
+#define trace2_region_leave(category, label, repo) \
+	trace2_region_leave_fl(__FILE__, __LINE__, (category), (label), (repo))
+
+void trace2_data_string_fl(const char *file, int line, const char *category,
+			   const struct repository *repo, const char *key,
+			   const char *value);
+
+#define trace2_data_string(category, repo, key, value)                       \
+	trace2_data_string_fl(__FILE__, __LINE__, (category), (repo), (key), \
+			      (value))
+
+void trace2_cmd_ancestry_fl(const char *file, int line, const char **parent_names);
+
+#define trace2_cmd_ancestry(v) trace2_cmd_ancestry_fl(__FILE__, __LINE__, (v))
+
+void trace2_cmd_error_va_fl(const char *file, int line, const char *fmt,
+			    va_list ap);
+
+#define trace2_cmd_error_va(fmt, ap) \
+	trace2_cmd_error_va_fl(__FILE__, __LINE__, (fmt), (ap))
+
+
+void trace2_cmd_name_fl(const char *file, int line, const char *name);
+
+#define trace2_cmd_name(v) trace2_cmd_name_fl(__FILE__, __LINE__, (v))
+
+void trace2_thread_start_fl(const char *file, int line,
+			    const char *thread_base_name);
+
+#define trace2_thread_start(thread_base_name) \
+	trace2_thread_start_fl(__FILE__, __LINE__, (thread_base_name))
+
+void trace2_thread_exit_fl(const char *file, int line);
+
+#define trace2_thread_exit() trace2_thread_exit_fl(__FILE__, __LINE__)
+
+void trace2_data_intmax_fl(const char *file, int line, const char *category,
+			   const struct repository *repo, const char *key,
+			   intmax_t value);
+
+#define trace2_data_intmax(category, repo, key, value)                       \
+	trace2_data_intmax_fl(__FILE__, __LINE__, (category), (repo), (key), \
+			      (value))
+
+enum trace2_process_info_reason {
+	TRACE2_PROCESS_INFO_STARTUP,
+	TRACE2_PROCESS_INFO_EXIT,
+};
+int trace2_is_enabled(void);
+void trace2_collect_process_info(enum trace2_process_info_reason reason);
+
+#endif /* TRACE2_H */
+
diff --git a/symlinks.c b/symlinks.c
index b29e340c2d..bced721a0c 100644
--- a/symlinks.c
+++ b/symlinks.c
@@ -337,6 +337,7 @@ void invalidate_lstat_cache(void)
 	reset_lstat_cache(&default_cache);
 }
 
+#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(GIT_STD_LIB)
 #undef rmdir
 int lstat_cache_aware_rmdir(const char *path)
 {
@@ -348,3 +349,4 @@ int lstat_cache_aware_rmdir(const char *path)
 
 	return ret;
 }
+#endif
-- 
2.41.0.640.ga95def55d0-goog


^ permalink raw reply related	[relevance 5%]

* Re: [PATCH 2/2] Move sequencer to builtin
  @ 2013-06-08 10:14  5%     ` Felipe Contreras
    0 siblings, 1 reply; 200+ results
From: Felipe Contreras @ 2013-06-08 10:14 UTC (permalink / raw)
  To: Duy Nguyen
  Cc: Git Mailing List, Junio C Hamano, Brandon Casey, Jonathan Nieder,
	Ramkumar Ramachandra

On Fri, Jun 7, 2013 at 9:35 PM, Duy Nguyen <pclouds@gmail.com> wrote:
> On Sat, Jun 8, 2013 at 5:16 AM, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
>> This code is only useful for cherry-pick and revert built-ins, nothing
>> else, so let's make it a builtin object, but make sure 'git-sequencer'
>> is not generated.
>
> As you can see, the convention is builtin/foo.c corresponds to git-foo
> (and maybe more). Why make an exception for sequencer?

Why not?

> What do we gain from this?

Organization.

> A lot of code in libgit.a is only used by builtin commands,
> e.g. fetch-pack.c, should we move it to?

Yes.

> I ask because I moved
> fetch-pack from builtin out because of linking issues and I don't want
> the same happen to sequencer.c.

I'm sure those linking issues can be solved.

I don't see why libgit.a couldn't eventually be the same as libgit2.
We need better organization tough (e.g. builtins/lib.a).

If you are arguing favor of a more messy setup, then we should link
all the builtin/*.o to libgit.a, because the current situation just
doesn't cut it.

For example, init_copy_notes_for_rewrite() cannot be accessed by
sequencer.c, and while it's possible to move that function (and
others) to libgit.a, it doesn't make sense, because it can only be
used by builtins.

-- 
Felipe Contreras

^ permalink raw reply	[relevance 5%]

* [PATCH v3 6/8] cmake: support for building git on windows with mingw
  @ 2020-05-29 13:40  5%     ` Sibi Siddharthan via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Sibi Siddharthan via GitGitGadget @ 2020-05-29 13:40 UTC (permalink / raw)
  To: git; +Cc: Sibi Siddharthan, Sibi Siddharthan

From: Sibi Siddharthan <sibisiddharthan.github@gmail.com>

This patch facilitates building git on Windows with CMake using MinGW

NOTE: The funtions unsetenv and hstrerror are not checked in Windows
builds.
Reasons
NO_UNSETENV is not compatible with Windows builds.
lines 262-264 compat/mingw.h

compat/mingw.h(line 25) provides a definition of hstrerror which
conflicts with the definition provided in
git-compat-util.h(lines 733-736).

To use CMake on Windows with MinGW do this:
cmake `relative-path-to-srcdir` -G "MinGW Makefiles"

Changes:
Changed the error message when sh.exe is not found on Windows as
suggested by Philip Oakley <philipoakley@iee.email>

v2:
Fixed a bug where a Windows user can pose as Linux user and vice versa.

Signed-off-by: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
---
 contrib/buildsystems/CMakeLists.txt | 121 ++++++++++++++++++++++------
 1 file changed, 98 insertions(+), 23 deletions(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index ea26f4612d3..46197d0b806 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -34,6 +34,10 @@ cmake_minimum_required(VERSION 3.14)
 set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
 
 find_program(SH_EXE sh)
+if(NOT SH_EXE)
+	message(FATAL_ERROR "sh: shell interpreter was not found in your path, please install one."
+			"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
+endif()
 
 #Create GIT-VERSION-FILE using GIT-VERSION-GEN
 if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
@@ -57,7 +61,9 @@ project(git
 	VERSION ${git_version}
 	LANGUAGES C)
 
+
 #TODO gitk git-gui gitweb
+#TODO Enable NLS on windows natively
 #TODO Add pcre support
 
 #macros for parsing the Makefile for sources and scripts
@@ -94,6 +100,7 @@ find_package(EXPAT)
 find_package(Iconv)
 find_package(Intl)
 
+
 if(NOT Intl_FOUND)
 	add_compile_definitions(NO_GETTEXT)
 	if(NOT Iconv_FOUND)
@@ -115,6 +122,14 @@ if(Intl_FOUND)
 	include_directories(SYSTEM ${Intl_INCLUDE_DIRS})
 endif()
 
+
+if(WIN32)
+	find_program(WINDRES_EXE windres)
+	if(NOT WINDRES_EXE)
+		message(FATAL_ERROR "Install windres on Windows for resource files")
+	endif()
+endif()
+
 find_program(MSGFMT_EXE msgfmt)
 if(NOT MSGFMT_EXE)
 	message(WARNING "Text Translations won't be build")
@@ -146,11 +161,39 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
 			BINDIR="bin"
 			GIT_BUILT_FROM_COMMIT="")
 
-set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
-add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+if(WIN32)
+	set(FALLBACK_RUNTIME_PREFIX /mingw64)
+	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+else()
+	set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
+	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+endif()
 
-add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
-list(APPEND compat_SOURCES unix-socket.c)
+
+#Platform Specific
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+	include_directories(${CMAKE_SOURCE_DIR}/compat/win32)
+	add_compile_definitions(HAVE_ALLOCA_H NO_POSIX_GOODIES NATIVE_CRLF NO_UNIX_SOCKETS WIN32
+				_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=".exe"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT
+				NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0
+				USE_NED_ALLOCATOR OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP
+				UNICODE _UNICODE HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET)
+	list(APPEND compat_SOURCES compat/mingw.c compat/winansi.c compat/win32/path-utils.c
+		compat/win32/pthread.c compat/win32mmap.c compat/win32/syslog.c
+		compat/win32/trace2_win32_process_info.c compat/win32/dirent.c
+		compat/nedmalloc/nedmalloc.c compat/strdup.c)
+	set(NO_UNIX_SOCKETS 1)
+
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+	add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
+	list(APPEND compat_SOURCES unix-socket.c)
+endif()
+
+if(WIN32)
+	set(EXE_EXTENSION .exe)
+else()
+	set(EXE_EXTENSION)
+endif()
 
 #header checks
 check_include_file(libgen.h HAVE_LIBGEN_H)
@@ -211,7 +254,12 @@ endif()
 #function checks
 set(function_checks
 	strcasestr memmem strlcpy strtoimax strtoumax strtoull
-	setenv mkdtemp poll pread memmem unsetenv hstrerror)
+	setenv mkdtemp poll pread memmem)
+
+#unsetenv,hstrerror are incompatible with windows build
+if(NOT WIN32)
+	list(APPEND function_checks unsetenv hstrerror)
+endif()
 
 foreach(f ${function_checks})
 	string(TOUPPER ${f} uf)
@@ -425,7 +473,13 @@ unset(CMAKE_REQUIRED_INCLUDES)
 #programs
 set(PROGRAMS_BUILT
 	git git-bugreport git-credential-store git-daemon git-fast-import git-http-backend git-sh-i18n--envsubst
-	git-shell git-remote-testsvn git-credential-cache git-credential-cache--daemon)
+	git-shell git-remote-testsvn)
+
+if(NO_UNIX_SOCKETS)
+	list(APPEND excluded_progs git-credential-cache git-credential-cache--daemon)
+else()
+	list(APPEND PROGRAMS_BUILT git-credential-cache git-credential-cache--daemon)
+endif()
 
 if(NOT CURL_FOUND)
 	list(APPEND excluded_progs git-http-fetch git-http-push)
@@ -497,15 +551,34 @@ parse_makefile_for_sources(libvcs-svn_SOURCES "VCSSVN_OBJS")
 list(TRANSFORM libvcs-svn_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
 add_library(vcs-svn STATIC ${libvcs-svn_SOURCES})
 
+#add git.rc for gcc
+if(WIN32)
+	add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
+			COMMAND ${WINDRES_EXE} -O coff -DMAJOR=${PROJECT_VERSION_MAJOR} -DMINOR=${PROJECT_VERSION_MINOR}
+				-DMICRO=${PROJECT_VERSION_PATCH} -DPATCHLEVEL=0 -DGIT_VERSION="\\\"${PROJECT_VERSION}.GIT\\\""
+				-i ${CMAKE_SOURCE_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+			WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+			VERBATIM)
+	add_custom_target(git-rc DEPENDS ${CMAKE_BINARY_DIR}/git.res)
+endif()
+
 #link all required libraries to common-main
 add_library(common-main OBJECT ${CMAKE_SOURCE_DIR}/common-main.c)
-target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES} pthread rt)
+
+target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES})
 if(Intl_FOUND)
 	target_link_libraries(common-main ${Intl_LIBRARIES})
 endif()
 if(Iconv_FOUND)
 	target_link_libraries(common-main ${Iconv_LIBRARIES})
 endif()
+if(WIN32)
+	target_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)
+	add_dependencies(common-main git-rc)
+	target_link_options(common-main PUBLIC -municode -Wl,--nxcompat -Wl,--dynamicbase -Wl,--pic-executable,-e,mainCRTStartup)
+elseif(UNIX)
+	target_link_libraries(common-main pthread rt)
+endif()
 
 #git
 parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
@@ -556,11 +629,13 @@ endif()
 add_executable(git-remote-testsvn ${CMAKE_SOURCE_DIR}/remote-testsvn.c)
 target_link_libraries(git-remote-testsvn common-main vcs-svn)
 
-add_executable(git-credential-cache ${CMAKE_SOURCE_DIR}/credential-cache.c)
-target_link_libraries(git-credential-cache common-main)
+if(NOT NO_UNIX_SOCKETS)
+	add_executable(git-credential-cache ${CMAKE_SOURCE_DIR}/credential-cache.c)
+	target_link_libraries(git-credential-cache common-main)
 
-add_executable(git-credential-cache--daemon ${CMAKE_SOURCE_DIR}/credential-cache--daemon.c)
-target_link_libraries(git-credential-cache--daemon common-main)
+	add_executable(git-credential-cache--daemon ${CMAKE_SOURCE_DIR}/credential-cache--daemon.c)
+	target_link_libraries(git-credential-cache--daemon common-main)
+endif()
 
 
 set(git_builtin_extra
@@ -572,16 +647,16 @@ set(git_builtin_extra
 foreach(s ${git_SOURCES} ${git_builtin_extra})
 	string(REPLACE "${CMAKE_SOURCE_DIR}/builtin/" "" s ${s})
 	string(REPLACE ".c" "" s ${s})
-	file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git git-${s})\n")
-	list(APPEND git_links ${CMAKE_BINARY_DIR}/git-${s})
+	file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git${EXE_EXTENSION} git-${s}${EXE_EXTENSION})\n")
+	list(APPEND git_links ${CMAKE_BINARY_DIR}/git-${s}${EXE_EXTENSION})
 endforeach()
 
 if(CURL_FOUND)
 	set(remote_exes
 		git-remote-https git-remote-ftp git-remote-ftps)
 	foreach(s ${remote_exes})
-		file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git-remote-http ${s})\n")
-		list(APPEND git_http_links ${CMAKE_BINARY_DIR}/${s})
+		file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git-remote-http${EXE_EXTENSION} ${s}${EXE_EXTENSION})\n")
+		list(APPEND git_http_links ${CMAKE_BINARY_DIR}/${s}${EXE_EXTENSION})
 	endforeach()
 endif()
 
@@ -705,20 +780,20 @@ set(bin_links
 	git-receive-pack git-upload-archive git-upload-pack)
 
 foreach(b ${bin_links})
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/bin/${b})")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/bin/${b}${EXE_EXTENSION})")
 endforeach()
 
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git)")
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git-shell ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-shell)")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git${EXE_EXTENSION})")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git-shell${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-shell${EXE_EXTENSION})")
 
 foreach(b ${git_links})
 	string(REPLACE "${CMAKE_BINARY_DIR}" "" b ${b})
-	install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b})")
+	install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b}${EXE_EXTENSION})")
 endforeach()
 
 foreach(b ${git_http_links})
 	string(REPLACE "${CMAKE_BINARY_DIR}" "" b ${b})
-	install(CODE "file(CREATE_LINK  ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-remote-http ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b})")
+	install(CODE "file(CREATE_LINK  ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-remote-http${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b}${EXE_EXTENSION})")
 endforeach()
 
 install(PROGRAMS ${git_shell_scripts} ${git_perl_scripts} ${CMAKE_BINARY_DIR}/git-p4
@@ -767,14 +842,14 @@ set(wrapper_test_scripts
 foreach(script ${wrapper_scripts})
 	file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
 	string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-	string(REPLACE "@@PROG@@" "${script}" content "${content}")
+	string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
 	file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
 endforeach()
 
 foreach(script ${wrapper_test_scripts})
 	file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
 	string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-	string(REPLACE "@@PROG@@" "t/helper/${script}" content "${content}")
+	string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
 	file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
 endforeach()
 
@@ -840,7 +915,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DC_SHA1='${DC_SHA1}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X=''\n")
+file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* Re: Libification project (SoC)
  @ 2007-03-18 14:08  5%               ` Petr Baudis
    2007-03-16 18:20  5%               ` Marco Costalba
  1 sibling, 1 reply; 200+ results
From: Petr Baudis @ 2007-03-18 14:08 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Rocco Rutte, git

On Fri, Mar 16, 2007 at 04:12:17PM CET, Johannes Schindelin wrote:
> Hi,
> 
> [please do not cull the Cc: list]
> 
> On Fri, 16 Mar 2007, Rocco Rutte wrote:
> 
> > First, I think that would be some cleanup "only" since that basically would
> > mean to
> > 
> >   1) make all functions die()ing return some value and handle it and
> >   2) wrap all static vars into structures and pass them around
> > 
> > If you don't choose a design before wrapping things up in structures, you'll
> > probably end up having one structure per source file (at least too many
> > structures).
> 
> Why? For some tasks, it should be 1) easier, 2) more elegant, and 3) 
> faster to write a function which re-initialises the static variables.
> 
> Of course, if you want to work with multiple repos _at the same time_, 
> this does not help you. But frankly, we don't support that with core-git, 
> so why should we in libgit?

Because you don't know who will want to use libgit. Maybe perl bindings
from inside of mod_perl, where single process can multiplex between many
repositories based on whichever request just arrived. You talked about
memory usage issues, but I think that's just a minor technical issue
that can be adjusted, while this is _conceptual_. Maybe someone will
want to write repodiff which looks at two repositories and compares them
(without fetching massive data around). Maybe someone will want to write
some other cool hack we didn't think about.

Because in the other subthread you just suggested the git viewers should
be multi-threaded. Of course you can state that "only a single thread
can use libgit at a time", but then multithreading is just a hack to
work around libgit limitations (albeit still legitimate) while it could
be used to do so much more cool stuff like fetching old history
information on background while you can already _work_ with the tool and
look at the new stuff details (isn't this actually exactly how gitk and
qgit already work? they couldn't with non-reentrant libgit!).

Because if you look at the UNIX history, you'll notice that first people
started with non-reentrant stuff because it was "good enough" and then
came back later and added reentrant versions anyway. Let's learn from
history. It's question of probability but it's very likely this will
happen to us as well.

This is why the _API_ should be designed to be re-entrant. The
implementation may not be re-entrant right away, it may take a while to
get there, but the API really should be.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Ever try. Ever fail. No matter. // Try again. Fail again. Fail better.
		-- Samuel Beckett

^ permalink raw reply	[relevance 5%]

* [StGIT PATCH] Implement a new patch identification scheme and id command
@ 2008-06-14  7:28  5% Catalin Marinas
  0 siblings, 0 replies; 200+ results
From: Catalin Marinas @ 2008-06-14  7:28 UTC (permalink / raw)
  To: git

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 7913 bytes --]

The new scheme allows '[<branch>:]<patch>' and '[<branch>:]{base}'
(the latter showing the base of a stack). The former format allows
symbols like ^, ^{...} etc.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---

 stgit/commands/common.py   |   32 ++++++++++++++++++++++++++++++++
 stgit/commands/id.py       |   25 +++++++++++--------------
 stgit/lib/git.py           |    4 ++--
 t/t0001-subdir-branches.sh |   26 +++++++++++---------------
 t/t1200-push-modified.sh   |    2 +-
 t/t1201-pull-trailing.sh   |    2 +-
 t/t2200-rebase.sh          |    2 +-
 7 files changed, 59 insertions(+), 34 deletions(-)

diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 029ec65..d1545e4 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -28,6 +28,7 @@ from stgit.run import *
 from stgit import stack, git, basedir
 from stgit.config import config, file_extensions
 from stgit.lib import stack as libstack
+from stgit.lib import git as libgit
 
 # Command exception class
 class CmdException(StgException):
@@ -116,6 +117,37 @@ def git_id(crt_series, rev):
 
     raise CmdException, 'Unknown patch or revision: %s' % rev
 
+def git_sha1(repository, branch, name):
+    """Return the SHA1 value if 'name' is a patch name or Git commit.
+    The patch names allowed are in the form '<branch>:<patch>' and can be
+    followed by standard symbols used by git-rev-parse. If <patch> is '{base}',
+    it represents the bottom of the stack.
+    """
+    # Try a Git commit first
+    try:
+        return repository.rev_parse(name, discard_stderr = True).sha1
+    except libgit.RepositoryException:
+        pass
+
+    # Git didn't recognise it, try a [branch:]patch name
+    try:
+        branch, patch = name.split(':', 1)
+    except ValueError:
+        patch = name
+    if not branch:
+        branch = repository.current_branch_name
+
+    # the stack base
+    if patch == '{base}':
+        return repository.get_stack(branch).base.sha1
+
+    # any other combination of branch and patch
+    try:
+        return repository.rev_parse('patches/%s/%s' % (branch, patch),
+                                    discard_stderr = True).sha1
+    except libgit.RepositoryException:
+        raise CmdException('%s: Unknown patch or revision name' % name)
+
 def check_local_changes():
     if git.local_changes():
         raise CmdException('local changes in the tree. Use "refresh" or'
diff --git a/stgit/commands/id.py b/stgit/commands/id.py
index 94b0229..50f6e8a 100644
--- a/stgit/commands/id.py
+++ b/stgit/commands/id.py
@@ -15,29 +15,26 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 """
 
-import sys, os
 from optparse import OptionParser, make_option
 
-from stgit.commands.common import *
-from stgit.utils import *
-from stgit.out import *
-from stgit import stack, git
-
+from stgit.out import out
+from stgit.commands import common
+from stgit.lib import stack
 
 help = 'print the GIT hash value of a StGIT reference'
 usage = """%prog [options] [id]
 
-Print the hash value of a GIT id (defaulting to HEAD). In addition to
-the standard GIT id's like heads and tags, this command also accepts
-'base[@<branch>]' and '[<patch>[@<branch>]][//[bottom | top]]'. If no
-'top' or 'bottom' are passed and <patch> is a valid patch name, 'top'
-will be used by default."""
+Print the SHA1 value of a Git id (defaulting to HEAD). In addition to
+the standard Git id's like heads and tags, this command also accepts
+'[<branch>:]<patch>]' and '[<branch>:]{base}]' showing the id of a patch
+or the base of the stack. If no branch is specified, it defaults to the
+current one. The bottom of a patch is accessible with the
+'[<branch>:]<patch>]^' format."""
 
-directory = DirectoryHasRepository()
+directory = common.DirectoryHasRepositoryLib()
 options = [make_option('-b', '--branch',
                        help = 'use BRANCH instead of the default one')]
 
-
 def func(parser, options, args):
     """Show the applied patches
     """
@@ -48,4 +45,4 @@ def func(parser, options, args):
     else:
         parser.error('incorrect number of arguments')
 
-    out.stdout(git_id(crt_series, id_str))
+    out.stdout(common.git_sha1(directory.repository, options.branch, id_str))
diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index 0e0cccb..379fb52 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -422,11 +422,11 @@ class Repository(RunWithEnv):
     refs = property(lambda self: self.__refs)
     def cat_object(self, sha1):
         return self.run(['git', 'cat-file', '-p', sha1]).raw_output()
-    def rev_parse(self, rev):
+    def rev_parse(self, rev, discard_stderr = False):
         try:
             return self.get_commit(self.run(
                     ['git', 'rev-parse', '%s^{commit}' % rev]
-                    ).output_one_line())
+                    ).discard_stderr(discard_stderr).output_one_line())
         except run.RunException:
             raise RepositoryException('%s: No such revision' % rev)
     def get_tree(self, sha1):
diff --git a/t/t0001-subdir-branches.sh b/t/t0001-subdir-branches.sh
index 0eed3a4..cf2059a 100755
--- a/t/t0001-subdir-branches.sh
+++ b/t/t0001-subdir-branches.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (c) 2006 Karl Hasselström
+# Copyright (c) 2006 Karl Hasselstr�m
 #
 
 test_description='Branch names containing slashes
@@ -18,25 +18,21 @@ test_expect_success 'Create a patch' \
    stg new foo -m "Add foo.txt" &&
    stg refresh'
 
-test_expect_success 'Old and new id with non-slashy branch' \
-  'stg id foo &&
-   stg id foo// &&
-   stg id foo/ &&
-   stg id foo//top &&
-   stg id foo/top &&
-   stg id foo@master &&
-   stg id foo@master//top &&
-   stg id foo@master/top'
+test_expect_success 'Try id with non-slashy branch' \
+  'stg id &&
+   stg id foo &&
+   stg id foo^ &&
+   stg id master:foo &&
+   stg id master:foo^'
 
 test_expect_success 'Clone branch to slashier name' \
   'stg branch --clone x/y/z'
 
-test_expect_success 'Try new form of id with slashy branch' \
+test_expect_success 'Try new id with slashy branch' \
   'stg id foo &&
-   stg id foo// &&
-   stg id foo//top &&
-   stg id foo@x/y/z &&
-   stg id foo@x/y/z//top'
+   stg id foo^ &&
+   stg id x/y/z:foo &&
+   stg id x/y/z:foo^'
 
 test_expect_success 'Try old id with slashy branch' '
    ! stg id foo/ &&
diff --git a/t/t1200-push-modified.sh b/t/t1200-push-modified.sh
index ba4f70c..e3c6425 100755
--- a/t/t1200-push-modified.sh
+++ b/t/t1200-push-modified.sh
@@ -36,7 +36,7 @@ test_expect_success \
     (
         cd foo &&
         GIT_DIR=../bar/.git git-format-patch --stdout \
-          $(cd ../bar && stg id base@master)..HEAD | git-am -3 -k
+          $(cd ../bar && stg id master:{base})..HEAD | git-am -3 -k
     )
 '
 
diff --git a/t/t1201-pull-trailing.sh b/t/t1201-pull-trailing.sh
index 9d70fe0..8a74873 100755
--- a/t/t1201-pull-trailing.sh
+++ b/t/t1201-pull-trailing.sh
@@ -30,7 +30,7 @@ test_expect_success \
     'Port those patches to orig tree' \
     '(cd foo &&
       GIT_DIR=../bar/.git git-format-patch --stdout \
-          $(cd ../bar && stg id base@master)..HEAD |
+          $(cd ../bar && stg id master:{base})..HEAD |
       git-am -3 -k
      )
     '
diff --git a/t/t2200-rebase.sh b/t/t2200-rebase.sh
index ec2a104..cd43c41 100755
--- a/t/t2200-rebase.sh
+++ b/t/t2200-rebase.sh
@@ -27,7 +27,7 @@ test_expect_success \
 	'Rebase to previous commit' \
 	'
 	stg rebase master~1 &&
-	test `stg id base@stack` = `git rev-parse master~1` &&
+	test `stg id stack:{base}` = `git rev-parse master~1` &&
 	test `stg applied | wc -l` = 1
 	'
 

^ permalink raw reply related	[relevance 5%]

* Git compile warnings (under mac/clang)
@ 2015-01-22 19:43  5% Michael Blume
  0 siblings, 0 replies; 200+ results
From: Michael Blume @ 2015-01-22 19:43 UTC (permalink / raw)
  To: Git List

These are probably minor, I only bring them up because Git's build is
generally so quiet that it might be worth squashing these too.

    CC fsck.o
fsck.c:110:38: warning: comparison of unsigned enum expression >= 0 is
always true [-Wtautological-compare]
        if (options->msg_severity && msg_id >= 0 && msg_id < FSCK_MSG_MAX)
                                     ~~~~~~ ^  ~
1 warning generated.
    AR libgit.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libgit.a(gettext.o) has no symbols
    CC builtin/remote.o
builtin/remote.c:1572:5: warning: add explicit braces to avoid
dangling else [-Wdangling-else]
                                else
                                ^
builtin/remote.c:1580:5: warning: add explicit braces to avoid
dangling else [-Wdangling-else]
                                else
                                ^
2 warnings generated.

(the warning about libgit.a(gettext.o) is probably because I'm
building with NO_GETTEXT -- I've never been able to get gettext to
work on my mac)

^ permalink raw reply	[relevance 5%]

* Re: [PATCH v2 02/13] sha1-file: provide functions to look up hash algorithms
  @ 2018-10-17 13:32  5%   ` SZEDER Gábor
  0 siblings, 0 replies; 200+ results
From: SZEDER Gábor @ 2018-10-17 13:32 UTC (permalink / raw)
  To: brian m. carlson
  Cc: git, Jeff King, Derrick Stolee,
	Ævar Arnfjörð Bjarmason

On Mon, Oct 15, 2018 at 02:18:49AM +0000, brian m. carlson wrote:
> There are several ways we might refer to a hash algorithm: by name, such
> as in the config file; by format ID, such as in a pack; or internally,
> by a pointer to the hash_algos array.  Provide functions to look up hash
> algorithms based on these various forms and return the internal constant
> used for them.  If conversion to another form is necessary, this
> internal constant can be used to look up the proper data in the
> hash_algos array.
> 
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
>  hash.h      | 13 +++++++++++++
>  sha1-file.c | 21 +++++++++++++++++++++
>  2 files changed, 34 insertions(+)
> 
> diff --git a/hash.h b/hash.h
> index 7c8238bc2e..90f4344619 100644
> --- a/hash.h
> +++ b/hash.h
> @@ -98,4 +98,17 @@ struct git_hash_algo {
>  };
>  extern const struct git_hash_algo hash_algos[GIT_HASH_NALGOS];
>  
> +/*
> + * Return a GIT_HASH_* constant based on the name.  Returns GIT_HASH_UNKNOWN if
> + * the name doesn't match a known algorithm.
> + */
> +int hash_algo_by_name(const char *name);
> +/* Identical, except based on the format ID. */
> +int hash_algo_by_id(uint32_t format_id);
> +/* Identical, except for a pointer to struct git_hash_algo. */
> +inline int hash_algo_by_ptr(const struct git_hash_algo *p)

This has to be declared as static, otherwise the linker will error out
when building without optimization:

    LINK git
libgit.a(commit-graph.o): In function `oid_version':
/home/szeder/src/git/commit-graph.c:48: undefined reference to `hash_algo_by_ptr'
libgit.a(hex.o): In function `hash_to_hex':
/home/szeder/src/git/hex.c:123: undefined reference to `hash_algo_by_ptr'
libgit.a(hex.o): In function `oid_to_hex':
/home/szeder/src/git/hex.c:128: undefined reference to `hash_algo_by_ptr'
collect2: error: ld returned 1 exit status
Makefile:2055: recipe for target 'git' failed
make: *** [git] Error 1


> +{
> +	return p - hash_algos;
> +}
> +
>  #endif
> diff --git a/sha1-file.c b/sha1-file.c
> index e29825f259..3a75d515eb 100644
> --- a/sha1-file.c
> +++ b/sha1-file.c
> @@ -122,6 +122,27 @@ const char *empty_blob_oid_hex(void)
>  	return oid_to_hex_r(buf, the_hash_algo->empty_blob);
>  }
>  
> +int hash_algo_by_name(const char *name)
> +{
> +	int i;
> +	if (!name)
> +		return GIT_HASH_UNKNOWN;
> +	for (i = 1; i < GIT_HASH_NALGOS; i++)
> +		if (!strcmp(name, hash_algos[i].name))
> +			return i;
> +	return GIT_HASH_UNKNOWN;
> +}
> +
> +int hash_algo_by_id(uint32_t format_id)
> +{
> +	int i;
> +	for (i = 1; i < GIT_HASH_NALGOS; i++)
> +		if (format_id == hash_algos[i].format_id)
> +			return i;
> +	return GIT_HASH_UNKNOWN;
> +}
> +
> +
>  /*
>   * This is meant to hold a *small* number of objects that you would
>   * want read_sha1_file() to be able to return, but yet you do not want

^ permalink raw reply	[relevance 5%]

* Re: [PATCH 2/2] Move sequencer to builtin
  @ 2013-06-08 12:25  5%         ` Felipe Contreras
    0 siblings, 1 reply; 200+ results
From: Felipe Contreras @ 2013-06-08 12:25 UTC (permalink / raw)
  To: Duy Nguyen
  Cc: Git Mailing List, Junio C Hamano, Brandon Casey, Jonathan Nieder,
	Ramkumar Ramachandra

On Sat, Jun 8, 2013 at 6:42 AM, Duy Nguyen <pclouds@gmail.com> wrote:
> On Sat, Jun 8, 2013 at 5:14 PM, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
>> On Fri, Jun 7, 2013 at 9:35 PM, Duy Nguyen <pclouds@gmail.com> wrote:
>>> On Sat, Jun 8, 2013 at 5:16 AM, Felipe Contreras
>>> <felipe.contreras@gmail.com> wrote:
>>>> This code is only useful for cherry-pick and revert built-ins, nothing
>>>> else, so let's make it a builtin object, but make sure 'git-sequencer'
>>>> is not generated.
>>>
>>> As you can see, the convention is builtin/foo.c corresponds to git-foo
>>> (and maybe more). Why make an exception for sequencer?
>>
>> Why not?
>
> And while we are at "why not", why don't you fork git?

That's not an answer.

>>> I ask because I moved
>>> fetch-pack from builtin out because of linking issues and I don't want
>>> the same happen to sequencer.c.
>>
>> I'm sure those linking issues can be solved.
>
> Yeah, I scratched my head for hours and finally gave in. Maybe you are
> better at the toolchain than me.

I gave it a try, but transport.c needs fetch_pack(), and transport
does belong in libgit.a, so fetch_pack() belongs there too.

This is not the case for sequencer.c.

>> I don't see why libgit.a couldn't eventually be the same as libgit2.
>> We need better organization tough (e.g. builtins/lib.a).
>>
>> If you are arguing favor of a more messy setup, then we should link
>> all the builtin/*.o to libgit.a, because the current situation just
>> doesn't cut it.
>>
>> For example, init_copy_notes_for_rewrite() cannot be accessed by
>> sequencer.c, and while it's possible to move that function (and
>> others) to libgit.a, it doesn't make sense, because it can only be
>> used by builtins.
>
> libgit.a is just a way of grouping a bunch of objects together, not a
> real library

That's what a library is.

> and not meant to be. If you aim something more organized,
> please show at least a roadmap what to move where.

I already did that; we move code from libgit.a to builtin/*.o until
libgit.a == libgit2. Done.

-- 
Felipe Contreras

^ permalink raw reply	[relevance 5%]

* Re: [PATCH 3/3] Move header files into a include/ subdirectory
  2011-02-18  2:37 18%     ` [PATCH 3/3] Move header files into a include/ subdirectory Jonathan Nieder
@ 2011-02-18  3:52  5%       ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 200+ results
From: Nguyen Thai Ngoc Duy @ 2011-02-18  3:52 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git, Junio C Hamano, Nicolas Pitre

2011/2/18 Jonathan Nieder <jrnieder@gmail.com>:
> Move most of git's header files to an include/ subdirectory.
> This leaves us with 71 fewer files in the toplevel directory,
> making the high-level structure of the codebase a little easier
> to see.
>
> Three headers stay behind, at least for now: git-compat-util.h,
> strbuf.h, and cache.h are referred to by some system-specific code
> (in compat/) using paths starting with "..".  Making these three core
> headers especially visible doesn't seem like a bad idea, anyway.

Perhaps it's time to split a large portion of cache.h to libgit.h and
make cache.h include libgit.h.

cache.h and git-compat-util.h at topdir is ok to me. strbuf.h should
go to libgit though, imo.

> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
-- 
Duy

^ permalink raw reply	[relevance 5%]

* Re: [PATCH] Makefile: determine the list of header files using a glob
  @ 2009-11-27  9:36  5% ` Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2009-11-27  9:36 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junio C Hamano, Git Mailing List

Hi,

On Fri, 27 Nov 2009, Johannes Sixt wrote:

> From: Johannes Sixt <j6t@kdbg.org>
> 
> The list of header files was incomplete because a number of header files
> were added to the code base, but were not added to the list LIB_H that we
> have in the Makefile. This meant that no rebuild was triggered if one of
> the missing headers was changed because we do not have automatic
> dependency tracking, either.
> 
> Sidestep the issue by computing the list using $(wildcard).

Funny; I thought that not all header files are library header files, i.e. 
not all header changes should trigger a full new build of libgit.a.

Am I wrong?

Ciao,
Dscho

P.S.: Something that comes to mind is the http.h header, which should 
really be independent of libgit.a.  Which reminds me: do we _still_ tell 
libgit.a at _compile time_ whether git-remote-http is compiled with cURL?

^ permalink raw reply	[relevance 5%]

* Re: Installing full fledged git on solaris?
  @ 2009-10-11 12:57  5% ` Dilip M
  0 siblings, 0 replies; 200+ results
From: Dilip M @ 2009-10-11 12:57 UTC (permalink / raw)
  To: git

On Sun, Oct 11, 2009 at 5:56 PM, Dilip M <dilipm79@gmail.com> wrote:
> Hello,
>
>
> Has anyone has the list of pkg's to be installed on solaris 10 sparc,
> to get the GIT compiled (with all features)..
>
> thanks in advance for sharing...

Trying to compile the latest version exit with this error

    CC xdiff/xpatience.o
    AR xdiff/lib.a
    LINK git-fast-import
Undefined                       first referenced
 symbol                             in file
libiconv_close                      libgit.a(utf8.o)
libiconv_open                       libgit.a(utf8.o)
libiconv                            libgit.a(utf8.o)
ld: fatal: Symbol referencing errors. No output written to git-fast-import
collect2: ld returned 1 exit status
gmake: *** [git-fast-import] Error 1


-- 
Dilip

^ permalink raw reply	[relevance 5%]

* Re: [PATCH] Makefile: improve customization for supporting HP-UX
  @ 2008-08-23 20:26  5%   ` Miklos Vajna
  0 siblings, 0 replies; 200+ results
From: Miklos Vajna @ 2008-08-23 20:26 UTC (permalink / raw)
  To: Robert Schiele; +Cc: git

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

On Sat, Aug 23, 2008 at 10:09:28PM +0200, Robert Schiele <rschiele@gmail.com> wrote:
> The systems I build on are:
> 
> 1x HP-UX B.11.11 U 9000/785

This is the same version I'm using at the moment.

The NEEDS_LIBICONV is simple, the linker fails to find iconv symbols:

/usr/ccs/bin/ld: Unsatisfied symbols:
   libiconv (first referenced in libgit.a(utf8.o)) (code)
   libiconv_open (first referenced in libgit.a(utf8.o)) (code)
   libiconv_close (first referenced in libgit.a(utf8.o)) (code)
collect2: ld returned 1 exit status
gmake: *** [git] Error 1

The SNPRINTF_RETURNS_BOGUS is not something you can notice compile-time,
but once you try to commit, you get:

$ git commit
fatal: your vsnprintf is broken

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

^ permalink raw reply	[relevance 5%]

* Re: QGit: Shrink used memory with custom git log format
  @ 2007-11-27 12:36  5%     ` Marco Costalba
  0 siblings, 0 replies; 200+ results
From: Marco Costalba @ 2007-11-27 12:36 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Shawn O. Pearce, Git Mailing List

On Nov 27, 2007 11:48 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
>
> > > Indeed there is a git-rev-list --stdin option but with different
> > > behaviour from git-diff-tree --stdin and not suitable for this.
> >
> > There was a proposed patch for git-cat-file that would let you run
> > it in a --stdin mode; the git-svn folks wanted this to speed up
> > fetching raw objects from the repository.  That may help as you
> > could get commit bodies (in raw format - not reencoded format!)
> > quite efficiently.
>

That would be nice.

> > Otherwise I think what you really want here is a libgit that you can
> > link into your process and that can efficiently inflate an object
> > on demand for you.

I would think libgit is overkilling for this.

You probably would not use libgit to just add a single feature but to
change completely the interface with git because the required work is
heavy both on git side and qgit side (you probably would want to run
the libgit linked part in a separated thread to avoid GUI soft locks
during slow  processing, now, because the executed git command is a
different process from qgit, the OS scheduler takes care of this 'for
free').

Marco

^ permalink raw reply	[relevance 5%]

* Re: Splitting common-main
  @ 2023-07-15  0:34  5%       ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2023-07-15  0:34 UTC (permalink / raw)
  To: Josh Steadmon
  Cc: git, calvinwan, szeder.dev, phillip.wood123, chooglen, avarab,
	sandals

Josh Steadmon <steadmon@google.com> writes:

> Sorry, I don't think I'm understanding your proposal here properly,
> please let me know where I'm going wrong: isn't this functionally
> equivalent to my patch, just with different filenames? Now main() would
> live in main.c (vs. my common-main.c), while check_bug_if_BUG() and
> common_exit() would live in common-main.c (now a misnomer, vs. my
> common-exit.c). I'm not following how that changes anything so I'm
> pretty sure I've misunderstood.

Sorry, the old discussion has expired out of my brain, and asking
what I had in mind back then is too late.

Your common-main.c has stuff _other than_ main(), and the remaining
main() has tons of Git specific stuff.  It may be one way to split,
but I did not find a reason to convince myself that it was a good
split.

What I was wondering as a straw-man alternative was to have main.c
that has only this and nothing else:

    $ cat >main.c <<\EOF
    #include "git-compat-util.h" /* or whatever defines git_main() */
    int main(int ac, char **av)
    {
	return git_main(ac, av);
    }
    EOF

Then in common-main.c, rename main() to git_main().

I was not saying such a split would be superiour compared to how you
moved only some stuff out of common-main.c to a separate file.  I
had trouble equally with your split and with the above strawman,
because I did not (and do not) quite see how one would evaluate the
result (go back to the message you are responding to for details).

> The issue I was trying to solve (whether for a unit-test framework or
> for the fuzzing engine) is that we don't have direct control over their
> main(), and so we can't rename it to avoid conflicts with our main().

Sure.  And if we by default use a very thin main() that calls
git_main(), it would be very easy for them to replace that main.o
file with their own implementation of main(); as long as they
eventually call git_main(), they can borrow what we do in ours.

> I guess there may be some linker magic we could do to avoid the conflict
> and have (our) main() call (their, renamed) main()?

We can throw a main.o that has the implementation of our default
"main" function into "libgit.a".

Then, when we link our "git" program (either built-in programs that
are reachable from git.o, or standalone programs like remote-curl.o
that have their own cmd_main()), we list our object files (but we do
not have to list main.o) and tuck libgit.a at the end of the linker
command line.  As the start-up runtime code needs to find symbol
"main", and the linker sees no object files listed has "main", the
linker goes in and finds main.o stored in libgit.a (which has "main"
defined) and that will end up being linked.

If on the other hand when we link somebody else's program that has
its own "main()", we list the object files that make up the program,
including the one that has their "main()", before "libgit.a" and
the linker does not bother trying to find "main" in libgit.a:main.o
so the resulting binary will use their main().

Is that what you are looking for?

^ permalink raw reply	[relevance 5%]

* Re: Announcing a new (prototype) git-remote-hg tool
  @ 2014-12-05 22:13  5% ` Jonathan Nieder
  0 siblings, 0 replies; 200+ results
From: Jonathan Nieder @ 2014-12-05 22:13 UTC (permalink / raw)
  To: Mike Hommey; +Cc: git, Junio C Hamano

Mike Hommey wrote:

> I'm currently evaluating what the final tool would look like. I'm *very*
> tempted to implement it in C, based on core git code, because there are
> many things that this helper does that would be so much easier to do
> with direct access to git's guts. And that wouldn't require more
> dependencies than git currently has: it would "just" need curl and ssh,
> and git already uses both.
>
> If I were to go in that direction, would you consider integrating it
> in git core?

Yes --- I would like this a lot.

The general trend has been to carry fewer contrib-style tools in-tree,
since the problem of discovering tools built on top of git is not as
hard as it used to be.  What you describe above seems to be a bit of an
exception:

 - libgit.a in its current state evolves too quickly for it to be
   convenient for out-of-tree tools to use.  cgit <http://git.zx2c4.com/cgit/>
   uses git pinned to a particular version as a submodule to get around
   this, which is fussy and has bad implications for remembering to
   get security updates.

 - an in-tree user of libgit.a would be useful as a reference example
   to use to try to make libgit.a into be a better library internally
   (and eventually expose e.g. by merging with libgit2 as something
   outside tools can link to, I hope)

 - if it makes sense to help people using the current remote helper
   in contrib to migrate to this, it could be convenient for users

In other words, although in the long term I would be happiest if
libgit becomes good enough to let this project live in a separate tree
and link to it, it's tempting to build this in-tree because we're not
there yet.

Some other alternatives:

 - using libgit2 <https://libgit2.github.com/>

 - improving git plumbing (e.g., with new fast-import commands) or
   exposing a small library with a stable API for the tool's use

I haven't thought it through carefully but at the moment I like the
in-tree approach best.

Thanks,
Jonathan

^ permalink raw reply	[relevance 5%]

* Darcs-Git: upgrading to Git 0.99
@ 2005-07-16 20:45  5% Juliusz Chroboczek
  2005-07-17 10:40  5% ` [darcs-devel] " David Roundy
  0 siblings, 1 reply; 200+ results
From: Juliusz Chroboczek @ 2005-07-16 20:45 UTC (permalink / raw)
  To: darcs-devel; +Cc: git

[CC'd to the Git mailling list; please CC any replies to Darcs-Devel]

David, Ian,

I'd like to upgrade the Git code used in Darcs to 0.99 (we're
currently using 0.6).  There are two good reasons for that, the first
of which is actually a showstopper:

 - the format of Git repositories has changed incompatibly, with a new
   kind of thing called the ``pack'' (a very neat performance hack, by
   the way); hence, Darcs-Git is unable to read recent Git repos,
   unless you use the Git tools to unpack them;

 - 0.99 actually exports usable interfaces, which will allow us to use
   pristine Git sources in Darcs.

Now I'm wondering how to do that.  Currently, I'm using a nasty hack
using the C preprocessor to include just the sources we need in
Darcs.  As 0.99 builds a ``libgit.a'', I'd like to use that instead.

There are three ways to do that:

  (1) require that the users put a suitable libgit.a in /usr/local/lib
      before building Darcs, and distribute a tarball of Git from
      darcs.net;

  (2) include just the sources needed for libgit.a in Darcs, and have
      the Darcs build build a local libgit

  (3) as (2), but include all of Git, including their
      ``user-friendly'' scripts.

Solution (2) will include 33 files totalling 167KB, while (3) is about
a megabyte of source.

My personal favourite is solution (2), as it is simple for both the
users and us.  I'm not very keen on (1), as it will cause problems
when the friendly Git folks change their interfaces, but have no
strong dislike towards it if it's what you think is right.  (3) is
definitely overkill.

                                        Juliusz

^ permalink raw reply	[relevance 5%]

* [PATCH 9/9] Add a sample user for the svndump library
  @ 2010-06-24 11:07  5% ` Jonathan Nieder
  0 siblings, 0 replies; 200+ results
From: Jonathan Nieder @ 2010-06-24 11:07 UTC (permalink / raw)
  To: git
  Cc: Ramkumar Ramachandra, David Michael Barr, Sverre Rabbelier,
	Daniel Shahaf

The svn-fe tool takes a Subversion dump file as input and produces
a fast-import stream as output.  This can be useful as a low-level
tool in building other importers, or for debugging the vcs-svn
library.

 make svn-fe
 make svn-fe.1

to test.

NEEDSWORK: litters cwd with useless .bin files.
But I hope it is enough to show the idea.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Thanks for reading.  Thoughts welcome.

 contrib/svn-fe/.gitignore |    3 ++
 contrib/svn-fe/Makefile   |   63 +++++++++++++++++++++++++++++++++++++++++++++
 contrib/svn-fe/svn-fe.c   |   43 ++++++++++++++++++++++++++++++
 contrib/svn-fe/svn-fe.txt |   56 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 165 insertions(+), 0 deletions(-)
 create mode 100644 contrib/svn-fe/.gitignore
 create mode 100644 contrib/svn-fe/Makefile
 create mode 100644 contrib/svn-fe/svn-fe.c
 create mode 100644 contrib/svn-fe/svn-fe.txt

diff --git a/contrib/svn-fe/.gitignore b/contrib/svn-fe/.gitignore
new file mode 100644
index 0000000..27a33b6
--- /dev/null
+++ b/contrib/svn-fe/.gitignore
@@ -0,0 +1,3 @@
+/*.xml
+/*.1
+/*.html
diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
new file mode 100644
index 0000000..4cc8d15
--- /dev/null
+++ b/contrib/svn-fe/Makefile
@@ -0,0 +1,63 @@
+all:: svn-fe$X
+
+CC = gcc
+RM = rm -f
+MV = mv
+
+CFLAGS = -g -O2 -Wall
+LDFLAGS =
+ALL_CFLAGS = $(CFLAGS)
+ALL_LDFLAGS = $(LDFLAGS)
+EXTLIBS =
+
+GIT_LIB = ../../libgit.a
+VCSSVN_LIB = ../../vcs-svn/lib.a
+LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(EXTLIBS)
+
+QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1 =
+
+ifneq ($(findstring $(MAKEFLAGS),w),w)
+PRINT_DIR = --no-print-directory
+else # "make -w"
+NO_SUBDIR = :
+endif
+
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+	QUIET_CC      = @echo '   ' CC $@;
+	QUIET_LINK    = @echo '   ' LINK $@;
+	QUIET_SUBDIR0 = +@subdir=
+	QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+	                $(MAKE) $(PRINT_DIR) -C $$subdir
+endif
+endif
+
+svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(GIT_LIB)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ svn-fe.o \
+		$(ALL_LDFLAGS) $(LIBS)
+
+svn-fe.o: svn-fe.c ../../vcs-svn/svndump.h
+	$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
+
+svn-fe.html: svn-fe.txt
+	$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
+		MAN_TXT=../contrib/svn-fe/svn-fe.txt \
+		../contrib/svn-fe/$@
+
+svn-fe.1: svn-fe.txt
+	$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
+		MAN_TXT=../contrib/svn-fe/svn-fe.txt \
+		../contrib/svn-fe/$@
+	$(MV) ../../Documentation/svn-fe.1 .
+
+../../vcs-svn/lib.a: FORCE
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) vcs-svn/lib.a
+
+../../libgit.a: FORCE
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
+
+clean:
+	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
+
+.PHONY: all clean FORCE
diff --git a/contrib/svn-fe/svn-fe.c b/contrib/svn-fe/svn-fe.c
new file mode 100644
index 0000000..d84dd4f
--- /dev/null
+++ b/contrib/svn-fe/svn-fe.c
@@ -0,0 +1,43 @@
+/*
+ * Parse and rearrange a svnadmin dump.
+ * Create the dump with:
+ * svnadmin dump --incremental -r<startrev>:<endrev> <repository> >outfile
+ *
+ * Copyright (C) 2010 David Barr <david.barr@cordelta.com>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice(s), this list of conditions and the following disclaimer
+ *    unmodified other than the allowable addition of one or more
+ *    copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include "../../vcs-svn/svndump.h"
+
+int main(int argc, char **argv)
+{
+	svndump_init(NULL);
+	svndump_read((argc > 1) ? argv[1] : NULL);
+	svndump_reset();
+	return 0;
+}
diff --git a/contrib/svn-fe/svn-fe.txt b/contrib/svn-fe/svn-fe.txt
new file mode 100644
index 0000000..bfd3a68
--- /dev/null
+++ b/contrib/svn-fe/svn-fe.txt
@@ -0,0 +1,56 @@
+svn-fe(1)
+=========
+
+NAME
+----
+svn-fe - convert an SVN "dumpfile" to a fast-import stream
+
+SYNOPSIS
+--------
+svnadmin dump --incremental REPO | svn-fe [url] | git fast-import
+
+DESCRIPTION
+-----------
+Converts a textual representation of a Subversion repository into
+input suitable for git-fast-import(1) and similar importers.
+
+INPUT FORMAT
+------------
+Subversion's repository dump format is documented in full in
+`notes/dump-load-format.txt` from the Subversion source tree.
+Files in this format can be generated using the 'svnadmin dump' or
+'svk admin dump' command.
+
+OUTPUT FORMAT
+-------------
+The fast-import format is documented by the git-fast-import(1)
+manual page.
+
+NOTES
+-----
+Subversion dumps do not record a separate author and committer for
+each revision, nor a separate display name and email address for
+each author.  Like git-svn(1), 'svn-fe' will use the name
+
+---------
+user <user@UUID>
+---------
+
+as committer, where 'user' is the value of the `svn:author` property
+and 'UUID' the repository's identifier.
+
+To support incremental imports, 'svn-fe' will put a `git-svn-id`
+line at the end of each commit log message if passed an url on the
+command line.  This line has the form `git-svn-id: URL@REVNO UUID`.
+
+Empty directories and unknown properties are silently discarded.
+
+The resulting repository will generally require further processing
+to put each project in its own repository and to separate the history
+of each branch.  The 'git filter-branch --subdirectory-filter' command
+may be useful for this purpose.
+
+SEE ALSO
+--------
+git-svn(1), svn2git(1), svk(1), git-filter-branch(1), git-fast-import(1),
+https://svn.apache.org/repos/asf/subversion/trunk/notes/dump-load-format.txt
-- 
1.7.1

^ permalink raw reply related	[relevance 5%]

* [PATCH 2/4] Implement a new patch identification scheme and id command
  @ 2008-07-13 11:40  5% ` Catalin Marinas
  0 siblings, 0 replies; 200+ results
From: Catalin Marinas @ 2008-07-13 11:40 UTC (permalink / raw)
  To: Karl Hasselström, git

The new scheme allows '[<branch>:]<patch>' and '[<branch>:]{base}'
(the latter showing the base of a stack). The former format allows
symbols like ^ and ^{...}.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---

 stgit/commands/common.py   |   33 +++++++++++++++++++++++++++++++++
 stgit/commands/id.py       |   28 ++++++++++++----------------
 stgit/lib/git.py           |    4 ++--
 t/t0001-subdir-branches.sh |   24 ++++++++++--------------
 t/t1200-push-modified.sh   |    2 +-
 t/t1201-pull-trailing.sh   |    2 +-
 t/t2200-rebase.sh          |    2 +-
 7 files changed, 60 insertions(+), 35 deletions(-)

diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 029ec65..0133f1a 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -28,6 +28,7 @@ from stgit.run import *
 from stgit import stack, git, basedir
 from stgit.config import config, file_extensions
 from stgit.lib import stack as libstack
+from stgit.lib import git as libgit
 
 # Command exception class
 class CmdException(StgException):
@@ -116,6 +117,38 @@ def git_id(crt_series, rev):
 
     raise CmdException, 'Unknown patch or revision: %s' % rev
 
+def git_commit(name, repository, branch = None):
+    """Return the a Commit object if 'name' is a patch name or Git commit.
+    The patch names allowed are in the form '<branch>:<patch>' and can
+    be followed by standard symbols used by git-rev-parse. If <patch>
+    is '{base}', it represents the bottom of the stack.
+    """
+    # Try a [branch:]patch name first
+    try:
+        branch, patch = name.split(':', 1)
+    except ValueError:
+        patch = name
+    if not branch:
+        branch = repository.current_branch_name
+
+    # The stack base
+    if patch.startswith('{base}'):
+        base_id = repository.get_stack(branch).base.sha1
+        return repository.rev_parse(base_id + patch[6:])
+
+    # Other combination of branch and patch
+    try:
+        return repository.rev_parse('patches/%s/%s' % (branch, patch),
+                                    discard_stderr = True)
+    except libgit.RepositoryException:
+        pass
+
+    # Try a Git commit
+    try:
+        return repository.rev_parse(name, discard_stderr = True)
+    except libgit.RepositoryException:
+        raise CmdException('%s: Unknown patch or revision name' % name)
+
 def check_local_changes():
     if git.local_changes():
         raise CmdException('local changes in the tree. Use "refresh" or'
diff --git a/stgit/commands/id.py b/stgit/commands/id.py
index 94b0229..3819acc 100644
--- a/stgit/commands/id.py
+++ b/stgit/commands/id.py
@@ -15,28 +15,24 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 """
 
-import sys, os
 from optparse import OptionParser, make_option
 
-from stgit.commands.common import *
-from stgit.utils import *
-from stgit.out import *
-from stgit import stack, git
-
+from stgit.out import out
+from stgit.commands import common
+from stgit.lib import stack
 
 help = 'print the GIT hash value of a StGIT reference'
 usage = """%prog [options] [id]
 
-Print the hash value of a GIT id (defaulting to HEAD). In addition to
-the standard GIT id's like heads and tags, this command also accepts
-'base[@<branch>]' and '[<patch>[@<branch>]][//[bottom | top]]'. If no
-'top' or 'bottom' are passed and <patch> is a valid patch name, 'top'
-will be used by default."""
-
-directory = DirectoryHasRepository()
-options = [make_option('-b', '--branch',
-                       help = 'use BRANCH instead of the default one')]
+Print the SHA1 value of a Git id (defaulting to HEAD). In addition to
+the standard Git id's like heads and tags, this command also accepts
+'[<branch>:]<patch>' and '[<branch>:]{base}' showing the id of a patch
+or the base of the stack. If no branch is specified, it defaults to the
+current one. The bottom of a patch is accessible with the
+'[<branch>:]<patch>^' format."""
 
+directory = common.DirectoryHasRepositoryLib()
+options = []
 
 def func(parser, options, args):
     """Show the applied patches
@@ -48,4 +44,4 @@ def func(parser, options, args):
     else:
         parser.error('incorrect number of arguments')
 
-    out.stdout(git_id(crt_series, id_str))
+    out.stdout(common.git_commit(id_str, directory.repository).sha1)
diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index 6ccdfa7..4746da3 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -422,11 +422,11 @@ class Repository(RunWithEnv):
     refs = property(lambda self: self.__refs)
     def cat_object(self, sha1):
         return self.run(['git', 'cat-file', '-p', sha1]).raw_output()
-    def rev_parse(self, rev):
+    def rev_parse(self, rev, discard_stderr = False):
         try:
             return self.get_commit(self.run(
                     ['git', 'rev-parse', '%s^{commit}' % rev]
-                    ).output_one_line())
+                    ).discard_stderr(discard_stderr).output_one_line())
         except run.RunException:
             raise RepositoryException('%s: No such revision' % rev)
     def get_tree(self, sha1):
diff --git a/t/t0001-subdir-branches.sh b/t/t0001-subdir-branches.sh
index 69c11a3..3f7962a 100755
--- a/t/t0001-subdir-branches.sh
+++ b/t/t0001-subdir-branches.sh
@@ -18,25 +18,21 @@ test_expect_success 'Create a patch' \
    stg new foo -m "Add foo.txt" &&
    stg refresh'
 
-test_expect_success 'Old and new id with non-slashy branch' \
-  'stg id foo &&
-   stg id foo// &&
-   stg id foo/ &&
-   stg id foo//top &&
-   stg id foo/top &&
-   stg id foo@master &&
-   stg id foo@master//top &&
-   stg id foo@master/top'
+test_expect_success 'Try id with non-slashy branch' \
+  'stg id &&
+   stg id foo &&
+   stg id foo^ &&
+   stg id master:foo &&
+   stg id master:foo^'
 
 test_expect_success 'Clone branch to slashier name' \
   'stg branch --clone x/y/z'
 
-test_expect_success 'Try new form of id with slashy branch' \
+test_expect_success 'Try new id with slashy branch' \
   'stg id foo &&
-   stg id foo// &&
-   stg id foo//top &&
-   stg id foo@x/y/z &&
-   stg id foo@x/y/z//top'
+   stg id foo^ &&
+   stg id x/y/z:foo &&
+   stg id x/y/z:foo^'
 
 test_expect_success 'Try old id with slashy branch' '
    command_error stg id foo/ &&
diff --git a/t/t1200-push-modified.sh b/t/t1200-push-modified.sh
index 6ebd0a1..2edc760 100755
--- a/t/t1200-push-modified.sh
+++ b/t/t1200-push-modified.sh
@@ -36,7 +36,7 @@ test_expect_success \
     (
         cd foo &&
         GIT_DIR=../bar/.git git-format-patch --stdout \
-          $(cd ../bar && stg id base@master)..HEAD | git-am -3 -k
+          $(cd ../bar && stg id master:{base})..HEAD | git-am -3 -k
     )
 '
 
diff --git a/t/t1201-pull-trailing.sh b/t/t1201-pull-trailing.sh
index 9d70fe0..8a74873 100755
--- a/t/t1201-pull-trailing.sh
+++ b/t/t1201-pull-trailing.sh
@@ -30,7 +30,7 @@ test_expect_success \
     'Port those patches to orig tree' \
     '(cd foo &&
       GIT_DIR=../bar/.git git-format-patch --stdout \
-          $(cd ../bar && stg id base@master)..HEAD |
+          $(cd ../bar && stg id master:{base})..HEAD |
       git-am -3 -k
      )
     '
diff --git a/t/t2200-rebase.sh b/t/t2200-rebase.sh
index a6f43bc..256eaaa 100755
--- a/t/t2200-rebase.sh
+++ b/t/t2200-rebase.sh
@@ -27,7 +27,7 @@ test_expect_success \
 	'Rebase to previous commit' \
 	'
 	stg rebase master~1 &&
-	test `stg id base@stack` = `git rev-parse master~1` &&
+	test `stg id stack:{base}` = `git rev-parse master~1` &&
 	test `stg applied | wc -l` = 1
 	'
 

^ permalink raw reply related	[relevance 5%]

* Re: [PATCH] Make git compile with SUNs forte12 compiler
  @ 2007-05-13 12:52  5%     ` matthieu castet
  0 siblings, 0 replies; 200+ results
From: matthieu castet @ 2007-05-13 12:52 UTC (permalink / raw)
  To: Thomas Glanzmann; +Cc: git, junkio

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

Hi Thomas,

Thomas Glanzmann wrote:
> Hello,
> 
> [ Junio please drop the patch, if you thought about putting it upstream ]
> 
>> Did you understand what you did ?
> 
> I do. But my objective wasn't get that function inline but get git to compile
> under forte12. However. After you pushed me in the right direction I read the
> compiler documentation and found a compiler option called "-features=no%extinl"
> which makes it possible to compile git as is using forte12.
What's strange with your compiler is that it seems to not take care of 
the "static" keyword and thinks about an "extern inline".
Now it could be interesting to understand why.

Let's look at your error [1].
First it only complain about tree_entry_extract not tree_entry_len.

Let's see why ?
If you look in tree-walk.h and search for tree_entry_extract, you will see :

static inline const unsigned char *tree_entry_extract(struct tree_desc 
*desc, const char **pathp, unsigned int *modep)
[...]
const unsigned char *tree_entry_extract(struct tree_desc *, const char 
**, unsigned int *);

This is bad, tree_entry_extract is declared as static inline and as extern.

If you remove the "const unsigned char *tree_entry_extract(struct 
tree_desc *, const char **, unsigned int *);", I bet everybody will be 
happy and no need to extra option for the sun compiler. [2]


Matthieu

[1]
LINK git-convert-objects
ld: fatal: symbol `tree_entry_extract' is multiply-defined:
         (file libgit.a(sha1_name.o) type=FUNC; file libgit.a(tree.o) 
type=FUNC);
ld: fatal: symbol `tree_entry_extract' is multiply-defined:
         (file libgit.a(sha1_name.o) type=FUNC; file 
libgit.a(tree-walk.o) type=FUNC);
ld: fatal: File processing errors. No output written to git-convert-objects

[2] see attached patch


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 489 bytes --]

--- a/tree-walk.h	2007-05-13 14:51:01.451827585 +0200
+++ b/tree-walk.h	2007-05-13 14:51:07.450235889 +0200
@@ -27,7 +27,6 @@
 
 void update_tree_entry(struct tree_desc *);
 void init_tree_desc(struct tree_desc *desc, const void *buf, unsigned long size);
-const unsigned char *tree_entry_extract(struct tree_desc *, const char **, unsigned int *);
 
 /* Helper function that does both of the above and returns true for success */
 int tree_entry(struct tree_desc *, struct name_entry *);

^ permalink raw reply	[relevance 5%]

* [StGIT PATCH 2/4] Implement a new patch identification scheme and id command
  @ 2008-06-19 21:42  5% ` Catalin Marinas
  0 siblings, 0 replies; 200+ results
From: Catalin Marinas @ 2008-06-19 21:42 UTC (permalink / raw)
  To: git, Karl Hasselström

The new scheme allows '[<branch>:]<patch>' and '[<branch>:]{base}'
(the latter showing the base of a stack). The former format allows
symbols like ^ and ^{...}.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---

 stgit/commands/common.py   |   32 ++++++++++++++++++++++++++++++++
 stgit/commands/id.py       |   28 ++++++++++++----------------
 stgit/lib/git.py           |    4 ++--
 t/t0001-subdir-branches.sh |   24 ++++++++++--------------
 t/t1200-push-modified.sh   |    2 +-
 t/t1201-pull-trailing.sh   |    2 +-
 t/t2200-rebase.sh          |    2 +-
 7 files changed, 59 insertions(+), 35 deletions(-)

diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 029ec65..349389f 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -28,6 +28,7 @@ from stgit.run import *
 from stgit import stack, git, basedir
 from stgit.config import config, file_extensions
 from stgit.lib import stack as libstack
+from stgit.lib import git as libgit
 
 # Command exception class
 class CmdException(StgException):
@@ -116,6 +117,37 @@ def git_id(crt_series, rev):
 
     raise CmdException, 'Unknown patch or revision: %s' % rev
 
+def git_commit(name, repository, branch = None):
+    """Return the a Commit object if 'name' is a patch name or Git commit.
+    The patch names allowed are in the form '<branch>:<patch>' and can be
+    followed by standard symbols used by git-rev-parse. If <patch> is '{base}',
+    it represents the bottom of the stack.
+    """
+    # Try a [branch:]patch name first
+    try:
+        branch, patch = name.split(':', 1)
+    except ValueError:
+        patch = name
+    if not branch:
+        branch = repository.current_branch_name
+
+    # The stack base
+    if patch == '{base}':
+        return repository.get_stack(branch).base
+
+    # Other combination of branch and patch
+    try:
+        return repository.rev_parse('patches/%s/%s' % (branch, patch),
+                                    discard_stderr = True)
+    except libgit.RepositoryException:
+        pass
+
+    # Try a Git commit
+    try:
+        return repository.rev_parse(name, discard_stderr = True)
+    except libgit.RepositoryException:
+        raise CmdException('%s: Unknown patch or revision name' % name)
+
 def check_local_changes():
     if git.local_changes():
         raise CmdException('local changes in the tree. Use "refresh" or'
diff --git a/stgit/commands/id.py b/stgit/commands/id.py
index 94b0229..3819acc 100644
--- a/stgit/commands/id.py
+++ b/stgit/commands/id.py
@@ -15,28 +15,24 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 """
 
-import sys, os
 from optparse import OptionParser, make_option
 
-from stgit.commands.common import *
-from stgit.utils import *
-from stgit.out import *
-from stgit import stack, git
-
+from stgit.out import out
+from stgit.commands import common
+from stgit.lib import stack
 
 help = 'print the GIT hash value of a StGIT reference'
 usage = """%prog [options] [id]
 
-Print the hash value of a GIT id (defaulting to HEAD). In addition to
-the standard GIT id's like heads and tags, this command also accepts
-'base[@<branch>]' and '[<patch>[@<branch>]][//[bottom | top]]'. If no
-'top' or 'bottom' are passed and <patch> is a valid patch name, 'top'
-will be used by default."""
-
-directory = DirectoryHasRepository()
-options = [make_option('-b', '--branch',
-                       help = 'use BRANCH instead of the default one')]
+Print the SHA1 value of a Git id (defaulting to HEAD). In addition to
+the standard Git id's like heads and tags, this command also accepts
+'[<branch>:]<patch>' and '[<branch>:]{base}' showing the id of a patch
+or the base of the stack. If no branch is specified, it defaults to the
+current one. The bottom of a patch is accessible with the
+'[<branch>:]<patch>^' format."""
 
+directory = common.DirectoryHasRepositoryLib()
+options = []
 
 def func(parser, options, args):
     """Show the applied patches
@@ -48,4 +44,4 @@ def func(parser, options, args):
     else:
         parser.error('incorrect number of arguments')
 
-    out.stdout(git_id(crt_series, id_str))
+    out.stdout(common.git_commit(id_str, directory.repository).sha1)
diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index 6ccdfa7..4746da3 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -422,11 +422,11 @@ class Repository(RunWithEnv):
     refs = property(lambda self: self.__refs)
     def cat_object(self, sha1):
         return self.run(['git', 'cat-file', '-p', sha1]).raw_output()
-    def rev_parse(self, rev):
+    def rev_parse(self, rev, discard_stderr = False):
         try:
             return self.get_commit(self.run(
                     ['git', 'rev-parse', '%s^{commit}' % rev]
-                    ).output_one_line())
+                    ).discard_stderr(discard_stderr).output_one_line())
         except run.RunException:
             raise RepositoryException('%s: No such revision' % rev)
     def get_tree(self, sha1):
diff --git a/t/t0001-subdir-branches.sh b/t/t0001-subdir-branches.sh
index 0eed3a4..4df0481 100755
--- a/t/t0001-subdir-branches.sh
+++ b/t/t0001-subdir-branches.sh
@@ -18,25 +18,21 @@ test_expect_success 'Create a patch' \
    stg new foo -m "Add foo.txt" &&
    stg refresh'
 
-test_expect_success 'Old and new id with non-slashy branch' \
-  'stg id foo &&
-   stg id foo// &&
-   stg id foo/ &&
-   stg id foo//top &&
-   stg id foo/top &&
-   stg id foo@master &&
-   stg id foo@master//top &&
-   stg id foo@master/top'
+test_expect_success 'Try id with non-slashy branch' \
+  'stg id &&
+   stg id foo &&
+   stg id foo^ &&
+   stg id master:foo &&
+   stg id master:foo^'
 
 test_expect_success 'Clone branch to slashier name' \
   'stg branch --clone x/y/z'
 
-test_expect_success 'Try new form of id with slashy branch' \
+test_expect_success 'Try new id with slashy branch' \
   'stg id foo &&
-   stg id foo// &&
-   stg id foo//top &&
-   stg id foo@x/y/z &&
-   stg id foo@x/y/z//top'
+   stg id foo^ &&
+   stg id x/y/z:foo &&
+   stg id x/y/z:foo^'
 
 test_expect_success 'Try old id with slashy branch' '
    ! stg id foo/ &&
diff --git a/t/t1200-push-modified.sh b/t/t1200-push-modified.sh
index ba4f70c..e3c6425 100755
--- a/t/t1200-push-modified.sh
+++ b/t/t1200-push-modified.sh
@@ -36,7 +36,7 @@ test_expect_success \
     (
         cd foo &&
         GIT_DIR=../bar/.git git-format-patch --stdout \
-          $(cd ../bar && stg id base@master)..HEAD | git-am -3 -k
+          $(cd ../bar && stg id master:{base})..HEAD | git-am -3 -k
     )
 '
 
diff --git a/t/t1201-pull-trailing.sh b/t/t1201-pull-trailing.sh
index 9d70fe0..8a74873 100755
--- a/t/t1201-pull-trailing.sh
+++ b/t/t1201-pull-trailing.sh
@@ -30,7 +30,7 @@ test_expect_success \
     'Port those patches to orig tree' \
     '(cd foo &&
       GIT_DIR=../bar/.git git-format-patch --stdout \
-          $(cd ../bar && stg id base@master)..HEAD |
+          $(cd ../bar && stg id master:{base})..HEAD |
       git-am -3 -k
      )
     '
diff --git a/t/t2200-rebase.sh b/t/t2200-rebase.sh
index ec2a104..cd43c41 100755
--- a/t/t2200-rebase.sh
+++ b/t/t2200-rebase.sh
@@ -27,7 +27,7 @@ test_expect_success \
 	'Rebase to previous commit' \
 	'
 	stg rebase master~1 &&
-	test `stg id base@stack` = `git rev-parse master~1` &&
+	test `stg id stack:{base}` = `git rev-parse master~1` &&
 	test `stg applied | wc -l` = 1
 	'
 

^ permalink raw reply related	[relevance 5%]

* [PATCH v4 6/8] cmake: support for building git on windows with mingw
  @ 2020-06-12 18:29  5%       ` Sibi Siddharthan via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Sibi Siddharthan via GitGitGadget @ 2020-06-12 18:29 UTC (permalink / raw)
  To: git; +Cc: Sibi Siddharthan, Sibi Siddharthan

From: Sibi Siddharthan <sibisiddharthan.github@gmail.com>

This patch facilitates building git on Windows with CMake using MinGW

NOTE: The funtions unsetenv and hstrerror are not checked in Windows
builds.
Reasons
NO_UNSETENV is not compatible with Windows builds.
lines 262-264 compat/mingw.h

compat/mingw.h(line 25) provides a definition of hstrerror which
conflicts with the definition provided in
git-compat-util.h(lines 733-736).

To use CMake on Windows with MinGW do this:
cmake `relative-path-to-srcdir` -G "MinGW Makefiles"

Signed-off-by: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
---
 contrib/buildsystems/CMakeLists.txt | 121 ++++++++++++++++++++++------
 1 file changed, 98 insertions(+), 23 deletions(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index f9976378d2d..9aff2b9f4f9 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -42,6 +42,10 @@ cmake_minimum_required(VERSION 3.14)
 set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
 
 find_program(SH_EXE sh)
+if(NOT SH_EXE)
+	message(FATAL_ERROR "sh: shell interpreter was not found in your path, please install one."
+			"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
+endif()
 
 #Create GIT-VERSION-FILE using GIT-VERSION-GEN
 if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
@@ -65,7 +69,9 @@ project(git
 	VERSION ${git_version}
 	LANGUAGES C)
 
+
 #TODO gitk git-gui gitweb
+#TODO Enable NLS on windows natively
 #TODO Add pcre support
 
 #macros for parsing the Makefile for sources and scripts
@@ -104,6 +110,7 @@ find_package(EXPAT)
 find_package(Iconv)
 find_package(Intl)
 
+
 if(NOT Intl_FOUND)
 	add_compile_definitions(NO_GETTEXT)
 	if(NOT Iconv_FOUND)
@@ -125,6 +132,14 @@ if(Intl_FOUND)
 	include_directories(SYSTEM ${Intl_INCLUDE_DIRS})
 endif()
 
+
+if(WIN32)
+	find_program(WINDRES_EXE windres)
+	if(NOT WINDRES_EXE)
+		message(FATAL_ERROR "Install windres on Windows for resource files")
+	endif()
+endif()
+
 find_program(MSGFMT_EXE msgfmt)
 if(NOT MSGFMT_EXE)
 	message(WARNING "Text Translations won't be build")
@@ -156,11 +171,39 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
 			BINDIR="bin"
 			GIT_BUILT_FROM_COMMIT="")
 
-set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
-add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+if(WIN32)
+	set(FALLBACK_RUNTIME_PREFIX /mingw64)
+	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+else()
+	set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
+	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+endif()
 
-add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
-list(APPEND compat_SOURCES unix-socket.c)
+
+#Platform Specific
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+	include_directories(${CMAKE_SOURCE_DIR}/compat/win32)
+	add_compile_definitions(HAVE_ALLOCA_H NO_POSIX_GOODIES NATIVE_CRLF NO_UNIX_SOCKETS WIN32
+				_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=".exe"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT
+				NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0
+				USE_NED_ALLOCATOR OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP
+				UNICODE _UNICODE HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET)
+	list(APPEND compat_SOURCES compat/mingw.c compat/winansi.c compat/win32/path-utils.c
+		compat/win32/pthread.c compat/win32mmap.c compat/win32/syslog.c
+		compat/win32/trace2_win32_process_info.c compat/win32/dirent.c
+		compat/nedmalloc/nedmalloc.c compat/strdup.c)
+	set(NO_UNIX_SOCKETS 1)
+
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+	add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
+	list(APPEND compat_SOURCES unix-socket.c)
+endif()
+
+if(WIN32)
+	set(EXE_EXTENSION .exe)
+else()
+	set(EXE_EXTENSION)
+endif()
 
 #header checks
 check_include_file(libgen.h HAVE_LIBGEN_H)
@@ -223,7 +266,12 @@ endif()
 #function checks
 set(function_checks
 	strcasestr memmem strlcpy strtoimax strtoumax strtoull
-	setenv mkdtemp poll pread memmem unsetenv hstrerror)
+	setenv mkdtemp poll pread memmem)
+
+#unsetenv,hstrerror are incompatible with windows build
+if(NOT WIN32)
+	list(APPEND function_checks unsetenv hstrerror)
+endif()
 
 foreach(f ${function_checks})
 	string(TOUPPER ${f} uf)
@@ -444,7 +492,13 @@ unset(CMAKE_REQUIRED_INCLUDES)
 #programs
 set(PROGRAMS_BUILT
 	git git-bugreport git-credential-store git-daemon git-fast-import git-http-backend git-sh-i18n--envsubst
-	git-shell git-remote-testsvn git-credential-cache git-credential-cache--daemon)
+	git-shell git-remote-testsvn)
+
+if(NO_UNIX_SOCKETS)
+	list(APPEND excluded_progs git-credential-cache git-credential-cache--daemon)
+else()
+	list(APPEND PROGRAMS_BUILT git-credential-cache git-credential-cache--daemon)
+endif()
 
 if(NOT CURL_FOUND)
 	list(APPEND excluded_progs git-http-fetch git-http-push)
@@ -516,15 +570,34 @@ parse_makefile_for_sources(libvcs-svn_SOURCES "VCSSVN_OBJS")
 list(TRANSFORM libvcs-svn_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
 add_library(vcs-svn STATIC ${libvcs-svn_SOURCES})
 
+#add git.rc for gcc
+if(WIN32)
+	add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
+			COMMAND ${WINDRES_EXE} -O coff -DMAJOR=${PROJECT_VERSION_MAJOR} -DMINOR=${PROJECT_VERSION_MINOR}
+				-DMICRO=${PROJECT_VERSION_PATCH} -DPATCHLEVEL=0 -DGIT_VERSION="\\\"${PROJECT_VERSION}.GIT\\\""
+				-i ${CMAKE_SOURCE_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+			WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+			VERBATIM)
+	add_custom_target(git-rc DEPENDS ${CMAKE_BINARY_DIR}/git.res)
+endif()
+
 #link all required libraries to common-main
 add_library(common-main OBJECT ${CMAKE_SOURCE_DIR}/common-main.c)
-target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES} pthread rt)
+
+target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES})
 if(Intl_FOUND)
 	target_link_libraries(common-main ${Intl_LIBRARIES})
 endif()
 if(Iconv_FOUND)
 	target_link_libraries(common-main ${Iconv_LIBRARIES})
 endif()
+if(WIN32)
+	target_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)
+	add_dependencies(common-main git-rc)
+	target_link_options(common-main PUBLIC -municode -Wl,--nxcompat -Wl,--dynamicbase -Wl,--pic-executable,-e,mainCRTStartup)
+elseif(UNIX)
+	target_link_libraries(common-main pthread rt)
+endif()
 
 #git
 parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
@@ -575,11 +648,13 @@ endif()
 add_executable(git-remote-testsvn ${CMAKE_SOURCE_DIR}/remote-testsvn.c)
 target_link_libraries(git-remote-testsvn common-main vcs-svn)
 
-add_executable(git-credential-cache ${CMAKE_SOURCE_DIR}/credential-cache.c)
-target_link_libraries(git-credential-cache common-main)
+if(NOT NO_UNIX_SOCKETS)
+	add_executable(git-credential-cache ${CMAKE_SOURCE_DIR}/credential-cache.c)
+	target_link_libraries(git-credential-cache common-main)
 
-add_executable(git-credential-cache--daemon ${CMAKE_SOURCE_DIR}/credential-cache--daemon.c)
-target_link_libraries(git-credential-cache--daemon common-main)
+	add_executable(git-credential-cache--daemon ${CMAKE_SOURCE_DIR}/credential-cache--daemon.c)
+	target_link_libraries(git-credential-cache--daemon common-main)
+endif()
 
 
 set(git_builtin_extra
@@ -591,16 +666,16 @@ set(git_builtin_extra
 foreach(s ${git_SOURCES} ${git_builtin_extra})
 	string(REPLACE "${CMAKE_SOURCE_DIR}/builtin/" "" s ${s})
 	string(REPLACE ".c" "" s ${s})
-	file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git git-${s})\n")
-	list(APPEND git_links ${CMAKE_BINARY_DIR}/git-${s})
+	file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git${EXE_EXTENSION} git-${s}${EXE_EXTENSION})\n")
+	list(APPEND git_links ${CMAKE_BINARY_DIR}/git-${s}${EXE_EXTENSION})
 endforeach()
 
 if(CURL_FOUND)
 	set(remote_exes
 		git-remote-https git-remote-ftp git-remote-ftps)
 	foreach(s ${remote_exes})
-		file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git-remote-http ${s})\n")
-		list(APPEND git_http_links ${CMAKE_BINARY_DIR}/${s})
+		file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git-remote-http${EXE_EXTENSION} ${s}${EXE_EXTENSION})\n")
+		list(APPEND git_http_links ${CMAKE_BINARY_DIR}/${s}${EXE_EXTENSION})
 	endforeach()
 endif()
 
@@ -721,20 +796,20 @@ set(bin_links
 	git-receive-pack git-upload-archive git-upload-pack)
 
 foreach(b ${bin_links})
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/bin/${b})")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/bin/${b}${EXE_EXTENSION})")
 endforeach()
 
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git)")
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git-shell ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-shell)")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git${EXE_EXTENSION})")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git-shell${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-shell${EXE_EXTENSION})")
 
 foreach(b ${git_links})
 	string(REPLACE "${CMAKE_BINARY_DIR}" "" b ${b})
-	install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b})")
+	install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b}${EXE_EXTENSION})")
 endforeach()
 
 foreach(b ${git_http_links})
 	string(REPLACE "${CMAKE_BINARY_DIR}" "" b ${b})
-	install(CODE "file(CREATE_LINK  ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-remote-http ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b})")
+	install(CODE "file(CREATE_LINK  ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-remote-http${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b}${EXE_EXTENSION})")
 endforeach()
 
 install(PROGRAMS ${git_shell_scripts} ${git_perl_scripts} ${CMAKE_BINARY_DIR}/git-p4
@@ -783,14 +858,14 @@ set(wrapper_test_scripts
 foreach(script ${wrapper_scripts})
 	file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
 	string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-	string(REPLACE "@@PROG@@" "${script}" content "${content}")
+	string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
 	file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
 endforeach()
 
 foreach(script ${wrapper_test_scripts})
 	file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
 	string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-	string(REPLACE "@@PROG@@" "t/helper/${script}" content "${content}")
+	string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
 	file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
 endforeach()
 
@@ -856,7 +931,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DC_SHA1='${DC_SHA1}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X=''\n")
+file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* [PATCH v5 6/8] cmake: support for building git on windows with mingw
  @ 2020-06-26 16:11  5%         ` Sibi Siddharthan via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Sibi Siddharthan via GitGitGadget @ 2020-06-26 16:11 UTC (permalink / raw)
  To: git; +Cc: Sibi Siddharthan, Sibi Siddharthan

From: Sibi Siddharthan <sibisiddharthan.github@gmail.com>

This patch facilitates building git on Windows with CMake using MinGW

NOTE: The funtions unsetenv and hstrerror are not checked in Windows
builds.
Reasons
NO_UNSETENV is not compatible with Windows builds.
lines 262-264 compat/mingw.h

compat/mingw.h(line 25) provides a definition of hstrerror which
conflicts with the definition provided in
git-compat-util.h(lines 733-736).

To use CMake on Windows with MinGW do this:
cmake `relative-path-to-srcdir` -G "MinGW Makefiles"

Signed-off-by: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
---
 contrib/buildsystems/CMakeLists.txt | 117 ++++++++++++++++++++++------
 1 file changed, 94 insertions(+), 23 deletions(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 2768ee5b71..2d7c0ed88e 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -42,6 +42,10 @@ cmake_minimum_required(VERSION 3.14)
 set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
 
 find_program(SH_EXE sh)
+if(NOT SH_EXE)
+	message(FATAL_ERROR "sh: shell interpreter was not found in your path, please install one."
+			"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
+endif()
 
 #Create GIT-VERSION-FILE using GIT-VERSION-GEN
 if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
@@ -65,7 +69,9 @@ project(git
 	VERSION ${git_version}
 	LANGUAGES C)
 
+
 #TODO gitk git-gui gitweb
+#TODO Enable NLS on windows natively
 #TODO Add pcre support
 
 #macros for parsing the Makefile for sources and scripts
@@ -104,6 +110,7 @@ find_package(EXPAT)
 find_package(Iconv)
 find_package(Intl)
 
+
 if(NOT Intl_FOUND)
 	add_compile_definitions(NO_GETTEXT)
 	if(NOT Iconv_FOUND)
@@ -125,6 +132,14 @@ if(Intl_FOUND)
 	include_directories(SYSTEM ${Intl_INCLUDE_DIRS})
 endif()
 
+
+if(WIN32)
+	find_program(WINDRES_EXE windres)
+	if(NOT WINDRES_EXE)
+		message(FATAL_ERROR "Install windres on Windows for resource files")
+	endif()
+endif()
+
 find_program(MSGFMT_EXE msgfmt)
 if(NOT MSGFMT_EXE)
 	message(WARNING "Text Translations won't be build")
@@ -156,11 +171,35 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
 			BINDIR="bin"
 			GIT_BUILT_FROM_COMMIT="")
 
-set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
-add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+if(WIN32)
+	set(FALLBACK_RUNTIME_PREFIX /mingw64)
+	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+else()
+	set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
+	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+endif()
+
+
+#Platform Specific
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+	include_directories(${CMAKE_SOURCE_DIR}/compat/win32)
+	add_compile_definitions(HAVE_ALLOCA_H NO_POSIX_GOODIES NATIVE_CRLF NO_UNIX_SOCKETS WIN32
+				_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=".exe"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT
+				NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0
+				USE_NED_ALLOCATOR OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP
+				UNICODE _UNICODE HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET)
+	list(APPEND compat_SOURCES compat/mingw.c compat/winansi.c compat/win32/path-utils.c
+		compat/win32/pthread.c compat/win32mmap.c compat/win32/syslog.c
+		compat/win32/trace2_win32_process_info.c compat/win32/dirent.c
+		compat/nedmalloc/nedmalloc.c compat/strdup.c)
+	set(NO_UNIX_SOCKETS 1)
+
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+	add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
+	list(APPEND compat_SOURCES unix-socket.c)
+endif()
 
-add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
-list(APPEND compat_SOURCES unix-socket.c)
+set(EXE_EXTENSION ${CMAKE_EXECUTABLE_SUFFIX})
 
 #header checks
 check_include_file(libgen.h HAVE_LIBGEN_H)
@@ -223,7 +262,12 @@ endif()
 #function checks
 set(function_checks
 	strcasestr memmem strlcpy strtoimax strtoumax strtoull
-	setenv mkdtemp poll pread memmem unsetenv hstrerror)
+	setenv mkdtemp poll pread memmem)
+
+#unsetenv,hstrerror are incompatible with windows build
+if(NOT WIN32)
+	list(APPEND function_checks unsetenv hstrerror)
+endif()
 
 foreach(f ${function_checks})
 	string(TOUPPER ${f} uf)
@@ -444,7 +488,13 @@ unset(CMAKE_REQUIRED_INCLUDES)
 #programs
 set(PROGRAMS_BUILT
 	git git-bugreport git-credential-store git-daemon git-fast-import git-http-backend git-sh-i18n--envsubst
-	git-shell git-remote-testsvn git-credential-cache git-credential-cache--daemon)
+	git-shell git-remote-testsvn)
+
+if(NO_UNIX_SOCKETS)
+	list(APPEND excluded_progs git-credential-cache git-credential-cache--daemon)
+else()
+	list(APPEND PROGRAMS_BUILT git-credential-cache git-credential-cache--daemon)
+endif()
 
 if(NOT CURL_FOUND)
 	list(APPEND excluded_progs git-http-fetch git-http-push)
@@ -516,15 +566,34 @@ parse_makefile_for_sources(libvcs-svn_SOURCES "VCSSVN_OBJS")
 list(TRANSFORM libvcs-svn_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
 add_library(vcs-svn STATIC ${libvcs-svn_SOURCES})
 
+#add git.rc for gcc
+if(WIN32)
+	add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
+			COMMAND ${WINDRES_EXE} -O coff -DMAJOR=${PROJECT_VERSION_MAJOR} -DMINOR=${PROJECT_VERSION_MINOR}
+				-DMICRO=${PROJECT_VERSION_PATCH} -DPATCHLEVEL=0 -DGIT_VERSION="\\\"${PROJECT_VERSION}.GIT\\\""
+				-i ${CMAKE_SOURCE_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+			WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+			VERBATIM)
+	add_custom_target(git-rc DEPENDS ${CMAKE_BINARY_DIR}/git.res)
+endif()
+
 #link all required libraries to common-main
 add_library(common-main OBJECT ${CMAKE_SOURCE_DIR}/common-main.c)
-target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES} pthread rt)
+
+target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES})
 if(Intl_FOUND)
 	target_link_libraries(common-main ${Intl_LIBRARIES})
 endif()
 if(Iconv_FOUND)
 	target_link_libraries(common-main ${Iconv_LIBRARIES})
 endif()
+if(WIN32)
+	target_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)
+	add_dependencies(common-main git-rc)
+	target_link_options(common-main PUBLIC -municode -Wl,--nxcompat -Wl,--dynamicbase -Wl,--pic-executable,-e,mainCRTStartup)
+elseif(UNIX)
+	target_link_libraries(common-main pthread rt)
+endif()
 
 #git
 parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
@@ -575,11 +644,13 @@ endif()
 add_executable(git-remote-testsvn ${CMAKE_SOURCE_DIR}/remote-testsvn.c)
 target_link_libraries(git-remote-testsvn common-main vcs-svn)
 
-add_executable(git-credential-cache ${CMAKE_SOURCE_DIR}/credential-cache.c)
-target_link_libraries(git-credential-cache common-main)
+if(NOT NO_UNIX_SOCKETS)
+	add_executable(git-credential-cache ${CMAKE_SOURCE_DIR}/credential-cache.c)
+	target_link_libraries(git-credential-cache common-main)
 
-add_executable(git-credential-cache--daemon ${CMAKE_SOURCE_DIR}/credential-cache--daemon.c)
-target_link_libraries(git-credential-cache--daemon common-main)
+	add_executable(git-credential-cache--daemon ${CMAKE_SOURCE_DIR}/credential-cache--daemon.c)
+	target_link_libraries(git-credential-cache--daemon common-main)
+endif()
 
 
 set(git_builtin_extra
@@ -591,16 +662,16 @@ set(git_builtin_extra
 foreach(s ${git_SOURCES} ${git_builtin_extra})
 	string(REPLACE "${CMAKE_SOURCE_DIR}/builtin/" "" s ${s})
 	string(REPLACE ".c" "" s ${s})
-	file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git git-${s})\n")
-	list(APPEND git_links ${CMAKE_BINARY_DIR}/git-${s})
+	file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git${EXE_EXTENSION} git-${s}${EXE_EXTENSION})\n")
+	list(APPEND git_links ${CMAKE_BINARY_DIR}/git-${s}${EXE_EXTENSION})
 endforeach()
 
 if(CURL_FOUND)
 	set(remote_exes
 		git-remote-https git-remote-ftp git-remote-ftps)
 	foreach(s ${remote_exes})
-		file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git-remote-http ${s})\n")
-		list(APPEND git_http_links ${CMAKE_BINARY_DIR}/${s})
+		file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git-remote-http${EXE_EXTENSION} ${s}${EXE_EXTENSION})\n")
+		list(APPEND git_http_links ${CMAKE_BINARY_DIR}/${s}${EXE_EXTENSION})
 	endforeach()
 endif()
 
@@ -722,20 +793,20 @@ set(bin_links
 	git-receive-pack git-upload-archive git-upload-pack)
 
 foreach(b ${bin_links})
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/bin/${b})")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/bin/${b}${EXE_EXTENSION})")
 endforeach()
 
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git)")
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git-shell ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-shell)")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git${EXE_EXTENSION})")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git-shell${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-shell${EXE_EXTENSION})")
 
 foreach(b ${git_links})
 	string(REPLACE "${CMAKE_BINARY_DIR}" "" b ${b})
-	install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b})")
+	install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b}${EXE_EXTENSION})")
 endforeach()
 
 foreach(b ${git_http_links})
 	string(REPLACE "${CMAKE_BINARY_DIR}" "" b ${b})
-	install(CODE "file(CREATE_LINK  ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-remote-http ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b})")
+	install(CODE "file(CREATE_LINK  ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-remote-http${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b}${EXE_EXTENSION})")
 endforeach()
 
 install(PROGRAMS ${git_shell_scripts} ${git_perl_scripts} ${CMAKE_BINARY_DIR}/git-p4
@@ -784,14 +855,14 @@ set(wrapper_test_scripts
 foreach(script ${wrapper_scripts})
 	file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
 	string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-	string(REPLACE "@@PROG@@" "${script}" content "${content}")
+	string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
 	file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
 endforeach()
 
 foreach(script ${wrapper_test_scripts})
 	file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
 	string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-	string(REPLACE "@@PROG@@" "t/helper/${script}" content "${content}")
+	string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
 	file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
 endforeach()
 
@@ -857,7 +928,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DC_SHA1='${DC_SHA1}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X=''\n")
+file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* Re: [PATCH v5 2/3] git-std-lib: introduce Git Standard Library
  @ 2024-02-29 18:54  5%         ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2024-02-29 18:54 UTC (permalink / raw)
  To: Linus Arver; +Cc: Phillip Wood, Calvin Wan, git, Jonathan Tan

Linus Arver <linusa@google.com> writes:

> It does make me wonder if we should stop being lazy and do the
> work that the linker has been doing for us "for free"
> ourselves. IOW, stop linking against a monolithic libgit.a.
> ... which might help us understand which things need what.

Sorry, but I fail see a point in such an exercise.  If a tool is
available to help us and if there is no downside of using the tool,
we should keep using it.  If you are proposing to move away from the
current build practice because you have a concrete downside of the
approach and avoid that, then it might be a good proposal, though.

And "we do not learn otherwise" is not a downside of the approach;
"we do not learn" comes from your not learning, the tools do not
force you to be ignorant.  We do not propose to use more __asm__ in
our C sources only because compilers were doing that for us "for
free" and because the compilers were somehow robbing us the
opportunity to learn micro-optimization techniques, do we?

A small downside I can immediately think of is possible in a
situation where we have been throwing an object file into libgit.a
archive that is no longer used by any final executable.  In such a
scenario, if you change the source file that is compiled into such
an unused object file, your next "make" will update libgit.a to
replace the unused object file with its new version with your
updates, and that would cause the final build product to be linked
again with objects needed from libgit.a, but there shouldn't be any
change because we are talking about an object that is *not* used by
them but still is in libgit.a due to be listed on LIB_OBJS variable.

But that is a purely theoretical downside. It may be the case that
we haven't done our spring cleaning recently and we haven't noticed
that a source file or two are now unused but are still listed on
LIB_OBJS to be included in the libgit.a archive.  But even if that
were the case, it is implausible that you are touching such an
unused source file in the first place.


^ permalink raw reply	[relevance 5%]

* Re: [darcs-devel] Darcs-Git: upgrading to Git 0.99
  2005-07-16 20:45  5% Darcs-Git: upgrading to Git 0.99 Juliusz Chroboczek
@ 2005-07-17 10:40  5% ` David Roundy
  0 siblings, 0 replies; 200+ results
From: David Roundy @ 2005-07-17 10:40 UTC (permalink / raw)
  To: Juliusz Chroboczek; +Cc: darcs-devel, git, Linus Torvalds

On Sat, Jul 16, 2005 at 10:45:47PM +0200, Juliusz Chroboczek wrote:
> 
> I'd like to upgrade the Git code used in Darcs to 0.99 (we're
> currently using 0.6). [...]

Great!

> Now I'm wondering how to do that.  Currently, I'm using a nasty hack
> using the C preprocessor to include just the sources we need in
> Darcs.  As 0.99 builds a ``libgit.a'', I'd like to use that instead.
> 
> There are three ways to do that:
> 
>   (1) require that the users put a suitable libgit.a in /usr/local/lib
>       before building Darcs, and distribute a tarball of Git from
>       darcs.net;
> 
>   (2) include just the sources needed for libgit.a in Darcs, and have
>       the Darcs build build a local libgit
> 
>   (3) as (2), but include all of Git, including their
>       ``user-friendly'' scripts.
> 
> Solution (2) will include 33 files totalling 167KB, while (3) is about
> a megabyte of source.

I'd really prefer option (1), *if* the git folks can confirm that the API
is at least intended to be stable.  As an subtly different option, we could
include a script that would download and untar the git sources and then
build them.  But it'd be great to allow users to upgrade their libgit
without our intervention if a protocol or repository format change occurs
that doesn't affect the API.

I guess the real question is whether the API is more or less stable than
the protocols and disk formats.  If the API is more stable, we'd rather
link with an external libgit and be robust with respect to on-disk format
changes (such as pack files).  If the on-disk format is more stable, we'd
rather include a copy of the source code and be robust with respect to API
changes of libgit.

A fourth option would be to include git sources, but also include a
configure flag that could be used to link with an external libgit.  This is
probably the most robust solution, but also the most complex solution (and
thus probably not the best).
-- 
David Roundy
http://www.darcs.net

^ permalink raw reply	[relevance 5%]

* [PATCH v2 06/11] cmake: support for building git on windows with mingw
  @ 2020-05-12 16:50  5%   ` Sibi Siddharthan via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Sibi Siddharthan via GitGitGadget @ 2020-05-12 16:50 UTC (permalink / raw)
  To: git; +Cc: Sibi Siddharthan, Sibi Siddharthan

From: Sibi Siddharthan <sibisiddharthan.github@gmail.com>

This patch facilitates building git on Windows with CMake using MinGW

NOTE: The funtions unsetenv and hstrerror are not checked in Windows
builds.
Reasons
NO_UNSETENV is not compatible with Windows builds.
lines 262-264 compat/mingw.h

compat/mingw.h(line 25) provides a definition of hstrerror which
conflicts with the definition provided in
git-compat-util.h(lines 733-736).

To use CMake on Windows with MinGW do this:
cmake `relative-path-to-srcdir` -G "MinGW Makefiles"

Changes:
Changed the error message when sh.exe is not found on Windows as
suggested by Philip Oakley <philipoakley@iee.email>

Signed-off-by: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
---
 CMakeLists.txt | 121 +++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 98 insertions(+), 23 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 47d3f3c2866..9625e41886f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,9 +13,12 @@ project(git
 	VERSION ${git_version}
 	LANGUAGES C)
 
+
 #TODO gitk git-gui gitweb
+#TODO Enable NLS on windows natively
 #TODO Add pcre support
 
+
 include(CheckTypeSize)
 include(CheckCSourceRuns)
 include(CheckCSourceCompiles)
@@ -31,6 +34,7 @@ find_package(EXPAT)
 find_package(Iconv)
 find_package(Intl)
 
+
 if(NOT Intl_FOUND)
 	add_compile_definitions(NO_GETTEXT)
 	if(NOT Iconv_FOUND)
@@ -53,6 +57,17 @@ if(Intl_FOUND)
 endif()
 
 find_program(SH_EXE sh)
+if(NOT SH_EXE)
+	message(FATAL_ERROR "sh: shell interpreter was not found in your path, please install one."
+			"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
+endif()
+
+if(WIN32)
+	find_program(WINDRES_EXE windres)
+	if(NOT WINDRES_EXE)
+		message(FATAL_ERROR "Install windres on Windows for resource files")
+	endif()
+endif()
 
 find_program(MSGFMT_EXE msgfmt)
 if(NOT MSGFMT_EXE)
@@ -85,11 +100,39 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
 			BINDIR="bin"
 			GIT_BUILT_FROM_COMMIT="")
 
-set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
-add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+if(WIN32)
+	set(FALLBACK_RUNTIME_PREFIX /mingw64)
+	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+else()
+	set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
+	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+endif()
 
-add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
-list(APPEND compat_SOURCES unix-socket.c)
+
+#Platform Specific
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+	include_directories(compat/win32)
+	add_compile_definitions(HAVE_ALLOCA_H NO_POSIX_GOODIES NATIVE_CRLF NO_UNIX_SOCKETS WIN32
+				_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=".exe"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT
+				NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0 NO_ST_BLOCKS_IN_STRUCT_STAT
+				USE_NED_ALLOCATOR OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP
+				UNICODE _UNICODE HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET)
+	list(APPEND compat_SOURCES compat/mingw.c compat/winansi.c compat/win32/path-utils.c
+		compat/win32/pthread.c compat/win32mmap.c compat/win32/syslog.c
+		compat/win32/trace2_win32_process_info.c compat/win32/dirent.c
+		compat/nedmalloc/nedmalloc.c compat/strdup.c)
+	set(NO_UNIX_SOCKETS 1)
+
+elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+	add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
+	list(APPEND compat_SOURCES unix-socket.c)
+endif()
+
+if(WIN32)
+	set(EXE_EXTENSION .exe)
+else()
+	set(EXE_EXTENSION)
+endif()
 
 #header checks
 check_include_file(libgen.h HAVE_LIBGEN_H)
@@ -150,7 +193,12 @@ endif()
 #function checks
 set(function_checks
 	strcasestr memmem strlcpy strtoimax strtoumax strtoull
-	setenv  mkdtemp poll pread  memmem unsetenv hstrerror)
+	setenv  mkdtemp poll pread  memmem)
+
+#unsetenv,hstrerror are incompatible with windows build
+if(NOT WIN32)
+	list(APPEND function_checks unsetenv hstrerror)
+endif()
 
 foreach(f ${function_checks})
 	string(TOUPPER ${f} uf)
@@ -309,7 +357,13 @@ endif()
 #programs
 set(PROGRAMS_BUILT
 	git git-bugreport git-credential-store git-daemon git-fast-import git-http-backend git-sh-i18n--envsubst
-	git-shell git-remote-testsvn git-credential-cache git-credential-cache--daemon)
+	git-shell git-remote-testsvn)
+
+if(NO_UNIX_SOCKETS)
+	list(APPEND excluded_progs git-credential-cache git-credential-cache--daemon)
+else()
+	list(APPEND PROGRAMS_BUILT git-credential-cache git-credential-cache--daemon)
+endif()
 
 if(NOT CURL_FOUND)
 	list(APPEND excluded_progs git-http-fetch git-http-push)
@@ -410,15 +464,34 @@ set(libvcs-svn_SOURCES
 	vcs-svn/svndiff.c vcs-svn/svndump.c)
 add_library(vcs-svn STATIC ${libvcs-svn_SOURCES})
 
+#add git.rc for gcc
+if(WIN32)
+	add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
+			COMMAND ${WINDRES_EXE} -O coff -DMAJOR=${PROJECT_VERSION_MAJOR} -DMINOR=${PROJECT_VERSION_MINOR}
+				-DMICRO=${PROJECT_VERSION_PATCH} -DPATCHLEVEL=0 -DGIT_VERSION="\\\"${PROJECT_VERSION}.GIT\\\""
+				-i ${CMAKE_SOURCE_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+			WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+			VERBATIM)
+	add_custom_target(git-rc DEPENDS ${CMAKE_BINARY_DIR}/git.res)
+endif()
+
 #link all required libraries to common-main
 add_library(common-main OBJECT common-main.c)
-target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES} pthread rt)
+
+target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES})
 if(Intl_FOUND)
 	target_link_libraries(common-main ${Intl_LIBRARIES})
 endif()
 if(Iconv_FOUND)
 	target_link_libraries(common-main ${Iconv_LIBRARIES})
 endif()
+if(WIN32)
+	target_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)
+	add_dependencies(common-main git-rc)
+	target_link_options(common-main PUBLIC -municode -Wl,--nxcompat -Wl,--dynamicbase -Wl,--pic-executable,-e,mainCRTStartup)
+elseif(UNIX)
+	target_link_libraries(common-main pthread rt)
+endif()
 
 
 set(git_SOURCES
@@ -501,11 +574,13 @@ endif()
 add_executable(git-remote-testsvn remote-testsvn.c)
 target_link_libraries(git-remote-testsvn common-main vcs-svn)
 
-add_executable(git-credential-cache credential-cache.c)
-target_link_libraries(git-credential-cache common-main)
+if(NOT NO_UNIX_SOCKETS)
+	add_executable(git-credential-cache credential-cache.c)
+	target_link_libraries(git-credential-cache common-main)
 
-add_executable(git-credential-cache--daemon credential-cache--daemon.c)
-target_link_libraries(git-credential-cache--daemon common-main)
+	add_executable(git-credential-cache--daemon credential-cache--daemon.c)
+	target_link_libraries(git-credential-cache--daemon common-main)
+endif()
 
 
 set(git_builtin_extra
@@ -517,16 +592,16 @@ set(git_builtin_extra
 foreach(s ${git_SOURCES} ${git_builtin_extra})
 	string(REPLACE "builtin/" "" s ${s})
 	string(REPLACE ".c" "" s ${s})
-	file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git git-${s})\n")
-	list(APPEND git_links ${CMAKE_BINARY_DIR}/git-${s})
+	file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git${EXE_EXTENSION} git-${s}${EXE_EXTENSION})\n")
+	list(APPEND git_links ${CMAKE_BINARY_DIR}/git-${s}${EXE_EXTENSION})
 endforeach()
 
 if(CURL_FOUND)
 	set(remote_exes
 		git-remote-https git-remote-ftp git-remote-ftps)
 	foreach(s ${remote_exes})
-		file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git-remote-http ${s})\n")
-		list(APPEND git_http_links ${CMAKE_BINARY_DIR}/${s})
+		file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git-remote-http${EXE_EXTENSION} ${s}${EXE_EXTENSION})\n")
+		list(APPEND git_http_links ${CMAKE_BINARY_DIR}/${s}${EXE_EXTENSION})
 	endforeach()
 endif()
 
@@ -654,20 +729,20 @@ set(bin_links
 	git-receive-pack git-upload-archive git-upload-pack)
 
 foreach(b ${bin_links})
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/bin/${b})")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/bin/${b}${EXE_EXTENSION})")
 endforeach()
 
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git)")
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git-shell ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-shell)")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git${EXE_EXTENSION})")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git-shell${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-shell${EXE_EXTENSION})")
 
 foreach(b ${git_links})
 	string(REPLACE "${CMAKE_BINARY_DIR}" "" b ${b})
-	install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b})")
+	install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b}${EXE_EXTENSION})")
 endforeach()
 
 foreach(b ${git_http_links})
 	string(REPLACE "${CMAKE_BINARY_DIR}" "" b ${b})
-	install(CODE "file(CREATE_LINK  ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-remote-http ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b})")
+	install(CODE "file(CREATE_LINK  ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-remote-http${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b}${EXE_EXTENSION})")
 endforeach()
 
 install(PROGRAMS ${git_shell_scripts} ${git_perl_scripts} ${CMAKE_BINARY_DIR}/git-p4
@@ -734,14 +809,14 @@ set(wrapper_test_scripts
 foreach(script ${wrapper_scripts})
 	file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
 	string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-	string(REPLACE "@@PROG@@" "${script}" content "${content}")
+	string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
 	file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
 endforeach()
 
 foreach(script ${wrapper_test_scripts})
 	file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
 	string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-	string(REPLACE "@@PROG@@" "t/helper/${script}" content "${content}")
+	string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
 	file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
 endforeach()
 
@@ -807,7 +882,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DC_SHA1='${DC_SHA1}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X=''\n")
+file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* Re: [PATCH] build: get rid of the notion of a git library
  @ 2013-06-10 21:45  5%             ` Jeff King
    0 siblings, 1 reply; 200+ results
From: Jeff King @ 2013-06-10 21:45 UTC (permalink / raw)
  To: Vincent van Ravesteijn
  Cc: Felipe Contreras, John Keeping, Ramkumar Ramachandra, git,
	Junio C Hamano, Jonathan Nieder, Duy Nguyen

On Sun, Jun 09, 2013 at 07:30:31PM +0200, Vincent van Ravesteijn wrote:

> I think that libgit.a should contain all code to be able to carry out
> all functions of git. The stuff in builtin/ is just a command-line
> user interface. Whether or not sequencer should be in builtin depends
> on whether the sequencer is only part of this command-line user
> interface.

One code organization issue I have not seen mentioned is that there is
more CLI than what is in builtin, and libgit.a does more than simply
provide code for the sources in builtin/. There are also external
commands shipped in git.git that are not linked against git.c or the
other builtins.

Once upon a time, all commands were that way, and that was the origin of
libgit.a: the set of common code used by all of the C commands in
git.git. Over time, those commands became builtins (mostly to keep the
size of the libexec dir down). These days there are only a handful of
external commands left, mostly ones that have startup time overhead from
the dynamic loader (e.g., remote-curl, http-push, imap-send).

That is what libgit.a _is_ now.  I do not mean to imply any additional
judgement on what it could be. But if the goal is to make libgit.a
"functions that programs outside git.git would want, and nothing else",
we may want to additionally split out a "libgit-internal.a" consisting
of code that is used by multiple externals in git, but which would not
be appropriate for clients to use.

For example, I think most of "http.c" is in that boat, as it is full of
wrappers for curl code that are of enough quality to reuse within git,
but a little too half-baked to be part of a stable API.

We can always link directly against http.o, too, of course. The point of
putting the files into a static library is that it makes the link
faster, and if there are only a handful of such links, it may not be
worth the effort.

-Peff

^ permalink raw reply	[relevance 5%]

* Re: [PATCH] Introduce Git.pm (v3)
  2006-06-22 23:50  6%   ` Petr Baudis
@ 2006-06-23 12:39  5%     ` Petr Baudis
  2006-06-23  0:22  5%     ` Junio C Hamano
  1 sibling, 0 replies; 200+ results
From: Petr Baudis @ 2006-06-23 12:39 UTC (permalink / raw)
  To: Junio C Hamano, Eric W. Biederman; +Cc: git

Dear diary, on Fri, Jun 23, 2006 at 10:57:50AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Petr Baudis <pasky@suse.cz> writes:
> 
> > Also, is there any real problem with just using -fPIC?
> 
> Personally, not really, but I consider it a workaround having to
> compile with -fPIC (being able to compile with -fPIC is a
> feature).

Well, for the .xs you do need an .so and for that you apparently need
-fPIC on most architectures, so there's no way around it.

There's a patch to build libgit.so, would you take it as an excuse to
always compile with -fPIC? ;-)

> Doesn't it have performance implications to use -fPIC when you
> do not have to?

No idea here.

> By the way, you also need to adjust the testsuite so that it
> finds the Perl modules from freshly built tree before
> installing.  I think (but haven't checked yet) the stuff written
> in Python does that already, so you might want to mimic it.

It should be enough to -I../perl/blib/lib -I../perl/blib/arch/auto/Git.


Dear diary, on Fri, Jun 23, 2006 at 02:04:17PM CEST, I got a letter
where "Eric W. Biederman" <ebiederm@xmission.com> said that...
> The question is why are we building with a .so?

To make use of it in Git.pm - it can call libgit routines directly from
inside of Perl, but for that it needs to dynamically link libgit to the
Perl process on the fly (using dlopen()).

We _can_ avoid the .so, but that involved producing a new perl
executable with libgit statically linked to it, which is quite
impractical, so to say.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
A person is just about as big as the things that make them angry.

^ permalink raw reply	[relevance 5%]

* [PATCH v3 5/6] git-std-lib: introduce git standard library
  @ 2023-09-08 17:44  5% ` Calvin Wan
  0 siblings, 0 replies; 200+ results
From: Calvin Wan @ 2023-09-08 17:44 UTC (permalink / raw)
  To: git; +Cc: Calvin Wan, nasamuffin, jonathantanmy, linusa, phillip.wood123,
	vdye

The Git Standard Library intends to serve as the foundational library
and root dependency that other libraries in Git will be built off of.
That is to say, suppose we have libraries X and Y; a user that wants to
use X and Y would need to include X, Y, and this Git Standard Library.

Add Documentation/technical/git-std-lib.txt to further explain the
design and rationale.

Signed-off-by: Calvin Wan <calvinwan@google.com>
Helped-by: Phillip Wood <phillip.wood123@gmail.com>
---
 Documentation/technical/git-std-lib.txt | 191 ++++++++++++++++++++++++
 Makefile                                |  39 ++++-
 git-compat-util.h                       |   7 +-
 stubs/pager.c                           |   6 +
 stubs/pager.h                           |   6 +
 stubs/trace2.c                          |  27 ++++
 symlinks.c                              |   2 +
 wrapper.c                               |   1 -
 8 files changed, 276 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/technical/git-std-lib.txt
 create mode 100644 stubs/pager.c
 create mode 100644 stubs/pager.h
 create mode 100644 stubs/trace2.c

diff --git a/Documentation/technical/git-std-lib.txt b/Documentation/technical/git-std-lib.txt
new file mode 100644
index 0000000000..397c1da8c8
--- /dev/null
+++ b/Documentation/technical/git-std-lib.txt
@@ -0,0 +1,191 @@
+Git Standard Library
+================
+
+The Git Standard Library intends to serve as the foundational library
+and root dependency that other libraries in Git will be built off of.
+That is to say, suppose we have libraries X and Y; a user that wants to
+use X and Y would need to include X, Y, and this Git Standard Library.
+This does not mean that the Git Standard Library will be the only
+possible root dependency in the future, but rather the most significant
+and widely used one.
+
+Dependency graph in libified Git
+================
+
+If you look in the Git Makefile, all of the objects defined in the Git
+library are compiled and archived into a singular file, libgit.a, which
+is linked against by common-main.o with other external dependencies and
+turned into the Git executable. In other words, the Git executable has
+dependencies on libgit.a and a couple of external libraries. The
+libfication of Git will not affect this current build flow, but instead
+will provide an alternate method for building Git.
+
+With our current method of building Git, we can imagine the dependency
+graph as such:
+
+        Git
+         /\
+        /  \
+       /    \
+  libgit.a   ext deps
+
+In libifying parts of Git, we want to shrink the dependency graph to
+only the minimal set of dependencies, so libraries should not use
+libgit.a. Instead, it would look like:
+
+                Git
+                /\
+               /  \
+              /    \
+          libgit.a  ext deps
+             /\
+            /  \
+           /    \
+object-store.a  (other lib)
+      |        /
+      |       /
+      |      /
+ config.a   / 
+      |    /
+      |   /
+      |  /
+git-std-lib.a
+
+Instead of containing all of the objects in Git, libgit.a would contain
+objects that are not built by libraries it links against. Consequently,
+if someone wanted their own custom build of Git with their own custom
+implementation of the object store, they would only have to swap out
+object-store.a rather than do a hard fork of Git.
+
+Rationale behind Git Standard Library
+================
+
+The rationale behind what's in and what's not in the Git Standard
+Library essentially is the result of two observations within the Git
+codebase: every file includes git-compat-util.h which defines functions
+in a couple of different files, and wrapper.c + usage.c have
+difficult-to-separate circular dependencies with each other and other
+files.
+
+Ubiquity of git-compat-util.h and circular dependencies
+========
+
+Every file in the Git codebase includes git-compat-util.h. It serves as
+"a compatibility aid that isolates the knowledge of platform specific
+inclusion order and what feature macros to define before including which
+system header" (Junio[1]). Since every file includes git-compat-util.h, and
+git-compat-util.h includes wrapper.h and usage.h, it would make sense
+for wrapper.c and usage.c to be a part of the root library. They have
+difficult to separate circular dependencies with each other so they
+can't be independent libraries. Wrapper.c has dependencies on parse.c,
+abspath.c, strbuf.c, which in turn also have dependencies on usage.c and
+wrapper.c -- more circular dependencies. 
+
+Tradeoff between swappability and refactoring
+========
+
+From the above dependency graph, we can see that git-std-lib.a could be
+many smaller libraries rather than a singular library. So why choose a
+singular library when multiple libraries can be individually easier to
+swap and are more modular? A singular library requires less work to
+separate out circular dependencies within itself so it becomes a
+tradeoff question between work and reward. While there may be a point in
+the future where a file like usage.c would want its own library so that
+someone can have custom die() or error(), the work required to refactor
+out the circular dependencies in some files would be enormous due to
+their ubiquity so therefore I believe it is not worth the tradeoff
+currently. Additionally, we can in the future choose to do this refactor
+and change the API for the library if there becomes enough of a reason
+to do so (remember we are avoiding promising stability of the interfaces
+of those libraries).
+
+Reuse of compatibility functions in git-compat-util.h
+========
+
+Most functions defined in git-compat-util.h are implemented in compat/
+and have dependencies limited to strbuf.h and wrapper.h so they can be
+easily included in git-std-lib.a, which as a root dependency means that
+higher level libraries do not have to worry about compatibility files in
+compat/. The rest of the functions defined in git-compat-util.h are
+implemented in top level files and are hidden behind
+an #ifdef if their implementation is not in git-std-lib.a.
+
+Rationale summary
+========
+
+The Git Standard Library allows us to get the libification ball rolling
+with other libraries in Git. By not spending many
+more months attempting to refactor difficult circular dependencies and
+instead spending that time getting to a state where we can test out
+swapping a library out such as config or object store, we can prove the
+viability of Git libification on a much faster time scale. Additionally
+the code cleanups that have happened so far have been minor and
+beneficial for the codebase. It is probable that making large movements
+would negatively affect code clarity.
+
+Git Standard Library boundary
+================
+
+While I have described above some useful heuristics for identifying
+potential candidates for git-std-lib.a, a standard library should not
+have a shaky definition for what belongs in it.
+
+ - Low-level files (aka operates only on other primitive types) that are
+   used everywhere within the codebase (wrapper.c, usage.c, strbuf.c)
+   - Dependencies that are low-level and widely used
+     (abspath.c, date.c, hex-ll.c, parse.c, utf8.c)
+ - low-level git/* files with functions defined in git-compat-util.h
+   (ctype.c)
+ - compat/*
+ - stubbed out dependencies in stubs/ (stubs/pager.c, stubs/trace2.c)
+
+There are other files that might fit this definition, but that does not
+mean it should belong in git-std-lib.a. Those files should start as
+their own separate library since any file added to git-std-lib.a loses
+its flexibility of being easily swappable.
+
+Wrapper.c and usage.c have dependencies on pager and trace2 that are
+possible to remove at the cost of sacrificing the ability for standard Git
+to be able to trace functions in those files and other files in git-std-lib.a.
+In order for git-std-lib.a to compile with those dependencies, stubbed out
+versions of those files are implemented and swapped in during compilation time.
+
+Files inside of Git Standard Library
+================
+
+The initial set of files in git-std-lib.a are:
+abspath.c
+ctype.c
+date.c
+hex-ll.c
+parse.c
+strbuf.c
+usage.c
+utf8.c
+wrapper.c
+relevant compat/ files
+
+When these files are compiled together with the following files (or
+user-provided files that provide the same functions), they form a
+complete library:
+stubs/pager.c
+stubs/trace2.c
+
+Pitfalls
+================
+
+There are a small amount of files under compat/* that have dependencies
+not inside of git-std-lib.a. While those functions are not called on
+Linux, other OSes might call those problematic functions. I don't see
+this as a major problem, just moreso an observation that libification in
+general may also require some minor compatibility work in the future.
+
+Testing
+================
+
+Unit tests should catch any breakages caused by changes to files in
+git-std-lib.a (i.e. introduction of a out of scope dependency) and new
+functions introduced to git-std-lib.a will require unit tests written
+for them.
+
+[1] https://lore.kernel.org/git/xmqqwn17sydw.fsf@gitster.g/
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 9226c719a0..0a2d1ae3cc 100644
--- a/Makefile
+++ b/Makefile
@@ -669,6 +669,7 @@ FUZZ_PROGRAMS =
 GIT_OBJS =
 LIB_OBJS =
 SCALAR_OBJS =
+STUB_OBJS =
 OBJECTS =
 OTHER_PROGRAMS =
 PROGRAM_OBJS =
@@ -956,6 +957,7 @@ COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
 
 LIB_H = $(FOUND_H_SOURCES)
 
+ifndef GIT_STD_LIB
 LIB_OBJS += abspath.o
 LIB_OBJS += add-interactive.o
 LIB_OBJS += add-patch.o
@@ -1196,6 +1198,27 @@ LIB_OBJS += write-or-die.o
 LIB_OBJS += ws.o
 LIB_OBJS += wt-status.o
 LIB_OBJS += xdiff-interface.o
+else ifdef GIT_STD_LIB
+LIB_OBJS += abspath.o
+LIB_OBJS += ctype.o
+LIB_OBJS += date.o
+LIB_OBJS += hex-ll.o
+LIB_OBJS += parse.o
+LIB_OBJS += strbuf.o
+LIB_OBJS += usage.o
+LIB_OBJS += utf8.o
+LIB_OBJS += wrapper.o
+
+ifdef STUB_TRACE2
+STUB_OBJS += stubs/trace2.o
+endif
+
+ifdef STUB_PAGER
+STUB_OBJS += stubs/pager.o
+endif
+
+LIB_OBJS += $(STUB_OBJS)
+endif
 
 BUILTIN_OBJS += builtin/add.o
 BUILTIN_OBJS += builtin/am.o
@@ -2162,6 +2185,11 @@ ifdef FSMONITOR_OS_SETTINGS
 	COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
 endif
 
+ifdef GIT_STD_LIB
+	BASIC_CFLAGS += -DGIT_STD_LIB
+	BASIC_CFLAGS += -DNO_GETTEXT
+endif
+
 ifeq ($(TCLTK_PATH),)
 NO_TCLTK = NoThanks
 endif
@@ -3668,7 +3696,7 @@ clean: profile-clean coverage-clean cocciclean
 	$(RM) git.res
 	$(RM) $(OBJECTS)
 	$(RM) headless-git.o
-	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
+	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB) $(STD_LIB_FILE)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS)
 	$(RM) $(TEST_PROGRAMS)
 	$(RM) $(FUZZ_PROGRAMS)
@@ -3849,3 +3877,12 @@ $(FUZZ_PROGRAMS): all
 		$(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
 
 fuzz-all: $(FUZZ_PROGRAMS)
+
+### Libified Git rules
+
+# git-std-lib
+# `make git-std-lib.a GIT_STD_LIB=YesPlease STUB_TRACE2=YesPlease STUB_PAGER=YesPlease`
+STD_LIB = git-std-lib.a
+
+$(STD_LIB): $(LIB_OBJS) $(COMPAT_OBJS) $(STUB_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
diff --git a/git-compat-util.h b/git-compat-util.h
index 3e7a59b5ff..14bf71c530 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -455,8 +455,8 @@ static inline int noop_core_config(const char *var UNUSED,
 #define platform_core_config noop_core_config
 #endif
 
+#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(GIT_STD_LIB)
 int lstat_cache_aware_rmdir(const char *path);
-#if !defined(__MINGW32__) && !defined(_MSC_VER)
 #define rmdir lstat_cache_aware_rmdir
 #endif
 
@@ -966,9 +966,11 @@ const char *inet_ntop(int af, const void *src, char *dst, size_t size);
 #endif
 
 #ifdef NO_PTHREADS
+#ifdef GIT_STD_LIB
 #define atexit git_atexit
 int git_atexit(void (*handler)(void));
 #endif
+#endif
 
 static inline size_t st_add(size_t a, size_t b)
 {
@@ -1462,14 +1464,17 @@ static inline int is_missing_file_error(int errno_)
 	return (errno_ == ENOENT || errno_ == ENOTDIR);
 }
 
+#ifndef GIT_STD_LIB
 int cmd_main(int, const char **);
 
 /*
  * Intercept all calls to exit() and route them to trace2 to
  * optionally emit a message before calling the real exit().
  */
+
 int common_exit(const char *file, int line, int code);
 #define exit(code) exit(common_exit(__FILE__, __LINE__, (code)))
+#endif
 
 /*
  * You can mark a stack variable with UNLEAK(var) to avoid it being
diff --git a/stubs/pager.c b/stubs/pager.c
new file mode 100644
index 0000000000..4f575cada7
--- /dev/null
+++ b/stubs/pager.c
@@ -0,0 +1,6 @@
+#include "pager.h"
+
+int pager_in_use(void)
+{
+	return 0;
+}
diff --git a/stubs/pager.h b/stubs/pager.h
new file mode 100644
index 0000000000..b797910881
--- /dev/null
+++ b/stubs/pager.h
@@ -0,0 +1,6 @@
+#ifndef PAGER_H
+#define PAGER_H
+
+int pager_in_use(void);
+
+#endif /* PAGER_H */
diff --git a/stubs/trace2.c b/stubs/trace2.c
new file mode 100644
index 0000000000..7d89482228
--- /dev/null
+++ b/stubs/trace2.c
@@ -0,0 +1,27 @@
+#include "git-compat-util.h"
+#include "trace2.h"
+
+struct child_process { int stub; };
+struct repository { int stub; };
+struct json_writer { int stub; };
+
+void trace2_region_enter_fl(const char *file, int line, const char *category,
+			    const char *label, const struct repository *repo, ...) { }
+void trace2_region_leave_fl(const char *file, int line, const char *category,
+			    const char *label, const struct repository *repo, ...) { }
+void trace2_data_string_fl(const char *file, int line, const char *category,
+			   const struct repository *repo, const char *key,
+			   const char *value) { }
+void trace2_cmd_ancestry_fl(const char *file, int line, const char **parent_names) { }
+void trace2_cmd_error_va_fl(const char *file, int line, const char *fmt,
+			    va_list ap) { }
+void trace2_cmd_name_fl(const char *file, int line, const char *name) { }
+void trace2_thread_start_fl(const char *file, int line,
+			    const char *thread_base_name) { }
+void trace2_thread_exit_fl(const char *file, int line) { }
+void trace2_data_intmax_fl(const char *file, int line, const char *category,
+			   const struct repository *repo, const char *key,
+			   intmax_t value) { }
+int trace2_is_enabled(void) { return 0; }
+void trace2_counter_add(enum trace2_counter_id cid, uint64_t value) { }
+void trace2_collect_process_info(enum trace2_process_info_reason reason) { }
diff --git a/symlinks.c b/symlinks.c
index b29e340c2d..bced721a0c 100644
--- a/symlinks.c
+++ b/symlinks.c
@@ -337,6 +337,7 @@ void invalidate_lstat_cache(void)
 	reset_lstat_cache(&default_cache);
 }
 
+#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(GIT_STD_LIB)
 #undef rmdir
 int lstat_cache_aware_rmdir(const char *path)
 {
@@ -348,3 +349,4 @@ int lstat_cache_aware_rmdir(const char *path)
 
 	return ret;
 }
+#endif
diff --git a/wrapper.c b/wrapper.c
index 7da15a56da..eeac3741cf 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -5,7 +5,6 @@
 #include "abspath.h"
 #include "parse.h"
 #include "gettext.h"
-#include "repository.h"
 #include "strbuf.h"
 #include "trace2.h"
 
-- 
2.42.0.283.g2d96d420d3-goog


^ permalink raw reply related	[relevance 5%]

* Re: [PATCH v2] diff: fix interaction between the "-s" option and other options
  @ 2023-05-13  3:07  5%                 ` Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2023-05-13  3:07 UTC (permalink / raw)
  To: Jeff King, Felipe Contreras; +Cc: Junio C Hamano, git

Jeff King wrote:
> On Wed, May 10, 2023 at 05:41:57PM -0600, Felipe Contreras wrote:
> > Felipe Contreras wrote:
> > > Junio C Hamano wrote:

> > > > And it led to unproductive and irritating waste of time number of times, and
> > > > eventually you were asked to leave the development community for at least a
> > > > few times.
> > > 
> > > That is blatantly false. As a member of Git's Project Leadership Committee, you
> > > should know precisely how many times the committee has excercised this power,
> > > and it hasn't been "a few times", it has been one time.
> > 
> > And for the record: that one time I was asked by the committee to not interact
> > with certain members of the community for a few months.
> > 
> > The amount of times I was asked to "leave the development community" is *zero*.
> 
> You're right, in the sense that the first time you were asked to leave
> we did not have a CoC,

That is is once again: *false*.

The git community has *never* asked me to leave.

> Likewise, many times during which your behavior has been a problem on the
> list,

False: it was not a problem on the list, it was a problem *for some people* on
the list.

> people did not ask you to leave, but simply said "I am not going to read your
> messages anymore".

Yes, and for every person who has said "I am not going to read your messages"
publicly, I received a response saying "thank you for saying what we are all
thinking but cannot say aloud for fear of reprisals" privately.

You do understand that people have different opinions? Some people hate Donald
Trump, some people don't. And some people cannot express their honest opinion
at $dayjob.

Having a different opinion is OK. And the foundation of a functioning civilized
democracy is to tolerate the opinions of others.

> For example, here's Junio asking you to leave in 2013:
> 
>   https://lore.kernel.org/git/7vsj0lvs8f.fsf@alter.siamese.dyndns.org/

Read the thread.

My objective was to show that the code organization was wrong, and libgit.a was
not an actual library. If there ever was any hope of having an actual libgit
library, the code needed to be reorganized:

====
  The plan is simple; make libgit.a a proper library, starting by
  clarifying what goes into libgit.a, and what doesn't. If there's any
  hopes of ever having a public library, it's clear what code doesn't
  belong in libgit.a; code that is meant for builtins, that code belongs
  in builtins/lib.a, or similar.
====
Felipe Contreras: [1]

The whole libification project of Google proves I was right: git was not (and
is not) ready to be a library. libgit.a is not nearly close to be an actual
standalone library. Pretty far from it.

Just today Elijah Newren sent a 27-patch series [2] attempting to move in the
right direction, but doesn't even begin to tip the scales to make libgit.so
possible.

My proposal did receive positive feedback:

====
  Nice joke patch to illustrate your point ;)
====
Ramkumar Ramachandra: [3]

====
  This is a good example: yes, I'm convinced that the code does need to
  be reorganized.
====
Ramkumar Ramachandra: [4]

Even you yourself provided useful positive feedback based on my proposal:

====
  If we want to start caring, then we probably need to create a separate
  "kitchen sink"-like library, with the rule that things in libgit.a
  cannot depend on it. In other words, a support library for Git's
  commands, for the parts that are not appropriate to expose as part of a
  library API.
====
Jeff King: [5]

Junio also provided good feedback initially:

====
  Another thing to think about is looking at pieces of data and
  functions defined in each *.o files and moving things around within
  them.  For example, looking at the dependency chain I quoted earlier
  for sequencer.o to build upload-pack, which is about responding to
  "git fetch" on the sending side:

  ...

  It is already crazy. There is no reason for the pack sender to be
  linking with the sequencer interpreter machinery. If the function
  definition (and possibly other ones) are split into separate source
  files (still in libgit.a), git-upload-pack binary does not have to
  pull in the whole sequencer.c at all.
====
Junio C Hamano: [6]

Things started to turn south when I expressed the following opinion:

====
  But init_copy_notes_for_rewrite() can *not* be used by anything other
  than git builtins. Standalone binaries will never use such a function,
  therefore it doesn't belong in libgit.a. Another example is
  alias_lookup(). They belong in builtin/lib.a.
====
Felipe Contreras: [7]

Junio asked me for an example of a function that would not belong to libgit.so,
and I said `init_copy_notes_for_rewrite()` is an example of a function that
nothing outside the `git` binary would need.

====
  But that is not a good justification for closing door to others that
  come later who may want to have a standalone that would want to use
  it.  Think about rewriting filter-branch.sh in C but not as a
  built-in, for example.
====
Junio C Hamano: [8]

I argued nobody would actually do that, and I was right, as eventually
filter-branch.sh was rewritten in C, but as a builtin, as I said it would.

Junio then argued that there was no justification for my claim that certain
functions would only be used by git builtins, and therefore they should not
belong in a libgit.so library:

====
  >> You still haven't justified why we have to _forbid_ any outside
  >> callers from calling copy_notes_for_rewrite().
  >
  > Because only builtins _should_ use it.

  And there is no justification behind that "_should_" claim; you are
  not making any technical argument to explain it.
====
Junio C Hamano: [9]

Google's libification project proves I was right: some functions should not
belong in libgit.a.

If Junio had listened to me back in 2013, the changes Google developers are
working on now to make libgit.a something that remotely resembles an actual
library would not be as monumental as they are in 2023.

Instead of considering my argument, Junio chose to attack me personally:

====
  I do not see a point in continuing to discuss this (or any design
  level issues) with you.  You seem to go into a wrong direction to
  break the design of the overall system, not in a direction to
  improve anything.  I do not know, and at this point I do not care,
  if you are doing so deliberately to sabotage Git.  Just stop.
====
Junio C Hamano: [9]

Even if Junio's opinion was the correct one (it's not: as Google's libification
project proves), it's not OK to personally attack a contributor merely for
expressing an opinion that happens to differ from that of the maintainer.

I am entitled to have my own opinion.

I already know what you are going to argue back: you are going to argue that
Google's libification project is different from my argument, but it's not:
Emily Shaffer's introductory mail explained the same thing:

====
  In other words, for some modules which
  already have clear boundaries inside of Git - like config.[ch],
  strbuf.[ch], etc. - we want to remove some implicit dependencies, like
  references to globals, and make explicit other dependencies, like
  references to other modules within Git.
====
Emily Shaffer: [10]

Google developers clearly believe the boundaries between "modules" are not
clear, and they should be. Which is *exactly* what I argued back in 2013.

You say Junio asked me to leave, but you conveniently avoid explaining *why*:
because he didn't like my opinion.

Junio was not content with simply saying "let's agree to disagree", he threw yet
another personal attack:

====
  So I do not think this is not even a bikeshedding.  Just one side
  being right, and the other side continuing to repeat nonsense
  without listening.
====
Junio C Hamano: [11]

And then:

====
  But what followed was a nonsense, which ended up wastign everybody's
  time:
====
Junio C Hamano: [12]

This breaks the current code of conduct, as it clearly is a behavior that is
not:

 * Demonstrating empathy and kindness toward other people
 * Being respectful of differing opinions, viewpoints, and experiences

This is what I objectively did *not* do in that thread:

 * Denigrate the opinions of others
 * Personally attack anybody

It was Junio the one who did that, not me.

Junio asked me to leave because I expressed an *opinion* he did not like.

Junio asked me to leave because I said in my opinion `copy_notes_for_rewrite()`
does not belong in libgit.a, because only git builtins should use it.

That's it.

I think it's incredibly deceitful of you to claim "Junio asked you to leave"
and provide a link, without explaining *why*.

Fast-forward to 2023, and Google developers are using the same language as I
did in 2013:

====
  Strbuf is a widely used basic structure that should only interact with other
  primitives in strbuf.[ch].
====
Calvin Wan: [13]

Is Junio asking them to leave the project for merely daring to express an
opinion about what *should* be the direction the Git project takes?

Of course not.

Ironically, the link you shared is a perfect example the double standards of
the Git project, in which a normative statement from a Google employee is par
for the course, but a normative statement from an unaffiliated contributor
(i.e. me) is complete heresy.

All of this is of course, nothing more than a smoke screen from the topic at hand.

---

This is the topic:

Subject: Re: [PATCH v2] diff: fix interaction between the "-s" option and other options

All that matters here is this:

 1. Apply Junio's patch
 2. Run this command `git diff -s --raw @~`

Does the command produce the same output before and after the patch? Yes or no.

That is it.

Stop dragging personal drama between Junio and me from 2013 in which nobody
else participated--including you--and answer the *only* relevant question in
this thread.

Does Junio's patch change the current behavior?

 a. Yes
 b. No

Cheers.

[1] https://lore.kernel.org/git/CAMP44s0cozMsTo7KQAjnqkqmvMwMw9D3SZrVxg48MOXkH9UQJQ@mail.gmail.com/
[2] https://lore.kernel.org/git/pull.1525.v2.git.1683875068.gitgitgadget@gmail.com/
[3] https://lore.kernel.org/git/CALkWK0mA7MXQv1k5bFpZLARDOHxU5kzKFXzcyUfb6NLZZY-=FA@mail.gmail.com/
[4] https://lore.kernel.org/git/CALkWK0=7PRndNc7XQ-PCPbVCp9vck909bA561JhQG6uXXj1n4g@mail.gmail.com/
[5] https://lore.kernel.org/git/20130610220627.GB28345@sigill.intra.peff.net/
[6] https://lore.kernel.org/git/7vwqq1ct0g.fsf@alter.siamese.dyndns.org/
[7] https://lore.kernel.org/git/CAMP44s03iXPVnunBdFT8etvZ-ew-D15A7mCV3wAAFXMNCpRAgA@mail.gmail.com/
[8] https://lore.kernel.org/git/7vppvsbkc3.fsf@alter.siamese.dyndns.org/
[9] https://lore.kernel.org/git/7vobbca1sr.fsf@alter.siamese.dyndns.org/
[10] https://lore.kernel.org/git/CAJoAoZ=Cig_kLocxKGax31sU7Xe4==BGzC__Bg2_pr7krNq6MA@mail.gmail.com/
[11] https://lore.kernel.org/git/7vehc8a05n.fsf@alter.siamese.dyndns.org/
[12] https://lore.kernel.org/git/7vzjuv14ir.fsf@alter.siamese.dyndns.org/
[13] https://lore.kernel.org/git/20230503184849.1809304-1-calvinwan@google.com/

-- 
Felipe Contreras

^ permalink raw reply	[relevance 5%]

* [PATCH 6/8] cmake: support for building git on windows with mingw
  @ 2020-04-24  4:01  5% ` Sibi Siddharthan via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Sibi Siddharthan via GitGitGadget @ 2020-04-24  4:01 UTC (permalink / raw)
  To: git; +Cc: Sibi Siddharthan, Sibi Siddharthan

From: Sibi Siddharthan <sibisiddharthan.github@gmail.com>

This patch facilitates building git on Windows with CMake using MinGW

NOTE: The funtions unsetenv and hstrerror are not checked in Windows
builds.
Reasons
NO_UNSETENV is not compatible with Windows builds.
lines 262-264 compat/mingw.h

compat/mingw.h(line 25) provides a definition of hstrerror which
conflicts with the definition provided in
git-compat-util.h(lines 733-736).

To use CMake on Windows with MinGW do this:
cmake `relative-path-to-srcdir` -G "MinGW Makefiles"

Signed-off-by: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
---
 CMakeLists.txt | 120 +++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 97 insertions(+), 23 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 29a23eb11f7..d9eb1060390 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,9 +13,12 @@ project(git
 	VERSION ${git_version}
 	LANGUAGES C)
 
+
 #TODO gitk git-gui gitweb
+#TODO Enable NLS on windows natively
 #TODO Add pcre support
 
+
 include(CheckTypeSize)
 include(CheckCSourceRuns)
 include(CheckCSourceCompiles)
@@ -31,6 +34,7 @@ find_package(EXPAT)
 find_package(Iconv)
 find_package(Intl)
 
+
 if(NOT Intl_FOUND)
 	add_compile_definitions(NO_GETTEXT)
 	if(NOT Iconv_FOUND)
@@ -53,6 +57,16 @@ if(Intl_FOUND)
 endif()
 
 find_program(SH_EXE sh)
+if(NOT SH_EXE)
+	message(FATAL_ERROR "sh interpreter was not found in your path, please install one. On Windows you can get it from here https://gitforwindows.org/")
+endif()
+
+if(WIN32)
+	find_program(WINDRES_EXE windres)
+	if(NOT WINDRES_EXE)
+		message(FATAL_ERROR "Install windres on Windows for resource files")
+	endif()
+endif()
 
 find_program(MSGFMT_EXE msgfmt)
 if(NOT MSGFMT_EXE)
@@ -85,11 +99,39 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
 			BINDIR="bin"
 			GIT_BUILT_FROM_COMMIT="")
 
-set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
-add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+if(WIN32)
+	set(FALLBACK_RUNTIME_PREFIX /mingw64)
+	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+else()
+	set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
+	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
+endif()
 
-add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
-list(APPEND compat_SOURCES unix-socket.c)
+
+#Platform Specific
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+	include_directories(compat/win32)
+	add_compile_definitions(HAVE_ALLOCA_H NO_POSIX_GOODIES NATIVE_CRLF NO_UNIX_SOCKETS WIN32
+				_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=".exe"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT
+				NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0 NO_ST_BLOCKS_IN_STRUCT_STAT
+				USE_NED_ALLOCATOR OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP
+				UNICODE _UNICODE HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET)
+	list(APPEND compat_SOURCES compat/mingw.c compat/winansi.c compat/win32/path-utils.c
+		compat/win32/pthread.c compat/win32mmap.c compat/win32/syslog.c
+		compat/win32/trace2_win32_process_info.c compat/win32/dirent.c
+		compat/nedmalloc/nedmalloc.c compat/strdup.c)
+	set(NO_UNIX_SOCKETS 1)
+
+elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+	add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
+	list(APPEND compat_SOURCES unix-socket.c)
+endif()
+
+if(WIN32)
+	set(EXE_EXTENSION .exe)
+else()
+	set(EXE_EXTENSION)
+endif()
 
 #header checks
 check_include_file(libgen.h HAVE_LIBGEN_H)
@@ -150,7 +192,12 @@ endif()
 #function checks
 set(function_checks
 	strcasestr memmem strlcpy strtoimax strtoumax strtoull
-	setenv  mkdtemp poll pread  memmem unsetenv hstrerror)
+	setenv  mkdtemp poll pread  memmem)
+
+#unsetenv,hstrerror are incompatible with windows build
+if(NOT WIN32)
+	list(APPEND function_checks unsetenv hstrerror)
+endif()
 
 foreach(f ${function_checks})
 	string(TOUPPER ${f} uf)
@@ -309,7 +356,13 @@ endif()
 #programs
 set(PROGRAMS_BUILT
 	git git-bugreport git-credential-store git-daemon git-fast-import git-http-backend git-sh-i18n--envsubst
-	git-shell git-remote-testsvn git-credential-cache git-credential-cache--daemon)
+	git-shell git-remote-testsvn)
+
+if(NO_UNIX_SOCKETS)
+	list(APPEND excluded_progs git-credential-cache git-credential-cache--daemon)
+else()
+	list(APPEND PROGRAMS_BUILT git-credential-cache git-credential-cache--daemon)
+endif()
 
 if(NOT CURL_FOUND)
 	list(APPEND excluded_progs git-http-fetch git-http-push)
@@ -410,15 +463,34 @@ set(libvcs-svn_SOURCES
 	vcs-svn/svndiff.c vcs-svn/svndump.c)
 add_library(vcs-svn STATIC ${libvcs-svn_SOURCES})
 
+#add git.rc for gcc
+if(WIN32)
+	add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
+			COMMAND ${WINDRES_EXE} -O coff -DMAJOR=${PROJECT_VERSION_MAJOR} -DMINOR=${PROJECT_VERSION_MINOR}
+				-DMICRO=${PROJECT_VERSION_PATCH} -DPATCHLEVEL=0 -DGIT_VERSION="\\\"${PROJECT_VERSION}.GIT\\\""
+				-i ${CMAKE_SOURCE_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+			WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+			VERBATIM)
+	add_custom_target(git-rc DEPENDS ${CMAKE_BINARY_DIR}/git.res)
+endif()
+
 #link all required libraries to common-main
 add_library(common-main OBJECT common-main.c)
-target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES} pthread rt)
+
+target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES})
 if(Intl_FOUND)
 	target_link_libraries(common-main ${Intl_LIBRARIES})
 endif()
 if(Iconv_FOUND)
 	target_link_libraries(common-main ${Iconv_LIBRARIES})
 endif()
+if(WIN32)
+	target_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)
+	add_dependencies(common-main git-rc)
+	target_link_options(common-main PUBLIC -municode -Wl,--nxcompat -Wl,--dynamicbase -Wl,--pic-executable,-e,mainCRTStartup)
+elseif(UNIX)
+	target_link_libraries(common-main pthread rt)
+endif()
 
 
 set(git_SOURCES
@@ -501,11 +573,13 @@ endif()
 add_executable(git-remote-testsvn remote-testsvn.c)
 target_link_libraries(git-remote-testsvn common-main vcs-svn)
 
-add_executable(git-credential-cache credential-cache.c)
-target_link_libraries(git-credential-cache common-main)
+if(NOT NO_UNIX_SOCKETS)
+	add_executable(git-credential-cache credential-cache.c)
+	target_link_libraries(git-credential-cache common-main)
 
-add_executable(git-credential-cache--daemon credential-cache--daemon.c)
-target_link_libraries(git-credential-cache--daemon common-main)
+	add_executable(git-credential-cache--daemon credential-cache--daemon.c)
+	target_link_libraries(git-credential-cache--daemon common-main)
+endif()
 
 
 set(git_builtin_extra
@@ -517,16 +591,16 @@ set(git_builtin_extra
 foreach(s ${git_SOURCES} ${git_builtin_extra})
 	string(REPLACE "builtin/" "" s ${s})
 	string(REPLACE ".c" "" s ${s})
-	file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git git-${s})\n")
-	list(APPEND git_links ${CMAKE_BINARY_DIR}/git-${s})
+	file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git${EXE_EXTENSION} git-${s}${EXE_EXTENSION})\n")
+	list(APPEND git_links ${CMAKE_BINARY_DIR}/git-${s}${EXE_EXTENSION})
 endforeach()
 
 if(CURL_FOUND)
 	set(remote_exes
 		git-remote-https git-remote-ftp git-remote-ftps)
 	foreach(s ${remote_exes})
-		file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git-remote-http ${s})\n")
-		list(APPEND git_http_links ${CMAKE_BINARY_DIR}/${s})
+		file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git-remote-http${EXE_EXTENSION} ${s}${EXE_EXTENSION})\n")
+		list(APPEND git_http_links ${CMAKE_BINARY_DIR}/${s}${EXE_EXTENSION})
 	endforeach()
 endif()
 
@@ -654,20 +728,20 @@ set(bin_links
 	git-receive-pack git-upload-archive git-upload-pack)
 
 foreach(b ${bin_links})
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/bin/${b})")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/bin/${b}${EXE_EXTENSION})")
 endforeach()
 
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git)")
-install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git-shell ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-shell)")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git${EXE_EXTENSION})")
+install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git-shell${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-shell${EXE_EXTENSION})")
 
 foreach(b ${git_links})
 	string(REPLACE "${CMAKE_BINARY_DIR}" "" b ${b})
-	install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b})")
+	install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b}${EXE_EXTENSION})")
 endforeach()
 
 foreach(b ${git_http_links})
 	string(REPLACE "${CMAKE_BINARY_DIR}" "" b ${b})
-	install(CODE "file(CREATE_LINK  ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-remote-http ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b})")
+	install(CODE "file(CREATE_LINK  ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-remote-http${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b}${EXE_EXTENSION})")
 endforeach()
 
 install(PROGRAMS ${git_shell_scripts} ${git_perl_scripts} ${CMAKE_BINARY_DIR}/git-p4
@@ -734,14 +808,14 @@ set(wrapper_test_scripts
 foreach(script ${wrapper_scripts})
 	file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
 	string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-	string(REPLACE "@@PROG@@" "${script}" content "${content}")
+	string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
 	file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
 endforeach()
 
 foreach(script ${wrapper_test_scripts})
 	file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
 	string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-	string(REPLACE "@@PROG@@" "t/helper/${script}" content "${content}")
+	string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
 	file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
 endforeach()
 
@@ -807,7 +881,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DC_SHA1='${DC_SHA1}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X=''\n")
+file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-- 
gitgitgadget


^ permalink raw reply related	[relevance 5%]

* Re: [PATCH 2/2] Move sequencer to builtin
  @ 2013-06-08 14:10  5%                   ` Duy Nguyen
    0 siblings, 1 reply; 200+ results
From: Duy Nguyen @ 2013-06-08 14:10 UTC (permalink / raw)
  To: Ramkumar Ramachandra
  Cc: Felipe Contreras, Git Mailing List, Junio C Hamano, Brandon Casey,
	Jonathan Nieder

On Sat, Jun 8, 2013 at 8:34 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
> I'm not saying that we can convert libgit.a into something that's
> usable as a long-running process by production servers tomorrow.  All
> I'm saying is that it might be possible to get ruby (and possibly
> other languages) to call into git-core, to make scripting more sane
> than shell-spawning everything like brutes.  I think this is what fc
> is aiming at, atleast in the foreseeable future.

It's technically possible. You can already call into libgit.a as fc
demonstrated with his ruby binding. Assuming that you are willing to
dig in and fix all the problems (in a non-intrusive way) when a call
into libgit.a does not work, there's still API issue. Do we want to
freeze libgit.a API so that scripts will not be audited and changed
unncessarily? Freezing the API at cmd_* level loses a lot of
flexibility. Freezing at lower level may prevent us from making some
changes. I still think that binding new languages to a clean library
like libgit2 is better than to libgit.a. Just thinking of what might
work and what might not is already a headache.
-- 
Duy

^ permalink raw reply	[relevance 5%]

* Re: using git directory cache code in darcs?
  @ 2005-04-18  2:56  5%       ` Paul Jackson
    0 siblings, 1 reply; 200+ results
From: Paul Jackson @ 2005-04-18  2:56 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: droundy, git, darcs-devel

Linus wrote:
> But then I'd really suggest that you use "git" itself, not any
> "libgit". Ie you take _all_ the plumbing as real programs, and instead of
> trying to link against individual routines, you'd _script_ it.

I think you've got this upside down, Linus.

Trying to make the executable 'git' commands the bottom layer of the
user implementation stack forces inefficiencies on higher layers
of the stack, and thus encourages stupid workarounds and cheats in
an effort to speed things up.

I'd encourage you to invite someone to provide a libgit.

Such work should _start_ with proposing and gaining acceptance on the
API - the calls, the arguments, the types, the rough idea of the
semantics. The actual coding is the easy part.  One is not slave to the
agreed API when coding.  The API will continue to evolve, but if the
originally accepted proposal was sound, the evolution will be at a
modest rate, with few incompatibilities introduced.

If several operations should be done as a unit, to preserve the
integrity of the .git data or to provide sane results, then libgit need
only provide such pre-packaged units, not the incomplete fragments from
which they are composed.  That is, the libgit calls could quite possibly
be at roughly the same semantic level as your git commands.  One could
even code up some of the libgit calls, in early versions of libgit, by
simply invoking the corresponding git command.  But, eventually, all the
git commands should be recoded on top of the libgit library, and the
libgit library become the canonical user interface to git, on which all
else is layered.

One typical way that this choice manifests itself is in the strace
output from doing some ordinary git command from a C program that is
implementing an SCM system on top of git.  Forcing every operation to be
done via a separate git command execution mushrooms the number of kernel
system calls a hundred fold, or two hundred fold if some dang fool uses
system(3S) to invoke the git command.  What might have been a handful of
calls to stat/open/read/write/close a file turns into a mini-shell
session.  That way lies insanity, or at least painful inefficiency, and
the usual parade of bugs, stupid coding tricks and painful user
interfaces that follow in the wake.

The recommended layering of such user facilities is well known, with a C
library at the bottom.  Granted, the history of source code management
tools provides few examples of this recommended layering.

On top of this library go plugin modules for the fancier scripting
languages that accept such.  Swig can be used to aid this construction,
for Tcl, Python, Perl, Guile, Java, Ruby, Mzscheme, PHP, Ocaml, Pike,
C#, Chicken Allegro CL, Modula-3, Javascript and Eiffel.  Though I
personally have not worked with Swig enough to gain success with it.
The only such modules I've done were handcoded Python modules.

Also on top of this library one provides a set of command line utilities
or one multiplexed 'git foo ...' command, for use at shell prompts.  Or
the command line utilities can be coded in one of the above higher level
scripting languages, using in turn the git library plugin.  However many
of these scripting languages bring runtime requirements that are not
universally satisfied on all target systems, so are a poor choice for
this purpose.

If I am recalling correctly, from the days when I regularly used bk, one
of the things that Larry did right with bk, which RCS and SCCS did not
do right before then, was to provide a low level library to his storage
- a cleanroom recoded variant of SCCS in his case.

Implementing production source control systems on top of a set of
executable commands is a pain in the arse.  An all too familiar pain.

I'd repeat my encouragement that you invite someone to provide such a
libgit, however since I have other commitments for the next month at
least, so can't volunteer right away, if ever, it is more appropriate
that I shut up now, under the old "put up code or be quiet" rule.

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@engr.sgi.com> 1.650.933.1373, 1.925.600.0401

^ permalink raw reply	[relevance 5%]

* [RFC PATCH 0/8] sequencer: dont't fork git commit
@ 2017-09-25 10:10  5% Phillip Wood
  0 siblings, 0 replies; 200+ results
From: Phillip Wood @ 2017-09-25 10:10 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Johannes Schindelin, Phillip Wood

From: Phillip Wood <phillip.wood@dunelm.org.uk>

These patches teach the sequencer to create commits without forking
git commit when the commit message does not need to be edited. This
speeds up cherry picking 10 commits by 26% and picking 10 commits with
rebase --continue by 44%. The first few patches move bits of
builtin/commit.c to sequencer.c. The last two patches actually
implement creating commits in sequencer.c.

Phillip Wood (8):
  commit: move empty message checks to libgit
  commit: move code to update HEAD to libgit
  sequencer: refactor update_head()
  commit: move post-rewrite code to libgit
  commit: move print_commit_summary() to libgit
  sequencer: simplify adding Signed-off-by: trailer
  sequencer: load commit related config
  sequencer: try to commit without forking 'git commit'

 builtin/commit.c         | 269 ++--------------------------
 builtin/rebase--helper.c |  13 +-
 builtin/revert.c         |  15 +-
 sequencer.c              | 447 ++++++++++++++++++++++++++++++++++++++++++++++-
 sequencer.h              |  20 +++
 5 files changed, 503 insertions(+), 261 deletions(-)

-- 
2.14.1


^ permalink raw reply	[relevance 5%]

* [PATCH 1/3] Move git_version_string to help.c before diff changes
  @ 2012-02-10 16:39  5%   ` Zbigniew Jędrzejewski-Szmek
  0 siblings, 0 replies; 200+ results
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-10 16:39 UTC (permalink / raw)
  To: git, gitster, pclouds; +Cc: Michael J Gruber, Zbigniew Jędrzejewski-Szmek

git_version_string lives in git.c. When diff.c starts to use functions
from help.c, which in turn use git_version_string, linking against
libgit.a will fail. This is because git_version_string is physically
located in git.o, and this object file is not part of libgit.a. One
option would be to add git.o to libgit.a, but git.o is biggish. The
second, better option is to move git_version_string to somewhere where
it'll become part of libgit.a. This variable is only used in a couple
of places, help.c being one of them, so it let's move
git_version_string from git.c to help.c. The git binary is linked with
help.o, so it is not affected by this move.

Without this change the next commit would fail with:
$ gcc  -g -O0 -I. -DUSE_LIBPCRE  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'  -DNO_STRLCPY -DNO_MKSTEMPS -o git-daemon   daemon.o libgit.a xdiff/lib.a  -lpcre -lz  -lcrypto -lpthread
libgit.a(help.o): In function `cmd_version':
/home/zbyszek/git/git/help.c:435: undefined reference to `git_version_string'

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
 Makefile |    5 +++--
 git.c    |    2 --
 help.c   |    2 ++
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 4817157..ccafb95 100644
--- a/Makefile
+++ b/Makefile
@@ -1890,7 +1890,7 @@ strip: $(PROGRAMS) git$X
 	$(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
 
 git.o: common-cmds.h
-git.sp git.s git.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"' \
+git.sp git.s git.o: EXTRA_CPPFLAGS = \
 	'-DGIT_HTML_PATH="$(htmldir_SQ)"' \
 	'-DGIT_MAN_PATH="$(mandir_SQ)"' \
 	'-DGIT_INFO_PATH="$(infodir_SQ)"'
@@ -1899,7 +1899,8 @@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
 		$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
 
-help.sp help.o: common-cmds.h
+help.o: common-cmds.h
+help.sp help.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"'
 
 builtin/help.sp builtin/help.o: common-cmds.h
 builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
diff --git a/git.c b/git.c
index 3805616..a24a0fd 100644
--- a/git.c
+++ b/git.c
@@ -256,8 +256,6 @@ static int handle_alias(int *argcp, const char ***argv)
 	return ret;
 }
 
-const char git_version_string[] = GIT_VERSION;
-
 #define RUN_SETUP		(1<<0)
 #define RUN_SETUP_GENTLY	(1<<1)
 #define USE_PAGER		(1<<2)
diff --git a/help.c b/help.c
index cbbe966..bc15066 100644
--- a/help.c
+++ b/help.c
@@ -409,6 +409,8 @@ const char *help_unknown_cmd(const char *cmd)
 	exit(1);
 }
 
+const char git_version_string[] = GIT_VERSION;
+
 int cmd_version(int argc, const char **argv, const char *prefix)
 {
 	printf("git version %s\n", git_version_string);
-- 
1.7.9.263.g4be11.dirty

^ permalink raw reply related	[relevance 5%]

* [PATCH 3/3] Makefile: Add cache-tree.h to the public headers list
@ 2007-09-05 23:22  5% Dmitry V. Levin
  0 siblings, 0 replies; 200+ results
From: Dmitry V. Levin @ 2007-09-05 23:22 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano

Some external projects (e.g. parsecvs) need cache-tree.h file.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index d50e30b..2b04829 100644
--- a/Makefile
+++ b/Makefile
@@ -283,7 +283,7 @@ LIB_FILE=libgit.a
 XDIFF_LIB=xdiff/lib.a
 
 LIB_H = \
-	archive.h blob.h cache.h commit.h csum-file.h delta.h grep.h \
+	archive.h blob.h cache.h cache-tree.h commit.h csum-file.h delta.h grep.h \
 	diff.h object.h pack.h pkt-line.h quote.h refs.h list-objects.h sideband.h \
 	run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
 	tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h \
-- 
ldv

^ permalink raw reply related	[relevance 5%]

* Re: Libification project (SoC)
  @ 2007-03-16 19:09  5%                   ` Andy Parkins
    1 sibling, 0 replies; 200+ results
From: Andy Parkins @ 2007-03-16 19:09 UTC (permalink / raw)
  To: git; +Cc: Marco Costalba, Johannes Schindelin, Rocco Rutte

On Friday 2007, March 16, Marco Costalba wrote:

> There is no way that a GUI tool is allowed to *freeze* for that
> amount of time. Currently, because an external process is forked when
> running 'git rev-list' all the problem is happly handled by the
> kernel scheduler and the QProcess callback mechanism (based on
> select()). In case of a libified git-rev-list this could be an issue.

I don't think that is ever going to be an issue.  At the worst you could 
just fork() and run the libgit command in that.  Threads are fairly 
easy in Qt as well.

In short, I wouldn't worry about libgit blocking - in fact it's almost a 
guarantee that libgit /will/ block; it would be a nightmare to write an 
asynchronous libgit.



Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com

^ permalink raw reply	[relevance 5%]

* Re: [ANNOUNCE] Cogito-0.8 (former git-pasky, big changes!)
  @ 2005-04-26  4:58  5% ` Jeff Garzik
  0 siblings, 0 replies; 200+ results
From: Jeff Garzik @ 2005-04-26  4:58 UTC (permalink / raw)
  To: pasky, git; +Cc: linux-kernel

Petr Baudis wrote:
>   Hello,
> 
>   here goes Cogito-0.8, my SCMish layer over Linus Torvald's git tree
> history tracker. This package was formerly called git-pasky, however
> this release brings big changes. The usage is significantly different,
> as well as some basic concepts; the history changed again (hopefully the
> last time?) because of fixing dates of some old commits. The .git/
> directory layout changed too.

tar xvfj $x
cd x
make
...
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o rpull rpull.c 
libgit.a rsh.c -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o rev-list rev-list.c 
libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-mktag 
git-mktag.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o diff-tree-helper 
diff-tree-helper.c libgit.a -lz -lssl
make: commit-id: Command not found
Generating cg-version...



So, it still complains about commit-id

	Jeff



^ permalink raw reply	[relevance 5%]

* Re: "True" git merge in git-pasky
  @ 2005-04-19  5:43  5% ` bert hubert
  0 siblings, 0 replies; 200+ results
From: bert hubert @ 2005-04-19  5:43 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

On Tue, Apr 19, 2005 at 05:51:07AM +0200, Petr Baudis wrote:
> 	http://pasky.or.cz/~pasky/dev/git

I pulled the tar.bz2 and did make:
gcc -g -O3 -Wall -o merge-cache merge-cache.o libgit.a libgit.a -lssl -lz
gcc -g -O3 -Wall   -c -o unpack-file.o unpack-file.c
gcc -g -O3 -Wall -o unpack-file unpack-file.o libgit.a libgit.a -lssl -lz
make: commit-id: Command not found
Generating gitversion.sh...

Is this bad?

-- 
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://netherlabs.nl              Open and Closed source services

^ permalink raw reply	[relevance 5%]

* [PATCH] Add a sample user for the svndump library
  @ 2010-07-15 16:25  5% ` Ramkumar Ramachandra
  0 siblings, 0 replies; 200+ results
From: Ramkumar Ramachandra @ 2010-07-15 16:25 UTC (permalink / raw)
  To: Git Mailing List
  Cc: David Michael Barr, Jonathan Nieder, Sverre Rabbelier,
	Junio C Hamano

From: Jonathan Nieder <jrnieder@gmail.com>

The svn-fe tool takes a Subversion dump file as input and produces
a fast-import stream as output.  This can be useful as a low-level
tool in building other importers, or for debugging the vcs-svn
library.

 make svn-fe
 make svn-fe.1

to test.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 contrib/svn-fe/.gitignore |    3 ++
 contrib/svn-fe/Makefile   |   63 ++++++++++++++++++++++++++++++++++++++++++
 contrib/svn-fe/svn-fe.c   |   15 ++++++++++
 contrib/svn-fe/svn-fe.txt |   66 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 147 insertions(+), 0 deletions(-)
 create mode 100644 contrib/svn-fe/.gitignore
 create mode 100644 contrib/svn-fe/Makefile
 create mode 100644 contrib/svn-fe/svn-fe.c
 create mode 100644 contrib/svn-fe/svn-fe.txt

diff --git a/contrib/svn-fe/.gitignore b/contrib/svn-fe/.gitignore
new file mode 100644
index 0000000..27a33b6
--- /dev/null
+++ b/contrib/svn-fe/.gitignore
@@ -0,0 +1,3 @@
+/*.xml
+/*.1
+/*.html
diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
new file mode 100644
index 0000000..4cc8d15
--- /dev/null
+++ b/contrib/svn-fe/Makefile
@@ -0,0 +1,63 @@
+all:: svn-fe$X
+
+CC = gcc
+RM = rm -f
+MV = mv
+
+CFLAGS = -g -O2 -Wall
+LDFLAGS =
+ALL_CFLAGS = $(CFLAGS)
+ALL_LDFLAGS = $(LDFLAGS)
+EXTLIBS =
+
+GIT_LIB = ../../libgit.a
+VCSSVN_LIB = ../../vcs-svn/lib.a
+LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(EXTLIBS)
+
+QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1 =
+
+ifneq ($(findstring $(MAKEFLAGS),w),w)
+PRINT_DIR = --no-print-directory
+else # "make -w"
+NO_SUBDIR = :
+endif
+
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+	QUIET_CC      = @echo '   ' CC $@;
+	QUIET_LINK    = @echo '   ' LINK $@;
+	QUIET_SUBDIR0 = +@subdir=
+	QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
+	                $(MAKE) $(PRINT_DIR) -C $$subdir
+endif
+endif
+
+svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(GIT_LIB)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ svn-fe.o \
+		$(ALL_LDFLAGS) $(LIBS)
+
+svn-fe.o: svn-fe.c ../../vcs-svn/svndump.h
+	$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
+
+svn-fe.html: svn-fe.txt
+	$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
+		MAN_TXT=../contrib/svn-fe/svn-fe.txt \
+		../contrib/svn-fe/$@
+
+svn-fe.1: svn-fe.txt
+	$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
+		MAN_TXT=../contrib/svn-fe/svn-fe.txt \
+		../contrib/svn-fe/$@
+	$(MV) ../../Documentation/svn-fe.1 .
+
+../../vcs-svn/lib.a: FORCE
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) vcs-svn/lib.a
+
+../../libgit.a: FORCE
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
+
+clean:
+	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
+
+.PHONY: all clean FORCE
diff --git a/contrib/svn-fe/svn-fe.c b/contrib/svn-fe/svn-fe.c
new file mode 100644
index 0000000..43c4320
--- /dev/null
+++ b/contrib/svn-fe/svn-fe.c
@@ -0,0 +1,15 @@
+/*
+ * This file is in the public domain.
+ * You may freely use, modify, distribute, and relicense it.
+ */
+
+#include <stdlib.h>
+#include "vcs-svn/svndump.h"
+
+int main(int argc, char **argv)
+{
+	svndump_init(NULL);
+	svndump_read((argc > 1) ? argv[1] : NULL);
+	svndump_reset();
+	return 0;
+}
diff --git a/contrib/svn-fe/svn-fe.txt b/contrib/svn-fe/svn-fe.txt
new file mode 100644
index 0000000..de30f83
--- /dev/null
+++ b/contrib/svn-fe/svn-fe.txt
@@ -0,0 +1,66 @@
+svn-fe(1)
+=========
+
+NAME
+----
+svn-fe - convert an SVN "dumpfile" to a fast-import stream
+
+SYNOPSIS
+--------
+svnadmin dump --incremental REPO | svn-fe [url] | git fast-import
+
+DESCRIPTION
+-----------
+
+Converts a Subversion dumpfile (version: 2) into input suitable for
+git-fast-import(1) and similar importers. REPO is a path to a
+Subversion repository mirrored on the local disk. Remote Subversion
+repositories can be mirrored on local disk using the `svnsync`
+command.
+
+INPUT FORMAT
+------------
+Subversion's repository dump format is documented in full in
+`notes/dump-load-format.txt` from the Subversion source tree.
+Files in this format can be generated using the 'svnadmin dump' or
+'svk admin dump' command.
+
+OUTPUT FORMAT
+-------------
+The fast-import format is documented by the git-fast-import(1)
+manual page.
+
+NOTES
+-----
+Subversion dumps do not record a separate author and committer for
+each revision, nor a separate display name and email address for
+each author.  Like git-svn(1), 'svn-fe' will use the name
+
+---------
+user <user@UUID>
+---------
+
+as committer, where 'user' is the value of the `svn:author` property
+and 'UUID' the repository's identifier.
+
+To support incremental imports, 'svn-fe' will put a `git-svn-id`
+line at the end of each commit log message if passed an url on the
+command line.  This line has the form `git-svn-id: URL@REVNO UUID`.
+
+Empty directories and unknown properties are silently discarded.
+
+The resulting repository will generally require further processing
+to put each project in its own repository and to separate the history
+of each branch.  The 'git filter-branch --subdirectory-filter' command
+may be useful for this purpose.
+
+BUGS
+----
+Litters the current working directory with .bin files for
+persistence. Will be fixed when the svn-fe infrastructure is aware of
+a Git working directory.
+
+SEE ALSO
+--------
+git-svn(1), svn2git(1), svk(1), git-filter-branch(1), git-fast-import(1),
+https://svn.apache.org/repos/asf/subversion/trunk/notes/dump-load-format.txt
-- 
1.7.1

^ permalink raw reply related	[relevance 5%]

* [PATCH/RFC v4 02/16] Integrate remote-svn into svn-fe/Makefile.
  @ 2012-08-17 20:25  5%   ` Florian Achleitner
  0 siblings, 0 replies; 200+ results
From: Florian Achleitner @ 2012-08-17 20:25 UTC (permalink / raw)
  To: git; +Cc: David Michael Barr, Jonathan Nieder, Junio C Hamano,
	Florian Achleitner

Requires some sha.h to be used and the libraries
to be linked, this is currently hardcoded, because
this makefile is only a temporary solution.

Also create a symbolic link in the toplevel dir named
'git-remote-svn' to allow git to find the remote helper.

Signed-off-by: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
---
 contrib/svn-fe/Makefile |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
index 360d8da..9f37093 100644
--- a/contrib/svn-fe/Makefile
+++ b/contrib/svn-fe/Makefile
@@ -1,14 +1,14 @@
-all:: svn-fe$X
+all:: svn-fe$X remote-svn$X
 
 CC = gcc
 RM = rm -f
 MV = mv
 
-CFLAGS = -g -O2 -Wall
+CFLAGS = -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>' -Wdeclaration-after-statement
 LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-EXTLIBS =
+EXTLIBS = -lssl -lcrypto -lpthread ../../xdiff/lib.a
 
 GIT_LIB = ../../libgit.a
 VCSSVN_LIB = ../../vcs-svn/lib.a
@@ -37,8 +37,13 @@ svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(GIT_LIB)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ svn-fe.o \
 		$(ALL_LDFLAGS) $(LIBS)
 
-svn-fe.o: svn-fe.c ../../vcs-svn/svndump.h
-	$(QUIET_CC)$(CC) -I../../vcs-svn -o $*.o -c $(ALL_CFLAGS) $<
+remote-svn$X: remote-svn.o $(VCSSVN_LIB) $(GIT_LIB)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ remote-svn.o \
+		$(ALL_LDFLAGS) $(LIBS)
+	ln -sf contrib/svn-fe/$@ ../../git-remote-svn
+		
+%.o: %.c ../../vcs-svn/svndump.h
+	$(QUIET_CC)$(CC) -I../../vcs-svn -I../../ -o $*.o -c $(ALL_CFLAGS) $<
 
 svn-fe.html: svn-fe.txt
 	$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
@@ -58,6 +63,7 @@ svn-fe.1: svn-fe.txt
 	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
 
 clean:
-	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
+	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1 \
+	remote-svn.o ../../git-remote-svn
 
 .PHONY: all clean FORCE
-- 
1.7.9.5

^ permalink raw reply related	[relevance 5%]

* [PATCH 1/7] Move try_merge_command and checkout_fast_forward to libgit.a
  2012-10-26 15:53 10%       ` [PATCH 0/7] Move code from builtin " Nguyễn Thái Ngọc Duy
                           ` (2 preceding siblings ...)
  2012-10-26 15:53  7%         ` [PATCH 4/7] Move setup_diff_pager " Nguyễn Thái Ngọc Duy
@ 2012-10-26 15:53  5%         ` Nguyễn Thái Ngọc Duy
  3 siblings, 0 replies; 200+ results
From: Nguyễn Thái Ngọc Duy @ 2012-10-26 15:53 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Nguyễn Thái Ngọc Duy

These functions are called in sequencer.c, which is part of
libgit.a. This makes libgit.a potentially require builtin/merge.c for
external git commands.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile          |   1 +
 builtin/merge.c   | 106 +--------------------------------------------------
 cache.h           |  11 +++++-
 merge-recursive.h |   5 ---
 merge.c           | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sequencer.c       |   2 +-
 6 files changed, 125 insertions(+), 112 deletions(-)
 create mode 100644 merge.c

diff --git a/Makefile b/Makefile
index f69979e..2c333dc 100644
--- a/Makefile
+++ b/Makefile
@@ -762,6 +762,7 @@ LIB_OBJS += lockfile.o
 LIB_OBJS += log-tree.o
 LIB_OBJS += mailmap.o
 LIB_OBJS += match-trees.o
+LIB_OBJS += merge.o
 LIB_OBJS += merge-file.o
 LIB_OBJS += merge-recursive.o
 LIB_OBJS += mergesort.o
diff --git a/builtin/merge.c b/builtin/merge.c
index 0ec8f0d..a96e8ea 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -628,59 +628,6 @@ static void write_tree_trivial(unsigned char *sha1)
 		die(_("git write-tree failed to write a tree"));
 }
 
-static const char *merge_argument(struct commit *commit)
-{
-	if (commit)
-		return sha1_to_hex(commit->object.sha1);
-	else
-		return EMPTY_TREE_SHA1_HEX;
-}
-
-int try_merge_command(const char *strategy, size_t xopts_nr,
-		      const char **xopts, struct commit_list *common,
-		      const char *head_arg, struct commit_list *remotes)
-{
-	const char **args;
-	int i = 0, x = 0, ret;
-	struct commit_list *j;
-	struct strbuf buf = STRBUF_INIT;
-
-	args = xmalloc((4 + xopts_nr + commit_list_count(common) +
-			commit_list_count(remotes)) * sizeof(char *));
-	strbuf_addf(&buf, "merge-%s", strategy);
-	args[i++] = buf.buf;
-	for (x = 0; x < xopts_nr; x++) {
-		char *s = xmalloc(strlen(xopts[x])+2+1);
-		strcpy(s, "--");
-		strcpy(s+2, xopts[x]);
-		args[i++] = s;
-	}
-	for (j = common; j; j = j->next)
-		args[i++] = xstrdup(merge_argument(j->item));
-	args[i++] = "--";
-	args[i++] = head_arg;
-	for (j = remotes; j; j = j->next)
-		args[i++] = xstrdup(merge_argument(j->item));
-	args[i] = NULL;
-	ret = run_command_v_opt(args, RUN_GIT_CMD);
-	strbuf_release(&buf);
-	i = 1;
-	for (x = 0; x < xopts_nr; x++)
-		free((void *)args[i++]);
-	for (j = common; j; j = j->next)
-		free((void *)args[i++]);
-	i += 2;
-	for (j = remotes; j; j = j->next)
-		free((void *)args[i++]);
-	free(args);
-	discard_cache();
-	if (read_cache() < 0)
-		die(_("failed to read the cache"));
-	resolve_undo_clear();
-
-	return ret;
-}
-
 static int try_merge_strategy(const char *strategy, struct commit_list *common,
 			      struct commit_list *remoteheads,
 			      struct commit *head, const char *head_arg)
@@ -762,56 +709,6 @@ static int count_unmerged_entries(void)
 	return ret;
 }
 
-int checkout_fast_forward(const unsigned char *head, const unsigned char *remote)
-{
-	struct tree *trees[MAX_UNPACK_TREES];
-	struct unpack_trees_options opts;
-	struct tree_desc t[MAX_UNPACK_TREES];
-	int i, fd, nr_trees = 0;
-	struct dir_struct dir;
-	struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
-
-	refresh_cache(REFRESH_QUIET);
-
-	fd = hold_locked_index(lock_file, 1);
-
-	memset(&trees, 0, sizeof(trees));
-	memset(&opts, 0, sizeof(opts));
-	memset(&t, 0, sizeof(t));
-	if (overwrite_ignore) {
-		memset(&dir, 0, sizeof(dir));
-		dir.flags |= DIR_SHOW_IGNORED;
-		setup_standard_excludes(&dir);
-		opts.dir = &dir;
-	}
-
-	opts.head_idx = 1;
-	opts.src_index = &the_index;
-	opts.dst_index = &the_index;
-	opts.update = 1;
-	opts.verbose_update = 1;
-	opts.merge = 1;
-	opts.fn = twoway_merge;
-	setup_unpack_trees_porcelain(&opts, "merge");
-
-	trees[nr_trees] = parse_tree_indirect(head);
-	if (!trees[nr_trees++])
-		return -1;
-	trees[nr_trees] = parse_tree_indirect(remote);
-	if (!trees[nr_trees++])
-		return -1;
-	for (i = 0; i < nr_trees; i++) {
-		parse_tree(trees[i]);
-		init_tree_desc(t+i, trees[i]->buffer, trees[i]->size);
-	}
-	if (unpack_trees(nr_trees, t, &opts))
-		return -1;
-	if (write_cache(fd, active_cache, active_nr) ||
-		commit_locked_index(lock_file))
-		die(_("unable to write new index file"));
-	return 0;
-}
-
 static void split_merge_strategies(const char *string, struct strategy **list,
 				   int *nr, int *alloc)
 {
@@ -1424,7 +1321,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		}
 
 		if (checkout_fast_forward(head_commit->object.sha1,
-					  commit->object.sha1)) {
+					  commit->object.sha1,
+					  overwrite_ignore)) {
 			ret = 1;
 			goto done;
 		}
diff --git a/cache.h b/cache.h
index a58df84..2dc4dec 100644
--- a/cache.h
+++ b/cache.h
@@ -1265,8 +1265,15 @@ struct startup_info {
 };
 extern struct startup_info *startup_info;
 
-/* builtin/merge.c */
-int checkout_fast_forward(const unsigned char *from, const unsigned char *to);
+/* merge.c */
+struct commit_list;
+int try_merge_command(const char *strategy, size_t xopts_nr,
+		const char **xopts, struct commit_list *common,
+		const char *head_arg, struct commit_list *remotes);
+int checkout_fast_forward(const unsigned char *from,
+			  const unsigned char *to,
+			  int overwrite_ignore);
+
 
 int sane_execvp(const char *file, char *const argv[]);
 
diff --git a/merge-recursive.h b/merge-recursive.h
index 58f3435..9e090a3 100644
--- a/merge-recursive.h
+++ b/merge-recursive.h
@@ -59,9 +59,4 @@ struct tree *write_tree_from_memory(struct merge_options *o);
 
 int parse_merge_opt(struct merge_options *out, const char *s);
 
-/* builtin/merge.c */
-int try_merge_command(const char *strategy, size_t xopts_nr,
-		const char **xopts, struct commit_list *common,
-		const char *head_arg, struct commit_list *remotes);
-
 #endif
diff --git a/merge.c b/merge.c
new file mode 100644
index 0000000..70f1000
--- /dev/null
+++ b/merge.c
@@ -0,0 +1,112 @@
+#include "cache.h"
+#include "commit.h"
+#include "run-command.h"
+#include "resolve-undo.h"
+#include "tree-walk.h"
+#include "unpack-trees.h"
+#include "dir.h"
+
+static const char *merge_argument(struct commit *commit)
+{
+	if (commit)
+		return sha1_to_hex(commit->object.sha1);
+	else
+		return EMPTY_TREE_SHA1_HEX;
+}
+
+int try_merge_command(const char *strategy, size_t xopts_nr,
+		      const char **xopts, struct commit_list *common,
+		      const char *head_arg, struct commit_list *remotes)
+{
+	const char **args;
+	int i = 0, x = 0, ret;
+	struct commit_list *j;
+	struct strbuf buf = STRBUF_INIT;
+
+	args = xmalloc((4 + xopts_nr + commit_list_count(common) +
+			commit_list_count(remotes)) * sizeof(char *));
+	strbuf_addf(&buf, "merge-%s", strategy);
+	args[i++] = buf.buf;
+	for (x = 0; x < xopts_nr; x++) {
+		char *s = xmalloc(strlen(xopts[x])+2+1);
+		strcpy(s, "--");
+		strcpy(s+2, xopts[x]);
+		args[i++] = s;
+	}
+	for (j = common; j; j = j->next)
+		args[i++] = xstrdup(merge_argument(j->item));
+	args[i++] = "--";
+	args[i++] = head_arg;
+	for (j = remotes; j; j = j->next)
+		args[i++] = xstrdup(merge_argument(j->item));
+	args[i] = NULL;
+	ret = run_command_v_opt(args, RUN_GIT_CMD);
+	strbuf_release(&buf);
+	i = 1;
+	for (x = 0; x < xopts_nr; x++)
+		free((void *)args[i++]);
+	for (j = common; j; j = j->next)
+		free((void *)args[i++]);
+	i += 2;
+	for (j = remotes; j; j = j->next)
+		free((void *)args[i++]);
+	free(args);
+	discard_cache();
+	if (read_cache() < 0)
+		die(_("failed to read the cache"));
+	resolve_undo_clear();
+
+	return ret;
+}
+
+int checkout_fast_forward(const unsigned char *head,
+			  const unsigned char *remote,
+			  int overwrite_ignore)
+{
+	struct tree *trees[MAX_UNPACK_TREES];
+	struct unpack_trees_options opts;
+	struct tree_desc t[MAX_UNPACK_TREES];
+	int i, fd, nr_trees = 0;
+	struct dir_struct dir;
+	struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
+
+	refresh_cache(REFRESH_QUIET);
+
+	fd = hold_locked_index(lock_file, 1);
+
+	memset(&trees, 0, sizeof(trees));
+	memset(&opts, 0, sizeof(opts));
+	memset(&t, 0, sizeof(t));
+	if (overwrite_ignore) {
+		memset(&dir, 0, sizeof(dir));
+		dir.flags |= DIR_SHOW_IGNORED;
+		setup_standard_excludes(&dir);
+		opts.dir = &dir;
+	}
+
+	opts.head_idx = 1;
+	opts.src_index = &the_index;
+	opts.dst_index = &the_index;
+	opts.update = 1;
+	opts.verbose_update = 1;
+	opts.merge = 1;
+	opts.fn = twoway_merge;
+	setup_unpack_trees_porcelain(&opts, "merge");
+
+	trees[nr_trees] = parse_tree_indirect(head);
+	if (!trees[nr_trees++])
+		return -1;
+	trees[nr_trees] = parse_tree_indirect(remote);
+	if (!trees[nr_trees++])
+		return -1;
+	for (i = 0; i < nr_trees; i++) {
+		parse_tree(trees[i]);
+		init_tree_desc(t+i, trees[i]->buffer, trees[i]->size);
+	}
+	if (unpack_trees(nr_trees, t, &opts))
+		return -1;
+	if (write_cache(fd, active_cache, active_nr) ||
+		commit_locked_index(lock_file))
+		die(_("unable to write new index file"));
+	return 0;
+}
diff --git a/sequencer.c b/sequencer.c
index e3723d2..be0cb8b 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -191,7 +191,7 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from)
 	struct ref_lock *ref_lock;
 
 	read_cache();
-	if (checkout_fast_forward(from, to))
+	if (checkout_fast_forward(from, to, 1))
 		exit(1); /* the callee should have complained already */
 	ref_lock = lock_any_ref_for_update("HEAD", from, 0);
 	return write_ref_sha1(ref_lock, to, "cherry-pick");
-- 
1.8.0.rc2.23.g1fb49df

^ permalink raw reply related	[relevance 5%]

* Re: [Administrivia] On ruby and contrib/
  @ 2013-06-09  2:41  5%                         ` Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2013-06-09  2:41 UTC (permalink / raw)
  To: Jeff King
  Cc: Duy Nguyen, Johannes Schindelin, Greg Troxel, Junio C Hamano,
	Git Mailing List, Jonathan Nieder, Thomas Rast, René Scharfe,
	Michael Haggerty, Matthieu Moy, Ramsay Jones, Erik Faye-Lund,
	Johannes Sixt

On Sat, Jun 8, 2013 at 9:23 PM, Jeff King <peff@peff.net> wrote:
> On Sat, Jun 08, 2013 at 08:17:08PM -0500, Felipe Contreras wrote:
>
>> > No, I didn't say that at all.
>>
>> Then you truly think libgit2 will ever reach the point where it can
>> replace libgit.a?
>
> I don't know. It may. Or something like it may. It is certainly not
> ready to do so yet, but perhaps one day it will be.

Perhaps one day we would end poverty and hunger, and perhaps one day
we will live in peace, but I wouldn't hold on my breath. I fact, I'll
do the opposite, I bet it won't happen anytime soon.

>> It won't.
>
> Oh, I see, you were not actually interested in my answer and were just
> being rhetorical.
>
>> But decreeing that both projects should remain isolated, and
>> that libgit.a should never be a library, you are effectively
>> condemning the effort to fail, knowingly or not.
>
> Huh? When did I decree anything?

When you said in your opinion we should wait until libgit2 is ready,
and not improve libgit.a.

>> How many years has libgit2 been brewing? Do you think it's closer for
>> merging so it can be used by Git's core? No, it doesn't, and it will
>> not in the future, because it was never meant for that.
>
> There has been about 2 years of active development, and there's been
> quite a lot of improvement in that time. Closer than what? Than it was 2
> years ago? Yes, I think it is. But it still has a ways to go.

Why is it closer? In what ways is it a better fit now than 2 years
ago? What is missing before merging to be used in Git's core?

> I do not think there will be a flag day where we throw away git.git's
> code and start using libgit2. But we could slowly start replacing
> underlying bits with libgit2 bits, if that implementation proves to be
> robust and clean enough to do so.

And what are we waiting for then? Shouldn't we copy the whole libgit2
code and start migrating?

>> > But hey, you don't need to listen to me. If you think it would be easier
>> > to make the git.git code into a library, go ahead and work on it. But I
>> > think you will find that there are a large number of hard-to-find bugs
>> > caused by implicit assumptions about global state, how file descriptors
>> > are used, and so forth.
>>
>> That's impossible. Specially since moving irrelevant code out of
>> libgit.a is not permitted.
>
> I'm not even sure what your second sentence means.

It means this:
http://article.gmane.org/gmane.comp.version-control.git/226752

I move code that doesn't belong in a libgit library out of libgit.a,
and the change gets rejected.

> But it seems to me that the first step would be cleaning up the internal
> code so that it is more friendly to library callers (both in interface
> and in being re-entrant),

That is the second step. It doesn't make sense to make code
re-entrant, if that code will only be used by builtin commands. First
step is to move irrelevant code out of libgit.a.

>> >> There's a reason why the Git project doesn't use libgit2, and for the
>> >> same reason the official Ruby scripts should not use it.
>> >
>> > What reason is that?
>>
>> You tell me. Why isn't Git using libgit2?
>
> Wait, you indicated you had such a reason in mind, but now you won't
> tell me? Is it a secret?

I did not. I made the assumption that there was a reason, if there's
no reason to stay clear of libgit2, then let's merge it already.

>> > I think it is a matter of critical mass. If you were to start linking
>> > against libgit.a and 90% of it worked, you might have a reason to fix
>> > the other 10%. But I suspect it is more the other way around.
>>
>> It doesn't matter if it's 90% or 10%, it's the only thing we have.
>>
>> Unless you are in favor of including libgit2 and start using it for
>> Git's core *right now*, the only way forward is to improve libgit.a.
>
> That seems like a false choice to me. You obviously feel that libgit2 is
> some kind of dead end. I don't agree. Whatever.

I never said so. It is a dead end *if* we don't do an effort to have a
proper libgit library, which is the path we are taking.

> I have very little interest in discussing this further with you, as it
> is not leading in a productive direction. In my opinion, the productive
> things to do would be one (or both) of:
>
>   1. Work on libgit2.
>
>   2. Clean up non-reentrant bits of git.git, hopefully making the code
>      more readable and more modular (and taking care not to make it
>      worse in other ways, like maintainability or performance).

You forgot the first step of 2.: move irrelevant code out of libgit.a.

-- 
Felipe Contreras

^ permalink raw reply	[relevance 5%]

* [PATCH] gitignore: Ignore some more boring things.
@ 2006-03-05 12:25  5% Mark Wooding
  0 siblings, 0 replies; 200+ results
From: Mark Wooding @ 2006-03-05 12:25 UTC (permalink / raw)
  To: git

From: Mark Wooding <mdw@distorted.org.uk>

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
---

 .gitignore   |    1 +
 t/.gitignore |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 5be239a..abbc509 100644
--- a/.gitignore
+++ b/.gitignore
@@ -130,3 +130,4 @@ libgit.a
 *.o
 *.py[co]
 config.mak
+git-blame
diff --git a/t/.gitignore b/t/.gitignore
new file mode 100644
index 0000000..fad67c0
--- /dev/null
+++ b/t/.gitignore
@@ -0,0 +1 @@
+trash

^ permalink raw reply related	[relevance 5%]

* Re: [PATCH] build: get rid of the notion of a git library
  @ 2013-06-10 22:06  5%                 ` Jeff King
  2013-06-10 22:22  5%                   ` Felipe Contreras
  0 siblings, 1 reply; 200+ results
From: Jeff King @ 2013-06-10 22:06 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: Vincent van Ravesteijn, John Keeping, Ramkumar Ramachandra, git,
	Junio C Hamano, Jonathan Nieder, Duy Nguyen

On Mon, Jun 10, 2013 at 04:52:57PM -0500, Felipe Contreras wrote:

> On Mon, Jun 10, 2013 at 4:45 PM, Jeff King <peff@peff.net> wrote:
> 
> > That is what libgit.a _is_ now.  I do not mean to imply any additional
> > judgement on what it could be. But if the goal is to make libgit.a
> > "functions that programs outside git.git would want, and nothing else",
> > we may want to additionally split out a "libgit-internal.a" consisting
> > of code that is used by multiple externals in git, but which would not
> > be appropriate for clients to use.
> 
> That might make sense, but that still doesn't clarify what belongs in
> ./*.o, and what belongs in ./builtin/*.o. And right now that creates a
> mess where you have code shared between ./builtin/*.o that is defined
> in cache.h (overlay_tree_on_cache), and some in builtin.h
> (init_copy_notes_for_rewrite). And it's not clear what should be done
> when code in ./*.o needs to access functionality in ./builtin/*.o,
> specially if that code is only useful for git builtins, and nothing
> else.

My general impression of the goal of our current code organization is:

  1. builtin/*.c should each contain a single builtin command and its
     supporting static functions. Each file gets linked into git.o to
     make the "main" git executable.

  2. ./*.c is one of:

       a. Shared code usable by externals and builtins, which gets
          linked into libgit.a

       b. An external command itself, with its own main(). It gets
          linked against libgit.a.

  3. Functions in libgit.a should be defined in a header file specific
     to their module (e.g., refs.h). cache.h picks up the slack for
     things that are general, or too small to get their own header file,
     or otherwise don't group well.

I said it was a "goal", because I know that we do not follow that in
many places, so it is certainly easy to find counter-examples (and nor
do I think it cannot be changed; I am just trying to describe the
current rationale). Under that organization, there is no place for "code
that does not go into libgit.a, but is not a builtin command in itself".
There was never a need in the past, because libgit.a was a bit of a
dumping ground for linkable functions, and nobody cared that it had
everything and the kitchen sink.

If we want to start caring, then we probably need to create a separate
"kitchen sink"-like library, with the rule that things in libgit.a
cannot depend on it. In other words, a support library for Git's
commands, for the parts that are not appropriate to expose as part of a
library API.

-Peff

^ permalink raw reply	[relevance 5%]

* Re: using xdl_merge(), was Re: Resolving conflicts
  @ 2006-12-05 19:50  5%                 ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2006-12-05 19:50 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Linus Torvalds, Ramsay Jones, git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> On Tue, 5 Dec 2006, Linus Torvalds wrote:
>
>>  - take every single merge in git (or the kernel, if you want even more)

The attached is the script I am using.  The test checks the
output from 'master' (merge from RCS) and 'next' (with xdl-merge)
and also tries to see how different the conflicts look like.

In the git.git archive, there is no "clean" merge on which
'master' and 'next' did not agree.  It is not a proof of
correctness at all but it gives a sense of assurance.

However, the conflict 'next' leaves seems a bit suspicious.
Trying to reproduce

	56f9686c4d1e1d586b731b815bd98d70f84ecda4

gives an interesting illustration.

Here is one conflicted hunk from that merge (RCS merge)

-- 8< -- RCS merge conflict hunk, diff from the 1st parent -- 8< --
 
--- a/Makefile
+++ b/Makefile
@@ -232,8 +232,13 @@ LIB_FILE=libgit.a
 XDIFF_LIB=xdiff/lib.a
 
 LIB_H = \
+<<<<<<< HEAD/Makefile
 	archive.h blob.h cache.h commit.h csum-file.h delta.h \
 	diff.h object.h pack.h pkt-line.h quote.h refs.h \
+=======
+	blob.h cache.h commit.h csum-file.h delta.h \
+	diff.h object.h pack.h pkt-line.h quote.h refs.h sideband.h \
+>>>>>>> d47f3db75c58139cdcbca5cc63b17bf5db293b6a/Makefile
 	run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
 	tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h
 
-- >8 -- RCS merge conflict hunk, diff from the 1st parent -- >8 --

-- 8< -- JS merge conflict hunk, diff from the 1st parent -- 8< --

--- a/Makefile
+++ b/Makefile
@@ -232,8 +232,14 @@ LIB_FILE=libgit.a
 XDIFF_LIB=xdiff/lib.a
 
 LIB_H = \
+<<<<<<< HEAD/Makefile
 	archive.h blob.h cache.h commit.h csum-file.h delta.h \
 	diff.h object.h pack.h pkt-line.h quote.h refs.h \
+=======
+	blob.h cache.h commit.h csum-file.h delta.h \
+	diff.h object.h pack.h pkt-line.h quote.h refs.h sideband.h \
+>>>>>>> d47f3db75c58139cdcbca5cc63b17bf5db293b6a/Makefile
+	diff.h object.h pack.h pkt-line.h quote.h refs.h sideband.h \
 	run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
 	tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h
 
-- >8 -- JS merge conflict hunk, diff from the 1st parent -- >8 --

Notice that there is one duplicated line after the closing
conflict marker?


-- 8< -- remerge.sh test script -- 8< --
#!/bin/sh
# Leaves things to be examined in /var/tmp/remerge-$$/

ogit=$HOME/git-master/bin/git
ngit=$HOME/git-next/bin/git
tmp=/var/tmp/remerge-$$-tmp

trap 'rm -f $tmp-*' 0

# Revlist
if ! test -f ./+RL
then
	git rev-list --parents HEAD |
	perl -n -e 'if (/^[0-9a-f]{40} [0-9a-f]{40} [0-9a-f]{40}$/) {
		print;
	}' >./+RL
fi

try_one () {
	# should be on a discardable branch.

	git=$1 parent1=$2 parent2=$3
	$git reset --hard "$parent1"
	
	if $git merge "$parent2"
	then
		echo clean merge
		$git diff-tree -r --raw "$parent1" HEAD 
	else
		echo conflicted merge
		$git ls-files -u
		$git diff --binary -p "$parent1"
	fi
}

# Make sure we do not trash anything important
current=`git symbolic-ref HEAD`
if test "z$current" != zrefs/heads/remerge-test
then
	git checkout -b remerge-test ||
        git checkout remerge-test

        current=`git symbolic-ref HEAD`
        test "z$current" = zrefs/heads/remerge-test || exit
fi

while read result parent1 parent2
do
	try_one $ogit $parent1 $parent2 >$tmp-1 2>/dev/null
	try_one $ngit $parent1 $parent2 >$tmp-2 2>/dev/null
	if diff $tmp-1 $tmp-2
	then
		echo "Ok"
	else
		echo "Bad $result"
		mkdir -p $tmp/$result
		mv $tmp-1 $tmp/$result/ogit
		mv $tmp-2 $tmp/$result/ngit
	fi
	$git reset --hard
done < ./+RL


^ permalink raw reply	[relevance 5%]

* [PATCH] Move try_merge_command and checkout_fast_forward to libgit.a
@ 2012-10-23  2:24  5% Nguyễn Thái Ngọc Duy
    0 siblings, 1 reply; 200+ results
From: Nguyễn Thái Ngọc Duy @ 2012-10-23  2:24 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

These functions are called in sequencer.c, which is part of
libgit.a. This makes libgit.a potentially require builtin/merge.c for
external git commands.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 I made some unrelated changes in sequencer.c and this problem shown
 up. merge-recursive.c is probably not the best place for these
 functions. I just don't want to create merge.c for them.

 builtin/merge.c   | 106 +----------------------------------------------------
 cache.h           |   3 --
 merge-recursive.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 merge-recursive.h |   4 ++
 sequencer.c       |   2 +-
 5 files changed, 115 insertions(+), 108 deletions(-)

diff --git a/builtin/merge.c b/builtin/merge.c
index 0ec8f0d..a96e8ea 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -628,59 +628,6 @@ static void write_tree_trivial(unsigned char *sha1)
 		die(_("git write-tree failed to write a tree"));
 }
 
-static const char *merge_argument(struct commit *commit)
-{
-	if (commit)
-		return sha1_to_hex(commit->object.sha1);
-	else
-		return EMPTY_TREE_SHA1_HEX;
-}
-
-int try_merge_command(const char *strategy, size_t xopts_nr,
-		      const char **xopts, struct commit_list *common,
-		      const char *head_arg, struct commit_list *remotes)
-{
-	const char **args;
-	int i = 0, x = 0, ret;
-	struct commit_list *j;
-	struct strbuf buf = STRBUF_INIT;
-
-	args = xmalloc((4 + xopts_nr + commit_list_count(common) +
-			commit_list_count(remotes)) * sizeof(char *));
-	strbuf_addf(&buf, "merge-%s", strategy);
-	args[i++] = buf.buf;
-	for (x = 0; x < xopts_nr; x++) {
-		char *s = xmalloc(strlen(xopts[x])+2+1);
-		strcpy(s, "--");
-		strcpy(s+2, xopts[x]);
-		args[i++] = s;
-	}
-	for (j = common; j; j = j->next)
-		args[i++] = xstrdup(merge_argument(j->item));
-	args[i++] = "--";
-	args[i++] = head_arg;
-	for (j = remotes; j; j = j->next)
-		args[i++] = xstrdup(merge_argument(j->item));
-	args[i] = NULL;
-	ret = run_command_v_opt(args, RUN_GIT_CMD);
-	strbuf_release(&buf);
-	i = 1;
-	for (x = 0; x < xopts_nr; x++)
-		free((void *)args[i++]);
-	for (j = common; j; j = j->next)
-		free((void *)args[i++]);
-	i += 2;
-	for (j = remotes; j; j = j->next)
-		free((void *)args[i++]);
-	free(args);
-	discard_cache();
-	if (read_cache() < 0)
-		die(_("failed to read the cache"));
-	resolve_undo_clear();
-
-	return ret;
-}
-
 static int try_merge_strategy(const char *strategy, struct commit_list *common,
 			      struct commit_list *remoteheads,
 			      struct commit *head, const char *head_arg)
@@ -762,56 +709,6 @@ static int count_unmerged_entries(void)
 	return ret;
 }
 
-int checkout_fast_forward(const unsigned char *head, const unsigned char *remote)
-{
-	struct tree *trees[MAX_UNPACK_TREES];
-	struct unpack_trees_options opts;
-	struct tree_desc t[MAX_UNPACK_TREES];
-	int i, fd, nr_trees = 0;
-	struct dir_struct dir;
-	struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
-
-	refresh_cache(REFRESH_QUIET);
-
-	fd = hold_locked_index(lock_file, 1);
-
-	memset(&trees, 0, sizeof(trees));
-	memset(&opts, 0, sizeof(opts));
-	memset(&t, 0, sizeof(t));
-	if (overwrite_ignore) {
-		memset(&dir, 0, sizeof(dir));
-		dir.flags |= DIR_SHOW_IGNORED;
-		setup_standard_excludes(&dir);
-		opts.dir = &dir;
-	}
-
-	opts.head_idx = 1;
-	opts.src_index = &the_index;
-	opts.dst_index = &the_index;
-	opts.update = 1;
-	opts.verbose_update = 1;
-	opts.merge = 1;
-	opts.fn = twoway_merge;
-	setup_unpack_trees_porcelain(&opts, "merge");
-
-	trees[nr_trees] = parse_tree_indirect(head);
-	if (!trees[nr_trees++])
-		return -1;
-	trees[nr_trees] = parse_tree_indirect(remote);
-	if (!trees[nr_trees++])
-		return -1;
-	for (i = 0; i < nr_trees; i++) {
-		parse_tree(trees[i]);
-		init_tree_desc(t+i, trees[i]->buffer, trees[i]->size);
-	}
-	if (unpack_trees(nr_trees, t, &opts))
-		return -1;
-	if (write_cache(fd, active_cache, active_nr) ||
-		commit_locked_index(lock_file))
-		die(_("unable to write new index file"));
-	return 0;
-}
-
 static void split_merge_strategies(const char *string, struct strategy **list,
 				   int *nr, int *alloc)
 {
@@ -1424,7 +1321,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		}
 
 		if (checkout_fast_forward(head_commit->object.sha1,
-					  commit->object.sha1)) {
+					  commit->object.sha1,
+					  overwrite_ignore)) {
 			ret = 1;
 			goto done;
 		}
diff --git a/cache.h b/cache.h
index a58df84..415c777 100644
--- a/cache.h
+++ b/cache.h
@@ -1265,9 +1265,6 @@ struct startup_info {
 };
 extern struct startup_info *startup_info;
 
-/* builtin/merge.c */
-int checkout_fast_forward(const unsigned char *from, const unsigned char *to);
-
 int sane_execvp(const char *file, char *const argv[]);
 
 #endif /* CACHE_H */
diff --git a/merge-recursive.c b/merge-recursive.c
index d882060..4d2422a 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -21,6 +21,9 @@
 #include "merge-recursive.h"
 #include "dir.h"
 #include "submodule.h"
+#include "run-command.h"
+#include "resolve-undo.h"
+#include "unpack-trees.h"
 
 static struct tree *shift_tree_object(struct tree *one, struct tree *two,
 				      const char *subtree_shift)
@@ -2087,3 +2090,108 @@ int parse_merge_opt(struct merge_options *o, const char *s)
 		return -1;
 	return 0;
 }
+
+static const char *merge_argument(struct commit *commit)
+{
+	if (commit)
+		return sha1_to_hex(commit->object.sha1);
+	else
+		return EMPTY_TREE_SHA1_HEX;
+}
+
+int try_merge_command(const char *strategy, size_t xopts_nr,
+		      const char **xopts, struct commit_list *common,
+		      const char *head_arg, struct commit_list *remotes)
+{
+	const char **args;
+	int i = 0, x = 0, ret;
+	struct commit_list *j;
+	struct strbuf buf = STRBUF_INIT;
+
+	args = xmalloc((4 + xopts_nr + commit_list_count(common) +
+			commit_list_count(remotes)) * sizeof(char *));
+	strbuf_addf(&buf, "merge-%s", strategy);
+	args[i++] = buf.buf;
+	for (x = 0; x < xopts_nr; x++) {
+		char *s = xmalloc(strlen(xopts[x])+2+1);
+		strcpy(s, "--");
+		strcpy(s+2, xopts[x]);
+		args[i++] = s;
+	}
+	for (j = common; j; j = j->next)
+		args[i++] = xstrdup(merge_argument(j->item));
+	args[i++] = "--";
+	args[i++] = head_arg;
+	for (j = remotes; j; j = j->next)
+		args[i++] = xstrdup(merge_argument(j->item));
+	args[i] = NULL;
+	ret = run_command_v_opt(args, RUN_GIT_CMD);
+	strbuf_release(&buf);
+	i = 1;
+	for (x = 0; x < xopts_nr; x++)
+		free((void *)args[i++]);
+	for (j = common; j; j = j->next)
+		free((void *)args[i++]);
+	i += 2;
+	for (j = remotes; j; j = j->next)
+		free((void *)args[i++]);
+	free(args);
+	discard_cache();
+	if (read_cache() < 0)
+		die(_("failed to read the cache"));
+	resolve_undo_clear();
+
+	return ret;
+}
+
+int checkout_fast_forward(const unsigned char *head,
+			  const unsigned char *remote,
+			  int overwrite_ignore)
+{
+	struct tree *trees[MAX_UNPACK_TREES];
+	struct unpack_trees_options opts;
+	struct tree_desc t[MAX_UNPACK_TREES];
+	int i, fd, nr_trees = 0;
+	struct dir_struct dir;
+	struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
+
+	refresh_cache(REFRESH_QUIET);
+
+	fd = hold_locked_index(lock_file, 1);
+
+	memset(&trees, 0, sizeof(trees));
+	memset(&opts, 0, sizeof(opts));
+	memset(&t, 0, sizeof(t));
+	if (overwrite_ignore) {
+		memset(&dir, 0, sizeof(dir));
+		dir.flags |= DIR_SHOW_IGNORED;
+		setup_standard_excludes(&dir);
+		opts.dir = &dir;
+	}
+
+	opts.head_idx = 1;
+	opts.src_index = &the_index;
+	opts.dst_index = &the_index;
+	opts.update = 1;
+	opts.verbose_update = 1;
+	opts.merge = 1;
+	opts.fn = twoway_merge;
+	setup_unpack_trees_porcelain(&opts, "merge");
+
+	trees[nr_trees] = parse_tree_indirect(head);
+	if (!trees[nr_trees++])
+		return -1;
+	trees[nr_trees] = parse_tree_indirect(remote);
+	if (!trees[nr_trees++])
+		return -1;
+	for (i = 0; i < nr_trees; i++) {
+		parse_tree(trees[i]);
+		init_tree_desc(t+i, trees[i]->buffer, trees[i]->size);
+	}
+	if (unpack_trees(nr_trees, t, &opts))
+		return -1;
+	if (write_cache(fd, active_cache, active_nr) ||
+		commit_locked_index(lock_file))
+		die(_("unable to write new index file"));
+	return 0;
+}
diff --git a/merge-recursive.h b/merge-recursive.h
index 58f3435..e01a9c0 100644
--- a/merge-recursive.h
+++ b/merge-recursive.h
@@ -64,4 +64,8 @@ int try_merge_command(const char *strategy, size_t xopts_nr,
 		const char **xopts, struct commit_list *common,
 		const char *head_arg, struct commit_list *remotes);
 
+int checkout_fast_forward(const unsigned char *from,
+			  const unsigned char *to,
+			  int overwrite_ignore);
+
 #endif
diff --git a/sequencer.c b/sequencer.c
index e3723d2..be0cb8b 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -191,7 +191,7 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from)
 	struct ref_lock *ref_lock;
 
 	read_cache();
-	if (checkout_fast_forward(from, to))
+	if (checkout_fast_forward(from, to, 1))
 		exit(1); /* the callee should have complained already */
 	ref_lock = lock_any_ref_for_update("HEAD", from, 0);
 	return write_ref_sha1(ref_lock, to, "cherry-pick");
-- 
1.8.0.rc3.18.g0d9b108

^ permalink raw reply related	[relevance 5%]

* Re: [PATCH 2/2] Move sequencer to builtin
  @ 2013-06-09  9:58  5%                         ` Ramkumar Ramachandra
  0 siblings, 0 replies; 200+ results
From: Ramkumar Ramachandra @ 2013-06-09  9:58 UTC (permalink / raw)
  To: Jeff King
  Cc: Felipe Contreras, Duy Nguyen, Git Mailing List, Junio C Hamano,
	Brandon Casey, Jonathan Nieder

Jeff King wrote:
> Sorry that I cannot show you the source code, but you may interested to
> know that libgit2 powers:

Yes, I'm well aware of these: libgit2 is LGPL, because of which these
three proprietary applications have been made possible.  Isn't it
completely orthogonal to the discussion about how best to lib'ify
git.git though?  From what I understand, fc is not interested in
building another application leveraging libgit.a or libgit2; he's
interested in improving libgit.a and getting more users.

> It is definitely not feature-complete when compared with git.git. But I
> do think it is in a state that is usable for quite a few tasks.

What is this task you are discussing?  fc is talking about improving
libgit.a and getting an official git library with many users.  Answer
the question: what should we do now?

1. Start moving irrelevant code out of libgit.a, and use inspiration
from libgit2 to improve it (this might or might not involve taking
code from libgit2).  Get _users_ of libgit.a via ruby bindings (or
something) asap, so it puts pressure on fixing it.

2. Wait indefinitely until libgit2.git magically becomes ready to be
usable by git.git as-is.  Then throw libgit.a out the window, and
rewrite git.git to call into libgit2.a instead [*1*].

What you seem to be saying is "3. Work on libgit2 (and abandon
git.git?)" [*2*], or worse: 2.  fc is in favor of 1.  Unless you are
in favor of _not_ improving libgit.a, don't stand in his way: you
might personally think that it is a difficult (or impossible) task,
but that's no reason to stop fc from trying.  I personally think his
goal is admirable, and I'm nobody to say that it cannot be done:
therefore, I will review his patches and help him in whatever little
way I can.

[Footnote]

*1* You have dismissed 1 as being unworkable, but do you realize how
unrealistic this sounds?

*2* git.git has _far_ more users and a _lot_ more contributors.  Don't
be unwelcoming to contributors by asking them to go away and work on
something else.  The three proprietary applications you have given as
counter-examples (?) is not helping anyone.

^ permalink raw reply	[relevance 5%]

* Re: [PATCH 1/1] do not add common-main to lib
  @ 2016-08-15 12:20  5% ` Johannes Schindelin
  2016-08-15 12:02  5% ` Jeff King
  1 sibling, 0 replies; 200+ results
From: Johannes Schindelin @ 2016-08-15 12:20 UTC (permalink / raw)
  To: Christian Hesse; +Cc: git, Christian Hesse

Hi Christian,

On Mon, 15 Aug 2016, Christian Hesse wrote:

> From: Christian Hesse <mail@eworm.de>
> 
> Commit 08aade70 (mingw: declare main()'s argv as const) changed
> declaration of main function. This breaks linking external projects
> (e.g. cgit) to libgit.a with:
> 
> error: Multiple definition of `main'
> 
> So do not add common-main to lib and let projects have their own
> main function.

I am opposed to this change.

For one, libgit.a is *not* a library with an API, for a good reason:
nothing in Git's development guarantees any kind of stable API. For that
reason, libgit.a is not installed, either, and neither are any headers.

And even more importantly: *iff* you *insist* on using libgit.a in your
project *despite* having been told not to, it is your responsibility to
stay up-to-date with the requirements of it.

One such requirement is that you now implement cmd_main() instead of
main().

So if you want to continue to have an out-of-tree project that links
against the (private) libgit.a, it is your out-of-tree project that needs
changing, not libgit.a.

Ciao,
Johannes

^ permalink raw reply	[relevance 5%]

* Re: PPC SHA-1 Updates in "pu"
  @ 2006-06-24 23:59  5%             ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2006-06-24 23:59 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git, Petr Baudis

Linus Torvalds <torvalds@osdl.org> writes:

> Don't everybody see them?

No.  But I see it now.

> how does that compile for anybody else, when -DSHA1_HEADER isn't set 
> correctly? The quotes have gone missing:
>
> 	-DSHA1_HEADER='ppc/sha1.h' 
>
> don't ask me why.

That is, as usual, caused by careless shell quoting.

        : gitster; PPC_SHA1=YesPlease Meta/Make perl/Makefile
        GIT_VERSION = 1.4.1.rc1.g9adbe
        (cd perl && /usr/bin/perl Makefile.PL \
                        PREFIX="/home/junio/git-test" \
                        DEFINE="-O2 -Wall -Wdeclaration-after-statement
                        -g -fPIC -DSHA1_HEADER='"ppc/sha1.h"'
                        -DGIT_VERSION=\\\"1.4.1.rc1.g9adbe\\\"" \
                        LIBS="libgit.a xdiff/lib.a -lz")
        Unrecognized argument in LIBS ignored: 'libgit.a'
        Unrecognized argument in LIBS ignored: 'xdiff/lib.a'
        Writing Makefile for Git

All options but to use OpenSSL SHA-1 implementation share the
same problem (Meta/Make is a thin "make" wrapper to give USE_PIC
and other C compilation flags):

        : gitster; ARM_SHA1=YesPlease Meta/Make perl/Makefile
        (cd perl && /usr/bin/perl Makefile.PL \
                        PREFIX="/home/junio/git-test" \
                        DEFINE="-O2 -Wall -Wdeclaration-after-statement
                        -g -fPIC -DSHA1_HEADER='"arm/sha1.h"'
                        -DGIT_VERSION=\\\"1.4.1.rc1.g9adbe\\\"" \
                        LIBS="libgit.a xdiff/lib.a -lz")
        Unrecognized argument in LIBS ignored: 'libgit.a'
        Unrecognized argument in LIBS ignored: 'xdiff/lib.a'
        Writing Makefile for Git

        : gitster; MOZILLA_SHA1=YesPlease Meta/Make perl/Makefile
        (cd perl && /usr/bin/perl Makefile.PL \
                        PREFIX="/home/junio/git-test" \
                        DEFINE="-O2 -Wall -Wdeclaration-after-statement
                        -g -fPIC -DSHA1_HEADER='"mozilla-sha1/sha1.h"'
                        -DGIT_VERSION=\\\"1.4.1.rc1.g9adbe\\\"" \
                        LIBS="libgit.a xdiff/lib.a -lz")
        Unrecognized argument in LIBS ignored: 'libgit.a'
        Unrecognized argument in LIBS ignored: 'xdiff/lib.a'
        Writing Makefile for Git

^ permalink raw reply	[relevance 5%]

* Re: using git directory cache code in darcs?
  @ 2005-04-18  4:36  5%           ` Paul Jackson
  0 siblings, 0 replies; 200+ results
From: Paul Jackson @ 2005-04-18  4:36 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: droundy, git, darcs-devel

> Not until all the data structures are really really stable.

Fine by me to wait, though perhaps not for the same reason, and perhaps
not as long.

A libgit.so can deal with data structure changes just as well as a set
of command line utilities.  So long as everything funnels through one
place, you can change by changing that one place.

However I am  willing to agree that its not libgit time yet, for two
reasons:

 1) everyone who has two clues on the subject is too busy and
    too productive on more pressing git issues, and

 2) in addition to internal data structures being not yet stable,
    I suspect that the operations (git commands, options and
    behaviour) are also not stable.

The first step of a good libgit is not coding to the internal data
structures, but rather designing the interface (the operations,
arguments, data types, and behaviour).

So, until people have time, and the interface ops are settled down, its
too early to design libgit.  Or at least too early to publish a design
and seek concensus.  If I had the time the first thing I'd be doing
right now would be designing libgit on the side, anticipating the day
when it was time to publish a draft and engage the community discussion
that leads to an adequate concensus.

===

By the way, a good libgit design, in my view, would isolate the data
structures written to files below .git from the data structures
presented at the library API, to some extent.  Changes in the file
structures must be handled without disrupting the library API.

If a libgit API didn't isolate the library caller from details of the
structures in files below .git, then yes you'd want really really stable
data structures, impossibly stable in fact.  That way leads to hacks and
workarounds in the future, because the data structures are never
perfectly stable.

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@engr.sgi.com> 1.650.933.1373, 1.925.600.0401

^ permalink raw reply	[relevance 5%]

* How to compile without iconv?
@ 2015-06-09 14:07  5% Sascha Ziemann
  0 siblings, 0 replies; 200+ results
From: Sascha Ziemann @ 2015-06-09 14:07 UTC (permalink / raw)
  To: git

I tried to compile git 2.4.3 on Solaris 10. I used the following configuration:

$ ./configure --without-iconv

$ grep -i iconv config.status
ac_cs_config="'--without-iconv'"
  set X /bin/bash './configure'  '--without-iconv'
$ac_configure_extra_args --no-create --no-recursion
OLD_ICONV=UnfortunatelyYes

But when I try to compile it, I get an error that libiconv is missing:

    LINK git-credential-store
Undefined                       first referenced
 symbol                             in file
libintl_gettext                     libgit.a(lockfile.o)
libiconv_close                      libgit.a(utf8.o)
libiconv_open                       libgit.a(utf8.o)
libintl_ngettext                    libgit.a(date.o)
libiconv                            libgit.a(utf8.o)
ld: fatal: symbol referencing errors. No output written to git-credential-store
collect2: ld returned 1 exit status
gmake: *** [git-credential-store] Error 1

How can I work around this?

^ permalink raw reply	[relevance 5%]

* Re: [PATCH v4 06/45] Move sequencer to builtin
  @ 2013-06-09 17:06  5%     ` Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2013-06-09 17:06 UTC (permalink / raw)
  To: Antoine Pelisse
  Cc: git, Junio C Hamano, Ramkumar Ramachandra, Jonathan Nieder,
	Martin von Zweigbergk

On Sun, Jun 9, 2013 at 12:02 PM, Antoine Pelisse <apelisse@gmail.com> wrote:
> On Sun, Jun 9, 2013 at 6:40 PM, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
>>
>> This code is only useful for cherry-pick and revert built-ins, nothing
>> else, so let's make it a builtin object.
>>
>> The first source file that doesn't generate a git-foo builtin, but does
>> go into the builtin library. Hopefully the first of many to clean
>> libgit.a.
>
> Hey Felipe,
> I don't understand why the code doesn't belong to libgit.a, and how
> it's gonna make it more "clean". I can see that it is needed only by
> revert and cherry-pick, but is that the only reason ?
>
> Thanks for taking the time to enlighten me :)

A libgit library should be useful for things other than builtin
commands. Eventually libgit.a should be similar to libgit2, therefore
if libgit2 wouldn't want sequencer.c in it (it doesn't) neither should
we want this code in libgit.a. It belongs in builtin/lib.a.

If we don't start moving non-library stuff out of libgit.a, libgit.a
will never be a library.

-- 
Felipe Contreras

^ permalink raw reply	[relevance 5%]

* Re: Libification project (SoC)
  2007-03-16 23:24  5%                       ` Johannes Schindelin
@ 2007-03-17  7:04  5%                         ` Marco Costalba
  0 siblings, 0 replies; 200+ results
From: Marco Costalba @ 2007-03-17  7:04 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Nicolas Pitre, Rocco Rutte, git

On 3/17/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> We are talking about libgit. Which should make access to certain common
> functions on Git repositories easy. Nothing more than that.
>

Fair enough.

> If you need to do that asynchronously, do _not_ fiddle with libgit. Just
> imagine what this would involve: you'd have to have timeouts (since there
> is _NO_ other way to find out when to return with empty hands, instead of
> blocking), which is _not_ portable. You'd soon be in the same _mess_ we
> are talking about with respect to exceptions.
>
> Also, you would make _all_ operations expensive, since they _would_ have
> to store state to be restartable.
>
> The common solution for your problem _is_ to use threads.
>

I would say, the common solution to have non blocking libgit is to use
threads in the tool linked with libgit.

This is clearly a  design choice and I agree it's an important
statement to keep libgit simple and portable (otherwise you'd probably
need to use a thread library as pthread in libgit). Thread facility in
Qt is instead already portable and well integrated. Anyway it's a
design choice perhaps worth documenting.

> And you have to admit that _only_ viewers would need asynchronous access
> anyway. I doubt that other tools -- which could take their advantage of a
> libgit -- would need such an access.
>

Yes, and you have to admit ;-)  that viewers are the tools that mostly
will use libgit.

    Marco

^ permalink raw reply	[relevance 5%]

* [PATCH/RFC v3 02/16] Integrate remote-svn into svn-fe/Makefile.
  @ 2012-08-14 19:13  6%   ` Florian Achleitner
  0 siblings, 0 replies; 200+ results
From: Florian Achleitner @ 2012-08-14 19:13 UTC (permalink / raw)
  To: git, David Michael Barr, Jonathan Nieder; +Cc: florian.achleitner.2.6.31

Requires some sha.h to be used and the libraries
to be linked, this is currently hardcoded.

Signed-off-by: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
---
 contrib/svn-fe/Makefile |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
index 360d8da..8f0eec2 100644
--- a/contrib/svn-fe/Makefile
+++ b/contrib/svn-fe/Makefile
@@ -1,14 +1,14 @@
-all:: svn-fe$X
+all:: svn-fe$X remote-svn$X
 
 CC = gcc
 RM = rm -f
 MV = mv
 
-CFLAGS = -g -O2 -Wall
+CFLAGS = -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>' -Wdeclaration-after-statement
 LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-EXTLIBS =
+EXTLIBS = -lssl -lcrypto -lpthread ../../xdiff/lib.a
 
 GIT_LIB = ../../libgit.a
 VCSSVN_LIB = ../../vcs-svn/lib.a
@@ -37,8 +37,12 @@ svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(GIT_LIB)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ svn-fe.o \
 		$(ALL_LDFLAGS) $(LIBS)
 
-svn-fe.o: svn-fe.c ../../vcs-svn/svndump.h
-	$(QUIET_CC)$(CC) -I../../vcs-svn -o $*.o -c $(ALL_CFLAGS) $<
+remote-svn$X: remote-svn.o $(VCSSVN_LIB) $(GIT_LIB)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ remote-svn.o \
+		$(ALL_LDFLAGS) $(LIBS)
+		
+%.o: %.c ../../vcs-svn/svndump.h
+	$(QUIET_CC)$(CC) -I../../vcs-svn -I../../ -o $*.o -c $(ALL_CFLAGS) $<
 
 svn-fe.html: svn-fe.txt
 	$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
@@ -58,6 +62,6 @@ svn-fe.1: svn-fe.txt
 	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
 
 clean:
-	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
+	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1 remote-svn.o
 
 .PHONY: all clean FORCE
-- 
1.7.9.5

^ permalink raw reply related	[relevance 6%]

* [RFC v2 02/16] Integrate remote-svn into svn-fe/Makefile.
  @ 2012-07-30 14:31  6%     ` Florian Achleitner
  0 siblings, 0 replies; 200+ results
From: Florian Achleitner @ 2012-07-30 14:31 UTC (permalink / raw)
  To: Jonathan Nieder, David Michael Barr, git; +Cc: florian.achleitner.2.6.31

Requires some sha.h to be used and the libraries
to be linked, this is currently hardcoded.

Signed-off-by: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
---
 contrib/svn-fe/Makefile |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
index 360d8da..8f0eec2 100644
--- a/contrib/svn-fe/Makefile
+++ b/contrib/svn-fe/Makefile
@@ -1,14 +1,14 @@
-all:: svn-fe$X
+all:: svn-fe$X remote-svn$X
 
 CC = gcc
 RM = rm -f
 MV = mv
 
-CFLAGS = -g -O2 -Wall
+CFLAGS = -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>' -Wdeclaration-after-statement
 LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-EXTLIBS =
+EXTLIBS = -lssl -lcrypto -lpthread ../../xdiff/lib.a
 
 GIT_LIB = ../../libgit.a
 VCSSVN_LIB = ../../vcs-svn/lib.a
@@ -37,8 +37,12 @@ svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(GIT_LIB)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ svn-fe.o \
 		$(ALL_LDFLAGS) $(LIBS)
 
-svn-fe.o: svn-fe.c ../../vcs-svn/svndump.h
-	$(QUIET_CC)$(CC) -I../../vcs-svn -o $*.o -c $(ALL_CFLAGS) $<
+remote-svn$X: remote-svn.o $(VCSSVN_LIB) $(GIT_LIB)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ remote-svn.o \
+		$(ALL_LDFLAGS) $(LIBS)
+		
+%.o: %.c ../../vcs-svn/svndump.h
+	$(QUIET_CC)$(CC) -I../../vcs-svn -I../../ -o $*.o -c $(ALL_CFLAGS) $<
 
 svn-fe.html: svn-fe.txt
 	$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
@@ -58,6 +62,6 @@ svn-fe.1: svn-fe.txt
 	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
 
 clean:
-	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
+	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1 remote-svn.o
 
 .PHONY: all clean FORCE
-- 
1.7.9.5

^ permalink raw reply related	[relevance 6%]

* [RFC 02/16] Integrate remote-svn into svn-fe/Makefile.
  @ 2012-07-26  7:32  6%   ` Florian Achleitner
  0 siblings, 0 replies; 200+ results
From: Florian Achleitner @ 2012-07-26  7:32 UTC (permalink / raw)
  To: Jonathan Nieder, David Michael Barr, git; +Cc: florian.achleitner.2.6.31

Requires some sha.h to be used and the libraries
to be linked, this is currently hardcoded.

Signed-off-by: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
---
 contrib/svn-fe/Makefile |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
index 360d8da..8f0eec2 100644
--- a/contrib/svn-fe/Makefile
+++ b/contrib/svn-fe/Makefile
@@ -1,14 +1,14 @@
-all:: svn-fe$X
+all:: svn-fe$X remote-svn$X
 
 CC = gcc
 RM = rm -f
 MV = mv
 
-CFLAGS = -g -O2 -Wall
+CFLAGS = -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>' -Wdeclaration-after-statement
 LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-EXTLIBS =
+EXTLIBS = -lssl -lcrypto -lpthread ../../xdiff/lib.a
 
 GIT_LIB = ../../libgit.a
 VCSSVN_LIB = ../../vcs-svn/lib.a
@@ -37,8 +37,12 @@ svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(GIT_LIB)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ svn-fe.o \
 		$(ALL_LDFLAGS) $(LIBS)
 
-svn-fe.o: svn-fe.c ../../vcs-svn/svndump.h
-	$(QUIET_CC)$(CC) -I../../vcs-svn -o $*.o -c $(ALL_CFLAGS) $<
+remote-svn$X: remote-svn.o $(VCSSVN_LIB) $(GIT_LIB)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ remote-svn.o \
+		$(ALL_LDFLAGS) $(LIBS)
+		
+%.o: %.c ../../vcs-svn/svndump.h
+	$(QUIET_CC)$(CC) -I../../vcs-svn -I../../ -o $*.o -c $(ALL_CFLAGS) $<
 
 svn-fe.html: svn-fe.txt
 	$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
@@ -58,6 +62,6 @@ svn-fe.1: svn-fe.txt
 	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
 
 clean:
-	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
+	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1 remote-svn.o
 
 .PHONY: all clean FORCE
-- 
1.7.9.5

^ permalink raw reply related	[relevance 6%]

* Re: [RFC/PATCH 0/3] Thinning the git toplevel directory
  @ 2011-02-18 12:33  6%           ` Jonathan Nieder
  0 siblings, 0 replies; 200+ results
From: Jonathan Nieder @ 2011-02-18 12:33 UTC (permalink / raw)
  To: Jeff King; +Cc: Nguyen Thai Ngoc Duy, git, Junio C Hamano, Nicolas Pitre

Jeff King wrote:
> On Fri, Feb 18, 2011 at 03:25:18AM -0600, Jonathan Nieder wrote:

>>  - moved the http support mini-library to http/.
>
> Seems like a weird one-off to me, as it only has two files.

That was just to get the files out of the toplevel.  I suspect the
reason they are not part of libgit is to isolate the expat and curl
linkage.

Hmm, maybe an http/README explaining that would be nice.

> So I
> think python/git_remote_helpers would probably be a more appropriate
> name in case we ever grow more python code.

Good idea.  So the layout would be:

 python/
	Makefile
	git_remote_helpers/
		...

>        - There are a still a lot of directories. I wonder if we should
>          be going deeper. Like commands/builtin. Or lib/*.

For reference:

 Documentation/
 block-sha1/	fast, portable sha1 routine
 builtin/   	built-in (busybox style) commands
 commands/  	stand-alone commands
 compat/    	compatibility replacements, platform-specific code
 contrib/   	contributed software
 gitk-git/  	gitk
 gitweb/    	web interface
 git-gui/   	gui
 http/      	code for use in HTTP support commands (wraps curl and expat)
 libgit/    	code for use in multiple commands
 perl/      	Git.pm
 ppc/       	fast sha1 routine in powerpc assembler
 python/    	python-fastimport + a remote-helper protocol helper
 scripts/   	build scripts
 t/         	tests
 templates/ 	repository skeleton
 test-programs/	sample programs to exercise libgit, vcs-svn, and the sha1 lib
 xdiff/     	diff generator
 vcs-svn/   	svn interop

To give an extreme example :), this could be pruned to

 Documentation/
 commands/
 contrib/
 libgit/
 scripts/
 templates/
 testsuite/
 xdiff/

by

 - not distinguishing builtins from non-builtins by filename
 - dropping gitk, git gui, and gitweb from the tree
 - moving test programs into the testsuite
 - moving sha1 implementations and compatibility code under libgit
 - including http support files in libgit/ even though they are not
   part of libgit.a
 - moving perl and python libraries under libgit
 
>        - Some names seem funny. Like "gitk-git", which really should
>          just be "gitk".

I think it was originally to make the transition from file to
directory smoother.

>                          But I think that is a limitation of the subtree
>          merge.

Should work fine, no?  Since / in common ancestor matches gitk/ in
HEAD, that would be the detected shift.  (Caveat: I haven't tried it.)

>        - Before build, "ls | wc -l" reports 35 entries. Afterwards, it
>          reports 213, and any structure you uncovered in reorganization
>          is lost.

I think the best way to fix this is to provide support[1] for

 make O=build/

for those who want to maintain a clean source tree.

Thanks for some good ideas.
Jonathan

[1] There's a skeleton of such support here:
http://thread.gmane.org/gmane.comp.version-control.git/165720/focus=165850
I don't think I'm the right one to take it further, though, since I
don't really like to use "make O=elsewhere".

^ permalink raw reply	[relevance 6%]

* [RFC PATCH 7/8] git-std-lib: introduce git standard library
  @ 2023-06-27 19:52  6% ` Calvin Wan
  0 siblings, 0 replies; 200+ results
From: Calvin Wan @ 2023-06-27 19:52 UTC (permalink / raw)
  To: git; +Cc: Calvin Wan, nasamuffin, chooglen, johnathantanmy

The Git Standard Library intends to serve as the foundational library
and root dependency that other libraries in Git will be built off of.
That is to say, suppose we have libraries X and Y; a user that wants to
use X and Y would need to include X, Y, and this Git Standard Library.

Add Documentation/technical/git-std-lib.txt to further explain the
design and rationale.

Signed-off-by: Calvin Wan <calvinwan@google.com>
---
 Documentation/technical/git-std-lib.txt | 182 ++++++++++++++++++++++++
 Makefile                                |  28 +++-
 git-compat-util.h                       |   7 +-
 symlinks.c                              |   2 +
 usage.c                                 |   8 ++
 5 files changed, 225 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/technical/git-std-lib.txt

diff --git a/Documentation/technical/git-std-lib.txt b/Documentation/technical/git-std-lib.txt
new file mode 100644
index 0000000000..3dce36c9f9
--- /dev/null
+++ b/Documentation/technical/git-std-lib.txt
@@ -0,0 +1,182 @@
+Git Standard Library
+================
+
+The Git Standard Library intends to serve as the foundational library
+and root dependency that other libraries in Git will be built off of.
+That is to say, suppose we have libraries X and Y; a user that wants to
+use X and Y would need to include X, Y, and this Git Standard Library.
+This does not mean that the Git Standard Library will be the only
+possible root dependency in the future, but rather the most significant
+and widely used one.
+
+Dependency graph in libified Git
+================
+
+If you look in the Git Makefile, all of the objects defined in the Git
+library are compiled and archived into a singular file, libgit.a, which
+is linked against by common-main.o with other external dependencies and
+turned into the Git executable. In other words, the Git executable has
+dependencies on libgit.a and a couple of external libraries. The
+libfication of Git will not affect this current build flow, but instead
+will provide an alternate method for building Git.
+
+With our current method of building Git, we can imagine the dependency
+graph as such:
+
+        Git
+         /\
+        /  \
+       /    \
+  libgit.a   ext deps
+
+In libifying parts of Git, we want to shrink the dependency graph to
+only the minimal set of dependencies, so libraries should not use
+libgit.a. Instead, it would look like:
+
+                Git
+                /\
+               /  \
+              /    \
+          libgit.a  ext deps
+             /\
+            /  \
+           /    \
+object-store.a  (other lib)
+      |        /
+      |       /
+      |      /
+ config.a   / 
+      |    /
+      |   /
+      |  /
+git-std-lib.a
+
+Instead of containing all of the objects in Git, libgit.a would contain
+objects that are not built by libraries it links against. Consequently,
+if someone wanted their own custom build of Git with their own custom
+implementation of the object store, they would only have to swap out
+object-store.a rather than do a hard fork of Git.
+
+Rationale behind Git Standard Library
+================
+
+The rationale behind Git Standard Library essentially is the result of
+two observations within the Git codebase: every file includes
+git-compat-util.h which defines functions in a couple of different
+files, and wrapper.c + usage.c have difficult-to-separate circular
+dependencies with each other and other files.
+
+Ubiquity of git-compat-util.h and circular dependencies
+========
+
+Every file in the Git codebase includes git-compat-util.h. It serves as
+"a compatibility aid that isolates the knowledge of platform specific
+inclusion order and what feature macros to define before including which
+system header" (Junio[1]). Since every file includes git-compat-util.h, and
+git-compat-util.h includes wrapper.h and usage.h, it would make sense
+for wrapper.c and usage.c to be a part of the root library. They have
+difficult to separate circular dependencies with each other so they
+can't be independent libraries. Wrapper.c has dependencies on parse.c,
+abspath.c, strbuf.c, which in turn also have dependencies on usage.c and
+wrapper.c -- more circular dependencies. 
+
+Tradeoff between swappability and refactoring
+========
+
+From the above dependency graph, we can see that git-std-lib.a could be
+many smaller libraries rather than a singular library. So why choose a
+singular library when multiple libraries can be individually easier to
+swap and are more modular? A singular library requires less work to
+separate out circular dependencies within itself so it becomes a
+tradeoff question between work and reward. While there may be a point in
+the future where a file like usage.c would want its own library so that
+someone can have custom die() or error(), the work required to refactor
+out the circular dependencies in some files would be enormous due to
+their ubiquity so therefore I believe it is not worth the tradeoff
+currently. Additionally, we can in the future choose to do this refactor
+and change the API for the library if there becomes enough of a reason
+to do so (remember we are avoiding promising stability of the interfaces
+of those libraries).
+
+Reuse of compatibility functions in git-compat-util.h
+========
+
+Most functions defined in git-compat-util.h are implemented in compat/
+and have dependencies limited to strbuf.h and wrapper.h so they can be
+easily included in git-std-lib.a, which as a root dependency means that
+higher level libraries do not have to worry about compatibility files in
+compat/. The rest of the functions defined in git-compat-util.h are
+implemented in top level files and, in this patch set, are hidden behind
+an #ifdef if their implementation is not in git-std-lib.a.
+
+Rationale summary
+========
+
+The Git Standard Library allows us to get the libification ball rolling
+with other libraries in Git. By not spending many
+more months attempting to refactor difficult circular dependencies and
+instead spending that time getting to a state where we can test out
+swapping a library out such as config or object store, we can prove the
+viability of Git libification on a much faster time scale. Additionally
+the code cleanups that have happened so far have been minor and
+beneficial for the codebase. It is probable that making large movements
+would negatively affect code clarity.
+
+Git Standard Library boundary
+================
+
+While I have described above some useful heuristics for identifying
+potential candidates for git-std-lib.a, a standard library should not
+have a shaky definition for what belongs in it.
+
+ - Low-level files (aka operates only on other primitive types) that are
+   used everywhere within the codebase (wrapper.c, usage.c, strbuf.c)
+   - Dependencies that are low-level and widely used
+     (abspath.c, date.c, hex-ll.c, parse.c, utf8.c)
+ - low-level git/* files with functions defined in git-compat-util.h
+   (ctype.c)
+ - compat/*
+
+There are other files that might fit this definition, but that does not
+mean it should belong in git-std-lib.a. Those files should start as
+their own separate library since any file added to git-std-lib.a loses
+its flexibility of being easily swappable.
+
+Files inside of Git Standard Library
+================
+
+The initial set of files in git-std-lib.a are:
+abspath.c
+ctype.c
+date.c
+hex-ll.c
+parse.c
+strbuf.c
+usage.c
+utf8.c
+wrapper.c
+relevant compat/ files
+
+Pitfalls
+================
+
+In patch 7, I use #ifdef GIT_STD_LIB to both stub out code and hide
+certain function headers. As other parts of Git are libified, if we
+have to use more ifdefs for each different library, then the codebase
+will become uglier and harder to understand. 
+
+There are a small amount of files under compat/* that have dependencies
+not inside of git-std-lib.a. While those functions are not called on
+Linux, other OSes might call those problematic functions. I don't see
+this as a major problem, just moreso an observation that libification in
+general may also require some minor compatibility work in the future.
+
+Testing
+================
+
+Unit tests should catch any breakages caused by changes to files in
+git-std-lib.a (i.e. introduction of a out of scope dependency) and new
+functions introduced to git-std-lib.a will require unit tests written
+for them.
+
+[1] https://lore.kernel.org/git/xmqqwn17sydw.fsf@gitster.g/
\ No newline at end of file
diff --git a/Makefile b/Makefile
index e9ad9f9ef1..255bd10b82 100644
--- a/Makefile
+++ b/Makefile
@@ -2162,6 +2162,11 @@ ifdef FSMONITOR_OS_SETTINGS
 	COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
 endif
 
+ifdef GIT_STD_LIB
+	BASIC_CFLAGS += -DGIT_STD_LIB
+	BASIC_CFLAGS += -DNO_GETTEXT
+endif
+
 ifeq ($(TCLTK_PATH),)
 NO_TCLTK = NoThanks
 endif
@@ -3654,7 +3659,7 @@ clean: profile-clean coverage-clean cocciclean
 	$(RM) po/git.pot po/git-core.pot
 	$(RM) git.res
 	$(RM) $(OBJECTS)
-	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
+	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB) $(STD_LIB_FILE)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS)
 	$(RM) $(TEST_PROGRAMS)
 	$(RM) $(FUZZ_PROGRAMS)
@@ -3834,3 +3839,24 @@ $(FUZZ_PROGRAMS): all
 		$(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
 
 fuzz-all: $(FUZZ_PROGRAMS)
+
+### Libified Git rules
+
+# git-std-lib
+# `make git-std-lib GIT_STD_LIB=YesPlease`
+STD_LIB = git-std-lib.a
+
+GIT_STD_LIB_OBJS += abspath.o
+GIT_STD_LIB_OBJS += ctype.o
+GIT_STD_LIB_OBJS += date.o
+GIT_STD_LIB_OBJS += hex-ll.o
+GIT_STD_LIB_OBJS += parse.o
+GIT_STD_LIB_OBJS += strbuf.o
+GIT_STD_LIB_OBJS += usage.o
+GIT_STD_LIB_OBJS += utf8.o
+GIT_STD_LIB_OBJS += wrapper.o
+
+$(STD_LIB): $(GIT_STD_LIB_OBJS) $(COMPAT_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
+
+git-std-lib: $(STD_LIB)
diff --git a/git-compat-util.h b/git-compat-util.h
index 481dac22b0..75aa9b263e 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -396,8 +396,8 @@ static inline int noop_core_config(const char *var UNUSED,
 #define platform_core_config noop_core_config
 #endif
 
+#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(GIT_STD_LIB)
 int lstat_cache_aware_rmdir(const char *path);
-#if !defined(__MINGW32__) && !defined(_MSC_VER)
 #define rmdir lstat_cache_aware_rmdir
 #endif
 
@@ -787,9 +787,11 @@ const char *inet_ntop(int af, const void *src, char *dst, size_t size);
 #endif
 
 #ifdef NO_PTHREADS
+#ifdef GIT_STD_LIB
 #define atexit git_atexit
 int git_atexit(void (*handler)(void));
 #endif
+#endif
 
 /*
  * Limit size of IO chunks, because huge chunks only cause pain.  OS X
@@ -951,14 +953,17 @@ int git_access(const char *path, int mode);
 # endif
 #endif
 
+#ifndef GIT_STD_LIB
 int cmd_main(int, const char **);
 
 /*
  * Intercept all calls to exit() and route them to trace2 to
  * optionally emit a message before calling the real exit().
  */
+
 int common_exit(const char *file, int line, int code);
 #define exit(code) exit(common_exit(__FILE__, __LINE__, (code)))
+#endif
 
 /*
  * You can mark a stack variable with UNLEAK(var) to avoid it being
diff --git a/symlinks.c b/symlinks.c
index b29e340c2d..bced721a0c 100644
--- a/symlinks.c
+++ b/symlinks.c
@@ -337,6 +337,7 @@ void invalidate_lstat_cache(void)
 	reset_lstat_cache(&default_cache);
 }
 
+#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(GIT_STD_LIB)
 #undef rmdir
 int lstat_cache_aware_rmdir(const char *path)
 {
@@ -348,3 +349,4 @@ int lstat_cache_aware_rmdir(const char *path)
 
 	return ret;
 }
+#endif
diff --git a/usage.c b/usage.c
index 09f0ed509b..58994e0d5c 100644
--- a/usage.c
+++ b/usage.c
@@ -5,7 +5,15 @@
  */
 #include "git-compat-util.h"
 #include "gettext.h"
+
+#ifdef GIT_STD_LIB
+#undef trace2_cmd_name
+#undef trace2_cmd_error_va
+#define trace2_cmd_name(x) 
+#define trace2_cmd_error_va(x, y)
+#else
 #include "trace2.h"
+#endif
 
 static void vreportf(const char *prefix, const char *err, va_list params)
 {
-- 
2.41.0.162.gfafddb0af9-goog


^ permalink raw reply related	[relevance 6%]

* Re: [PATCH v2 1/4] libgit: Add a read-only helper to test the worktree lock
  @ 2019-10-21  1:36  6%   ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2019-10-21  1:36 UTC (permalink / raw)
  To: Peter Jones; +Cc: git, Eric Sunshine, SZEDER Gábor

Peter Jones <pjones@redhat.com> writes:

> Subject: Re: [PATCH v2 1/4] libgit: Add a read-only helper to test the worktree lock

Having a word "worktree" somewhere on the title is good, but have it
as the "I am changing this area"; "libgit" does not give readers the
hint that this is a step about the worktree subsystem.

    Subject: [PATCH v2 1/4] worktree: add is_worktree_locked() helper

When the new helper function is properly named, like yours, there is
not much need to explain what it does (i.e. "to test the worktree
lock"), so just "worktree: add is_worktree_locked()" is sufficient.

> Add the function is_worktree_locked(), which is a helper to tell if a
> worktree is locked without having to be able to modify it.

I do not see the reason why your proposed title and log message
stress the fact that this helper can be used even by callers that
are not permitted to modify the worktree (i.e. the emphasis on
"read-only").  Asking for worktree_lock_reason() can be done by
anybody, but I do not think we particularly advertise it as
read-only.

Perhaps drop "without having to..."?

> -	locked = !!worktree_lock_reason(wt);
> +	locked = is_worktree_locked(wt);
>  	if ((!locked && opts->force) || (locked && opts->force > 1)) {
>  		if (delete_git_dir(wt->id))
>  		    die(_("unable to re-add worktree '%s'"), path);
> diff --git a/worktree.c b/worktree.c
> index 5b4793caa34..4924805c389 100644
> --- a/worktree.c
> +++ b/worktree.c
> @@ -244,6 +244,22 @@ int is_main_worktree(const struct worktree *wt)
>  	return !wt->id;
>  }
>  
> +int is_worktree_locked(const struct worktree *wt)
> +{
> +	struct strbuf path = STRBUF_INIT;
> +	int locked = 0;
> +
> +	if (wt->lock_reason_valid && wt->lock_reason)
> +		return 1;
> +
> +	strbuf_addstr(&path, worktree_git_path(wt, "locked"));
> +	if (file_exists(path.buf))
> +		locked = 1;

If you write

	locked = file_exists(path.buf);

here, then readers do not have to scan backwards and find that the
variable is initialized to zero, and that no other statement since
its initialization touches its value, in order to see what value is
returned when file does not exist.  Writing the RHS !!file_exists()
concisely allows readers to tell that this function returns only 0
or 1 without having to check what file_exists() returns, but that
may probably be overkill.

> +	strbuf_release(&path);
> +	return locked;
> +}

I wondered why this is not just

	#define is_worktree_locked(wt) (!!worktree_lock_reason(wt))

There are a few differences compared to worktree_lock_reason():

 - this can be called on the main worktree by mistake and would
   probably yield "not locked" (but the existing guard is a mere
   assert() which probably is stripped away in production builds)

 - this can be used by a process that cannot even read the contents
   of the locked file for the reason;

 - because reason is not read, reason or reason_valid fields are not
   updated, and repeated calls on the same worktree structure would
   result in repeated lstat() calls.

Shouldn't we be advising the callers that the last one as a
potential downside?  The fact that the new helper is usable even by
read-only callers hints that any caching of earlier results is
disabled, but it is somewhat a round-about way to say so.

As I do not see why being able to take "const struct worktree *", as
opposed to non-const version is a huge advantage, for this helper, I
wonder if it would make even more sense to introduce one more level
to "lock-reason-valid" and allow caching of is_worktree_locked().

Currently, "lock-reason-valid" only tells us "lock-reason may be
NULL, but that does not necessarily mean it is not locked---you have
to check it" boolean, but it could be instead a tristate:

    A: lock-reason may be NULL but that is only because we haven't
       even tried to see if the lock file exists

    B: NULL-ness of lock-reason reliably tells if the worktree is
       locked or not because we have tried file_exists(), but if the
       field has non-NULL value, that is *not* the string we read;
       if you want to know the reason, you must read the file.

    C: NULL in lock-reason means it is not locked; non-NULL in
       lock-reason is what we read form the file.

Also, it may make sense to correct the first difference and in a
more meaningful way than assert(), given that the reason why this
helper is introduced is eventually to perform an destructive action
later in the series.  Perhaps

	if (is_main_worktree(wt))
		BUG("is-worktree-locked called for the main worktree");

at the front.

Thanks.

>  const char *worktree_lock_reason(struct worktree *wt)
>  {
>  	assert(!is_main_worktree(wt));
> diff --git a/worktree.h b/worktree.h
> index caecc7a281c..5ff16c414b5 100644
> --- a/worktree.h
> +++ b/worktree.h
> @@ -56,6 +56,11 @@ struct worktree *find_worktree(struct worktree **list,
>   */
>  int is_main_worktree(const struct worktree *wt);
>  
> +/*
> + * Return true if the given worktree is locked
> + */
> +int is_worktree_locked(const struct worktree *wt);
> +
>  /*
>   * Return the reason string if the given worktree is locked or NULL
>   * otherwise.

^ permalink raw reply	[relevance 6%]

* [PATCH v2 1/2] Move git_sort(), a stable sort, into into libgit.a
  @ 2019-09-30 17:21  6%   ` Johannes Schindelin via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2019-09-30 17:21 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Junio C Hamano, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The `qsort()` function is not guaranteed to be stable, i.e. it does not
promise to maintain the order of items it is told to consider equal. In
contrast, the `git_sort()` function we carry in `compat/qsort.c` _is_
stable, by virtue of implementing a merge sort algorithm.

In preparation for using a stable sort in Git's rename detection, move
the stable sort into `libgit.a` so that it is compiled in
unconditionally, and rename it to `git_stable_qsort()`.

Note: this also makes the hack obsolete that was introduced in
fe21c6b285d (mingw: reencode environment variables on the fly (UTF-16
<-> UTF-8), 2018-10-30), where we included `compat/qsort.c` directly in
`compat/mingw.c` to use the stable sort.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                         |  2 +-
 compat/mingw.c                   | 11 +++--------
 git-compat-util.h                |  9 ++++++---
 compat/qsort.c => stable-qsort.c |  6 +++---
 4 files changed, 13 insertions(+), 15 deletions(-)
 rename compat/qsort.c => stable-qsort.c (89%)

diff --git a/Makefile b/Makefile
index f9255344ae..60c809e580 100644
--- a/Makefile
+++ b/Makefile
@@ -983,6 +983,7 @@ LIB_OBJS += shallow.o
 LIB_OBJS += sideband.o
 LIB_OBJS += sigchain.o
 LIB_OBJS += split-index.o
+LIB_OBJS += stable-qsort.o
 LIB_OBJS += strbuf.o
 LIB_OBJS += streaming.o
 LIB_OBJS += string-list.o
@@ -1714,7 +1715,6 @@ ifdef NO_GETPAGESIZE
 endif
 ifdef INTERNAL_QSORT
 	COMPAT_CFLAGS += -DINTERNAL_QSORT
-	COMPAT_OBJS += compat/qsort.o
 endif
 ifdef HAVE_ISO_QSORT_S
 	COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
diff --git a/compat/mingw.c b/compat/mingw.c
index 738f0a826a..50af33b2b3 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1229,11 +1229,6 @@ static int wenvcmp(const void *a, const void *b)
 	return _wcsnicmp(p, q, p_len);
 }
 
-/* We need a stable sort to convert the environment between UTF-16 <-> UTF-8 */
-#ifndef INTERNAL_QSORT
-#include "qsort.c"
-#endif
-
 /*
  * Build an environment block combining the inherited environment
  * merged with the given list of settings.
@@ -1272,8 +1267,8 @@ static wchar_t *make_environment_block(char **deltaenv)
 
 	/*
 	 * If there is a deltaenv, let's accumulate all keys into `array`,
-	 * sort them using the stable git_qsort() and then copy, skipping
-	 * duplicate keys
+	 * sort them using the stable git_stable_qsort() and then copy,
+	 * skipping duplicate keys
 	 */
 	for (p = wenv; p && *p; ) {
 		ALLOC_GROW(array, nr + 1, alloc);
@@ -1296,7 +1291,7 @@ static wchar_t *make_environment_block(char **deltaenv)
 		p += wlen + 1;
 	}
 
-	git_qsort(array, nr, sizeof(*array), wenvcmp);
+	git_stable_qsort(array, nr, sizeof(*array), wenvcmp);
 	ALLOC_ARRAY(result, size + delta_size);
 
 	for (p = result, i = 0; i < nr; i++) {
diff --git a/git-compat-util.h b/git-compat-util.h
index 83be89de0a..7ec2c8fe31 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -1094,10 +1094,10 @@ static inline int strtol_i(char const *s, int base, int *result)
 	return 0;
 }
 
+void git_stable_qsort(void *base, size_t nmemb, size_t size,
+		      int(*compar)(const void *, const void *));
 #ifdef INTERNAL_QSORT
-void git_qsort(void *base, size_t nmemb, size_t size,
-	       int(*compar)(const void *, const void *));
-#define qsort git_qsort
+#define qsort git_stable_qsort
 #endif
 
 #define QSORT(base, n, compar) sane_qsort((base), (n), sizeof(*(base)), compar)
@@ -1108,6 +1108,9 @@ static inline void sane_qsort(void *base, size_t nmemb, size_t size,
 		qsort(base, nmemb, size, compar);
 }
 
+#define STABLE_QSORT(base, n, compar) \
+	git_stable_qsort((base), (n), sizeof(*(base)), compar)
+
 #ifndef HAVE_ISO_QSORT_S
 int git_qsort_s(void *base, size_t nmemb, size_t size,
 		int (*compar)(const void *, const void *, void *), void *ctx);
diff --git a/compat/qsort.c b/stable-qsort.c
similarity index 89%
rename from compat/qsort.c
rename to stable-qsort.c
index 7d071afb70..6cbaf39f7b 100644
--- a/compat/qsort.c
+++ b/stable-qsort.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /*
  * A merge sort implementation, simplified from the qsort implementation
@@ -44,8 +44,8 @@ static void msort_with_tmp(void *b, size_t n, size_t s,
 	memcpy(b, t, (n - n2) * s);
 }
 
-void git_qsort(void *b, size_t n, size_t s,
-	       int (*cmp)(const void *, const void *))
+void git_stable_qsort(void *b, size_t n, size_t s,
+		      int (*cmp)(const void *, const void *))
 {
 	const size_t size = st_mult(n, s);
 	char buf[1024];
-- 
gitgitgadget


^ permalink raw reply related	[relevance 6%]

* Unable to install git-2.43.0 from source on macOS Big Sur 11.7.10
@ 2023-12-17 22:54  6% Jonathan Abrams
  0 siblings, 0 replies; 200+ results
From: Jonathan Abrams @ 2023-12-17 22:54 UTC (permalink / raw)
  To: git@vger.kernel.org

Hello,

I am trying to install git-2.43.0 from source on macOS Big Sur 11.7.10.  I have Xcode 13.2.1 installed.  I have read https://github.com/git/git/blob/master/INSTALL.

The command that will not complete successfully is sudo make all doc.  The Terminal output before the error is as follows.
--
    AR libgit.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libgit.a(zlib-uncompress2.o) has no symbols
    CC xdiff/xdiffi.o
    CC xdiff/xemit.o
    CC xdiff/xhistogram.o
    CC xdiff/xmerge.o
    CC xdiff/xpatience.o
    CC xdiff/xprepare.o
    CC xdiff/xutils.o
    AR xdiff/lib.a
    CC reftable/basics.o
    CC reftable/error.o
    CC reftable/block.o
    CC reftable/blocksource.o
    CC reftable/iter.o
    CC reftable/publicbasics.o
    CC reftable/merged.o
    CC reftable/pq.o
    CC reftable/reader.o
    CC reftable/record.o
    CC reftable/refname.o
    CC reftable/generic.o
    CC reftable/stack.o
    CC reftable/tree.o
    CC reftable/writer.o
    AR reftable/libreftable.a
    LINK git-daemon
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _precompose_utf8_readdir in libgit.a(precompose_utf8.o)
      _reencode_string_iconv in libgit.a(utf8.o)
  "_libiconv_close", referenced from:
      _precompose_string_if_needed in libgit.a(precompose_utf8.o)
      _precompose_utf8_closedir in libgit.a(precompose_utf8.o)
      _reencode_string_len in libgit.a(utf8.o)
  "_libiconv_open", referenced from:
      _precompose_string_if_needed in libgit.a(precompose_utf8.o)
      _precompose_utf8_opendir in libgit.a(precompose_utf8.o)
      _reencode_string_len in libgit.a(utf8.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [git-daemon] Error 1
--
Does anyone reading this know how to resolve this error?

Thank you,

Jonathan S. Abrams

^ permalink raw reply	[relevance 6%]

* Make errors
@ 2005-05-08 19:35  6% John Kacur
  0 siblings, 0 replies; 200+ results
From: John Kacur @ 2005-05-08 19:35 UTC (permalink / raw)
  To: git

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

Ok, I'm coming late to the git game, and having some build problems.
My machine is amd64 (athlon64), and I fetched both

git-0.7.tar.bz2
cogito-0.9.tar.bz2

They both fail to build in a similar fashion
For example, I did
bunzip2 -c git-0.7.tar.bz2 | tar xvf -
cd git-0.7
export PATH=$PWD:$PATH
make

and it fails here:
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-convert-cache
convert-c
ache.c libgit.a -lz -lssl
convert-cache.c: In function `write_subdirectory':
convert-cache.c:102: warning: field precision is not type int (arg 4)
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-http-pull
http-pull.c l
ibgit.a -lz -lssl -lcurl
http-pull.c:10:23: curl/curl.h: No such file or directory
http-pull.c:11:23: curl/easy.h: No such file or directory
http-pull.c:13: error: parse error before '*' token

Any hints?

Thanks in advance

The entire build output is attached:



[-- Attachment #2: out.txt --]
[-- Type: text/plain, Size: 4381 bytes --]

gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>'   -c -o read-cache.o read-cache.c
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>'   -c -o sha1_file.o sha1_file.c
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>'   -c -o usage.o usage.c
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>'   -c -o object.o object.c
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>'   -c -o commit.o commit.c
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>'   -c -o tree.o tree.c
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>'   -c -o blob.o blob.c
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>'   -c -o tag.o tag.c
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>'   -c -o strbuf.o strbuf.c
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>'   -c -o diff.o diff.c
ar rcs libgit.a read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o tag.o strbuf.o diff.o
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-update-cache update-cache.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-diff-files diff-files.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-init-db init-db.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-write-tree write-tree.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-read-tree read-tree.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-commit-tree commit-tree.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-cat-file cat-file.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-fsck-cache fsck-cache.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-checkout-cache checkout-cache.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-diff-tree diff-tree.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-rev-tree rev-tree.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-show-files show-files.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-check-files check-files.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-ls-tree ls-tree.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-merge-base merge-base.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-merge-cache merge-cache.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-unpack-file unpack-file.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-export export.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-diff-cache diff-cache.c libgit.a -lz -lssl
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-convert-cache convert-cache.c libgit.a -lz -lssl
convert-cache.c: In function `write_subdirectory':
convert-cache.c:102: warning: field precision is not type int (arg 4)
gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-http-pull http-pull.c libgit.a -lz -lssl -lcurl
http-pull.c:10:23: curl/curl.h: No such file or directory
http-pull.c:11:23: curl/easy.h: No such file or directory
http-pull.c:13: error: parse error before '*' token
http-pull.c:13: warning: type defaults to `int' in declaration of `curl'
http-pull.c:13: warning: data definition has no type or storage class
http-pull.c: In function `fetch':
http-pull.c:73: warning: implicit declaration of function `curl_easy_setopt'
http-pull.c:73: error: `CURLOPT_FILE' undeclared (first use in this function)
http-pull.c:73: error: (Each undeclared identifier is reported only once
http-pull.c:73: error: for each function it appears in.)
http-pull.c:74: error: `CURLOPT_WRITEFUNCTION' undeclared (first use in this function)
http-pull.c:86: error: `CURLOPT_URL' undeclared (first use in this function)
http-pull.c:90: warning: implicit declaration of function `curl_easy_perform'
http-pull.c: In function `main':
http-pull.c:191: warning: implicit declaration of function `curl_global_init'
http-pull.c:191: error: `CURL_GLOBAL_ALL' undeclared (first use in this function)
http-pull.c:193: warning: implicit declaration of function `curl_easy_init'
http-pull.c:193: warning: assignment makes pointer from integer without a cast
http-pull.c:202: warning: implicit declaration of function `curl_global_cleanup'
make: *** [git-http-pull] Error 1

^ permalink raw reply	[relevance 6%]

* problem compiling tonights Git
@ 2006-02-02 18:41  6% dave morgan
  0 siblings, 0 replies; 200+ results
From: dave morgan @ 2006-02-02 18:41 UTC (permalink / raw)
  To: git

Debian/testing system, 2.6.15 Kernel, AMD Athlon CPU @ 1Ghz, 512Mb RAM
(some of the following lines re-wrapped by my mailer)

david@tower2:~/git$ cg-update -v
Fetching head...
Fetching objects...
progress: 28 objects, 107898 bytes
Fetching tags...
Tree change:
8233340ce6eb700eb2cd9c0fef4d1705997c499b:823bcd6edc7f7330714486b228b052953c2f4229

Applying changes...
Fast-forwarding 8233340ce6eb700eb2cd9c0fef4d1705997c499b ->
823bcd6edc7f7330714486b228b052953c2f4229
        on top of 8233340ce6eb700eb2cd9c0fef4d1705997c499b...
:100644 100644 243f967... 36363bd... M  combine-diff.c
:100644 100644 8ae6dbc... ec51e7d... M  diff.c
:100755 100755 6e3a44a... b6799d8... M  git-svnimport.perl
:100644 100644 92326f9... 97ce13c... M  http-fetch.c
:100644 100644 ad0eafe... f92b960... M  index.c
:100644 100644 1bc1887... a554e07... M  rev-list.c
:100644 100644 a84a04f... afec98d... M  update-index.c
david@tower2:~/git$ make install
GIT_VERSION = 1.1.6.g823b
gcc -o index.o -c -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>' index.c
gcc -o diff.o -c -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  diff.c
gcc -o combine-diff.o -c -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'
combine-diff.c
ar rcs libgit.a blob.o commit.o connect.o count-delta.o csum-file.o
date.o diff-delta.o entry.o exec_cmd.o ident.o index.o object.o
pack-check.o patch-delta.o path.o pkt-line.o quote.o read-cache.o
refs.o run-command.o server-info.o setup.o sha1_file.o sha1_name.o
strbuf.o tag.o tree.o usage.o config.o environment.o ctype.o copy.o
fetch-clone.o diff.o diffcore-break.o diffcore-order.o
diffcore-pathspec.o diffcore-pickaxe.o diffcore-rename.o tree-diff.o
combine-diff.o epoch.o
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-apply apply.o
libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-cat-file
cat-file.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o
git-checkout-index  checkout-index.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-clone-pack
clone-pack.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-commit-tree
commit-tree.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o
git-convert-objects  convert-objects.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-diff-files
diff-files.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-diff-index
diff-index.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-diff-stages
diff-stages.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-diff-tree
diff-tree.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-fetch-pack
fetch-pack.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-fsck-objects
fsck-objects.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-hash-object
hash-object.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-index-pack
index-pack.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-init-db
init-db.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-local-fetch
local-fetch.o fetch.o libgit.a -lz  -lcrypto
gcc -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  -o git-ls-files
ls-files.o libgit.a -lz  -lcrypto
collect2: ld terminated with signal 11 [Segmentation fault]
make: *** [git-ls-files] Error 1


david@tower2:~/git$ ld --version
GNU ld version 2.16.91 20051214 Debian GNU/Linux
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms
of
the GNU General Public License.  This program has absolutely no
warranty.


is this a problem with git-ls-files, or my toolchain?

best regards
Dave

^ permalink raw reply	[relevance 6%]

* [RFC PATCH 1/3] test: add simple shared library
    2023-05-02  4:11  8% ` [RFC PATCH 2/3] test: add basic unit testing framework Felipe Contreras
@ 2023-05-02  4:11  6% ` Felipe Contreras
  1 sibling, 0 replies; 200+ results
From: Felipe Contreras @ 2023-05-02  4:11 UTC (permalink / raw)
  To: git; +Cc: Calvin Wan, Felipe Contreras

It doesn't contain anything, it's just preparation for further commits.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 .gitignore  | 1 +
 t/Makefile  | 9 +++++++++
 t/lib/git.c | 1 +
 t/lib/git.h | 4 ++++
 4 files changed, 15 insertions(+)
 create mode 100644 t/lib/git.c
 create mode 100644 t/lib/git.h

diff --git a/.gitignore b/.gitignore
index e875c59054..c249487b9d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -237,6 +237,7 @@
 *.iobj
 *.ipdb
 *.dll
+*.so
 .vs/
 Debug/
 Release/
diff --git a/t/Makefile b/t/Makefile
index 3e00cdd801..d85e3e661d 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -65,6 +65,15 @@ prove: pre-clean check-chainlint $(TEST_LINT)
 $(T):
 	@echo "*** $@ ***"; '$(TEST_SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
 
+lib/git.o: lib/git.c
+	$(QUIET_CC)$(COMPILE.c) -o $@ $<
+
+lib/libgit.so: CFLAGS := -fPIC -Ilib/ $(CFLAGS)
+lib/libgit.so: lib/git.o
+
+%.so::
+	$(QUIET_LINK)$(CC) -shared -o $@ $^ $(LIBS)
+
 pre-clean:
 	$(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
 
diff --git a/t/lib/git.c b/t/lib/git.c
new file mode 100644
index 0000000000..40d96ee354
--- /dev/null
+++ b/t/lib/git.c
@@ -0,0 +1 @@
+#include <git.h>
diff --git a/t/lib/git.h b/t/lib/git.h
new file mode 100644
index 0000000000..58a28085f5
--- /dev/null
+++ b/t/lib/git.h
@@ -0,0 +1,4 @@
+#ifndef GIT_H
+#define GIT_H
+
+#endif /* GIT_H */
-- 
2.40.0+fc1


^ permalink raw reply related	[relevance 6%]

* [PATCH 1/2] Move git_sort(), a stable sort, into into libgit.a
  @ 2019-09-25  8:36  6% ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2019-09-25  8:36 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

The `qsort()` function is not guaranteed to be stable, i.e. it does not
promise to maintain the order of items it is told to consider equal. In
contrast, the `git_sort()` function we carry in `compat/qsort.c` _is_
stable, by virtue of implementing a merge sort algorithm.

In preparation for using a stable sort in Git's rename detection, move
the stable sort into `libgit.a` so that it is compiled in
unconditionally.

Note: this also makes the hack obsolete that was introduced in
fe21c6b285d (mingw: reencode environment variables on the fly (UTF-16
<-> UTF-8), 2018-10-30), where we included `compat/qsort.c` directly in
`compat/mingw.c` to use the stable sort.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                  | 2 +-
 compat/mingw.c            | 5 -----
 git-compat-util.h         | 4 +++-
 compat/qsort.c => qsort.c | 2 +-
 4 files changed, 5 insertions(+), 8 deletions(-)
 rename compat/qsort.c => qsort.c (97%)

diff --git a/Makefile b/Makefile
index f9255344ae..1e144598e4 100644
--- a/Makefile
+++ b/Makefile
@@ -950,6 +950,7 @@ LIB_OBJS += prio-queue.o
 LIB_OBJS += progress.o
 LIB_OBJS += prompt.o
 LIB_OBJS += protocol.o
+LIB_OBJS += qsort.o
 LIB_OBJS += quote.o
 LIB_OBJS += range-diff.o
 LIB_OBJS += reachable.o
@@ -1714,7 +1715,6 @@ ifdef NO_GETPAGESIZE
 endif
 ifdef INTERNAL_QSORT
 	COMPAT_CFLAGS += -DINTERNAL_QSORT
-	COMPAT_OBJS += compat/qsort.o
 endif
 ifdef HAVE_ISO_QSORT_S
 	COMPAT_CFLAGS += -DHAVE_ISO_QSORT_S
diff --git a/compat/mingw.c b/compat/mingw.c
index 738f0a826a..77d4ef4d19 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1229,11 +1229,6 @@ static int wenvcmp(const void *a, const void *b)
 	return _wcsnicmp(p, q, p_len);
 }
 
-/* We need a stable sort to convert the environment between UTF-16 <-> UTF-8 */
-#ifndef INTERNAL_QSORT
-#include "qsort.c"
-#endif
-
 /*
  * Build an environment block combining the inherited environment
  * merged with the given list of settings.
diff --git a/git-compat-util.h b/git-compat-util.h
index 83be89de0a..2d46162897 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -1094,9 +1094,9 @@ static inline int strtol_i(char const *s, int base, int *result)
 	return 0;
 }
 
-#ifdef INTERNAL_QSORT
 void git_qsort(void *base, size_t nmemb, size_t size,
 	       int(*compar)(const void *, const void *));
+#ifdef INTERNAL_QSORT
 #define qsort git_qsort
 #endif
 
@@ -1108,6 +1108,8 @@ static inline void sane_qsort(void *base, size_t nmemb, size_t size,
 		qsort(base, nmemb, size, compar);
 }
 
+#define QSORT_STABLE(base, n, compar) git_qsort((base), (n), sizeof(*(base)), compar)
+
 #ifndef HAVE_ISO_QSORT_S
 int git_qsort_s(void *base, size_t nmemb, size_t size,
 		int (*compar)(const void *, const void *, void *), void *ctx);
diff --git a/compat/qsort.c b/qsort.c
similarity index 97%
rename from compat/qsort.c
rename to qsort.c
index 7d071afb70..08f80eea09 100644
--- a/compat/qsort.c
+++ b/qsort.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /*
  * A merge sort implementation, simplified from the qsort implementation
-- 
gitgitgadget


^ permalink raw reply related	[relevance 6%]

* Re: [PATCH] Introduce Git.pm (v3)
  @ 2006-06-22 23:50  6%   ` Petr Baudis
  2006-06-23 12:39  5%     ` Petr Baudis
  2006-06-23  0:22  5%     ` Junio C Hamano
  0 siblings, 2 replies; 200+ results
From: Petr Baudis @ 2006-06-22 23:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Dear diary, on Fri, Jun 23, 2006 at 01:18:10AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Petr Baudis <pasky@suse.cz> writes:
> 
> > 	* Added hash_object() and Git.xs providing the fast implementation
> > 	* Better error reporting
> > 	* Plenty of random minor stuff
> >
> > It's a good thing v2 didn't make it to the list since it contained a huge
> > file which turns out that can be autogenerated at the build time, so v3
> > just changes that (and adds .gitignore file and makes some other minor
> > changes).
> >
> > I consider this patch "stable" now. Further enhancements will be posted
> > as patches on top of this.
> 
> Eek.  It does not compile for me -- maybe there is more
> dependencies that need to be listed in INSTALL file?
> 
> make -C perl
> make[1]: Entering directory `/opt/git/git.git/perl'
> cc -c  -I. -I.. -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2   -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC "-I/usr/lib/perl/5.8/CORE"  -O2 -Wall -Wdeclaration-after-statement -g -DSHA1_HEADER='<openssl/sha.h>'  Git.c
> Git.xs: In function 'XS_Git_xs_hash_object':
> Git.xs:27: warning: ISO C90 forbids mixed declarations and code
> Git.xs:44: warning: passing argument 1 of 'Perl_io_close' from incompatible pointer type
> Git.xs:44: warning: passing argument 2 of 'Perl_io_close' makes pointer from integer without a cast
> Git.xs:44: error: too few arguments to function 'Perl_io_close'

Oops, sorry. Apparently, I've digged too deep and unleashed a monster of
unstable API. Now I've finally discovered perlapio(1) and know I
should've just called PerlIO_close(). Below comes a fixed patch, I
didn't bother to bump the version number.

---

[PATCH] Introduce Git.pm (v3)

This patch introduces a very basic and barebone Git.pm module
with a sketch of how the generic interface would look like;
most functions are missing, but this should give some good base.
I will continue expanding it.

Most desirable now is more careful error reporting, generic_in() for feeding
input to Git commands and the repository() constructor doing some poking
with git-rev-parse to get the git directory and subdirectory prefix.
Those three are basically the prerequisities for converting git-mv.

Currently Git.pm just wraps up exec()s of Git commands, but even that
is not trivial to get right and various Git perl scripts do it in
various inconsistent ways. In addition to Git.pm, there is now also
Git.xs which provides barebone Git.xs for directly interfacing with
libgit.a, and as an example providing the hash_object() function using
libgit.

This adds the Git module, integrates it to the build system and as
an example converts the git-fmt-merge-msg.perl script to it (the result
is not very impressive since its advantage is not quite apparent in this
one, but I just picked up the simplest Git user around).

The changes since v1 are:

	* s/generic/command/ in the API, added command_pipe() and
	  changed behaviour of command() in the scalar context
	* Added hash_object() and Git.xs providing the fast implementation
	* Better error reporting
	* Plenty of random minor stuff

It's a good thing v2 didn't make it to the list since it contained a huge
file which turns out that can be autogenerated at the build time, so v3
just changes that (and adds .gitignore file and makes some other minor
changes).

I consider this patch "stable" now. Further enhancements will be posted
as patches on top of this.

My current working state is available all the time at

	http://pasky.or.cz/~xpasky/git-perl/Git.pm

and an irregularily updated API documentation is at

	http://pasky.or.cz/~xpasky/git-perl/Git.html

Many thanks to Jakub Narebski, Junio and others for their feedback.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 Makefile               |   12 +
 git-fmt-merge-msg.perl |   10 +
 perl/.gitignore        |    7 +
 perl/Git.pm            |  401 ++++++++++++++++++++++++++++++++++++++++++++++++
 perl/Git.xs            |   60 +++++++
 perl/Makefile.PL       |   21 +++
 6 files changed, 504 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index a5b6784..4d20b22 100644
--- a/Makefile
+++ b/Makefile
@@ -476,7 +476,8 @@ ### Build rules
 
 all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk
 
-all:
+all: perl/Makefile
+	$(MAKE) -C perl
 	$(MAKE) -C templates
 
 strip: $(PROGRAMS) git$X
@@ -508,7 +509,7 @@ common-cmds.h: Documentation/git-*.txt
 
 $(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
 	rm -f $@ $@+
-	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	sed -e '1s|#!.*perl\(.*\)|#!$(PERL_PATH_SQ)\1 -I'"$$(make -s -C perl instlibdir)"'|' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    $@.perl >$@+
 	chmod +x $@+
@@ -594,6 +595,9 @@ XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare
 	rm -f $@ && $(AR) rcs $@ $(XDIFF_OBJS)
 
 
+perl/Makefile:	perl/Git.pm perl/Makefile.PL
+	(cd perl && $(PERL_PATH) Makefile.PL PREFIX="$(prefix)" DEFINE="$(ALL_CFLAGS)" LIBS="$(LIBS)")
+
 doc:
 	$(MAKE) -C Documentation all
 
@@ -649,6 +653,7 @@ install: all
 	$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
 	$(INSTALL) git$X gitk '$(DESTDIR_SQ)$(bindir_SQ)'
 	$(MAKE) -C templates install
+	$(MAKE) -C perl install
 	$(INSTALL) -d -m755 '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
 	$(INSTALL) $(PYMODULES) '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
 	if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \
@@ -716,7 +721,8 @@ clean:
 	rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
 	rm -f $(htmldocs).tar.gz $(manpages).tar.gz
 	$(MAKE) -C Documentation/ clean
-	$(MAKE) -C templates clean
+	[ ! -e perl/Makefile ] || $(MAKE) -C perl/ clean
+	$(MAKE) -C templates/ clean
 	$(MAKE) -C t/ clean
 	rm -f GIT-VERSION-FILE GIT-CFLAGS
 
diff --git a/git-fmt-merge-msg.perl b/git-fmt-merge-msg.perl
index 5986e54..c32cafb 100755
--- a/git-fmt-merge-msg.perl
+++ b/git-fmt-merge-msg.perl
@@ -6,6 +6,9 @@ # Read .git/FETCH_HEAD and make a human 
 # by grouping branches and tags together to form a single line.
 
 use strict;
+use Git;
+
+my $repo = Git->repository();
 
 my @src;
 my %src;
@@ -28,13 +31,12 @@ sub andjoin {
 }
 
 sub repoconfig {
-	my ($val) = qx{git-repo-config --get merge.summary};
+	my ($val) = $repo->command_oneline('repo-config', '--get', 'merge.summary');
 	return $val;
 }
 
 sub current_branch {
-	my ($bra) = qx{git-symbolic-ref HEAD};
-	chomp($bra);
+	my ($bra) = $repo->command_oneline('symbolic-ref', 'HEAD');
 	$bra =~ s|^refs/heads/||;
 	if ($bra ne 'master') {
 		$bra = " into $bra";
@@ -47,7 +49,7 @@ sub current_branch {
 sub shortlog {
 	my ($tip) = @_;
 	my @result;
-	foreach ( qx{git-log --no-merges --topo-order --pretty=oneline $tip ^HEAD} ) {
+	foreach ($repo->command('log', '--no-merges', '--topo-order', '--pretty=oneline', $tip, '^HEAD')) {
 		s/^[0-9a-f]{40}\s+//;
 		push @result, $_;
 	}
diff --git a/perl/.gitignore b/perl/.gitignore
new file mode 100644
index 0000000..6d778f3
--- /dev/null
+++ b/perl/.gitignore
@@ -0,0 +1,7 @@
+Git.bs
+Git.c
+Makefile
+blib
+blibdirs
+pm_to_blib
+ppport.h
diff --git a/perl/Git.pm b/perl/Git.pm
new file mode 100644
index 0000000..4bb7c50
--- /dev/null
+++ b/perl/Git.pm
@@ -0,0 +1,401 @@
+=head1 NAME
+
+Git - Perl interface to the Git version control system
+
+=cut
+
+
+package Git;
+
+use strict;
+
+
+BEGIN {
+
+our ($VERSION, @ISA, @EXPORT, @EXPORT_OK);
+
+# Totally unstable API.
+$VERSION = '0.01';
+
+
+=head1 SYNOPSIS
+
+  use Git;
+
+  my $version = Git::command_oneline('version');
+
+  Git::command_noisy('update-server-info');
+
+  my $repo = Git->repository (Directory => '/srv/git/cogito.git');
+
+
+  my @revs = $repo->command('rev-list', '--since=last monday', '--all');
+
+  my $fh = $repo->command_pipe('rev-list', '--since=last monday', '--all');
+  my $lastrev = <$fh>; chomp $lastrev;
+  close $fh; # You may want to test rev-list exit status here
+
+  my $lastrev = $repo->command_oneline('rev-list', '--all');
+
+=cut
+
+
+require Exporter;
+
+@ISA = qw(Exporter);
+
+@EXPORT = qw();
+
+# Methods which can be called as standalone functions as well:
+@EXPORT_OK = qw(command command_oneline command_pipe command_noisy);
+
+
+=head1 DESCRIPTION
+
+This module provides Perl scripts easy way to interface the Git version control
+system. The modules have an easy and well-tested way to call arbitrary Git
+commands; in the future, the interface will also provide specialized methods
+for doing easily operations which are not totally trivial to do over
+the generic command interface.
+
+While some commands can be executed outside of any context (e.g. 'version'
+or 'init-db'), most operations require a repository context, which in practice
+means getting an instance of the Git object using the repository() constructor.
+(In the future, we will also get a new_repository() constructor.) All commands
+called as methods of the object are then executed in the context of the
+repository.
+
+TODO: In the future, we might also do
+
+	my $subdir = $repo->subdir('Documentation');
+	# Gets called in the subdirectory context:
+	$subdir->command('status');
+
+	my $remoterepo = $repo->remote_repository (name => 'cogito', branch => 'master');
+	$remoterepo ||= Git->remote_repository ('http://git.or.cz/cogito.git/');
+	my @refs = $remoterepo->refs();
+
+So far, all functions just die if anything goes wrong. If you don't want that,
+make appropriate provisions to catch the possible deaths. Better error recovery
+mechanisms will be provided in the future.
+
+Currently, the module merely wraps calls to external Git tools. In the future,
+it will provide a much faster way to interact with Git by linking directly
+to libgit. This should be completely opaque to the user, though (performance
+increate nonwithstanding).
+
+=cut
+
+
+use Carp qw(carp croak);
+
+require XSLoader;
+XSLoader::load('Git', $VERSION);
+
+}
+
+
+=head1 CONSTRUCTORS
+
+=over 4
+
+=item repository ( OPTIONS )
+
+=item repository ( DIRECTORY )
+
+=item repository ()
+
+Construct a new repository object.
+C<OPTIONS> are passed in a hash like fashion, using key and value pairs.
+Possible options are:
+
+B<Repository> - Path to the Git repository.
+
+B<WorkingCopy> - Path to the associated working copy; not strictly required
+as many commands will happily crunch on a bare repository.
+
+B<Directory> - Path to the Git working directory in its usual setup. This
+is just for convenient setting of both C<Repository> and C<WorkingCopy>
+at once: If the directory as a C<.git> subdirectory, C<Repository> is pointed
+to the subdirectory and the directory is assumed to be the working copy.
+If the directory does not have the subdirectory, C<WorkingCopy> is left
+undefined and C<Repository> is pointed to the directory itself.
+
+B<GitPath> - Path to the C<git> binary executable. By default the C<$PATH>
+is searched for it.
+
+You should not use both C<Directory> and either of C<Repository> and
+C<WorkingCopy> - the results of that are undefined.
+
+Alternatively, a directory path may be passed as a single scalar argument
+to the constructor; it is equivalent to setting only the C<Directory> option
+field.
+
+Calling the constructor with no options whatsoever is equivalent to
+calling it with C<< Directory => '.' >>.
+
+=cut
+
+sub repository {
+	my $class = shift;
+	my @args = @_;
+	my %opts = ();
+	my $self;
+
+	if (defined $args[0]) {
+		if ($#args % 2 != 1) {
+			# Not a hash.
+			$#args == 0 or croak "bad usage";
+			%opts = (Directory => $args[0]);
+		} else {
+			%opts = @args;
+		}
+
+		if ($opts{Directory}) {
+			-d $opts{Directory} or croak "Directory not found: $!";
+			if (-d $opts{Directory}."/.git") {
+				# TODO: Might make this more clever
+				$opts{WorkingCopy} = $opts{Directory};
+				$opts{Repository} = $opts{Directory}."/.git";
+			} else {
+				$opts{Repository} = $opts{Directory};
+			}
+			delete $opts{Directory};
+		}
+	}
+
+	$self = { opts => \%opts };
+	bless $self, $class;
+}
+
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item command ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given Git C<COMMAND> (specify it without the 'git-'
+prefix), optionally with the specified extra C<ARGUMENTS>.
+
+The method can be called without any instance or on a specified Git repository
+(in that case the command will be run in the repository context).
+
+In scalar context, it returns all the command output in a single string
+(verbatim).
+
+In array context, it returns an array containing lines printed to the
+command's stdout (without trailing newlines).
+
+In both cases, the command's stdin and stderr are the same as the caller's.
+
+=cut
+
+sub command {
+	my $fh = command_pipe(@_);
+
+	if (not defined wantarray) {
+		_cmd_close($fh);
+
+	} elsif (not wantarray) {
+		local $/;
+		my $text = <$fh>;
+		_cmd_close($fh);
+		return $text;
+
+	} else {
+		my @lines = <$fh>;
+		_cmd_close($fh);
+		chomp @lines;
+		return @lines;
+	}
+}
+
+=item command_oneline ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given C<COMMAND> in the same way as command()
+does but always return a scalar string containing the first line
+of the command's standard output.
+
+=cut
+
+sub command_oneline {
+	my $fh = command_pipe(@_);
+
+	my $line = <$fh>;
+	_cmd_close($fh);
+
+	chomp $line;
+	return $line;
+}
+
+=item command_pipe ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given C<COMMAND> in the same way as command()
+does but return a pipe filehandle from which the command output can be
+read.
+
+=cut
+
+sub command_pipe {
+	my ($self, $cmd, @args) = _maybe_self(@_);
+
+	$cmd =~ /^[a-z0-9A-Z_-]+$/ or croak "bad command: $cmd";
+
+	my $pid = open(my $fh, "-|");
+	if (not defined $pid) {
+		croak "open failed: $!";
+	} elsif ($pid == 0) {
+		_cmd_exec($self, $cmd, @args);
+	}
+	return $fh;
+}
+
+=item command_noisy ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given C<COMMAND> in the same way as command() does but do not
+capture the command output - the standard output is not redirected and goes
+to the standard output of the caller application.
+
+While the method is called command_noisy(), you might want to as well use
+it for the most silent Git commands which you know will never pollute your
+stdout but you want to avoid the overhead of the pipe setup when calling them.
+
+The function returns only after the command has finished running.
+
+=cut
+
+sub command_noisy {
+	my ($self, $cmd, @args) = _maybe_self(@_);
+
+	$cmd =~ /^[a-z0-9A-Z_-]+$/ or croak "bad command: $cmd";
+
+	my $pid = fork;
+	if (not defined $pid) {
+		croak "fork failed: $!";
+	} elsif ($pid == 0) {
+		_cmd_exec($self, $cmd, @args);
+	}
+	if (waitpid($pid, 0) > 0 and $? != 0) {
+		croak "exit status: $?";
+	}
+}
+
+=item hash_object ( FILENAME [, TYPE ] )
+
+=item hash_object ( FILEHANDLE [, TYPE ] )
+
+Compute the SHA1 object id of the given C<FILENAME> (or data waiting in
+C<FILEHANDLE>) considering it is of the C<TYPE> object type (C<blob>
+(default), C<commit>, C<tree>).
+
+In case of C<FILEHANDLE> passed instead of file name, all the data
+available are read and hashed, and the filehandle is automatically
+closed. The file handle should be freshly opened - if you have already
+read anything from the file handle, the results are undefined (since
+this function works directly with the file descriptor and internal
+PerlIO buffering might have messed things up).
+
+The method can be called without any instance or on a specified Git repository,
+it makes zero difference.
+
+The function returns the SHA1 hash.
+
+Implementation of this function is very fast; no external command calls
+are involved.
+
+=cut
+
+# Implemented in Git.xs.
+
+
+=back
+
+=head1 TODO
+
+This is still fairly crude.
+We need some good way to report errors back except just dying.
+
+=head1 COPYRIGHT
+
+Copyright 2006 by Petr Baudis E<lt>pasky@suse.czE<gt>.
+
+This module is free software; it may be used, copied, modified
+and distributed under the terms of the GNU General Public Licence,
+either version 2, or (at your option) any later version.
+
+=cut
+
+
+# Take raw method argument list and return ($obj, @args) in case
+# the method was called upon an instance and (undef, @args) if
+# it was called directly.
+sub _maybe_self {
+	# This breaks inheritance. Oh well.
+	ref $_[0] eq 'Git' ? @_ : (undef, @_);
+}
+
+# When already in the subprocess, set up the appropriate state
+# for the given repository and execute the git command.
+sub _cmd_exec {
+	my ($self, @args) = @_;
+	if ($self) {
+		$self->{opts}->{Repository} and $ENV{'GIT_DIR'} = $self->{opts}->{Repository};
+		$self->{opts}->{WorkingCopy} and chdir($self->{opts}->{WorkingCopy});
+	}
+	my $git = $self->{opts}->{GitPath};
+	$git ||= 'git';
+	exec ($git, @args) or croak "exec failed: $!";
+}
+
+# Close pipe to a subprocess.
+sub _cmd_close {
+	my ($fh) = @_;
+	if (not close $fh) {
+		if ($!) {
+			# It's just close, no point in fatalities
+			carp "error closing pipe: $!";
+		} else {
+			croak "exit status: $?";
+		}
+	}
+}
+
+
+# Trickery for .xs routines: In order to avoid having some horrid
+# C code trying to do stuff with undefs and hashes, we gate all
+# xs calls through the following and in case we are being ran upon
+# an instance call a C part of the gate which will set up the
+# environment properly.
+sub _call_gate {
+	my $xsfunc = shift;
+	my ($self, @args) = _maybe_self(@_);
+
+	if (defined $self) {
+		# XXX: We ignore the WorkingCopy! To properly support
+		# that will require heavy changes in libgit.
+
+		# XXX: And we ignore everything else as well. libgit
+		# at least needs to be extended to let us specify
+		# the $GIT_DIR instead of looking it up in environment.
+		#xs_call_gate($self->{opts}->{Repository});
+	}
+
+	&$xsfunc(@args);
+}
+
+sub AUTOLOAD {
+	my $xsname;
+	our $AUTOLOAD;
+	($xsname = $AUTOLOAD) =~ s/.*:://;
+	croak "&Git::$xsname not defined" if $xsname =~ /^xs_/;
+	$xsname = 'xs_'.$xsname;
+	_call_gate(\&$xsname, @_);
+}
+
+sub DESTROY { }
+
+
+1; # Famous last words
diff --git a/perl/Git.xs b/perl/Git.xs
new file mode 100644
index 0000000..3799ee9
--- /dev/null
+++ b/perl/Git.xs
@@ -0,0 +1,60 @@
+/* By carefully stacking #includes here (even if WE don't really need them)
+ * we strive to make the thing actually compile. Git header files aren't very
+ * nice. Perl headers are one of the signs of the coming apocalypse. */
+#include <ctype.h>
+/* Ok, it hasn't been so bad so far. */
+
+/* libgit interface */
+#include "../cache.h"
+
+/* XS and Perl interface */
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include "ppport.h"
+
+
+MODULE = Git		PACKAGE = Git		
+
+# /* TODO: xs_call_gate(). See Git.pm. */
+
+char *
+xs_hash_object(file, type = "blob")
+	SV *file;
+	char *type;
+CODE:
+	unsigned char sha1[20];
+
+	if (SvTYPE(file) == SVt_RV)
+		file = SvRV(file);
+
+	if (SvTYPE(file) == SVt_PVGV) {
+		/* Filehandle */
+		PerlIO *pio;
+
+		pio = IoIFP(sv_2io(file));
+		if (!pio)
+			croak("You passed me something weird - a dir glob?");
+		/* XXX: I just hope PerlIO didn't read anything from it yet.
+		 * --pasky */
+		if (index_pipe(sha1, PerlIO_fileno(pio), type, 0))
+			croak("Unable to hash given filehandle");
+		/* Avoid any nasty surprises. */
+		PerlIO_close(pio);
+
+	} else {
+		/* String */
+		char *path = SvPV_nolen(file);
+		int fd = open(path, O_RDONLY);
+		struct stat st;
+
+		if (fd < 0 ||
+		    fstat(fd, &st) < 0 ||
+		    index_fd(sha1, fd, &st, 0, type))
+			croak("Unable to hash %s", path);
+		close(fd);
+	}
+	RETVAL = sha1_to_hex(sha1);
+OUTPUT:
+	RETVAL
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
new file mode 100644
index 0000000..dd61056
--- /dev/null
+++ b/perl/Makefile.PL
@@ -0,0 +1,21 @@
+use ExtUtils::MakeMaker;
+
+sub MY::postamble {
+	return <<'MAKE_FRAG';
+instlibdir:
+	@echo $(INSTALLSITELIB)
+
+MAKE_FRAG
+}
+
+WriteMakefile(
+	NAME            => 'Git',
+	VERSION_FROM    => 'Git.pm',
+	MYEXTLIB        => '../libgit.a',
+	INC             => '-I. -I..',
+);
+
+
+use Devel::PPPort;
+
+-s 'ppport.h' or Devel::PPPort::WriteFile();

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
A person is just about as big as the things that make them angry.

^ permalink raw reply related	[relevance 6%]

* [PATCH 01/12] Introduce Git.pm (v4)
@ 2006-06-24  2:34  7% Petr Baudis
    0 siblings, 1 reply; 200+ results
From: Petr Baudis @ 2006-06-24  2:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This patch introduces a very basic and barebone Git.pm module
with a sketch of how the generic interface would look like;
most functions are missing, but this should give some good base.
I will continue expanding it.

Most desirable now is more careful error reporting, generic_in() for feeding
input to Git commands and the repository() constructor doing some poking
with git-rev-parse to get the git directory and subdirectory prefix.
Those three are basically the prerequisities for converting git-mv.
I will send them as follow-ups to this patch.

Currently Git.pm just wraps up exec()s of Git commands, but even that
is not trivial to get right and various Git perl scripts do it in
various inconsistent ways. In addition to Git.pm, there is now also
Git.xs which provides barebone Git.xs for directly interfacing with
libgit.a, and as an example providing the hash_object() function using
libgit.

This adds the Git module, integrates it to the build system and as
an example converts the git-fmt-merge-msg.perl script to it (the result
is not very impressive since its advantage is not quite apparent in this
one, but I just picked up the simplest Git user around).

Compared to v3, only very minor things were fixed in this patch (some
whitespaces, a missing export, tiny bug in git-fmt-merge-msg.perl);
at first I wanted to post them as a separate patch but since this
is still only in pu, I decided that it will be cleaner to just resend
the patch.

My current working state is available all the time at

	http://pasky.or.cz/~xpasky/git-perl/Git.pm

and an irregularily updated API documentation is at

	http://pasky.or.cz/~xpasky/git-perl/Git.html

Many thanks to Jakub Narebski, Junio and others for their feedback.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 Makefile               |   12 +
 git-fmt-merge-msg.perl |   13 +-
 perl/.gitignore        |    7 +
 perl/Git.pm            |  408 ++++++++++++++++++++++++++++++++++++++++++++++++
 perl/Git.xs            |   64 ++++++++
 perl/Makefile.PL       |   21 ++
 6 files changed, 516 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index a5b6784..4d20b22 100644
--- a/Makefile
+++ b/Makefile
@@ -476,7 +476,8 @@ ### Build rules
 
 all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk
 
-all:
+all: perl/Makefile
+	$(MAKE) -C perl
 	$(MAKE) -C templates
 
 strip: $(PROGRAMS) git$X
@@ -508,7 +509,7 @@ common-cmds.h: Documentation/git-*.txt
 
 $(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
 	rm -f $@ $@+
-	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	sed -e '1s|#!.*perl\(.*\)|#!$(PERL_PATH_SQ)\1 -I'"$$(make -s -C perl instlibdir)"'|' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    $@.perl >$@+
 	chmod +x $@+
@@ -594,6 +595,9 @@ XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare
 	rm -f $@ && $(AR) rcs $@ $(XDIFF_OBJS)
 
 
+perl/Makefile:	perl/Git.pm perl/Makefile.PL
+	(cd perl && $(PERL_PATH) Makefile.PL PREFIX="$(prefix)" DEFINE="$(ALL_CFLAGS)" LIBS="$(LIBS)")
+
 doc:
 	$(MAKE) -C Documentation all
 
@@ -649,6 +653,7 @@ install: all
 	$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
 	$(INSTALL) git$X gitk '$(DESTDIR_SQ)$(bindir_SQ)'
 	$(MAKE) -C templates install
+	$(MAKE) -C perl install
 	$(INSTALL) -d -m755 '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
 	$(INSTALL) $(PYMODULES) '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
 	if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \
@@ -716,7 +721,8 @@ clean:
 	rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
 	rm -f $(htmldocs).tar.gz $(manpages).tar.gz
 	$(MAKE) -C Documentation/ clean
-	$(MAKE) -C templates clean
+	[ ! -e perl/Makefile ] || $(MAKE) -C perl/ clean
+	$(MAKE) -C templates/ clean
 	$(MAKE) -C t/ clean
 	rm -f GIT-VERSION-FILE GIT-CFLAGS
 
diff --git a/git-fmt-merge-msg.perl b/git-fmt-merge-msg.perl
index 5986e54..be2a48c 100755
--- a/git-fmt-merge-msg.perl
+++ b/git-fmt-merge-msg.perl
@@ -6,6 +6,9 @@ # Read .git/FETCH_HEAD and make a human 
 # by grouping branches and tags together to form a single line.
 
 use strict;
+use Git;
+
+my $repo = Git->repository();
 
 my @src;
 my %src;
@@ -28,13 +31,12 @@ sub andjoin {
 }
 
 sub repoconfig {
-	my ($val) = qx{git-repo-config --get merge.summary};
+	my ($val) = $repo->command_oneline('repo-config', '--get', 'merge.summary');
 	return $val;
 }
 
 sub current_branch {
-	my ($bra) = qx{git-symbolic-ref HEAD};
-	chomp($bra);
+	my ($bra) = $repo->command_oneline('symbolic-ref', 'HEAD');
 	$bra =~ s|^refs/heads/||;
 	if ($bra ne 'master') {
 		$bra = " into $bra";
@@ -47,11 +49,10 @@ sub current_branch {
 sub shortlog {
 	my ($tip) = @_;
 	my @result;
-	foreach ( qx{git-log --no-merges --topo-order --pretty=oneline $tip ^HEAD} ) {
+	foreach ($repo->command('log', '--no-merges', '--topo-order', '--pretty=oneline', $tip, '^HEAD')) {
 		s/^[0-9a-f]{40}\s+//;
 		push @result, $_;
 	}
-	die "git-log failed\n" if $?;
 	return @result;
 }
 
@@ -168,6 +169,6 @@ for (@origin) {
 			print "  ...\n";
 			last;
 		}
-		print "  $log";
+		print "  $log\n";
 	}
 }
diff --git a/perl/.gitignore b/perl/.gitignore
new file mode 100644
index 0000000..6d778f3
--- /dev/null
+++ b/perl/.gitignore
@@ -0,0 +1,7 @@
+Git.bs
+Git.c
+Makefile
+blib
+blibdirs
+pm_to_blib
+ppport.h
diff --git a/perl/Git.pm b/perl/Git.pm
new file mode 100644
index 0000000..8fff785
--- /dev/null
+++ b/perl/Git.pm
@@ -0,0 +1,408 @@
+=head1 NAME
+
+Git - Perl interface to the Git version control system
+
+=cut
+
+
+package Git;
+
+use strict;
+
+
+BEGIN {
+
+our ($VERSION, @ISA, @EXPORT, @EXPORT_OK);
+
+# Totally unstable API.
+$VERSION = '0.01';
+
+
+=head1 SYNOPSIS
+
+  use Git;
+
+  my $version = Git::command_oneline('version');
+
+  Git::command_noisy('update-server-info');
+
+  my $repo = Git->repository (Directory => '/srv/git/cogito.git');
+
+
+  my @revs = $repo->command('rev-list', '--since=last monday', '--all');
+
+  my $fh = $repo->command_pipe('rev-list', '--since=last monday', '--all');
+  my $lastrev = <$fh>; chomp $lastrev;
+  close $fh; # You may want to test rev-list exit status here
+
+  my $lastrev = $repo->command_oneline('rev-list', '--all');
+
+=cut
+
+
+require Exporter;
+
+@ISA = qw(Exporter);
+
+@EXPORT = qw();
+
+# Methods which can be called as standalone functions as well:
+@EXPORT_OK = qw(command command_oneline command_pipe command_noisy
+                hash_object);
+
+
+=head1 DESCRIPTION
+
+This module provides Perl scripts easy way to interface the Git version control
+system. The modules have an easy and well-tested way to call arbitrary Git
+commands; in the future, the interface will also provide specialized methods
+for doing easily operations which are not totally trivial to do over
+the generic command interface.
+
+While some commands can be executed outside of any context (e.g. 'version'
+or 'init-db'), most operations require a repository context, which in practice
+means getting an instance of the Git object using the repository() constructor.
+(In the future, we will also get a new_repository() constructor.) All commands
+called as methods of the object are then executed in the context of the
+repository.
+
+TODO: In the future, we might also do
+
+	my $subdir = $repo->subdir('Documentation');
+	# Gets called in the subdirectory context:
+	$subdir->command('status');
+
+	my $remoterepo = $repo->remote_repository (Name => 'cogito', Branch => 'master');
+	$remoterepo ||= Git->remote_repository ('http://git.or.cz/cogito.git/');
+	my @refs = $remoterepo->refs();
+
+So far, all functions just die if anything goes wrong. If you don't want that,
+make appropriate provisions to catch the possible deaths. Better error recovery
+mechanisms will be provided in the future.
+
+Currently, the module merely wraps calls to external Git tools. In the future,
+it will provide a much faster way to interact with Git by linking directly
+to libgit. This should be completely opaque to the user, though (performance
+increate nonwithstanding).
+
+=cut
+
+
+use Carp qw(carp croak);
+
+require XSLoader;
+XSLoader::load('Git', $VERSION);
+
+}
+
+
+=head1 CONSTRUCTORS
+
+=over 4
+
+=item repository ( OPTIONS )
+
+=item repository ( DIRECTORY )
+
+=item repository ()
+
+Construct a new repository object.
+C<OPTIONS> are passed in a hash like fashion, using key and value pairs.
+Possible options are:
+
+B<Repository> - Path to the Git repository.
+
+B<WorkingCopy> - Path to the associated working copy; not strictly required
+as many commands will happily crunch on a bare repository.
+
+B<Directory> - Path to the Git working directory in its usual setup. This
+is just for convenient setting of both C<Repository> and C<WorkingCopy>
+at once: If the directory as a C<.git> subdirectory, C<Repository> is pointed
+to the subdirectory and the directory is assumed to be the working copy.
+If the directory does not have the subdirectory, C<WorkingCopy> is left
+undefined and C<Repository> is pointed to the directory itself.
+
+B<GitPath> - Path to the C<git> binary executable. By default the C<$PATH>
+is searched for it.
+
+You should not use both C<Directory> and either of C<Repository> and
+C<WorkingCopy> - the results of that are undefined.
+
+Alternatively, a directory path may be passed as a single scalar argument
+to the constructor; it is equivalent to setting only the C<Directory> option
+field.
+
+Calling the constructor with no options whatsoever is equivalent to
+calling it with C<< Directory => '.' >>.
+
+=cut
+
+sub repository {
+	my $class = shift;
+	my @args = @_;
+	my %opts = ();
+	my $self;
+
+	if (defined $args[0]) {
+		if ($#args % 2 != 1) {
+			# Not a hash.
+			$#args == 0 or croak "bad usage";
+			%opts = (Directory => $args[0]);
+		} else {
+			%opts = @args;
+		}
+
+		if ($opts{Directory}) {
+			-d $opts{Directory} or croak "Directory not found: $!";
+			if (-d $opts{Directory}."/.git") {
+				# TODO: Might make this more clever
+				$opts{WorkingCopy} = $opts{Directory};
+				$opts{Repository} = $opts{Directory}."/.git";
+			} else {
+				$opts{Repository} = $opts{Directory};
+			}
+			delete $opts{Directory};
+		}
+	}
+
+	$self = { opts => \%opts };
+	bless $self, $class;
+}
+
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item command ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given Git C<COMMAND> (specify it without the 'git-'
+prefix), optionally with the specified extra C<ARGUMENTS>.
+
+The method can be called without any instance or on a specified Git repository
+(in that case the command will be run in the repository context).
+
+In scalar context, it returns all the command output in a single string
+(verbatim).
+
+In array context, it returns an array containing lines printed to the
+command's stdout (without trailing newlines).
+
+In both cases, the command's stdin and stderr are the same as the caller's.
+
+=cut
+
+sub command {
+	my $fh = command_pipe(@_);
+
+	if (not defined wantarray) {
+		_cmd_close($fh);
+
+	} elsif (not wantarray) {
+		local $/;
+		my $text = <$fh>;
+		_cmd_close($fh);
+		return $text;
+
+	} else {
+		my @lines = <$fh>;
+		_cmd_close($fh);
+		chomp @lines;
+		return @lines;
+	}
+}
+
+
+=item command_oneline ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given C<COMMAND> in the same way as command()
+does but always return a scalar string containing the first line
+of the command's standard output.
+
+=cut
+
+sub command_oneline {
+	my $fh = command_pipe(@_);
+
+	my $line = <$fh>;
+	_cmd_close($fh);
+
+	chomp $line;
+	return $line;
+}
+
+
+=item command_pipe ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given C<COMMAND> in the same way as command()
+does but return a pipe filehandle from which the command output can be
+read.
+
+=cut
+
+sub command_pipe {
+	my ($self, $cmd, @args) = _maybe_self(@_);
+
+	$cmd =~ /^[a-z0-9A-Z_-]+$/ or croak "bad command: $cmd";
+
+	my $pid = open(my $fh, "-|");
+	if (not defined $pid) {
+		croak "open failed: $!";
+	} elsif ($pid == 0) {
+		_cmd_exec($self, $cmd, @args);
+	}
+	return $fh;
+}
+
+
+=item command_noisy ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given C<COMMAND> in the same way as command() does but do not
+capture the command output - the standard output is not redirected and goes
+to the standard output of the caller application.
+
+While the method is called command_noisy(), you might want to as well use
+it for the most silent Git commands which you know will never pollute your
+stdout but you want to avoid the overhead of the pipe setup when calling them.
+
+The function returns only after the command has finished running.
+
+=cut
+
+sub command_noisy {
+	my ($self, $cmd, @args) = _maybe_self(@_);
+
+	$cmd =~ /^[a-z0-9A-Z_-]+$/ or croak "bad command: $cmd";
+
+	my $pid = fork;
+	if (not defined $pid) {
+		croak "fork failed: $!";
+	} elsif ($pid == 0) {
+		_cmd_exec($self, $cmd, @args);
+	}
+	if (waitpid($pid, 0) > 0 and $? != 0) {
+		croak "exit status: $?";
+	}
+}
+
+
+=item hash_object ( FILENAME [, TYPE ] )
+
+=item hash_object ( FILEHANDLE [, TYPE ] )
+
+Compute the SHA1 object id of the given C<FILENAME> (or data waiting in
+C<FILEHANDLE>) considering it is of the C<TYPE> object type (C<blob>
+(default), C<commit>, C<tree>).
+
+In case of C<FILEHANDLE> passed instead of file name, all the data
+available are read and hashed, and the filehandle is automatically
+closed. The file handle should be freshly opened - if you have already
+read anything from the file handle, the results are undefined (since
+this function works directly with the file descriptor and internal
+PerlIO buffering might have messed things up).
+
+The method can be called without any instance or on a specified Git repository,
+it makes zero difference.
+
+The function returns the SHA1 hash.
+
+Implementation of this function is very fast; no external command calls
+are involved.
+
+=cut
+
+# Implemented in Git.xs.
+
+
+=back
+
+=head1 TODO
+
+This is still fairly crude.
+We need some good way to report errors back except just dying.
+
+=head1 COPYRIGHT
+
+Copyright 2006 by Petr Baudis E<lt>pasky@suse.czE<gt>.
+
+This module is free software; it may be used, copied, modified
+and distributed under the terms of the GNU General Public Licence,
+either version 2, or (at your option) any later version.
+
+=cut
+
+
+# Take raw method argument list and return ($obj, @args) in case
+# the method was called upon an instance and (undef, @args) if
+# it was called directly.
+sub _maybe_self {
+	# This breaks inheritance. Oh well.
+	ref $_[0] eq 'Git' ? @_ : (undef, @_);
+}
+
+# When already in the subprocess, set up the appropriate state
+# for the given repository and execute the git command.
+sub _cmd_exec {
+	my ($self, @args) = @_;
+	if ($self) {
+		$self->{opts}->{Repository} and $ENV{'GIT_DIR'} = $self->{opts}->{Repository};
+		$self->{opts}->{WorkingCopy} and chdir($self->{opts}->{WorkingCopy});
+	}
+	my $git = $self->{opts}->{GitPath};
+	$git ||= 'git';
+	exec ($git, @args) or croak "exec failed: $!";
+}
+
+# Close pipe to a subprocess.
+sub _cmd_close {
+	my ($fh) = @_;
+	if (not close $fh) {
+		if ($!) {
+			# It's just close, no point in fatalities
+			carp "error closing pipe: $!";
+		} elsif ($? >> 8) {
+			croak "exit status: ".($? >> 8);
+		}
+		# else we might e.g. closed a live stream; the command
+		# dying of SIGPIPE would drive us here.
+	}
+}
+
+
+# Trickery for .xs routines: In order to avoid having some horrid
+# C code trying to do stuff with undefs and hashes, we gate all
+# xs calls through the following and in case we are being ran upon
+# an instance call a C part of the gate which will set up the
+# environment properly.
+sub _call_gate {
+	my $xsfunc = shift;
+	my ($self, @args) = _maybe_self(@_);
+
+	if (defined $self) {
+		# XXX: We ignore the WorkingCopy! To properly support
+		# that will require heavy changes in libgit.
+
+		# XXX: And we ignore everything else as well. libgit
+		# at least needs to be extended to let us specify
+		# the $GIT_DIR instead of looking it up in environment.
+		#xs_call_gate($self->{opts}->{Repository});
+	}
+
+	&$xsfunc(@args);
+}
+
+sub AUTOLOAD {
+	my $xsname;
+	our $AUTOLOAD;
+	($xsname = $AUTOLOAD) =~ s/.*:://;
+	croak "&Git::$xsname not defined" if $xsname =~ /^xs_/;
+	$xsname = 'xs_'.$xsname;
+	_call_gate(\&$xsname, @_);
+}
+
+sub DESTROY { }
+
+
+1; # Famous last words
diff --git a/perl/Git.xs b/perl/Git.xs
new file mode 100644
index 0000000..9885e2c
--- /dev/null
+++ b/perl/Git.xs
@@ -0,0 +1,64 @@
+/* By carefully stacking #includes here (even if WE don't really need them)
+ * we strive to make the thing actually compile. Git header files aren't very
+ * nice. Perl headers are one of the signs of the coming apocalypse. */
+#include <ctype.h>
+/* Ok, it hasn't been so bad so far. */
+
+/* libgit interface */
+#include "../cache.h"
+
+/* XS and Perl interface */
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include "ppport.h"
+
+
+MODULE = Git		PACKAGE = Git		
+
+PROTOTYPES: DISABLE
+
+# /* TODO: xs_call_gate(). See Git.pm. */
+
+char *
+xs_hash_object(file, type = "blob")
+	SV *file;
+	char *type;
+CODE:
+{
+	unsigned char sha1[20];
+
+	if (SvTYPE(file) == SVt_RV)
+		file = SvRV(file);
+
+	if (SvTYPE(file) == SVt_PVGV) {
+		/* Filehandle */
+		PerlIO *pio;
+
+		pio = IoIFP(sv_2io(file));
+		if (!pio)
+			croak("You passed me something weird - a dir glob?");
+		/* XXX: I just hope PerlIO didn't read anything from it yet.
+		 * --pasky */
+		if (index_pipe(sha1, PerlIO_fileno(pio), type, 0))
+			croak("Unable to hash given filehandle");
+		/* Avoid any nasty surprises. */
+		PerlIO_close(pio);
+
+	} else {
+		/* String */
+		char *path = SvPV_nolen(file);
+		int fd = open(path, O_RDONLY);
+		struct stat st;
+
+		if (fd < 0 ||
+		    fstat(fd, &st) < 0 ||
+		    index_fd(sha1, fd, &st, 0, type))
+			croak("Unable to hash %s", path);
+		close(fd);
+	}
+	RETVAL = sha1_to_hex(sha1);
+}
+OUTPUT:
+	RETVAL
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
new file mode 100644
index 0000000..dd61056
--- /dev/null
+++ b/perl/Makefile.PL
@@ -0,0 +1,21 @@
+use ExtUtils::MakeMaker;
+
+sub MY::postamble {
+	return <<'MAKE_FRAG';
+instlibdir:
+	@echo $(INSTALLSITELIB)
+
+MAKE_FRAG
+}
+
+WriteMakefile(
+	NAME            => 'Git',
+	VERSION_FROM    => 'Git.pm',
+	MYEXTLIB        => '../libgit.a',
+	INC             => '-I. -I..',
+);
+
+
+use Devel::PPPort;
+
+-s 'ppport.h' or Devel::PPPort::WriteFile();

^ permalink raw reply related	[relevance 7%]

* [PATCH] Introduce Git.pm (v3)
@ 2006-06-22 22:02  7% Petr Baudis
    0 siblings, 1 reply; 200+ results
From: Petr Baudis @ 2006-06-22 22:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This patch introduces a very basic and barebone Git.pm module
with a sketch of how the generic interface would look like;
most functions are missing, but this should give some good base.
I will continue expanding it.

Most desirable now is more careful error reporting, generic_in() for feeding
input to Git commands and the repository() constructor doing some poking
with git-rev-parse to get the git directory and subdirectory prefix.
Those three are basically the prerequisities for converting git-mv.

Currently Git.pm just wraps up exec()s of Git commands, but even that
is not trivial to get right and various Git perl scripts do it in
various inconsistent ways. In addition to Git.pm, there is now also
Git.xs which provides barebone Git.xs for directly interfacing with
libgit.a, and as an example providing the hash_object() function using
libgit.

This adds the Git module, integrates it to the build system and as
an example converts the git-fmt-merge-msg.perl script to it (the result
is not very impressive since its advantage is not quite apparent in this
one, but I just picked up the simplest Git user around).

The changes since v1 are:

	* s/generic/command/ in the API, added command_pipe() and
	  changed behaviour of command() in the scalar context
	* Added hash_object() and Git.xs providing the fast implementation
	* Better error reporting
	* Plenty of random minor stuff

It's a good thing v2 didn't make it to the list since it contained a huge
file which turns out that can be autogenerated at the build time, so v3
just changes that (and adds .gitignore file and makes some other minor
changes).

I consider this patch "stable" now. Further enhancements will be posted
as patches on top of this.

My current working state is available all the time at

	http://pasky.or.cz/~xpasky/git-perl/Git.pm

and an irregularily updated API documentation is at

	http://pasky.or.cz/~xpasky/git-perl/Git.html

Many thanks to Jakub Narebski, Junio and others for their feedback.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 Makefile               |   12 +
 git-fmt-merge-msg.perl |   10 +
 perl/.gitignore        |    7 +
 perl/Git.pm            |  401 ++++++++++++++++++++++++++++++++++++++++++++++++
 perl/Git.xs            |   60 +++++++
 perl/Makefile.PL       |   21 +++
 6 files changed, 504 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index a5b6784..4d20b22 100644
--- a/Makefile
+++ b/Makefile
@@ -476,7 +476,8 @@ ### Build rules
 
 all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk
 
-all:
+all: perl/Makefile
+	$(MAKE) -C perl
 	$(MAKE) -C templates
 
 strip: $(PROGRAMS) git$X
@@ -508,7 +509,7 @@ common-cmds.h: Documentation/git-*.txt
 
 $(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
 	rm -f $@ $@+
-	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	sed -e '1s|#!.*perl\(.*\)|#!$(PERL_PATH_SQ)\1 -I'"$$(make -s -C perl instlibdir)"'|' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    $@.perl >$@+
 	chmod +x $@+
@@ -594,6 +595,9 @@ XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare
 	rm -f $@ && $(AR) rcs $@ $(XDIFF_OBJS)
 
 
+perl/Makefile:	perl/Git.pm perl/Makefile.PL
+	(cd perl && $(PERL_PATH) Makefile.PL PREFIX="$(prefix)" DEFINE="$(ALL_CFLAGS)" LIBS="$(LIBS)")
+
 doc:
 	$(MAKE) -C Documentation all
 
@@ -649,6 +653,7 @@ install: all
 	$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
 	$(INSTALL) git$X gitk '$(DESTDIR_SQ)$(bindir_SQ)'
 	$(MAKE) -C templates install
+	$(MAKE) -C perl install
 	$(INSTALL) -d -m755 '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
 	$(INSTALL) $(PYMODULES) '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
 	if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \
@@ -716,7 +721,8 @@ clean:
 	rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
 	rm -f $(htmldocs).tar.gz $(manpages).tar.gz
 	$(MAKE) -C Documentation/ clean
-	$(MAKE) -C templates clean
+	[ ! -e perl/Makefile ] || $(MAKE) -C perl/ clean
+	$(MAKE) -C templates/ clean
 	$(MAKE) -C t/ clean
 	rm -f GIT-VERSION-FILE GIT-CFLAGS
 
diff --git a/git-fmt-merge-msg.perl b/git-fmt-merge-msg.perl
index 5986e54..c32cafb 100755
--- a/git-fmt-merge-msg.perl
+++ b/git-fmt-merge-msg.perl
@@ -6,6 +6,9 @@ # Read .git/FETCH_HEAD and make a human 
 # by grouping branches and tags together to form a single line.
 
 use strict;
+use Git;
+
+my $repo = Git->repository();
 
 my @src;
 my %src;
@@ -28,13 +31,12 @@ sub andjoin {
 }
 
 sub repoconfig {
-	my ($val) = qx{git-repo-config --get merge.summary};
+	my ($val) = $repo->command_oneline('repo-config', '--get', 'merge.summary');
 	return $val;
 }
 
 sub current_branch {
-	my ($bra) = qx{git-symbolic-ref HEAD};
-	chomp($bra);
+	my ($bra) = $repo->command_oneline('symbolic-ref', 'HEAD');
 	$bra =~ s|^refs/heads/||;
 	if ($bra ne 'master') {
 		$bra = " into $bra";
@@ -47,7 +49,7 @@ sub current_branch {
 sub shortlog {
 	my ($tip) = @_;
 	my @result;
-	foreach ( qx{git-log --no-merges --topo-order --pretty=oneline $tip ^HEAD} ) {
+	foreach ($repo->command('log', '--no-merges', '--topo-order', '--pretty=oneline', $tip, '^HEAD')) {
 		s/^[0-9a-f]{40}\s+//;
 		push @result, $_;
 	}
diff --git a/perl/.gitignore b/perl/.gitignore
new file mode 100644
index 0000000..6d778f3
--- /dev/null
+++ b/perl/.gitignore
@@ -0,0 +1,7 @@
+Git.bs
+Git.c
+Makefile
+blib
+blibdirs
+pm_to_blib
+ppport.h
diff --git a/perl/Git.pm b/perl/Git.pm
new file mode 100644
index 0000000..4bb7c50
--- /dev/null
+++ b/perl/Git.pm
@@ -0,0 +1,401 @@
+=head1 NAME
+
+Git - Perl interface to the Git version control system
+
+=cut
+
+
+package Git;
+
+use strict;
+
+
+BEGIN {
+
+our ($VERSION, @ISA, @EXPORT, @EXPORT_OK);
+
+# Totally unstable API.
+$VERSION = '0.01';
+
+
+=head1 SYNOPSIS
+
+  use Git;
+
+  my $version = Git::command_oneline('version');
+
+  Git::command_noisy('update-server-info');
+
+  my $repo = Git->repository (Directory => '/srv/git/cogito.git');
+
+
+  my @revs = $repo->command('rev-list', '--since=last monday', '--all');
+
+  my $fh = $repo->command_pipe('rev-list', '--since=last monday', '--all');
+  my $lastrev = <$fh>; chomp $lastrev;
+  close $fh; # You may want to test rev-list exit status here
+
+  my $lastrev = $repo->command_oneline('rev-list', '--all');
+
+=cut
+
+
+require Exporter;
+
+@ISA = qw(Exporter);
+
+@EXPORT = qw();
+
+# Methods which can be called as standalone functions as well:
+@EXPORT_OK = qw(command command_oneline command_pipe command_noisy);
+
+
+=head1 DESCRIPTION
+
+This module provides Perl scripts easy way to interface the Git version control
+system. The modules have an easy and well-tested way to call arbitrary Git
+commands; in the future, the interface will also provide specialized methods
+for doing easily operations which are not totally trivial to do over
+the generic command interface.
+
+While some commands can be executed outside of any context (e.g. 'version'
+or 'init-db'), most operations require a repository context, which in practice
+means getting an instance of the Git object using the repository() constructor.
+(In the future, we will also get a new_repository() constructor.) All commands
+called as methods of the object are then executed in the context of the
+repository.
+
+TODO: In the future, we might also do
+
+	my $subdir = $repo->subdir('Documentation');
+	# Gets called in the subdirectory context:
+	$subdir->command('status');
+
+	my $remoterepo = $repo->remote_repository (name => 'cogito', branch => 'master');
+	$remoterepo ||= Git->remote_repository ('http://git.or.cz/cogito.git/');
+	my @refs = $remoterepo->refs();
+
+So far, all functions just die if anything goes wrong. If you don't want that,
+make appropriate provisions to catch the possible deaths. Better error recovery
+mechanisms will be provided in the future.
+
+Currently, the module merely wraps calls to external Git tools. In the future,
+it will provide a much faster way to interact with Git by linking directly
+to libgit. This should be completely opaque to the user, though (performance
+increate nonwithstanding).
+
+=cut
+
+
+use Carp qw(carp croak);
+
+require XSLoader;
+XSLoader::load('Git', $VERSION);
+
+}
+
+
+=head1 CONSTRUCTORS
+
+=over 4
+
+=item repository ( OPTIONS )
+
+=item repository ( DIRECTORY )
+
+=item repository ()
+
+Construct a new repository object.
+C<OPTIONS> are passed in a hash like fashion, using key and value pairs.
+Possible options are:
+
+B<Repository> - Path to the Git repository.
+
+B<WorkingCopy> - Path to the associated working copy; not strictly required
+as many commands will happily crunch on a bare repository.
+
+B<Directory> - Path to the Git working directory in its usual setup. This
+is just for convenient setting of both C<Repository> and C<WorkingCopy>
+at once: If the directory as a C<.git> subdirectory, C<Repository> is pointed
+to the subdirectory and the directory is assumed to be the working copy.
+If the directory does not have the subdirectory, C<WorkingCopy> is left
+undefined and C<Repository> is pointed to the directory itself.
+
+B<GitPath> - Path to the C<git> binary executable. By default the C<$PATH>
+is searched for it.
+
+You should not use both C<Directory> and either of C<Repository> and
+C<WorkingCopy> - the results of that are undefined.
+
+Alternatively, a directory path may be passed as a single scalar argument
+to the constructor; it is equivalent to setting only the C<Directory> option
+field.
+
+Calling the constructor with no options whatsoever is equivalent to
+calling it with C<< Directory => '.' >>.
+
+=cut
+
+sub repository {
+	my $class = shift;
+	my @args = @_;
+	my %opts = ();
+	my $self;
+
+	if (defined $args[0]) {
+		if ($#args % 2 != 1) {
+			# Not a hash.
+			$#args == 0 or croak "bad usage";
+			%opts = (Directory => $args[0]);
+		} else {
+			%opts = @args;
+		}
+
+		if ($opts{Directory}) {
+			-d $opts{Directory} or croak "Directory not found: $!";
+			if (-d $opts{Directory}."/.git") {
+				# TODO: Might make this more clever
+				$opts{WorkingCopy} = $opts{Directory};
+				$opts{Repository} = $opts{Directory}."/.git";
+			} else {
+				$opts{Repository} = $opts{Directory};
+			}
+			delete $opts{Directory};
+		}
+	}
+
+	$self = { opts => \%opts };
+	bless $self, $class;
+}
+
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item command ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given Git C<COMMAND> (specify it without the 'git-'
+prefix), optionally with the specified extra C<ARGUMENTS>.
+
+The method can be called without any instance or on a specified Git repository
+(in that case the command will be run in the repository context).
+
+In scalar context, it returns all the command output in a single string
+(verbatim).
+
+In array context, it returns an array containing lines printed to the
+command's stdout (without trailing newlines).
+
+In both cases, the command's stdin and stderr are the same as the caller's.
+
+=cut
+
+sub command {
+	my $fh = command_pipe(@_);
+
+	if (not defined wantarray) {
+		_cmd_close($fh);
+
+	} elsif (not wantarray) {
+		local $/;
+		my $text = <$fh>;
+		_cmd_close($fh);
+		return $text;
+
+	} else {
+		my @lines = <$fh>;
+		_cmd_close($fh);
+		chomp @lines;
+		return @lines;
+	}
+}
+
+=item command_oneline ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given C<COMMAND> in the same way as command()
+does but always return a scalar string containing the first line
+of the command's standard output.
+
+=cut
+
+sub command_oneline {
+	my $fh = command_pipe(@_);
+
+	my $line = <$fh>;
+	_cmd_close($fh);
+
+	chomp $line;
+	return $line;
+}
+
+=item command_pipe ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given C<COMMAND> in the same way as command()
+does but return a pipe filehandle from which the command output can be
+read.
+
+=cut
+
+sub command_pipe {
+	my ($self, $cmd, @args) = _maybe_self(@_);
+
+	$cmd =~ /^[a-z0-9A-Z_-]+$/ or croak "bad command: $cmd";
+
+	my $pid = open(my $fh, "-|");
+	if (not defined $pid) {
+		croak "open failed: $!";
+	} elsif ($pid == 0) {
+		_cmd_exec($self, $cmd, @args);
+	}
+	return $fh;
+}
+
+=item command_noisy ( COMMAND [, ARGUMENTS... ] )
+
+Execute the given C<COMMAND> in the same way as command() does but do not
+capture the command output - the standard output is not redirected and goes
+to the standard output of the caller application.
+
+While the method is called command_noisy(), you might want to as well use
+it for the most silent Git commands which you know will never pollute your
+stdout but you want to avoid the overhead of the pipe setup when calling them.
+
+The function returns only after the command has finished running.
+
+=cut
+
+sub command_noisy {
+	my ($self, $cmd, @args) = _maybe_self(@_);
+
+	$cmd =~ /^[a-z0-9A-Z_-]+$/ or croak "bad command: $cmd";
+
+	my $pid = fork;
+	if (not defined $pid) {
+		croak "fork failed: $!";
+	} elsif ($pid == 0) {
+		_cmd_exec($self, $cmd, @args);
+	}
+	if (waitpid($pid, 0) > 0 and $? != 0) {
+		croak "exit status: $?";
+	}
+}
+
+=item hash_object ( FILENAME [, TYPE ] )
+
+=item hash_object ( FILEHANDLE [, TYPE ] )
+
+Compute the SHA1 object id of the given C<FILENAME> (or data waiting in
+C<FILEHANDLE>) considering it is of the C<TYPE> object type (C<blob>
+(default), C<commit>, C<tree>).
+
+In case of C<FILEHANDLE> passed instead of file name, all the data
+available are read and hashed, and the filehandle is automatically
+closed. The file handle should be freshly opened - if you have already
+read anything from the file handle, the results are undefined (since
+this function works directly with the file descriptor and internal
+PerlIO buffering might have messed things up).
+
+The method can be called without any instance or on a specified Git repository,
+it makes zero difference.
+
+The function returns the SHA1 hash.
+
+Implementation of this function is very fast; no external command calls
+are involved.
+
+=cut
+
+# Implemented in Git.xs.
+
+
+=back
+
+=head1 TODO
+
+This is still fairly crude.
+We need some good way to report errors back except just dying.
+
+=head1 COPYRIGHT
+
+Copyright 2006 by Petr Baudis E<lt>pasky@suse.czE<gt>.
+
+This module is free software; it may be used, copied, modified
+and distributed under the terms of the GNU General Public Licence,
+either version 2, or (at your option) any later version.
+
+=cut
+
+
+# Take raw method argument list and return ($obj, @args) in case
+# the method was called upon an instance and (undef, @args) if
+# it was called directly.
+sub _maybe_self {
+	# This breaks inheritance. Oh well.
+	ref $_[0] eq 'Git' ? @_ : (undef, @_);
+}
+
+# When already in the subprocess, set up the appropriate state
+# for the given repository and execute the git command.
+sub _cmd_exec {
+	my ($self, @args) = @_;
+	if ($self) {
+		$self->{opts}->{Repository} and $ENV{'GIT_DIR'} = $self->{opts}->{Repository};
+		$self->{opts}->{WorkingCopy} and chdir($self->{opts}->{WorkingCopy});
+	}
+	my $git = $self->{opts}->{GitPath};
+	$git ||= 'git';
+	exec ($git, @args) or croak "exec failed: $!";
+}
+
+# Close pipe to a subprocess.
+sub _cmd_close {
+	my ($fh) = @_;
+	if (not close $fh) {
+		if ($!) {
+			# It's just close, no point in fatalities
+			carp "error closing pipe: $!";
+		} else {
+			croak "exit status: $?";
+		}
+	}
+}
+
+
+# Trickery for .xs routines: In order to avoid having some horrid
+# C code trying to do stuff with undefs and hashes, we gate all
+# xs calls through the following and in case we are being ran upon
+# an instance call a C part of the gate which will set up the
+# environment properly.
+sub _call_gate {
+	my $xsfunc = shift;
+	my ($self, @args) = _maybe_self(@_);
+
+	if (defined $self) {
+		# XXX: We ignore the WorkingCopy! To properly support
+		# that will require heavy changes in libgit.
+
+		# XXX: And we ignore everything else as well. libgit
+		# at least needs to be extended to let us specify
+		# the $GIT_DIR instead of looking it up in environment.
+		#xs_call_gate($self->{opts}->{Repository});
+	}
+
+	&$xsfunc(@args);
+}
+
+sub AUTOLOAD {
+	my $xsname;
+	our $AUTOLOAD;
+	($xsname = $AUTOLOAD) =~ s/.*:://;
+	croak "&Git::$xsname not defined" if $xsname =~ /^xs_/;
+	$xsname = 'xs_'.$xsname;
+	_call_gate(\&$xsname, @_);
+}
+
+sub DESTROY { }
+
+
+1; # Famous last words
diff --git a/perl/Git.xs b/perl/Git.xs
new file mode 100644
index 0000000..33bb3ca
--- /dev/null
+++ b/perl/Git.xs
@@ -0,0 +1,60 @@
+/* By carefully stacking #includes here (even if WE don't really need them)
+ * we strive to make the thing actually compile. Git header files aren't very
+ * nice. Perl headers are one of the signs of the coming apocalypse. */
+#include <ctype.h>
+/* Ok, it hasn't been so bad so far. */
+
+/* libgit interface */
+#include "../cache.h"
+
+/* XS and Perl interface */
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include "ppport.h"
+
+
+MODULE = Git		PACKAGE = Git		
+
+# /* TODO: xs_call_gate(). See Git.pm. */
+
+char *
+xs_hash_object(file, type = "blob")
+	SV *file;
+	char *type;
+CODE:
+	unsigned char sha1[20];
+
+	if (SvTYPE(file) == SVt_RV)
+		file = SvRV(file);
+
+	if (SvTYPE(file) == SVt_PVGV) {
+		/* Filehandle */
+		PerlIO *pio;
+
+		pio = IoIFP(sv_2io(file));
+		if (!pio)
+			croak("You passed me something weird - a dir glob?");
+		/* XXX: I just hope PerlIO didn't read anything from it yet.
+		 * --pasky */
+		if (index_pipe(sha1, PerlIO_fileno(pio), type, 0))
+			croak("Unable to hash given filehandle");
+		/* Avoid any nasty surprises. */
+		Perl_io_close(sv_2io(file), 1);
+
+	} else {
+		/* String */
+		char *path = SvPV_nolen(file);
+		int fd = open(path, O_RDONLY);
+		struct stat st;
+
+		if (fd < 0 ||
+		    fstat(fd, &st) < 0 ||
+		    index_fd(sha1, fd, &st, 0, type))
+			croak("Unable to hash %s", path);
+		close(fd);
+	}
+	RETVAL = sha1_to_hex(sha1);
+OUTPUT:
+	RETVAL
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
new file mode 100644
index 0000000..dd61056
--- /dev/null
+++ b/perl/Makefile.PL
@@ -0,0 +1,21 @@
+use ExtUtils::MakeMaker;
+
+sub MY::postamble {
+	return <<'MAKE_FRAG';
+instlibdir:
+	@echo $(INSTALLSITELIB)
+
+MAKE_FRAG
+}
+
+WriteMakefile(
+	NAME            => 'Git',
+	VERSION_FROM    => 'Git.pm',
+	MYEXTLIB        => '../libgit.a',
+	INC             => '-I. -I..',
+);
+
+
+use Devel::PPPort;
+
+-s 'ppport.h' or Devel::PPPort::WriteFile();

^ permalink raw reply related	[relevance 7%]

* Re: Using VC build git (split patch)
@ 2009-08-17 13:13  7% Frank Li
  0 siblings, 0 replies; 200+ results
From: Frank Li @ 2009-08-17 13:13 UTC (permalink / raw)
  To: git, msysGit; +Cc: Johannes Schindelin

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

Thanks Dscho for reviewing my patch patient.
I split my patch and read SumbittingPatchs.

I try to use git format-patch -M --stdout origin/master | git
imap-send to send patch directly according to guide.
But imap-send has not ported to msysgit.

[-- Attachment #2: 0011-Add-gitignore-and-ReadMe-file-for-MSVC-Build.patch --]
[-- Type: application/octet-stream, Size: 1319 bytes --]

From 2d5f52081d4d8916185ee2885cbf86604a9f54f3 Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Mon, 17 Aug 2009 15:00:45 +0800
Subject: [PATCH 11/11] Add gitignore and ReadMe file for MSVC Build

Add ReadMe to user how to build git with MSVC.
Add gitignore to filter out files created file by MSVC.

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/vcbuild/.gitignore |    3 +++
 compat/vcbuild/ReadMe     |   13 +++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 compat/vcbuild/.gitignore
 create mode 100644 compat/vcbuild/ReadMe

diff --git a/compat/vcbuild/.gitignore b/compat/vcbuild/.gitignore
new file mode 100644
index 0000000..7796990
--- /dev/null
+++ b/compat/vcbuild/.gitignore
@@ -0,0 +1,3 @@
+Debug
+Release
+*.user
\ No newline at end of file
diff --git a/compat/vcbuild/ReadMe b/compat/vcbuild/ReadMe
new file mode 100644
index 0000000..47c089e
--- /dev/null
+++ b/compat/vcbuild/ReadMe
@@ -0,0 +1,13 @@
+The Steps of Build Git with VS2008
+
+1. Create VC Build Environment.
+
+   git clone git://repo.or.cz/gitbuild.git
+
+   gitbuild include VS solution file and library such as zlib.
+ 
+2. Get Submodule
+  
+   git submodule update
+
+3. Open gitbuild\gitbuild.sln with VS2008. Then press F7.
\ No newline at end of file
-- 
1.6.4.msysgit.0


[-- Attachment #3: 0001-Fix-build-failure-at-VC-because-function-declare-use.patch --]
[-- Type: application/octet-stream, Size: 1005 bytes --]

From ceb73fc1cd4c32d30c2fd534009c507cf18704fa Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Sun, 16 Aug 2009 13:15:18 +0800
Subject: [PATCH 01/11] Fix build failure at VC because function declare use old style at regex.c

regerror declare function argument type after function define.

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/regex/regex.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/compat/regex/regex.c b/compat/regex/regex.c
index 5ea0075..5728de1 100644
--- a/compat/regex/regex.c
+++ b/compat/regex/regex.c
@@ -4852,11 +4852,7 @@ regexec (preg, string, nmatch, pmatch, eflags)
    from either regcomp or regexec.   We don't use PREG here.  */
 
 size_t
-regerror (errcode, preg, errbuf, errbuf_size)
-    int errcode;
-    const regex_t *preg;
-    char *errbuf;
-    size_t errbuf_size;
+regerror (int errcode, const regex_t * preg, char * errbuf,size_t errbuf_size)
 {
   const char *msg;
   size_t msg_size;
-- 
1.6.4.msysgit.0


[-- Attachment #4: 0002-Fix-declare-variable-at-mid-of-function.patch --]
[-- Type: application/octet-stream, Size: 3156 bytes --]

From 753c6790df6eca740c2d708c19301d117fbbb085 Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Sun, 16 Aug 2009 13:34:03 +0800
Subject: [PATCH 02/11] Fix declare variable at mid of function

Some compiler such as MSVC can't support declear variable at mid of funtion at c file.

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/mingw.c |   16 ++++++++++++----
 help.c         |    3 ++-
 run-command.c  |    2 ++
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index bed4178..75c74b1 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -123,13 +123,17 @@ int mingw_open (const char *filename, int oflags, ...)
 {
 	va_list args;
 	unsigned mode;
+	int fd;
+
 	va_start(args, oflags);
 	mode = va_arg(args, int);
 	va_end(args);
 
 	if (!strcmp(filename, "/dev/null"))
 		filename = "nul";
-	int fd = open(filename, oflags, mode);
+
+	fd = open(filename, oflags, mode);
+
 	if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {
 		DWORD attrs = GetFileAttributes(filename);
 		if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY))
@@ -580,10 +584,11 @@ static char **get_path_split(void)
 
 static void free_path_split(char **path)
 {
+	char **p = path;
+
 	if (!path)
 		return;
 
-	char **p = path;
 	while (*p)
 		free(*p++);
 	free(path);
@@ -1108,9 +1113,11 @@ int sigaction(int sig, struct sigaction *in, struct sigaction *out)
 #undef signal
 sig_handler_t mingw_signal(int sig, sig_handler_t handler)
 {
+	sig_handler_t old;
+
 	if (sig != SIGALRM)
 		return signal(sig, handler);
-	sig_handler_t old = timer_fn;
+	old = timer_fn;
 	timer_fn = handler;
 	return old;
 }
@@ -1197,8 +1204,9 @@ struct dirent *mingw_readdir(DIR *dir)
 
 	if (dir->dd_handle == (long)INVALID_HANDLE_VALUE && dir->dd_stat == 0)
 	{
+		DWORD lasterr;
 		handle = FindFirstFileA(dir->dd_name, &buf);
-		DWORD lasterr = GetLastError();
+		lasterr = GetLastError();
 		dir->dd_handle = (long)handle;
 		if (handle == INVALID_HANDLE_VALUE && (lasterr != ERROR_NO_MORE_FILES)) {
 			errno = err_win_to_posix(lasterr);
diff --git a/help.c b/help.c
index 6c46d8b..399b0b4 100644
--- a/help.c
+++ b/help.c
@@ -127,7 +127,7 @@ static int is_executable(const char *name)
 		return 0;
 
 #ifdef __MINGW32__
-	/* cannot trust the executable bit, peek into the file instead */
+{	/* cannot trust the executable bit, peek into the file instead */
 	char buf[3] = { 0 };
 	int n;
 	int fd = open(name, O_RDONLY);
@@ -140,6 +140,7 @@ static int is_executable(const char *name)
 				st.st_mode |= S_IXUSR;
 		close(fd);
 	}
+}
 #endif
 	return st.st_mode & S_IXUSR;
 }
diff --git a/run-command.c b/run-command.c
index ff3d8e2..d1df7ab 100644
--- a/run-command.c
+++ b/run-command.c
@@ -123,6 +123,7 @@ int start_command(struct child_process *cmd)
 		exit(127);
 	}
 #else
+{
 	int s0 = -1, s1 = -1, s2 = -1;	/* backups of stdin, stdout, stderr */
 	const char **sargv = cmd->argv;
 	char **env = environ;
@@ -186,6 +187,7 @@ int start_command(struct child_process *cmd)
 		dup2(s1, 1), close(s1);
 	if (s2 >= 0)
 		dup2(s2, 2), close(s2);
+}
 #endif
 
 	if (cmd->pid < 0) {
-- 
1.6.4.msysgit.0


[-- Attachment #5: 0003-Define-SNPRINTF_SIZE_CORR-1-when-use-MSVC-build-git.patch --]
[-- Type: application/octet-stream, Size: 1157 bytes --]

From 7edc5a10d29ec735dc302d110945ad70bac3d83f Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Sun, 16 Aug 2009 13:53:30 +0800
Subject: [PATCH 03/11] Define SNPRINTF_SIZE_CORR 1 when use MSVC build git

There are not NUL at vsnprintf verstion of MSVC when rearch max len.
Define vsnprintf to _vsnprintf. vsnprintf have deprecated.

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/snprintf.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/compat/snprintf.c b/compat/snprintf.c
index 6c0fb05..47b2b8a 100644
--- a/compat/snprintf.c
+++ b/compat/snprintf.c
@@ -6,7 +6,7 @@
  * number of characters to write without the trailing NUL.
  */
 #ifndef SNPRINTF_SIZE_CORR
-#if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ < 4
+#if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ < 4 || defined(_MSC_VER)
 #define SNPRINTF_SIZE_CORR 1
 #else
 #define SNPRINTF_SIZE_CORR 0
@@ -14,6 +14,11 @@
 #endif
 
 #undef vsnprintf
+
+#if defined(_MSC_VER)
+#define vsnprintf _vsnprintf
+#endif
+
 int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)
 {
 	char *s;
-- 
1.6.4.msysgit.0


[-- Attachment #6: 0004-Add-_MSC_VER-predefine-macro-to-make-same-behaviors-.patch --]
[-- Type: application/octet-stream, Size: 3402 bytes --]

From e82f2baea636dca70328e1e5161456bd61c21bec Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Sun, 16 Aug 2009 19:14:29 +0800
Subject: [PATCH 04/11] Add _MSC_VER predefine macro to make same behaviors with __MINGW32__
 Enable MSVC build. MSVC have the save behaviors with msysgit.

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 help.c        |    2 +-
 pager.c       |    4 ++--
 run-command.c |    8 ++++----
 run-command.h |    2 +-
 setup.c       |    2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/help.c b/help.c
index 399b0b4..a311241 100644
--- a/help.c
+++ b/help.c
@@ -126,7 +126,7 @@ static int is_executable(const char *name)
 	    !S_ISREG(st.st_mode))
 		return 0;
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_MSC_VER)
 {	/* cannot trust the executable bit, peek into the file instead */
 	char buf[3] = { 0 };
 	int n;
diff --git a/pager.c b/pager.c
index 4921843..28122c5 100644
--- a/pager.c
+++ b/pager.c
@@ -9,7 +9,7 @@
 
 static int spawned_pager;
 
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 static void pager_preexec(void)
 {
 	/*
@@ -70,7 +70,7 @@ void setup_pager(void)
 	pager_argv[2] = pager;
 	pager_process.argv = pager_argv;
 	pager_process.in = -1;
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 	pager_process.preexec_cb = pager_preexec;
 #endif
 	if (start_command(&pager_process))
diff --git a/run-command.c b/run-command.c
index d1df7ab..df139da 100644
--- a/run-command.c
+++ b/run-command.c
@@ -67,7 +67,7 @@ int start_command(struct child_process *cmd)
 
 	trace_argv_printf(cmd->argv, "trace: run_command:");
 
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 	fflush(NULL);
 	cmd->pid = fork();
 	if (!cmd->pid) {
@@ -294,7 +294,7 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const
 	return run_command(&cmd);
 }
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_MSC_VER)
 static __stdcall unsigned run_thread(void *data)
 {
 	struct async *async = data;
@@ -310,7 +310,7 @@ int start_async(struct async *async)
 		return error("cannot create pipe: %s", strerror(errno));
 	async->out = pipe_out[0];
 
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 	/* Flush stdio before fork() to avoid cloning buffers */
 	fflush(NULL);
 
@@ -339,7 +339,7 @@ int start_async(struct async *async)
 
 int finish_async(struct async *async)
 {
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 	int ret = 0;
 
 	if (wait_or_whine(async->pid))
diff --git a/run-command.h b/run-command.h
index e345502..57a707b 100644
--- a/run-command.h
+++ b/run-command.h
@@ -79,7 +79,7 @@ struct async {
 	int (*proc)(int fd, void *data);
 	void *data;
 	int out;	/* caller reads from here and closes it */
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 	pid_t pid;
 #else
 	HANDLE tid;
diff --git a/setup.c b/setup.c
index e3781b6..14e3ca7 100644
--- a/setup.c
+++ b/setup.c
@@ -41,7 +41,7 @@ const char *prefix_path(const char *prefix, int len, const char *path)
 const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
 {
 	static char path[PATH_MAX];
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 	if (!pfx || !*pfx || is_absolute_path(arg))
 		return arg;
 	memcpy(path, pfx, pfx_len);
-- 
1.6.4.msysgit.0


[-- Attachment #7: 0005-Remove-va_copy-at-MSVC-because-there-are-va_copy.patch --]
[-- Type: application/octet-stream, Size: 1116 bytes --]

From 67a26d74abe9720b59c7cf56926b278f3c72a312 Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Sun, 16 Aug 2009 20:57:10 +0800
Subject: [PATCH 05/11] Remove va_copy at MSVC because there are va_copy.

MSVs have not implemented va_copy. remove va_copy at MSVC environment.
It will malloc buffer each time.

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/winansi.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/compat/winansi.c b/compat/winansi.c
index 9217c24..6091138 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -3,7 +3,11 @@
  */
 
 #include <windows.h>
+#ifdef _MSC_VER
+#include <stdio.h>
+#else
 #include "../git-compat-util.h"
+#endif
 
 /*
  Functions to be wrapped:
@@ -310,9 +314,13 @@ static int winansi_vfprintf(FILE *stream, const char *format, va_list list)
 	if (!console)
 		goto abort;
 
+#ifndef _MSC_VER 
 	va_copy(cp, list);
 	len = vsnprintf(small_buf, sizeof(small_buf), format, cp);
 	va_end(cp);
+#else
+	len= sizeof(small_buf) ;
+#endif
 
 	if (len > sizeof(small_buf) - 1) {
 		buf = malloc(len + 1);
-- 
1.6.4.msysgit.0


[-- Attachment #8: 0006-Add-miss-git-compat-util.h-at-regex.c-and-fnmatch.c.patch --]
[-- Type: application/octet-stream, Size: 1289 bytes --]

From 4f7ead893ef71510f5f0b96246692a049cd61d3b Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Sun, 16 Aug 2009 21:04:45 +0800
Subject: [PATCH 06/11] Add miss git-compat-util.h at regex.c and fnmatch.c
 Add git-compat-util.h to enable build at MSVC environment

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/fnmatch/fnmatch.c |    4 ++++
 compat/regex/regex.c     |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/compat/fnmatch/fnmatch.c b/compat/fnmatch/fnmatch.c
index 14feac7..5cbd49c 100644
--- a/compat/fnmatch/fnmatch.c
+++ b/compat/fnmatch/fnmatch.c
@@ -16,6 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifdef _MSC_VER
+#include "git-compat-util.h"
+#endif
+
 #if HAVE_CONFIG_H
 # include <config.h>
 #endif
diff --git a/compat/regex/regex.c b/compat/regex/regex.c
index 5728de1..2298a3a 100644
--- a/compat/regex/regex.c
+++ b/compat/regex/regex.c
@@ -20,6 +20,10 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 /* AIX requires this to be the first thing in the file. */
+#ifdef _MSC_VER
+#include "git-compat-util.h"
+#endif
+
 #if defined (_AIX) && !defined (REGEX_MALLOC)
   #pragma alloca
 #endif
-- 
1.6.4.msysgit.0


[-- Attachment #9: 0007-Add-O_BINARY-flag-to-open-flag-at-mingw.c.patch --]
[-- Type: application/octet-stream, Size: 1200 bytes --]

From ee80ee9f5f62eded25405a6158ded556216723f4 Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Mon, 17 Aug 2009 14:52:01 +0800
Subject: [PATCH 07/11] Add  O_BINARY flag to open flag at mingw.c

Windows will convert CR\LF and union code at text mode.
Git doesn't like this. Add O_BINARY flag to open function

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/mingw.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 75c74b1..d5fa0ed 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -132,7 +132,7 @@ int mingw_open (const char *filename, int oflags, ...)
 	if (!strcmp(filename, "/dev/null"))
 		filename = "nul";
 
-	fd = open(filename, oflags, mode);
+	fd = open(filename, oflags | O_BINARY, mode);
 
 	if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {
 		DWORD attrs = GetFileAttributes(filename);
@@ -278,7 +278,7 @@ int mkstemp(char *template)
 	char *filename = mktemp(template);
 	if (filename == NULL)
 		return -1;
-	return open(filename, O_RDWR | O_CREAT, 0600);
+	return open(filename, O_RDWR | O_CREAT | O_BINARY, 0600);
 }
 
 int gettimeofday(struct timeval *tv, void *tz)
-- 
1.6.4.msysgit.0


[-- Attachment #10: 0008-Place-__stdcall-to-correct-position.patch --]
[-- Type: application/octet-stream, Size: 1864 bytes --]

From 7783d7e2d367588b4b9f8d2aa32e3135af7d12a0 Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Mon, 17 Aug 2009 14:54:31 +0800
Subject: [PATCH 08/11] Place __stdcall to correct position.

MSVC require __stdcall is between return value and function name.
ALL Win32 API definition is as TYPE WINAPI function name

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/mingw.c |    4 ++--
 run-command.c  |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index d5fa0ed..0c9c793 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1017,7 +1017,7 @@ static sig_handler_t timer_fn = SIG_DFL;
  * length to call the signal handler.
  */
 
-static __stdcall unsigned ticktack(void *dummy)
+static unsigned __stdcall ticktack(void *dummy)
 {
 	while (WaitForSingleObject(timer_event, timer_interval) == WAIT_TIMEOUT) {
 		if (timer_fn == SIG_DFL)
@@ -1146,7 +1146,7 @@ void mingw_open_html(const char *unixpath)
 
 int link(const char *oldpath, const char *newpath)
 {
-	typedef BOOL WINAPI (*T)(const char*, const char*, LPSECURITY_ATTRIBUTES);
+	typedef  BOOL (WINAPI *T)(const char*, const char*, LPSECURITY_ATTRIBUTES);
 	static T create_hard_link = NULL;
 	if (!create_hard_link) {
 		create_hard_link = (T) GetProcAddress(
diff --git a/run-command.c b/run-command.c
index df139da..423b506 100644
--- a/run-command.c
+++ b/run-command.c
@@ -295,12 +295,12 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const
 }
 
 #if defined(__MINGW32__) || defined(_MSC_VER)
-static __stdcall unsigned run_thread(void *data)
+static unsigned __stdcall run_thread(void *data)
 {
 	struct async *async = data;
 	return async->proc(async->fd_for_proc, async->data);
 }
-#endif
+#endif /* __MINGW32__ || _MSC_VER */
 
 int start_async(struct async *async)
 {
-- 
1.6.4.msysgit.0


[-- Attachment #11: 0009-Add-MSVC-porting-header-files.patch --]
[-- Type: application/octet-stream, Size: 11084 bytes --]

From 6add8b13e7b5266ba4b125e826e78bed5f72b7f7 Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Mon, 17 Aug 2009 14:56:26 +0800
Subject: [PATCH 09/11] Add MSVC porting header files.

Add unix head file, dirent.h, unistd.h  and time.h
Add MSVC special porting head file msvc.h and msvc.c.

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/msvc.c                   |   33 ++++++++++
 compat/msvc.h                   |   95 +++++++++++++++++++++++++++++
 compat/vcbuild/include/dirent.h |  127 +++++++++++++++++++++++++++++++++++++++
 compat/vcbuild/include/unistd.h |   92 ++++++++++++++++++++++++++++
 compat/vcbuild/sys/time.h       |   21 +++++++
 git-compat-util.h               |   12 ++++-
 6 files changed, 379 insertions(+), 1 deletions(-)
 create mode 100644 compat/msvc.c
 create mode 100644 compat/msvc.h
 create mode 100644 compat/vcbuild/include/dirent.h
 create mode 100644 compat/vcbuild/include/unistd.h
 create mode 100644 compat/vcbuild/sys/time.h

diff --git a/compat/msvc.c b/compat/msvc.c
new file mode 100644
index 0000000..80afd4d
--- /dev/null
+++ b/compat/msvc.c
@@ -0,0 +1,33 @@
+#include "../git-compat-util.h"
+#include "win32.h"
+#include <conio.h>
+#include "../strbuf.h"
+
+DIR *opendir(const char *name)
+{
+	int len;
+	DIR *p;
+	p = (DIR*)malloc(sizeof(DIR));
+	memset(p, 0, sizeof(DIR));
+	strncpy(p->dd_name, name, PATH_MAX);
+	len = strlen(p->dd_name);
+	p->dd_name[len] = '/';
+	p->dd_name[len+1] = '*';
+
+	if (p == NULL)
+		return NULL;
+
+	p->dd_handle = _findfirst(p->dd_name, &p->dd_dta);
+
+	if (p->dd_handle == -1) {
+		free(p);
+		return NULL;
+	}
+	return p;
+}
+int closedir(DIR *dir)
+{
+	_findclose(dir->dd_handle);
+	free(dir);
+	return 0;
+}
diff --git a/compat/msvc.h b/compat/msvc.h
new file mode 100644
index 0000000..6071565
--- /dev/null
+++ b/compat/msvc.h
@@ -0,0 +1,95 @@
+#ifndef __MSVC__HEAD
+#define __MSVC__HEAD
+
+#define WINVER 0x0500
+#define _WIN32_WINNT 0x0500
+#define _WIN32_WINDOWS 0x0410
+#define _WIN32_IE 0x0700
+#define NTDDI_VERSION NTDDI_WIN2KSP1
+#include <winsock2.h>
+
+/*Configuration*/
+
+#define NO_PREAD
+#define NO_OPENSSL
+#define NO_LIBGEN_H
+#define NO_SYMLINK_HEAD
+#define NO_IPV6
+#define NO_SETENV
+#define NO_UNSETENV
+#define NO_STRCASESTR
+#define NO_STRLCPY
+#define NO_MEMMEM
+#define NO_C99_FORMAT
+#define NO_STRTOUMAX
+#define NO_MKDTEMP
+#define NO_MKSTEMPS
+
+#define RUNTIME_PREFIX
+#define NO_ST_BLOCKS_IN_STRUCT_STAT
+#define NO_NSEC
+#define USE_WIN32_MMAP
+#define USE_NED_ALLOCATOR
+
+#define NO_REGEX
+
+#define NO_SYS_SELECT_H
+#define NO_PTHEADS
+#define HAVE_STRING_H 1
+#define STDC_HEADERS
+#define NO_ICONV
+
+#define inline __inline
+#define __inline__ __inline
+
+#define SNPRINTF_RETURNS_BOGUS
+
+#define SHA1_HEADER "mozilla-sha1\\sha1.h"
+
+#define ETC_GITCONFIG "%HOME%"
+
+#define NO_PTHREADS
+#define NO_CURL
+
+
+#define NO_STRTOUMAX
+#define REGEX_MALLOC
+
+
+#define GIT_EXEC_PATH "bin"
+#define GIT_VERSION "1.6"
+#define BINDIR "bin"
+#define PREFIX "."
+#define GIT_MAN_PATH "man"
+#define GIT_INFO_PATH "info"
+#define GIT_HTML_PATH "html"
+#define DEFAULT_GIT_TEMPLATE_DIR "templates"
+
+#define NO_STRLCPY
+#define NO_UNSETENV
+#define NO_SETENV
+
+#define strdup _strdup
+#define read _read
+#define close _close
+#define dup _dup
+#define dup2 _dup2
+#define strncasecmp _strnicmp
+#define strtoull _strtoui64
+
+#define __attribute__(x)
+
+static __inline int strcasecmp (const char *s1, const char *s2)
+{
+	int size1=strlen(s1);
+	int sisz2=strlen(s2);
+
+	return _strnicmp(s1,s2,sisz2>size1?sisz2:size1);
+}
+
+#include "compat/mingw.h"
+#undef ERROR
+#undef stat
+#define stat(x,y) mingw_lstat
+#define stat      _stat64
+#endif
\ No newline at end of file
diff --git a/compat/vcbuild/include/dirent.h b/compat/vcbuild/include/dirent.h
new file mode 100644
index 0000000..a6b6f4c
--- /dev/null
+++ b/compat/vcbuild/include/dirent.h
@@ -0,0 +1,127 @@
+/*
+ * DIRENT.H (formerly DIRLIB.H)
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is a part of the mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within the package.
+ *
+ */
+#ifndef _DIRENT_H_
+#define _DIRENT_H_
+
+/* All the headers include this file. */
+//#include <_mingw.h>
+
+#include <io.h>
+
+#define PATH_MAX 512
+
+#define __MINGW_NOTHROW
+
+#ifndef RC_INVOKED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct dirent
+{
+	long		d_ino;		/* Always zero. */
+	unsigned short	d_reclen;	/* Always zero. */
+	unsigned short	d_namlen;	/* Length of name in d_name. */
+	char		d_name[FILENAME_MAX]; /* File name. */
+};
+
+/*
+ * This is an internal data structure. Good programmers will not use it
+ * except as an argument to one of the functions below.
+ * dd_stat field is now int (was short in older versions).
+ */
+typedef struct
+{
+	/* disk transfer area for this dir */
+	struct _finddata_t	dd_dta;
+
+	/* dirent struct to return from dir (NOTE: this makes this thread
+	 * safe as long as only one thread uses a particular DIR struct at
+	 * a time) */
+	struct dirent		dd_dir;
+
+	/* _findnext handle */
+	long			dd_handle;
+
+	/*
+         * Status of search:
+	 *   0 = not started yet (next entry to read is first entry)
+	 *  -1 = off the end
+	 *   positive = 0 based index of next entry
+	 */
+	int			dd_stat;
+
+	/* given path for dir with search pattern (struct is extended) */
+	char			dd_name[PATH_MAX+3];
+} DIR;
+
+DIR* __cdecl __MINGW_NOTHROW opendir (const char*);
+struct dirent* __cdecl __MINGW_NOTHROW readdir (DIR*);
+int __cdecl __MINGW_NOTHROW closedir (DIR*);
+void __cdecl __MINGW_NOTHROW rewinddir (DIR*);
+long __cdecl __MINGW_NOTHROW telldir (DIR*);
+void __cdecl __MINGW_NOTHROW seekdir (DIR*, long);
+
+
+/* wide char versions */
+
+struct _wdirent
+{
+	long		d_ino;		/* Always zero. */
+	unsigned short	d_reclen;	/* Always zero. */
+	unsigned short	d_namlen;	/* Length of name in d_name. */
+	wchar_t		d_name[FILENAME_MAX]; /* File name. */
+};
+
+/*
+ * This is an internal data structure. Good programmers will not use it
+ * except as an argument to one of the functions below.
+ */
+typedef struct
+{
+	/* disk transfer area for this dir */
+	//struct _wfinddata_t	dd_dta;
+
+	/* dirent struct to return from dir (NOTE: this makes this thread
+	 * safe as long as only one thread uses a particular DIR struct at
+	 * a time) */
+	struct _wdirent		dd_dir;
+
+	/* _findnext handle */
+	long			dd_handle;
+
+	/*
+         * Status of search:
+	 *   0 = not started yet (next entry to read is first entry)
+	 *  -1 = off the end
+	 *   positive = 0 based index of next entry
+	 */
+	int			dd_stat;
+
+	/* given path for dir with search pattern (struct is extended) */
+	wchar_t			dd_name[1];
+} _WDIR;
+
+
+
+_WDIR* __cdecl __MINGW_NOTHROW _wopendir (const wchar_t*);
+struct _wdirent*  __cdecl __MINGW_NOTHROW _wreaddir (_WDIR*);
+int __cdecl __MINGW_NOTHROW _wclosedir (_WDIR*);
+void __cdecl __MINGW_NOTHROW _wrewinddir (_WDIR*);
+long __cdecl __MINGW_NOTHROW _wtelldir (_WDIR*);
+void __cdecl __MINGW_NOTHROW _wseekdir (_WDIR*, long);
+
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* Not RC_INVOKED */
+
+#endif	/* Not _DIRENT_H_ */
diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h
new file mode 100644
index 0000000..a0f59e6
--- /dev/null
+++ b/compat/vcbuild/include/unistd.h
@@ -0,0 +1,92 @@
+#ifndef _UNISTD_
+#define _UNISTD_
+
+/* Win32 define for porting git*/
+
+#ifndef _MODE_T_
+#define	_MODE_T_
+typedef unsigned short _mode_t;
+
+#ifndef	_NO_OLDNAMES
+typedef _mode_t	mode_t;
+#endif
+#endif	/* Not _MODE_T_ */
+
+#ifndef _SSIZE_T_
+#define _SSIZE_T_
+typedef long _ssize_t;
+
+#ifndef	_OFF_T_
+#define	_OFF_T_
+typedef long _off_t;
+
+#ifndef	_NO_OLDNAMES
+typedef _off_t	off_t;
+#endif
+#endif	/* Not _OFF_T_ */
+
+
+#ifndef	_NO_OLDNAMES
+typedef _ssize_t ssize_t;
+#endif
+#endif /* Not _SSIZE_T_ */
+
+typedef signed char int8_t;
+typedef unsigned char   uint8_t;
+typedef short  int16_t;
+typedef unsigned short  uint16_t;
+typedef int  int32_t;
+typedef unsigned   uint32_t;
+typedef long long  int64_t;
+typedef unsigned long long   uint64_t;
+
+typedef long long  intmax_t;
+typedef unsigned long long uintmax_t;
+
+typedef int64_t off64_t;
+
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+/* Some defines for _access nAccessMode (MS doesn't define them, but
+ * it doesn't seem to hurt to add them). */
+#define	F_OK	0	/* Check for file existence */
+/* Well maybe it does hurt.  On newer versions of MSVCRT, an access mode
+   of 1 causes invalid parameter error. */ 
+#define	X_OK	0	/* MS access() doesn't check for execute permission. */
+#define	W_OK	2	/* Check for write permission */
+#define	R_OK	4	/* Check for read permission */
+
+#define	_S_IFIFO	0x1000	/* FIFO */
+#define	_S_IFCHR	0x2000	/* Character */
+#define	_S_IFBLK	0x3000	/* Block: Is this ever set under w32? */
+#define	_S_IFDIR	0x4000	/* Directory */
+#define	_S_IFREG	0x8000	/* Regular */
+
+#define	_S_IFMT		0xF000	/* File type mask */
+
+#define	_S_IXUSR	_S_IEXEC
+#define	_S_IWUSR	_S_IWRITE
+#define	_S_IRUSR	_S_IREAD
+#define	_S_ISDIR(m)	(((m) & _S_IFMT) == _S_IFDIR)
+
+#define	S_IFIFO		_S_IFIFO
+#define	S_IFCHR		_S_IFCHR
+#define	S_IFBLK		_S_IFBLK
+#define	S_IFDIR		_S_IFDIR
+#define	S_IFREG		_S_IFREG
+#define	S_IFMT		_S_IFMT
+#define	S_IEXEC		_S_IEXEC
+#define	S_IWRITE	_S_IWRITE
+#define	S_IREAD		_S_IREAD
+#define	S_IRWXU		_S_IRWXU
+#define	S_IXUSR		_S_IXUSR
+#define	S_IWUSR		_S_IWUSR
+#define	S_IRUSR		_S_IRUSR
+
+
+#define	S_ISDIR(m)	(((m) & S_IFMT) == S_IFDIR)
+#define	S_ISREG(m)	(((m) & S_IFMT) == S_IFREG)
+#define	S_ISFIFO(m)	(((m) & S_IFMT) == S_IFIFO)
+
+#endif
\ No newline at end of file
diff --git a/compat/vcbuild/sys/time.h b/compat/vcbuild/sys/time.h
new file mode 100644
index 0000000..6ed82c0
--- /dev/null
+++ b/compat/vcbuild/sys/time.h
@@ -0,0 +1,21 @@
+#ifndef	_UTIME_H_
+#define	_UTIME_H_
+/*
+ * Structure used by _utime function.
+ */
+struct _utimbuf
+{
+	time_t	actime;		/* Access time */
+	time_t	modtime;	/* Modification time */
+};
+
+#ifndef	_NO_OLDNAMES
+/* NOTE: Must be the same as _utimbuf above. */
+struct utimbuf
+{
+	time_t	actime;
+	time_t	modtime;
+};
+#endif	/* Not _NO_OLDNAMES */
+
+#endif
diff --git a/git-compat-util.h b/git-compat-util.h
index 9f941e4..cb89294 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -77,8 +77,10 @@
 #include <string.h>
 #include <errno.h>
 #include <limits.h>
+#ifndef _MSC_VER
 #include <sys/param.h>
 #include <sys/types.h>
+#endif
 #include <dirent.h>
 #include <sys/time.h>
 #include <time.h>
@@ -86,7 +88,12 @@
 #include <fnmatch.h>
 #include <assert.h>
 #include <regex.h>
+
+#ifndef _MSC_VER
 #include <utime.h>
+#endif
+
+#ifndef _MSC_VER
 #ifndef __MINGW32__
 #include <sys/wait.h>
 #include <sys/poll.h>
@@ -114,7 +121,10 @@
 #else 	/* __MINGW32__ */
 /* pull in Windows compatibility stuff */
 #include "compat/mingw.h"
-#endif	/* __MINGW32__ */
+#endif  /* __MINGW32__ */
+#else   /* _MSC_VER */
+#include "compat/msvc.h"
+#endif	/* _MSC_VER */
 
 #ifndef NO_LIBGEN_H
 #include <libgen.h>
-- 
1.6.4.msysgit.0


[-- Attachment #12: 0010-Add-MSVC-Project-file.patch --]
[-- Type: application/octet-stream, Size: 30219 bytes --]

From 84c6da8e081b453c2ae64b1481ab385df5904c95 Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Mon, 17 Aug 2009 14:59:46 +0800
Subject: [PATCH 10/11] Add MSVC Project file

Add libgit.vcproj to build common library.
Add git.vcproj to build git program.

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/vcbuild/git/git.vcproj       |  197 +++++
 compat/vcbuild/libgit/libgit.vcproj | 1347 +++++++++++++++++++++++++++++++++++
 2 files changed, 1544 insertions(+), 0 deletions(-)
 create mode 100644 compat/vcbuild/git/git.vcproj
 create mode 100644 compat/vcbuild/libgit/libgit.vcproj

diff --git a/compat/vcbuild/git/git.vcproj b/compat/vcbuild/git/git.vcproj
new file mode 100644
index 0000000..6f85de3
--- /dev/null
+++ b/compat/vcbuild/git/git.vcproj
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="git"
+	ProjectGUID="{E3E30E51-C5AD-407B-AB43-985E4111474A}"
+	RootNamespace="git"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="wininet.lib ws2_32.lib "
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="wininet.lib ws2_32.lib "
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\git.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/compat/vcbuild/libgit/libgit.vcproj b/compat/vcbuild/libgit/libgit.vcproj
new file mode 100644
index 0000000..bbc3aed
--- /dev/null
+++ b/compat/vcbuild/libgit/libgit.vcproj
@@ -0,0 +1,1347 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libgit"
+	ProjectGUID="{F6DEC8C3-B803-4A86-8848-430F08B499E3}"
+	RootNamespace="libgit"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\msvc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mozilla-sha1\sha1.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\archive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\delta.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fetch-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\git-compat-util.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\http.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\notes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\send-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shortlog.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tar.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="compat"
+			>
+			<File
+				RelativePath="..\..\..\compat\basename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\cygwin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fopen.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\memmem.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkdtemp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkstemps.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\pread.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\qsort.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\setenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\snprintf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strcasestr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strlcpy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strtoumax.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\unsetenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32mmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\winansi.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="git"
+			>
+			<File
+				RelativePath="..\..\..\abspath.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alias.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alloc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-tar.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-zip.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\base85.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bisect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-add.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-annotate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-apply.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bisect--helper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-blame.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-cat-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-ref-format.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clean.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clone.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-count-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-describe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fast-export.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch--tool.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fmt-merge-msg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-for-each-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-gc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-init-db.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-log.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailinfo.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailsplit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-base.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-ours.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mktree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-name-rev.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune-packed.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-push.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-read-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-receive-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reflog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reset.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-parse.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-revert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rm.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-send-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-shortlog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-stripspace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-symbolic-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tar-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-unpack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-upload-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-write-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\combine-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\connect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\convert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\copy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ctype.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\date.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-lib.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-no-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-break.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-order.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-pickaxe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-rename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\editor.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\entry.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\environment.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ident.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lockfile.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\match-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\name-hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-check.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-write.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pager.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\path.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\preload-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pretty.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\read-cache.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\server-info.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\setup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_name.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shallow.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\symlinks.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\trace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\usage.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wrapper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\write_or_die.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ws.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="xdiff"
+			>
+			<File
+				RelativePath="..\..\..\xdiff\xdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xinclude.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmacros.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmerge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xpatience.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xtypes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
-- 
1.6.4.msysgit.0


^ permalink raw reply related	[relevance 7%]

* [PATCH 2/5] Move split_cmdline() to libgit
  @ 2008-05-24  0:01  7%   ` Miklos Vajna
  0 siblings, 0 replies; 200+ results
From: Miklos Vajna @ 2008-05-24  0:01 UTC (permalink / raw)
  To: git

split_cmdline() is currently used for aliases only, but later it can be
useful for other builtins as well. Move it to alias.c for now,
indicating that originally it's for aliases, but we'll have it in libgit
this way.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 alias.c |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 cache.h |    1 +
 git.c   |   53 -----------------------------------------------------
 3 files changed, 55 insertions(+), 53 deletions(-)

diff --git a/alias.c b/alias.c
index 116cac8..75bc48a 100644
--- a/alias.c
+++ b/alias.c
@@ -20,3 +20,57 @@ char *alias_lookup(const char *alias)
 	git_config(alias_lookup_cb);
 	return alias_val;
 }
+
+int split_cmdline(char *cmdline, const char ***argv)
+{
+	int src, dst, count = 0, size = 16;
+	char quoted = 0;
+
+	*argv = xmalloc(sizeof(char*) * size);
+
+	/* split alias_string */
+	(*argv)[count++] = cmdline;
+	for (src = dst = 0; cmdline[src];) {
+		char c = cmdline[src];
+		if (!quoted && isspace(c)) {
+			cmdline[dst++] = 0;
+			while (cmdline[++src]
+					&& isspace(cmdline[src]))
+				; /* skip */
+			if (count >= size) {
+				size += 16;
+				*argv = xrealloc(*argv, sizeof(char*) * size);
+			}
+			(*argv)[count++] = cmdline + dst;
+		} else if (!quoted && (c == '\'' || c == '"')) {
+			quoted = c;
+			src++;
+		} else if (c == quoted) {
+			quoted = 0;
+			src++;
+		} else {
+			if (c == '\\' && quoted != '\'') {
+				src++;
+				c = cmdline[src];
+				if (!c) {
+					free(*argv);
+					*argv = NULL;
+					return error("cmdline ends with \\");
+				}
+			}
+			cmdline[dst++] = c;
+			src++;
+		}
+	}
+
+	cmdline[dst] = 0;
+
+	if (quoted) {
+		free(*argv);
+		*argv = NULL;
+		return error("unclosed quote");
+	}
+
+	return count;
+}
+
diff --git a/cache.h b/cache.h
index 093f04c..5e22b1e 100644
--- a/cache.h
+++ b/cache.h
@@ -814,5 +814,6 @@ int report_path_error(const char *ps_matched, const char **pathspec, int prefix_
 void overlay_tree_on_cache(const char *tree_name, const char *prefix);
 
 char *alias_lookup(const char *alias);
+int split_cmdline(char *cmdline, const char ***argv);
 
 #endif /* CACHE_H */
diff --git a/git.c b/git.c
index 89b431f..b8df19e 100644
--- a/git.c
+++ b/git.c
@@ -87,59 +87,6 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
 	return handled;
 }
 
-static int split_cmdline(char *cmdline, const char ***argv)
-{
-	int src, dst, count = 0, size = 16;
-	char quoted = 0;
-
-	*argv = xmalloc(sizeof(char*) * size);
-
-	/* split alias_string */
-	(*argv)[count++] = cmdline;
-	for (src = dst = 0; cmdline[src];) {
-		char c = cmdline[src];
-		if (!quoted && isspace(c)) {
-			cmdline[dst++] = 0;
-			while (cmdline[++src]
-					&& isspace(cmdline[src]))
-				; /* skip */
-			if (count >= size) {
-				size += 16;
-				*argv = xrealloc(*argv, sizeof(char*) * size);
-			}
-			(*argv)[count++] = cmdline + dst;
-		} else if(!quoted && (c == '\'' || c == '"')) {
-			quoted = c;
-			src++;
-		} else if (c == quoted) {
-			quoted = 0;
-			src++;
-		} else {
-			if (c == '\\' && quoted != '\'') {
-				src++;
-				c = cmdline[src];
-				if (!c) {
-					free(*argv);
-					*argv = NULL;
-					return error("cmdline ends with \\");
-				}
-			}
-			cmdline[dst++] = c;
-			src++;
-		}
-	}
-
-	cmdline[dst] = 0;
-
-	if (quoted) {
-		free(*argv);
-		*argv = NULL;
-		return error("unclosed quote");
-	}
-
-	return count;
-}
-
 static int handle_alias(int *argcp, const char ***argv)
 {
 	int envchanged = 0, ret = 0, saved_errno = errno;
-- 
1.5.5.1.357.g1af8b.dirty

^ permalink raw reply related	[relevance 7%]

* How to properly find git config in a libgit.a-using executable?
@ 2019-03-20 10:19  7% Mike Hommey
  2019-03-22  7:33  8% ` Jeff King
  0 siblings, 1 reply; 200+ results
From: Mike Hommey @ 2019-03-20 10:19 UTC (permalink / raw)
  To: git

Hi,

In git-cinnabar (the remote-helper that can talk to mercurial servers),
I'm using a fast-import-derived helper to do a lot of the heavy lifting,
because $REASONS. Anyways, while built (mostly) with the git build system,
using libgit.a, etc. the helper doesn't live in the GIT_EXEC_PATH. That
leads me to a very subtle problem: it doesn't necessarily find the
system config that git uses.

Because the system confit that git uses depends on how git was built,
the result might not be the right thing. For one, a Linux distro git
will likely have been built with prefix=/usr, which makes the system
config be /etc/gitconfig, but someone building their own git will have
a system config in etc/gitconfig relative to their git.

The latter is more of nitpicking, because practically speaking, it
doesn't matter much. Which is why I've been building with prefix=/usr
(at least for the helper binaries that I ship pre-built ; locally built
helpers actually don't get this treatment ; but that's also not much of
a practical problem because it seems Linux distros don't ship a
/etc/gitconfig anyways (at least Debian doesn't)).

Anyways, the real problem comes on Windows, because git-for-windows does
come with a system config that does make important tweaks, like setting
http.sslcainfo to a path that actually exists. And without reading that
system config, the helper doesn't find the cainfo file and fails to
connect to HTTPS mercurial servers.

Now, my question here is, what would you suggest I do to make my helper
find the right config?

I thought of a few options (it's worth noting the helper is invoked in a
way that makes $GIT_EXEC_PATH set, which can help a little):
- spawn `$GIT_EXEC_PATH/git-config -l -z`, parse its output, and set the
  internal config from that. That's the barbarian option.
- build the helper with RUNTIME_PREFIX, and modify the RUNTIME_PREFIX
  code to use $GIT_EXEC_PATH if it's set, rather than the path the
  executable is in. That actually sounds reasonable enough that I'd send
  a patch for git itself. But that doesn't quite address the nitpick case
  where ETC_GITCONFIG could be either `/etc/gitconfig` or
  `etc/gitconfig` depending how git was compiled, and there's no way to
  know which is the right one.

WDYT?

Mike

^ permalink raw reply	[relevance 7%]

* [PATCH v4 04/19] reftable: utility functions
  @ 2021-10-07 20:25  7%       ` Han-Wen Nienhuys via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Han-Wen Nienhuys via GitGitGadget @ 2021-10-07 20:25 UTC (permalink / raw)
  To: git
  Cc: Han-Wen Nienhuys, Carlo Marcelo Arenas Belón,
	Ævar Arnfjörð Bjarmason, Han-Wen Nienhuys,
	Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

This commit provides basic utility classes for the reftable library.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                                   |  25 +++-
 contrib/buildsystems/CMakeLists.txt        |  14 ++-
 contrib/buildsystems/Generators/Vcxproj.pm |  11 +-
 reftable/basics.c                          | 128 +++++++++++++++++++++
 reftable/basics.h                          |  60 ++++++++++
 reftable/basics_test.c                     |  98 ++++++++++++++++
 reftable/publicbasics.c                    |  65 +++++++++++
 reftable/reftable-malloc.h                 |  18 +++
 reftable/reftable-tests.h                  |  22 ++++
 reftable/system.h                          |  32 ++++++
 reftable/test_framework.c                  |  23 ++++
 reftable/test_framework.h                  |  53 +++++++++
 t/helper/test-reftable.c                   |   9 ++
 t/helper/test-tool.c                       |   3 +-
 t/helper/test-tool.h                       |   1 +
 t/t0032-reftable-unittest.sh               |  15 +++
 16 files changed, 570 insertions(+), 7 deletions(-)
 create mode 100644 reftable/basics.c
 create mode 100644 reftable/basics.h
 create mode 100644 reftable/basics_test.c
 create mode 100644 reftable/publicbasics.c
 create mode 100644 reftable/reftable-malloc.h
 create mode 100644 reftable/reftable-tests.h
 create mode 100644 reftable/system.h
 create mode 100644 reftable/test_framework.c
 create mode 100644 reftable/test_framework.h
 create mode 100644 t/helper/test-reftable.c
 create mode 100755 t/t0032-reftable-unittest.sh

diff --git a/Makefile b/Makefile
index e04c942f58f..aa5ac56cde6 100644
--- a/Makefile
+++ b/Makefile
@@ -736,6 +736,7 @@ TEST_BUILTINS_OBJS += test-read-cache.o
 TEST_BUILTINS_OBJS += test-read-graph.o
 TEST_BUILTINS_OBJS += test-read-midx.o
 TEST_BUILTINS_OBJS += test-ref-store.o
+TEST_BUILTINS_OBJS += test-reftable.o
 TEST_BUILTINS_OBJS += test-regex.o
 TEST_BUILTINS_OBJS += test-repository.o
 TEST_BUILTINS_OBJS += test-revision-walking.o
@@ -814,6 +815,8 @@ TEST_SHELL_PATH = $(SHELL_PATH)
 
 LIB_FILE = libgit.a
 XDIFF_LIB = xdiff/lib.a
+REFTABLE_LIB = reftable/libreftable.a
+REFTABLE_TEST_LIB = reftable/libreftable_test.a
 
 GENERATED_H += command-list.h
 GENERATED_H += config-list.h
@@ -1188,7 +1191,7 @@ THIRD_PARTY_SOURCES += compat/regex/%
 THIRD_PARTY_SOURCES += sha1collisiondetection/%
 THIRD_PARTY_SOURCES += sha1dc/%
 
-GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
+GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB)
 EXTLIBS =
 
 GIT_USER_AGENT = git/$(GIT_VERSION)
@@ -2426,7 +2429,15 @@ XDIFF_OBJS += xdiff/xutils.o
 .PHONY: xdiff-objs
 xdiff-objs: $(XDIFF_OBJS)
 
+REFTABLE_OBJS += reftable/basics.o
+REFTABLE_OBJS += reftable/error.o
+REFTABLE_OBJS += reftable/publicbasics.o
+
+REFTABLE_TEST_OBJS += reftable/test_framework.o
+REFTABLE_TEST_OBJS += reftable/basics_test.o
+
 TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
+
 .PHONY: test-objs
 test-objs: $(TEST_OBJS)
 
@@ -2442,6 +2453,8 @@ OBJECTS += $(PROGRAM_OBJS)
 OBJECTS += $(TEST_OBJS)
 OBJECTS += $(XDIFF_OBJS)
 OBJECTS += $(FUZZ_OBJS)
+OBJECTS += $(REFTABLE_OBJS) $(REFTABLE_TEST_OBJS)
+
 ifndef NO_CURL
 	OBJECTS += http.o http-walker.o remote-curl.o
 endif
@@ -2591,6 +2604,12 @@ $(LIB_FILE): $(LIB_OBJS)
 $(XDIFF_LIB): $(XDIFF_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
+$(REFTABLE_LIB): $(REFTABLE_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
+
+$(REFTABLE_TEST_LIB): $(REFTABLE_TEST_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
+
 export DEFAULT_EDITOR DEFAULT_PAGER
 
 Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
@@ -2889,7 +2908,7 @@ perf: all
 
 t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
 
-t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
+t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS) $(REFTABLE_TEST_LIB)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
 
 check-sha1:: t/helper/test-tool$X
@@ -3224,7 +3243,7 @@ cocciclean:
 clean: profile-clean coverage-clean cocciclean
 	$(RM) *.res
 	$(RM) $(OBJECTS)
-	$(RM) $(LIB_FILE) $(XDIFF_LIB)
+	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
 	$(RM) $(TEST_PROGRAMS)
 	$(RM) $(FUZZ_PROGRAMS)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 171b4124afe..c2bf5bdffc6 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -640,6 +640,12 @@ parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
 list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
 add_library(xdiff STATIC ${libxdiff_SOURCES})
 
+#reftable
+parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+
+list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+add_library(reftable STATIC ${reftable_SOURCES})
+
 if(WIN32)
 	if(NOT MSVC)#use windres when compiling with gcc and clang
 		add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
@@ -662,7 +668,7 @@ endif()
 #link all required libraries to common-main
 add_library(common-main OBJECT ${CMAKE_SOURCE_DIR}/common-main.c)
 
-target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES})
+target_link_libraries(common-main libgit xdiff reftable ${ZLIB_LIBRARIES})
 if(Intl_FOUND)
 	target_link_libraries(common-main ${Intl_LIBRARIES})
 endif()
@@ -902,11 +908,15 @@ if(BUILD_TESTING)
 add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
 target_link_libraries(test-fake-ssh common-main)
 
+#reftable-tests
+parse_makefile_for_sources(test-reftable_SOURCES "REFTABLE_TEST_OBJS")
+list(TRANSFORM test-reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+
 #test-tool
 parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
 
 list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
-add_executable(test-tool ${CMAKE_SOURCE_DIR}/t/helper/test-tool.c ${test-tool_SOURCES})
+add_executable(test-tool ${CMAKE_SOURCE_DIR}/t/helper/test-tool.c ${test-tool_SOURCES} ${test-reftable_SOURCES})
 target_link_libraries(test-tool common-main)
 
 set_target_properties(test-fake-ssh test-tool
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index d2584450ba1..1a25789d285 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libexpat\.lib/libexpatd\.lib/g;
@@ -232,6 +232,7 @@ EOM
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -241,6 +242,14 @@ EOM
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
diff --git a/reftable/basics.c b/reftable/basics.c
new file mode 100644
index 00000000000..f761e48028c
--- /dev/null
+++ b/reftable/basics.c
@@ -0,0 +1,128 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "basics.h"
+
+void put_be24(uint8_t *out, uint32_t i)
+{
+	out[0] = (uint8_t)((i >> 16) & 0xff);
+	out[1] = (uint8_t)((i >> 8) & 0xff);
+	out[2] = (uint8_t)(i & 0xff);
+}
+
+uint32_t get_be24(uint8_t *in)
+{
+	return (uint32_t)(in[0]) << 16 | (uint32_t)(in[1]) << 8 |
+	       (uint32_t)(in[2]);
+}
+
+void put_be16(uint8_t *out, uint16_t i)
+{
+	out[0] = (uint8_t)((i >> 8) & 0xff);
+	out[1] = (uint8_t)(i & 0xff);
+}
+
+int binsearch(size_t sz, int (*f)(size_t k, void *args), void *args)
+{
+	size_t lo = 0;
+	size_t hi = sz;
+
+	/* Invariants:
+	 *
+	 *  (hi == sz) || f(hi) == true
+	 *  (lo == 0 && f(0) == true) || fi(lo) == false
+	 */
+	while (hi - lo > 1) {
+		size_t mid = lo + (hi - lo) / 2;
+
+		if (f(mid, args))
+			hi = mid;
+		else
+			lo = mid;
+	}
+
+	if (lo)
+		return hi;
+
+	return f(0, args) ? 0 : 1;
+}
+
+void free_names(char **a)
+{
+	char **p;
+	if (!a) {
+		return;
+	}
+	for (p = a; *p; p++) {
+		reftable_free(*p);
+	}
+	reftable_free(a);
+}
+
+int names_length(char **names)
+{
+	char **p = names;
+	for (; *p; p++) {
+		/* empty */
+	}
+	return p - names;
+}
+
+void parse_names(char *buf, int size, char ***namesp)
+{
+	char **names = NULL;
+	size_t names_cap = 0;
+	size_t names_len = 0;
+
+	char *p = buf;
+	char *end = buf + size;
+	while (p < end) {
+		char *next = strchr(p, '\n');
+		if (next && next < end) {
+			*next = 0;
+		} else {
+			next = end;
+		}
+		if (p < next) {
+			if (names_len == names_cap) {
+				names_cap = 2 * names_cap + 1;
+				names = reftable_realloc(
+					names, names_cap * sizeof(*names));
+			}
+			names[names_len++] = xstrdup(p);
+		}
+		p = next + 1;
+	}
+
+	names = reftable_realloc(names, (names_len + 1) * sizeof(*names));
+	names[names_len] = NULL;
+	*namesp = names;
+}
+
+int names_equal(char **a, char **b)
+{
+	int i = 0;
+	for (; a[i] && b[i]; i++) {
+		if (strcmp(a[i], b[i])) {
+			return 0;
+		}
+	}
+
+	return a[i] == b[i];
+}
+
+int common_prefix_size(struct strbuf *a, struct strbuf *b)
+{
+	int p = 0;
+	for (; p < a->len && p < b->len; p++) {
+		if (a->buf[p] != b->buf[p])
+			break;
+	}
+
+	return p;
+}
diff --git a/reftable/basics.h b/reftable/basics.h
new file mode 100644
index 00000000000..096b36862b9
--- /dev/null
+++ b/reftable/basics.h
@@ -0,0 +1,60 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef BASICS_H
+#define BASICS_H
+
+/*
+ * miscellaneous utilities that are not provided by Git.
+ */
+
+#include "system.h"
+
+/* Bigendian en/decoding of integers */
+
+void put_be24(uint8_t *out, uint32_t i);
+uint32_t get_be24(uint8_t *in);
+void put_be16(uint8_t *out, uint16_t i);
+
+/*
+ * find smallest index i in [0, sz) at which f(i) is true, assuming
+ * that f is ascending. Return sz if f(i) is false for all indices.
+ *
+ * Contrary to bsearch(3), this returns something useful if the argument is not
+ * found.
+ */
+int binsearch(size_t sz, int (*f)(size_t k, void *args), void *args);
+
+/*
+ * Frees a NULL terminated array of malloced strings. The array itself is also
+ * freed.
+ */
+void free_names(char **a);
+
+/* parse a newline separated list of names. `size` is the length of the buffer,
+ * without terminating '\0'. Empty names are discarded. */
+void parse_names(char *buf, int size, char ***namesp);
+
+/* compares two NULL-terminated arrays of strings. */
+int names_equal(char **a, char **b);
+
+/* returns the array size of a NULL-terminated array of strings. */
+int names_length(char **names);
+
+/* Allocation routines; they invoke the functions set through
+ * reftable_set_alloc() */
+void *reftable_malloc(size_t sz);
+void *reftable_realloc(void *p, size_t sz);
+void reftable_free(void *p);
+void *reftable_calloc(size_t sz);
+
+/* Find the longest shared prefix size of `a` and `b` */
+struct strbuf;
+int common_prefix_size(struct strbuf *a, struct strbuf *b);
+
+#endif
diff --git a/reftable/basics_test.c b/reftable/basics_test.c
new file mode 100644
index 00000000000..1fcd2297256
--- /dev/null
+++ b/reftable/basics_test.c
@@ -0,0 +1,98 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "system.h"
+
+#include "basics.h"
+#include "test_framework.h"
+#include "reftable-tests.h"
+
+struct binsearch_args {
+	int key;
+	int *arr;
+};
+
+static int binsearch_func(size_t i, void *void_args)
+{
+	struct binsearch_args *args = void_args;
+
+	return args->key < args->arr[i];
+}
+
+static void test_binsearch(void)
+{
+	int arr[] = { 2, 4, 6, 8, 10 };
+	size_t sz = ARRAY_SIZE(arr);
+	struct binsearch_args args = {
+		.arr = arr,
+	};
+
+	int i = 0;
+	for (i = 1; i < 11; i++) {
+		int res;
+		args.key = i;
+		res = binsearch(sz, &binsearch_func, &args);
+
+		if (res < sz) {
+			EXPECT(args.key < arr[res]);
+			if (res > 0) {
+				EXPECT(args.key >= arr[res - 1]);
+			}
+		} else {
+			EXPECT(args.key == 10 || args.key == 11);
+		}
+	}
+}
+
+static void test_names_length(void)
+{
+	char *a[] = { "a", "b", NULL };
+	EXPECT(names_length(a) == 2);
+}
+
+static void test_parse_names_normal(void)
+{
+	char in[] = "a\nb\n";
+	char **out = NULL;
+	parse_names(in, strlen(in), &out);
+	EXPECT(!strcmp(out[0], "a"));
+	EXPECT(!strcmp(out[1], "b"));
+	EXPECT(!out[2]);
+	free_names(out);
+}
+
+static void test_parse_names_drop_empty(void)
+{
+	char in[] = "a\n\n";
+	char **out = NULL;
+	parse_names(in, strlen(in), &out);
+	EXPECT(!strcmp(out[0], "a"));
+	EXPECT(!out[1]);
+	free_names(out);
+}
+
+static void test_common_prefix(void)
+{
+	struct strbuf s1 = STRBUF_INIT;
+	struct strbuf s2 = STRBUF_INIT;
+	strbuf_addstr(&s1, "abcdef");
+	strbuf_addstr(&s2, "abc");
+	EXPECT(common_prefix_size(&s1, &s2) == 3);
+	strbuf_release(&s1);
+	strbuf_release(&s2);
+}
+
+int basics_test_main(int argc, const char *argv[])
+{
+	RUN_TEST(test_common_prefix);
+	RUN_TEST(test_parse_names_normal);
+	RUN_TEST(test_parse_names_drop_empty);
+	RUN_TEST(test_binsearch);
+	RUN_TEST(test_names_length);
+	return 0;
+}
diff --git a/reftable/publicbasics.c b/reftable/publicbasics.c
new file mode 100644
index 00000000000..0ad7d5c0ff2
--- /dev/null
+++ b/reftable/publicbasics.c
@@ -0,0 +1,65 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "reftable-malloc.h"
+
+#include "basics.h"
+#include "system.h"
+
+static void *(*reftable_malloc_ptr)(size_t sz);
+static void *(*reftable_realloc_ptr)(void *, size_t);
+static void (*reftable_free_ptr)(void *);
+
+void *reftable_malloc(size_t sz)
+{
+	if (reftable_malloc_ptr)
+		return (*reftable_malloc_ptr)(sz);
+	return malloc(sz);
+}
+
+void *reftable_realloc(void *p, size_t sz)
+{
+	if (reftable_realloc_ptr)
+		return (*reftable_realloc_ptr)(p, sz);
+	return realloc(p, sz);
+}
+
+void reftable_free(void *p)
+{
+	if (reftable_free_ptr)
+		reftable_free_ptr(p);
+	else
+		free(p);
+}
+
+void *reftable_calloc(size_t sz)
+{
+	void *p = reftable_malloc(sz);
+	memset(p, 0, sz);
+	return p;
+}
+
+void reftable_set_alloc(void *(*malloc)(size_t),
+			void *(*realloc)(void *, size_t), void (*free)(void *))
+{
+	reftable_malloc_ptr = malloc;
+	reftable_realloc_ptr = realloc;
+	reftable_free_ptr = free;
+}
+
+int hash_size(uint32_t id)
+{
+	switch (id) {
+	case 0:
+	case GIT_SHA1_FORMAT_ID:
+		return GIT_SHA1_RAWSZ;
+	case GIT_SHA256_FORMAT_ID:
+		return GIT_SHA256_RAWSZ;
+	}
+	abort();
+}
diff --git a/reftable/reftable-malloc.h b/reftable/reftable-malloc.h
new file mode 100644
index 00000000000..5f2185f1f34
--- /dev/null
+++ b/reftable/reftable-malloc.h
@@ -0,0 +1,18 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef REFTABLE_H
+#define REFTABLE_H
+
+#include <stddef.h>
+
+/* Overrides the functions to use for memory management. */
+void reftable_set_alloc(void *(*malloc)(size_t),
+			void *(*realloc)(void *, size_t), void (*free)(void *));
+
+#endif
diff --git a/reftable/reftable-tests.h b/reftable/reftable-tests.h
new file mode 100644
index 00000000000..5e7698ae654
--- /dev/null
+++ b/reftable/reftable-tests.h
@@ -0,0 +1,22 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef REFTABLE_TESTS_H
+#define REFTABLE_TESTS_H
+
+int basics_test_main(int argc, const char **argv);
+int block_test_main(int argc, const char **argv);
+int merged_test_main(int argc, const char **argv);
+int record_test_main(int argc, const char **argv);
+int refname_test_main(int argc, const char **argv);
+int reftable_test_main(int argc, const char **argv);
+int stack_test_main(int argc, const char **argv);
+int tree_test_main(int argc, const char **argv);
+int reftable_dump_main(int argc, char *const *argv);
+
+#endif
diff --git a/reftable/system.h b/reftable/system.h
new file mode 100644
index 00000000000..4907306c0c5
--- /dev/null
+++ b/reftable/system.h
@@ -0,0 +1,32 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef SYSTEM_H
+#define SYSTEM_H
+
+/* This header glues the reftable library to the rest of Git */
+
+#include "git-compat-util.h"
+#include "strbuf.h"
+#include "hash.h" /* hash ID, sizes.*/
+#include "dir.h" /* remove_dir_recursively, for tests.*/
+
+#include <zlib.h>
+
+#ifdef NO_UNCOMPRESS2
+/*
+ * This is uncompress2, which is only available in zlib >= 1.2.9
+ * (released as of early 2017)
+ */
+int uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source,
+		uLong *sourceLen);
+#endif
+
+int hash_size(uint32_t id);
+
+#endif
diff --git a/reftable/test_framework.c b/reftable/test_framework.c
new file mode 100644
index 00000000000..84ac972cad0
--- /dev/null
+++ b/reftable/test_framework.c
@@ -0,0 +1,23 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "system.h"
+#include "test_framework.h"
+
+#include "basics.h"
+
+void set_test_hash(uint8_t *p, int i)
+{
+	memset(p, (uint8_t)i, hash_size(GIT_SHA1_FORMAT_ID));
+}
+
+ssize_t strbuf_add_void(void *b, const void *data, size_t sz)
+{
+	strbuf_add(b, data, sz);
+	return sz;
+}
diff --git a/reftable/test_framework.h b/reftable/test_framework.h
new file mode 100644
index 00000000000..774cb275bf6
--- /dev/null
+++ b/reftable/test_framework.h
@@ -0,0 +1,53 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef TEST_FRAMEWORK_H
+#define TEST_FRAMEWORK_H
+
+#include "system.h"
+#include "reftable-error.h"
+
+#define EXPECT_ERR(c)                                                  \
+	if (c != 0) {                                                  \
+		fflush(stderr);                                        \
+		fflush(stdout);                                        \
+		fprintf(stderr, "%s: %d: error == %d (%s), want 0\n",  \
+			__FILE__, __LINE__, c, reftable_error_str(c)); \
+		abort();                                               \
+	}
+
+#define EXPECT_STREQ(a, b)                                               \
+	if (strcmp(a, b)) {                                              \
+		fflush(stderr);                                          \
+		fflush(stdout);                                          \
+		fprintf(stderr, "%s:%d: %s (%s) != %s (%s)\n", __FILE__, \
+			__LINE__, #a, a, #b, b);                         \
+		abort();                                                 \
+	}
+
+#define EXPECT(c)                                                          \
+	if (!(c)) {                                                        \
+		fflush(stderr);                                            \
+		fflush(stdout);                                            \
+		fprintf(stderr, "%s: %d: failed assertion %s\n", __FILE__, \
+			__LINE__, #c);                                     \
+		abort();                                                   \
+	}
+
+#define RUN_TEST(f)                          \
+	fprintf(stderr, "running %s\n", #f); \
+	fflush(stderr);                      \
+	f();
+
+void set_test_hash(uint8_t *p, int i);
+
+/* Like strbuf_add, but suitable for passing to reftable_new_writer
+ */
+ssize_t strbuf_add_void(void *b, const void *data, size_t sz);
+
+#endif
diff --git a/t/helper/test-reftable.c b/t/helper/test-reftable.c
new file mode 100644
index 00000000000..3b58e423e7b
--- /dev/null
+++ b/t/helper/test-reftable.c
@@ -0,0 +1,9 @@
+#include "reftable/reftable-tests.h"
+#include "test-tool.h"
+
+int cmd__reftable(int argc, const char **argv)
+{
+	basics_test_main(argc, argv);
+
+	return 0;
+}
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 3ce5585e53a..f7c888ffda7 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -53,13 +53,14 @@ static struct test_cmd cmds[] = {
 	{ "pcre2-config", cmd__pcre2_config },
 	{ "pkt-line", cmd__pkt_line },
 	{ "prio-queue", cmd__prio_queue },
-	{ "proc-receive", cmd__proc_receive},
+	{ "proc-receive", cmd__proc_receive },
 	{ "progress", cmd__progress },
 	{ "reach", cmd__reach },
 	{ "read-cache", cmd__read_cache },
 	{ "read-graph", cmd__read_graph },
 	{ "read-midx", cmd__read_midx },
 	{ "ref-store", cmd__ref_store },
+	{ "reftable", cmd__reftable },
 	{ "regex", cmd__regex },
 	{ "repository", cmd__repository },
 	{ "revision-walking", cmd__revision_walking },
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 9f0f5228508..25f77469146 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -49,6 +49,7 @@ int cmd__read_cache(int argc, const char **argv);
 int cmd__read_graph(int argc, const char **argv);
 int cmd__read_midx(int argc, const char **argv);
 int cmd__ref_store(int argc, const char **argv);
+int cmd__reftable(int argc, const char **argv);
 int cmd__regex(int argc, const char **argv);
 int cmd__repository(int argc, const char **argv);
 int cmd__revision_walking(int argc, const char **argv);
diff --git a/t/t0032-reftable-unittest.sh b/t/t0032-reftable-unittest.sh
new file mode 100755
index 00000000000..0ed14971a58
--- /dev/null
+++ b/t/t0032-reftable-unittest.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# Copyright (c) 2020 Google LLC
+#
+
+test_description='reftable unittests'
+
+. ./test-lib.sh
+
+test_expect_success 'unittests' '
+	TMPDIR=$(pwd) && export TMPDIR &&
+	test-tool reftable
+'
+
+test_done
-- 
gitgitgadget


^ permalink raw reply related	[relevance 7%]

* [PATCH v3 04/19] reftable: utility functions
  @ 2021-09-28 15:10  7%     ` Han-Wen Nienhuys via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Han-Wen Nienhuys via GitGitGadget @ 2021-09-28 15:10 UTC (permalink / raw)
  To: git
  Cc: Han-Wen Nienhuys, Carlo Marcelo Arenas Belón,
	Ævar Arnfjörð Bjarmason, Han-Wen Nienhuys,
	Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

This commit provides basic utility classes for the reftable library.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                                   |  25 +++-
 contrib/buildsystems/CMakeLists.txt        |  14 ++-
 contrib/buildsystems/Generators/Vcxproj.pm |  11 +-
 reftable/basics.c                          | 128 +++++++++++++++++++++
 reftable/basics.h                          |  60 ++++++++++
 reftable/basics_test.c                     |  98 ++++++++++++++++
 reftable/publicbasics.c                    |  58 ++++++++++
 reftable/reftable-malloc.h                 |  18 +++
 reftable/reftable-tests.h                  |  22 ++++
 reftable/system.h                          |  32 ++++++
 reftable/test_framework.c                  |  23 ++++
 reftable/test_framework.h                  |  53 +++++++++
 t/helper/test-reftable.c                   |   9 ++
 t/helper/test-tool.c                       |   3 +-
 t/helper/test-tool.h                       |   1 +
 t/t0032-reftable-unittest.sh               |  15 +++
 16 files changed, 563 insertions(+), 7 deletions(-)
 create mode 100644 reftable/basics.c
 create mode 100644 reftable/basics.h
 create mode 100644 reftable/basics_test.c
 create mode 100644 reftable/publicbasics.c
 create mode 100644 reftable/reftable-malloc.h
 create mode 100644 reftable/reftable-tests.h
 create mode 100644 reftable/system.h
 create mode 100644 reftable/test_framework.c
 create mode 100644 reftable/test_framework.h
 create mode 100644 t/helper/test-reftable.c
 create mode 100755 t/t0032-reftable-unittest.sh

diff --git a/Makefile b/Makefile
index a9f9b689f0c..cb48d44b0da 100644
--- a/Makefile
+++ b/Makefile
@@ -736,6 +736,7 @@ TEST_BUILTINS_OBJS += test-read-cache.o
 TEST_BUILTINS_OBJS += test-read-graph.o
 TEST_BUILTINS_OBJS += test-read-midx.o
 TEST_BUILTINS_OBJS += test-ref-store.o
+TEST_BUILTINS_OBJS += test-reftable.o
 TEST_BUILTINS_OBJS += test-regex.o
 TEST_BUILTINS_OBJS += test-repository.o
 TEST_BUILTINS_OBJS += test-revision-walking.o
@@ -814,6 +815,8 @@ TEST_SHELL_PATH = $(SHELL_PATH)
 
 LIB_FILE = libgit.a
 XDIFF_LIB = xdiff/lib.a
+REFTABLE_LIB = reftable/libreftable.a
+REFTABLE_TEST_LIB = reftable/libreftable_test.a
 
 GENERATED_H += command-list.h
 GENERATED_H += config-list.h
@@ -1188,7 +1191,7 @@ THIRD_PARTY_SOURCES += compat/regex/%
 THIRD_PARTY_SOURCES += sha1collisiondetection/%
 THIRD_PARTY_SOURCES += sha1dc/%
 
-GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
+GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB)
 EXTLIBS =
 
 GIT_USER_AGENT = git/$(GIT_VERSION)
@@ -2424,7 +2427,15 @@ XDIFF_OBJS += xdiff/xutils.o
 .PHONY: xdiff-objs
 xdiff-objs: $(XDIFF_OBJS)
 
+REFTABLE_OBJS += reftable/basics.o
+REFTABLE_OBJS += reftable/error.o
+REFTABLE_OBJS += reftable/publicbasics.o
+
+REFTABLE_TEST_OBJS += reftable/test_framework.o
+REFTABLE_TEST_OBJS += reftable/basics_test.o
+
 TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
+
 .PHONY: test-objs
 test-objs: $(TEST_OBJS)
 
@@ -2440,6 +2451,8 @@ OBJECTS += $(PROGRAM_OBJS)
 OBJECTS += $(TEST_OBJS)
 OBJECTS += $(XDIFF_OBJS)
 OBJECTS += $(FUZZ_OBJS)
+OBJECTS += $(REFTABLE_OBJS) $(REFTABLE_TEST_OBJS)
+
 ifndef NO_CURL
 	OBJECTS += http.o http-walker.o remote-curl.o
 endif
@@ -2590,6 +2603,12 @@ $(LIB_FILE): $(LIB_OBJS)
 $(XDIFF_LIB): $(XDIFF_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
+$(REFTABLE_LIB): $(REFTABLE_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
+
+$(REFTABLE_TEST_LIB): $(REFTABLE_TEST_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
+
 export DEFAULT_EDITOR DEFAULT_PAGER
 
 Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
@@ -2888,7 +2907,7 @@ perf: all
 
 t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
 
-t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
+t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS) $(REFTABLE_TEST_LIB)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
 
 check-sha1:: t/helper/test-tool$X
@@ -3223,7 +3242,7 @@ cocciclean:
 clean: profile-clean coverage-clean cocciclean
 	$(RM) *.res
 	$(RM) $(OBJECTS)
-	$(RM) $(LIB_FILE) $(XDIFF_LIB)
+	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
 	$(RM) $(TEST_PROGRAMS)
 	$(RM) $(FUZZ_PROGRAMS)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 171b4124afe..c2bf5bdffc6 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -640,6 +640,12 @@ parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
 list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
 add_library(xdiff STATIC ${libxdiff_SOURCES})
 
+#reftable
+parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+
+list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+add_library(reftable STATIC ${reftable_SOURCES})
+
 if(WIN32)
 	if(NOT MSVC)#use windres when compiling with gcc and clang
 		add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
@@ -662,7 +668,7 @@ endif()
 #link all required libraries to common-main
 add_library(common-main OBJECT ${CMAKE_SOURCE_DIR}/common-main.c)
 
-target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES})
+target_link_libraries(common-main libgit xdiff reftable ${ZLIB_LIBRARIES})
 if(Intl_FOUND)
 	target_link_libraries(common-main ${Intl_LIBRARIES})
 endif()
@@ -902,11 +908,15 @@ if(BUILD_TESTING)
 add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
 target_link_libraries(test-fake-ssh common-main)
 
+#reftable-tests
+parse_makefile_for_sources(test-reftable_SOURCES "REFTABLE_TEST_OBJS")
+list(TRANSFORM test-reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+
 #test-tool
 parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
 
 list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
-add_executable(test-tool ${CMAKE_SOURCE_DIR}/t/helper/test-tool.c ${test-tool_SOURCES})
+add_executable(test-tool ${CMAKE_SOURCE_DIR}/t/helper/test-tool.c ${test-tool_SOURCES} ${test-reftable_SOURCES})
 target_link_libraries(test-tool common-main)
 
 set_target_properties(test-fake-ssh test-tool
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index d2584450ba1..1a25789d285 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libexpat\.lib/libexpatd\.lib/g;
@@ -232,6 +232,7 @@ EOM
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -241,6 +242,14 @@ EOM
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
diff --git a/reftable/basics.c b/reftable/basics.c
new file mode 100644
index 00000000000..f761e48028c
--- /dev/null
+++ b/reftable/basics.c
@@ -0,0 +1,128 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "basics.h"
+
+void put_be24(uint8_t *out, uint32_t i)
+{
+	out[0] = (uint8_t)((i >> 16) & 0xff);
+	out[1] = (uint8_t)((i >> 8) & 0xff);
+	out[2] = (uint8_t)(i & 0xff);
+}
+
+uint32_t get_be24(uint8_t *in)
+{
+	return (uint32_t)(in[0]) << 16 | (uint32_t)(in[1]) << 8 |
+	       (uint32_t)(in[2]);
+}
+
+void put_be16(uint8_t *out, uint16_t i)
+{
+	out[0] = (uint8_t)((i >> 8) & 0xff);
+	out[1] = (uint8_t)(i & 0xff);
+}
+
+int binsearch(size_t sz, int (*f)(size_t k, void *args), void *args)
+{
+	size_t lo = 0;
+	size_t hi = sz;
+
+	/* Invariants:
+	 *
+	 *  (hi == sz) || f(hi) == true
+	 *  (lo == 0 && f(0) == true) || fi(lo) == false
+	 */
+	while (hi - lo > 1) {
+		size_t mid = lo + (hi - lo) / 2;
+
+		if (f(mid, args))
+			hi = mid;
+		else
+			lo = mid;
+	}
+
+	if (lo)
+		return hi;
+
+	return f(0, args) ? 0 : 1;
+}
+
+void free_names(char **a)
+{
+	char **p;
+	if (!a) {
+		return;
+	}
+	for (p = a; *p; p++) {
+		reftable_free(*p);
+	}
+	reftable_free(a);
+}
+
+int names_length(char **names)
+{
+	char **p = names;
+	for (; *p; p++) {
+		/* empty */
+	}
+	return p - names;
+}
+
+void parse_names(char *buf, int size, char ***namesp)
+{
+	char **names = NULL;
+	size_t names_cap = 0;
+	size_t names_len = 0;
+
+	char *p = buf;
+	char *end = buf + size;
+	while (p < end) {
+		char *next = strchr(p, '\n');
+		if (next && next < end) {
+			*next = 0;
+		} else {
+			next = end;
+		}
+		if (p < next) {
+			if (names_len == names_cap) {
+				names_cap = 2 * names_cap + 1;
+				names = reftable_realloc(
+					names, names_cap * sizeof(*names));
+			}
+			names[names_len++] = xstrdup(p);
+		}
+		p = next + 1;
+	}
+
+	names = reftable_realloc(names, (names_len + 1) * sizeof(*names));
+	names[names_len] = NULL;
+	*namesp = names;
+}
+
+int names_equal(char **a, char **b)
+{
+	int i = 0;
+	for (; a[i] && b[i]; i++) {
+		if (strcmp(a[i], b[i])) {
+			return 0;
+		}
+	}
+
+	return a[i] == b[i];
+}
+
+int common_prefix_size(struct strbuf *a, struct strbuf *b)
+{
+	int p = 0;
+	for (; p < a->len && p < b->len; p++) {
+		if (a->buf[p] != b->buf[p])
+			break;
+	}
+
+	return p;
+}
diff --git a/reftable/basics.h b/reftable/basics.h
new file mode 100644
index 00000000000..096b36862b9
--- /dev/null
+++ b/reftable/basics.h
@@ -0,0 +1,60 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef BASICS_H
+#define BASICS_H
+
+/*
+ * miscellaneous utilities that are not provided by Git.
+ */
+
+#include "system.h"
+
+/* Bigendian en/decoding of integers */
+
+void put_be24(uint8_t *out, uint32_t i);
+uint32_t get_be24(uint8_t *in);
+void put_be16(uint8_t *out, uint16_t i);
+
+/*
+ * find smallest index i in [0, sz) at which f(i) is true, assuming
+ * that f is ascending. Return sz if f(i) is false for all indices.
+ *
+ * Contrary to bsearch(3), this returns something useful if the argument is not
+ * found.
+ */
+int binsearch(size_t sz, int (*f)(size_t k, void *args), void *args);
+
+/*
+ * Frees a NULL terminated array of malloced strings. The array itself is also
+ * freed.
+ */
+void free_names(char **a);
+
+/* parse a newline separated list of names. `size` is the length of the buffer,
+ * without terminating '\0'. Empty names are discarded. */
+void parse_names(char *buf, int size, char ***namesp);
+
+/* compares two NULL-terminated arrays of strings. */
+int names_equal(char **a, char **b);
+
+/* returns the array size of a NULL-terminated array of strings. */
+int names_length(char **names);
+
+/* Allocation routines; they invoke the functions set through
+ * reftable_set_alloc() */
+void *reftable_malloc(size_t sz);
+void *reftable_realloc(void *p, size_t sz);
+void reftable_free(void *p);
+void *reftable_calloc(size_t sz);
+
+/* Find the longest shared prefix size of `a` and `b` */
+struct strbuf;
+int common_prefix_size(struct strbuf *a, struct strbuf *b);
+
+#endif
diff --git a/reftable/basics_test.c b/reftable/basics_test.c
new file mode 100644
index 00000000000..1fcd2297256
--- /dev/null
+++ b/reftable/basics_test.c
@@ -0,0 +1,98 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "system.h"
+
+#include "basics.h"
+#include "test_framework.h"
+#include "reftable-tests.h"
+
+struct binsearch_args {
+	int key;
+	int *arr;
+};
+
+static int binsearch_func(size_t i, void *void_args)
+{
+	struct binsearch_args *args = void_args;
+
+	return args->key < args->arr[i];
+}
+
+static void test_binsearch(void)
+{
+	int arr[] = { 2, 4, 6, 8, 10 };
+	size_t sz = ARRAY_SIZE(arr);
+	struct binsearch_args args = {
+		.arr = arr,
+	};
+
+	int i = 0;
+	for (i = 1; i < 11; i++) {
+		int res;
+		args.key = i;
+		res = binsearch(sz, &binsearch_func, &args);
+
+		if (res < sz) {
+			EXPECT(args.key < arr[res]);
+			if (res > 0) {
+				EXPECT(args.key >= arr[res - 1]);
+			}
+		} else {
+			EXPECT(args.key == 10 || args.key == 11);
+		}
+	}
+}
+
+static void test_names_length(void)
+{
+	char *a[] = { "a", "b", NULL };
+	EXPECT(names_length(a) == 2);
+}
+
+static void test_parse_names_normal(void)
+{
+	char in[] = "a\nb\n";
+	char **out = NULL;
+	parse_names(in, strlen(in), &out);
+	EXPECT(!strcmp(out[0], "a"));
+	EXPECT(!strcmp(out[1], "b"));
+	EXPECT(!out[2]);
+	free_names(out);
+}
+
+static void test_parse_names_drop_empty(void)
+{
+	char in[] = "a\n\n";
+	char **out = NULL;
+	parse_names(in, strlen(in), &out);
+	EXPECT(!strcmp(out[0], "a"));
+	EXPECT(!out[1]);
+	free_names(out);
+}
+
+static void test_common_prefix(void)
+{
+	struct strbuf s1 = STRBUF_INIT;
+	struct strbuf s2 = STRBUF_INIT;
+	strbuf_addstr(&s1, "abcdef");
+	strbuf_addstr(&s2, "abc");
+	EXPECT(common_prefix_size(&s1, &s2) == 3);
+	strbuf_release(&s1);
+	strbuf_release(&s2);
+}
+
+int basics_test_main(int argc, const char *argv[])
+{
+	RUN_TEST(test_common_prefix);
+	RUN_TEST(test_parse_names_normal);
+	RUN_TEST(test_parse_names_drop_empty);
+	RUN_TEST(test_binsearch);
+	RUN_TEST(test_names_length);
+	return 0;
+}
diff --git a/reftable/publicbasics.c b/reftable/publicbasics.c
new file mode 100644
index 00000000000..bd0a02d3f68
--- /dev/null
+++ b/reftable/publicbasics.c
@@ -0,0 +1,58 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "reftable-malloc.h"
+
+#include "basics.h"
+#include "system.h"
+
+static void *(*reftable_malloc_ptr)(size_t sz) = &malloc;
+static void *(*reftable_realloc_ptr)(void *, size_t) = &realloc;
+static void (*reftable_free_ptr)(void *) = &free;
+
+void *reftable_malloc(size_t sz)
+{
+	return (*reftable_malloc_ptr)(sz);
+}
+
+void *reftable_realloc(void *p, size_t sz)
+{
+	return (*reftable_realloc_ptr)(p, sz);
+}
+
+void reftable_free(void *p)
+{
+	reftable_free_ptr(p);
+}
+
+void *reftable_calloc(size_t sz)
+{
+	void *p = reftable_malloc(sz);
+	memset(p, 0, sz);
+	return p;
+}
+
+void reftable_set_alloc(void *(*malloc)(size_t),
+			void *(*realloc)(void *, size_t), void (*free)(void *))
+{
+	reftable_malloc_ptr = malloc;
+	reftable_realloc_ptr = realloc;
+	reftable_free_ptr = free;
+}
+
+int hash_size(uint32_t id)
+{
+	switch (id) {
+	case 0:
+	case GIT_SHA1_FORMAT_ID:
+		return GIT_SHA1_RAWSZ;
+	case GIT_SHA256_FORMAT_ID:
+		return GIT_SHA256_RAWSZ;
+	}
+	abort();
+}
diff --git a/reftable/reftable-malloc.h b/reftable/reftable-malloc.h
new file mode 100644
index 00000000000..5f2185f1f34
--- /dev/null
+++ b/reftable/reftable-malloc.h
@@ -0,0 +1,18 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef REFTABLE_H
+#define REFTABLE_H
+
+#include <stddef.h>
+
+/* Overrides the functions to use for memory management. */
+void reftable_set_alloc(void *(*malloc)(size_t),
+			void *(*realloc)(void *, size_t), void (*free)(void *));
+
+#endif
diff --git a/reftable/reftable-tests.h b/reftable/reftable-tests.h
new file mode 100644
index 00000000000..5e7698ae654
--- /dev/null
+++ b/reftable/reftable-tests.h
@@ -0,0 +1,22 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef REFTABLE_TESTS_H
+#define REFTABLE_TESTS_H
+
+int basics_test_main(int argc, const char **argv);
+int block_test_main(int argc, const char **argv);
+int merged_test_main(int argc, const char **argv);
+int record_test_main(int argc, const char **argv);
+int refname_test_main(int argc, const char **argv);
+int reftable_test_main(int argc, const char **argv);
+int stack_test_main(int argc, const char **argv);
+int tree_test_main(int argc, const char **argv);
+int reftable_dump_main(int argc, char *const *argv);
+
+#endif
diff --git a/reftable/system.h b/reftable/system.h
new file mode 100644
index 00000000000..4907306c0c5
--- /dev/null
+++ b/reftable/system.h
@@ -0,0 +1,32 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef SYSTEM_H
+#define SYSTEM_H
+
+/* This header glues the reftable library to the rest of Git */
+
+#include "git-compat-util.h"
+#include "strbuf.h"
+#include "hash.h" /* hash ID, sizes.*/
+#include "dir.h" /* remove_dir_recursively, for tests.*/
+
+#include <zlib.h>
+
+#ifdef NO_UNCOMPRESS2
+/*
+ * This is uncompress2, which is only available in zlib >= 1.2.9
+ * (released as of early 2017)
+ */
+int uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source,
+		uLong *sourceLen);
+#endif
+
+int hash_size(uint32_t id);
+
+#endif
diff --git a/reftable/test_framework.c b/reftable/test_framework.c
new file mode 100644
index 00000000000..84ac972cad0
--- /dev/null
+++ b/reftable/test_framework.c
@@ -0,0 +1,23 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "system.h"
+#include "test_framework.h"
+
+#include "basics.h"
+
+void set_test_hash(uint8_t *p, int i)
+{
+	memset(p, (uint8_t)i, hash_size(GIT_SHA1_FORMAT_ID));
+}
+
+ssize_t strbuf_add_void(void *b, const void *data, size_t sz)
+{
+	strbuf_add(b, data, sz);
+	return sz;
+}
diff --git a/reftable/test_framework.h b/reftable/test_framework.h
new file mode 100644
index 00000000000..774cb275bf6
--- /dev/null
+++ b/reftable/test_framework.h
@@ -0,0 +1,53 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef TEST_FRAMEWORK_H
+#define TEST_FRAMEWORK_H
+
+#include "system.h"
+#include "reftable-error.h"
+
+#define EXPECT_ERR(c)                                                  \
+	if (c != 0) {                                                  \
+		fflush(stderr);                                        \
+		fflush(stdout);                                        \
+		fprintf(stderr, "%s: %d: error == %d (%s), want 0\n",  \
+			__FILE__, __LINE__, c, reftable_error_str(c)); \
+		abort();                                               \
+	}
+
+#define EXPECT_STREQ(a, b)                                               \
+	if (strcmp(a, b)) {                                              \
+		fflush(stderr);                                          \
+		fflush(stdout);                                          \
+		fprintf(stderr, "%s:%d: %s (%s) != %s (%s)\n", __FILE__, \
+			__LINE__, #a, a, #b, b);                         \
+		abort();                                                 \
+	}
+
+#define EXPECT(c)                                                          \
+	if (!(c)) {                                                        \
+		fflush(stderr);                                            \
+		fflush(stdout);                                            \
+		fprintf(stderr, "%s: %d: failed assertion %s\n", __FILE__, \
+			__LINE__, #c);                                     \
+		abort();                                                   \
+	}
+
+#define RUN_TEST(f)                          \
+	fprintf(stderr, "running %s\n", #f); \
+	fflush(stderr);                      \
+	f();
+
+void set_test_hash(uint8_t *p, int i);
+
+/* Like strbuf_add, but suitable for passing to reftable_new_writer
+ */
+ssize_t strbuf_add_void(void *b, const void *data, size_t sz);
+
+#endif
diff --git a/t/helper/test-reftable.c b/t/helper/test-reftable.c
new file mode 100644
index 00000000000..3b58e423e7b
--- /dev/null
+++ b/t/helper/test-reftable.c
@@ -0,0 +1,9 @@
+#include "reftable/reftable-tests.h"
+#include "test-tool.h"
+
+int cmd__reftable(int argc, const char **argv)
+{
+	basics_test_main(argc, argv);
+
+	return 0;
+}
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 3ce5585e53a..f7c888ffda7 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -53,13 +53,14 @@ static struct test_cmd cmds[] = {
 	{ "pcre2-config", cmd__pcre2_config },
 	{ "pkt-line", cmd__pkt_line },
 	{ "prio-queue", cmd__prio_queue },
-	{ "proc-receive", cmd__proc_receive},
+	{ "proc-receive", cmd__proc_receive },
 	{ "progress", cmd__progress },
 	{ "reach", cmd__reach },
 	{ "read-cache", cmd__read_cache },
 	{ "read-graph", cmd__read_graph },
 	{ "read-midx", cmd__read_midx },
 	{ "ref-store", cmd__ref_store },
+	{ "reftable", cmd__reftable },
 	{ "regex", cmd__regex },
 	{ "repository", cmd__repository },
 	{ "revision-walking", cmd__revision_walking },
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 9f0f5228508..25f77469146 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -49,6 +49,7 @@ int cmd__read_cache(int argc, const char **argv);
 int cmd__read_graph(int argc, const char **argv);
 int cmd__read_midx(int argc, const char **argv);
 int cmd__ref_store(int argc, const char **argv);
+int cmd__reftable(int argc, const char **argv);
 int cmd__regex(int argc, const char **argv);
 int cmd__repository(int argc, const char **argv);
 int cmd__revision_walking(int argc, const char **argv);
diff --git a/t/t0032-reftable-unittest.sh b/t/t0032-reftable-unittest.sh
new file mode 100755
index 00000000000..0ed14971a58
--- /dev/null
+++ b/t/t0032-reftable-unittest.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# Copyright (c) 2020 Google LLC
+#
+
+test_description='reftable unittests'
+
+. ./test-lib.sh
+
+test_expect_success 'unittests' '
+	TMPDIR=$(pwd) && export TMPDIR &&
+	test-tool reftable
+'
+
+test_done
-- 
gitgitgadget


^ permalink raw reply related	[relevance 7%]

* [PATCH v2 04/19] reftable: utility functions
  @ 2021-09-09 18:47  7%   ` Han-Wen Nienhuys via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Han-Wen Nienhuys via GitGitGadget @ 2021-09-09 18:47 UTC (permalink / raw)
  To: git
  Cc: Han-Wen Nienhuys, Carlo Marcelo Arenas Belón,
	Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

This commit provides basic utility classes for the reftable library.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                                   |  25 +++-
 contrib/buildsystems/CMakeLists.txt        |  14 ++-
 contrib/buildsystems/Generators/Vcxproj.pm |  11 +-
 reftable/basics.c                          | 128 +++++++++++++++++++++
 reftable/basics.h                          |  60 ++++++++++
 reftable/basics_test.c                     |  98 ++++++++++++++++
 reftable/publicbasics.c                    |  58 ++++++++++
 reftable/reftable-malloc.h                 |  18 +++
 reftable/reftable-tests.h                  |  22 ++++
 reftable/system.h                          |  32 ++++++
 reftable/test_framework.c                  |  23 ++++
 reftable/test_framework.h                  |  53 +++++++++
 t/helper/test-reftable.c                   |   9 ++
 t/helper/test-tool.c                       |   3 +-
 t/helper/test-tool.h                       |   1 +
 t/t0032-reftable-unittest.sh               |  15 +++
 16 files changed, 563 insertions(+), 7 deletions(-)
 create mode 100644 reftable/basics.c
 create mode 100644 reftable/basics.h
 create mode 100644 reftable/basics_test.c
 create mode 100644 reftable/publicbasics.c
 create mode 100644 reftable/reftable-malloc.h
 create mode 100644 reftable/reftable-tests.h
 create mode 100644 reftable/system.h
 create mode 100644 reftable/test_framework.c
 create mode 100644 reftable/test_framework.h
 create mode 100644 t/helper/test-reftable.c
 create mode 100755 t/t0032-reftable-unittest.sh

diff --git a/Makefile b/Makefile
index 429c276058d..0bf5e49aa61 100644
--- a/Makefile
+++ b/Makefile
@@ -743,6 +743,7 @@ TEST_BUILTINS_OBJS += test-read-cache.o
 TEST_BUILTINS_OBJS += test-read-graph.o
 TEST_BUILTINS_OBJS += test-read-midx.o
 TEST_BUILTINS_OBJS += test-ref-store.o
+TEST_BUILTINS_OBJS += test-reftable.o
 TEST_BUILTINS_OBJS += test-regex.o
 TEST_BUILTINS_OBJS += test-repository.o
 TEST_BUILTINS_OBJS += test-revision-walking.o
@@ -821,6 +822,8 @@ TEST_SHELL_PATH = $(SHELL_PATH)
 
 LIB_FILE = libgit.a
 XDIFF_LIB = xdiff/lib.a
+REFTABLE_LIB = reftable/libreftable.a
+REFTABLE_TEST_LIB = reftable/libreftable_test.a
 
 GENERATED_H += command-list.h
 GENERATED_H += config-list.h
@@ -1195,7 +1198,7 @@ THIRD_PARTY_SOURCES += compat/regex/%
 THIRD_PARTY_SOURCES += sha1collisiondetection/%
 THIRD_PARTY_SOURCES += sha1dc/%
 
-GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
+GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB)
 EXTLIBS =
 
 GIT_USER_AGENT = git/$(GIT_VERSION)
@@ -2446,7 +2449,15 @@ XDIFF_OBJS += xdiff/xutils.o
 .PHONY: xdiff-objs
 xdiff-objs: $(XDIFF_OBJS)
 
+REFTABLE_OBJS += reftable/basics.o
+REFTABLE_OBJS += reftable/error.o
+REFTABLE_OBJS += reftable/publicbasics.o
+
+REFTABLE_TEST_OBJS += reftable/test_framework.o
+REFTABLE_TEST_OBJS += reftable/basics_test.o
+
 TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
+
 .PHONY: test-objs
 test-objs: $(TEST_OBJS)
 
@@ -2462,6 +2473,8 @@ OBJECTS += $(PROGRAM_OBJS)
 OBJECTS += $(TEST_OBJS)
 OBJECTS += $(XDIFF_OBJS)
 OBJECTS += $(FUZZ_OBJS)
+OBJECTS += $(REFTABLE_OBJS) $(REFTABLE_TEST_OBJS)
+
 ifndef NO_CURL
 	OBJECTS += http.o http-walker.o remote-curl.o
 endif
@@ -2612,6 +2625,12 @@ $(LIB_FILE): $(LIB_OBJS)
 $(XDIFF_LIB): $(XDIFF_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
+$(REFTABLE_LIB): $(REFTABLE_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
+
+$(REFTABLE_TEST_LIB): $(REFTABLE_TEST_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
+
 export DEFAULT_EDITOR DEFAULT_PAGER
 
 Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
@@ -2904,7 +2923,7 @@ perf: all
 
 t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
 
-t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
+t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS) $(REFTABLE_TEST_LIB)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
 
 check-sha1:: t/helper/test-tool$X
@@ -3234,7 +3253,7 @@ cocciclean:
 clean: profile-clean coverage-clean cocciclean
 	$(RM) *.res
 	$(RM) $(OBJECTS)
-	$(RM) $(LIB_FILE) $(XDIFF_LIB)
+	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
 	$(RM) $(TEST_PROGRAMS)
 	$(RM) $(FUZZ_PROGRAMS)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 171b4124afe..c2bf5bdffc6 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -640,6 +640,12 @@ parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
 list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
 add_library(xdiff STATIC ${libxdiff_SOURCES})
 
+#reftable
+parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+
+list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+add_library(reftable STATIC ${reftable_SOURCES})
+
 if(WIN32)
 	if(NOT MSVC)#use windres when compiling with gcc and clang
 		add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
@@ -662,7 +668,7 @@ endif()
 #link all required libraries to common-main
 add_library(common-main OBJECT ${CMAKE_SOURCE_DIR}/common-main.c)
 
-target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES})
+target_link_libraries(common-main libgit xdiff reftable ${ZLIB_LIBRARIES})
 if(Intl_FOUND)
 	target_link_libraries(common-main ${Intl_LIBRARIES})
 endif()
@@ -902,11 +908,15 @@ if(BUILD_TESTING)
 add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
 target_link_libraries(test-fake-ssh common-main)
 
+#reftable-tests
+parse_makefile_for_sources(test-reftable_SOURCES "REFTABLE_TEST_OBJS")
+list(TRANSFORM test-reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+
 #test-tool
 parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
 
 list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
-add_executable(test-tool ${CMAKE_SOURCE_DIR}/t/helper/test-tool.c ${test-tool_SOURCES})
+add_executable(test-tool ${CMAKE_SOURCE_DIR}/t/helper/test-tool.c ${test-tool_SOURCES} ${test-reftable_SOURCES})
 target_link_libraries(test-tool common-main)
 
 set_target_properties(test-fake-ssh test-tool
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index d2584450ba1..1a25789d285 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libexpat\.lib/libexpatd\.lib/g;
@@ -232,6 +232,7 @@ EOM
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -241,6 +242,14 @@ EOM
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
diff --git a/reftable/basics.c b/reftable/basics.c
new file mode 100644
index 00000000000..f761e48028c
--- /dev/null
+++ b/reftable/basics.c
@@ -0,0 +1,128 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "basics.h"
+
+void put_be24(uint8_t *out, uint32_t i)
+{
+	out[0] = (uint8_t)((i >> 16) & 0xff);
+	out[1] = (uint8_t)((i >> 8) & 0xff);
+	out[2] = (uint8_t)(i & 0xff);
+}
+
+uint32_t get_be24(uint8_t *in)
+{
+	return (uint32_t)(in[0]) << 16 | (uint32_t)(in[1]) << 8 |
+	       (uint32_t)(in[2]);
+}
+
+void put_be16(uint8_t *out, uint16_t i)
+{
+	out[0] = (uint8_t)((i >> 8) & 0xff);
+	out[1] = (uint8_t)(i & 0xff);
+}
+
+int binsearch(size_t sz, int (*f)(size_t k, void *args), void *args)
+{
+	size_t lo = 0;
+	size_t hi = sz;
+
+	/* Invariants:
+	 *
+	 *  (hi == sz) || f(hi) == true
+	 *  (lo == 0 && f(0) == true) || fi(lo) == false
+	 */
+	while (hi - lo > 1) {
+		size_t mid = lo + (hi - lo) / 2;
+
+		if (f(mid, args))
+			hi = mid;
+		else
+			lo = mid;
+	}
+
+	if (lo)
+		return hi;
+
+	return f(0, args) ? 0 : 1;
+}
+
+void free_names(char **a)
+{
+	char **p;
+	if (!a) {
+		return;
+	}
+	for (p = a; *p; p++) {
+		reftable_free(*p);
+	}
+	reftable_free(a);
+}
+
+int names_length(char **names)
+{
+	char **p = names;
+	for (; *p; p++) {
+		/* empty */
+	}
+	return p - names;
+}
+
+void parse_names(char *buf, int size, char ***namesp)
+{
+	char **names = NULL;
+	size_t names_cap = 0;
+	size_t names_len = 0;
+
+	char *p = buf;
+	char *end = buf + size;
+	while (p < end) {
+		char *next = strchr(p, '\n');
+		if (next && next < end) {
+			*next = 0;
+		} else {
+			next = end;
+		}
+		if (p < next) {
+			if (names_len == names_cap) {
+				names_cap = 2 * names_cap + 1;
+				names = reftable_realloc(
+					names, names_cap * sizeof(*names));
+			}
+			names[names_len++] = xstrdup(p);
+		}
+		p = next + 1;
+	}
+
+	names = reftable_realloc(names, (names_len + 1) * sizeof(*names));
+	names[names_len] = NULL;
+	*namesp = names;
+}
+
+int names_equal(char **a, char **b)
+{
+	int i = 0;
+	for (; a[i] && b[i]; i++) {
+		if (strcmp(a[i], b[i])) {
+			return 0;
+		}
+	}
+
+	return a[i] == b[i];
+}
+
+int common_prefix_size(struct strbuf *a, struct strbuf *b)
+{
+	int p = 0;
+	for (; p < a->len && p < b->len; p++) {
+		if (a->buf[p] != b->buf[p])
+			break;
+	}
+
+	return p;
+}
diff --git a/reftable/basics.h b/reftable/basics.h
new file mode 100644
index 00000000000..096b36862b9
--- /dev/null
+++ b/reftable/basics.h
@@ -0,0 +1,60 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef BASICS_H
+#define BASICS_H
+
+/*
+ * miscellaneous utilities that are not provided by Git.
+ */
+
+#include "system.h"
+
+/* Bigendian en/decoding of integers */
+
+void put_be24(uint8_t *out, uint32_t i);
+uint32_t get_be24(uint8_t *in);
+void put_be16(uint8_t *out, uint16_t i);
+
+/*
+ * find smallest index i in [0, sz) at which f(i) is true, assuming
+ * that f is ascending. Return sz if f(i) is false for all indices.
+ *
+ * Contrary to bsearch(3), this returns something useful if the argument is not
+ * found.
+ */
+int binsearch(size_t sz, int (*f)(size_t k, void *args), void *args);
+
+/*
+ * Frees a NULL terminated array of malloced strings. The array itself is also
+ * freed.
+ */
+void free_names(char **a);
+
+/* parse a newline separated list of names. `size` is the length of the buffer,
+ * without terminating '\0'. Empty names are discarded. */
+void parse_names(char *buf, int size, char ***namesp);
+
+/* compares two NULL-terminated arrays of strings. */
+int names_equal(char **a, char **b);
+
+/* returns the array size of a NULL-terminated array of strings. */
+int names_length(char **names);
+
+/* Allocation routines; they invoke the functions set through
+ * reftable_set_alloc() */
+void *reftable_malloc(size_t sz);
+void *reftable_realloc(void *p, size_t sz);
+void reftable_free(void *p);
+void *reftable_calloc(size_t sz);
+
+/* Find the longest shared prefix size of `a` and `b` */
+struct strbuf;
+int common_prefix_size(struct strbuf *a, struct strbuf *b);
+
+#endif
diff --git a/reftable/basics_test.c b/reftable/basics_test.c
new file mode 100644
index 00000000000..1fcd2297256
--- /dev/null
+++ b/reftable/basics_test.c
@@ -0,0 +1,98 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "system.h"
+
+#include "basics.h"
+#include "test_framework.h"
+#include "reftable-tests.h"
+
+struct binsearch_args {
+	int key;
+	int *arr;
+};
+
+static int binsearch_func(size_t i, void *void_args)
+{
+	struct binsearch_args *args = void_args;
+
+	return args->key < args->arr[i];
+}
+
+static void test_binsearch(void)
+{
+	int arr[] = { 2, 4, 6, 8, 10 };
+	size_t sz = ARRAY_SIZE(arr);
+	struct binsearch_args args = {
+		.arr = arr,
+	};
+
+	int i = 0;
+	for (i = 1; i < 11; i++) {
+		int res;
+		args.key = i;
+		res = binsearch(sz, &binsearch_func, &args);
+
+		if (res < sz) {
+			EXPECT(args.key < arr[res]);
+			if (res > 0) {
+				EXPECT(args.key >= arr[res - 1]);
+			}
+		} else {
+			EXPECT(args.key == 10 || args.key == 11);
+		}
+	}
+}
+
+static void test_names_length(void)
+{
+	char *a[] = { "a", "b", NULL };
+	EXPECT(names_length(a) == 2);
+}
+
+static void test_parse_names_normal(void)
+{
+	char in[] = "a\nb\n";
+	char **out = NULL;
+	parse_names(in, strlen(in), &out);
+	EXPECT(!strcmp(out[0], "a"));
+	EXPECT(!strcmp(out[1], "b"));
+	EXPECT(!out[2]);
+	free_names(out);
+}
+
+static void test_parse_names_drop_empty(void)
+{
+	char in[] = "a\n\n";
+	char **out = NULL;
+	parse_names(in, strlen(in), &out);
+	EXPECT(!strcmp(out[0], "a"));
+	EXPECT(!out[1]);
+	free_names(out);
+}
+
+static void test_common_prefix(void)
+{
+	struct strbuf s1 = STRBUF_INIT;
+	struct strbuf s2 = STRBUF_INIT;
+	strbuf_addstr(&s1, "abcdef");
+	strbuf_addstr(&s2, "abc");
+	EXPECT(common_prefix_size(&s1, &s2) == 3);
+	strbuf_release(&s1);
+	strbuf_release(&s2);
+}
+
+int basics_test_main(int argc, const char *argv[])
+{
+	RUN_TEST(test_common_prefix);
+	RUN_TEST(test_parse_names_normal);
+	RUN_TEST(test_parse_names_drop_empty);
+	RUN_TEST(test_binsearch);
+	RUN_TEST(test_names_length);
+	return 0;
+}
diff --git a/reftable/publicbasics.c b/reftable/publicbasics.c
new file mode 100644
index 00000000000..bd0a02d3f68
--- /dev/null
+++ b/reftable/publicbasics.c
@@ -0,0 +1,58 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "reftable-malloc.h"
+
+#include "basics.h"
+#include "system.h"
+
+static void *(*reftable_malloc_ptr)(size_t sz) = &malloc;
+static void *(*reftable_realloc_ptr)(void *, size_t) = &realloc;
+static void (*reftable_free_ptr)(void *) = &free;
+
+void *reftable_malloc(size_t sz)
+{
+	return (*reftable_malloc_ptr)(sz);
+}
+
+void *reftable_realloc(void *p, size_t sz)
+{
+	return (*reftable_realloc_ptr)(p, sz);
+}
+
+void reftable_free(void *p)
+{
+	reftable_free_ptr(p);
+}
+
+void *reftable_calloc(size_t sz)
+{
+	void *p = reftable_malloc(sz);
+	memset(p, 0, sz);
+	return p;
+}
+
+void reftable_set_alloc(void *(*malloc)(size_t),
+			void *(*realloc)(void *, size_t), void (*free)(void *))
+{
+	reftable_malloc_ptr = malloc;
+	reftable_realloc_ptr = realloc;
+	reftable_free_ptr = free;
+}
+
+int hash_size(uint32_t id)
+{
+	switch (id) {
+	case 0:
+	case GIT_SHA1_FORMAT_ID:
+		return GIT_SHA1_RAWSZ;
+	case GIT_SHA256_FORMAT_ID:
+		return GIT_SHA256_RAWSZ;
+	}
+	abort();
+}
diff --git a/reftable/reftable-malloc.h b/reftable/reftable-malloc.h
new file mode 100644
index 00000000000..5f2185f1f34
--- /dev/null
+++ b/reftable/reftable-malloc.h
@@ -0,0 +1,18 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef REFTABLE_H
+#define REFTABLE_H
+
+#include <stddef.h>
+
+/* Overrides the functions to use for memory management. */
+void reftable_set_alloc(void *(*malloc)(size_t),
+			void *(*realloc)(void *, size_t), void (*free)(void *));
+
+#endif
diff --git a/reftable/reftable-tests.h b/reftable/reftable-tests.h
new file mode 100644
index 00000000000..5e7698ae654
--- /dev/null
+++ b/reftable/reftable-tests.h
@@ -0,0 +1,22 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef REFTABLE_TESTS_H
+#define REFTABLE_TESTS_H
+
+int basics_test_main(int argc, const char **argv);
+int block_test_main(int argc, const char **argv);
+int merged_test_main(int argc, const char **argv);
+int record_test_main(int argc, const char **argv);
+int refname_test_main(int argc, const char **argv);
+int reftable_test_main(int argc, const char **argv);
+int stack_test_main(int argc, const char **argv);
+int tree_test_main(int argc, const char **argv);
+int reftable_dump_main(int argc, char *const *argv);
+
+#endif
diff --git a/reftable/system.h b/reftable/system.h
new file mode 100644
index 00000000000..4907306c0c5
--- /dev/null
+++ b/reftable/system.h
@@ -0,0 +1,32 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef SYSTEM_H
+#define SYSTEM_H
+
+/* This header glues the reftable library to the rest of Git */
+
+#include "git-compat-util.h"
+#include "strbuf.h"
+#include "hash.h" /* hash ID, sizes.*/
+#include "dir.h" /* remove_dir_recursively, for tests.*/
+
+#include <zlib.h>
+
+#ifdef NO_UNCOMPRESS2
+/*
+ * This is uncompress2, which is only available in zlib >= 1.2.9
+ * (released as of early 2017)
+ */
+int uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source,
+		uLong *sourceLen);
+#endif
+
+int hash_size(uint32_t id);
+
+#endif
diff --git a/reftable/test_framework.c b/reftable/test_framework.c
new file mode 100644
index 00000000000..84ac972cad0
--- /dev/null
+++ b/reftable/test_framework.c
@@ -0,0 +1,23 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "system.h"
+#include "test_framework.h"
+
+#include "basics.h"
+
+void set_test_hash(uint8_t *p, int i)
+{
+	memset(p, (uint8_t)i, hash_size(GIT_SHA1_FORMAT_ID));
+}
+
+ssize_t strbuf_add_void(void *b, const void *data, size_t sz)
+{
+	strbuf_add(b, data, sz);
+	return sz;
+}
diff --git a/reftable/test_framework.h b/reftable/test_framework.h
new file mode 100644
index 00000000000..774cb275bf6
--- /dev/null
+++ b/reftable/test_framework.h
@@ -0,0 +1,53 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef TEST_FRAMEWORK_H
+#define TEST_FRAMEWORK_H
+
+#include "system.h"
+#include "reftable-error.h"
+
+#define EXPECT_ERR(c)                                                  \
+	if (c != 0) {                                                  \
+		fflush(stderr);                                        \
+		fflush(stdout);                                        \
+		fprintf(stderr, "%s: %d: error == %d (%s), want 0\n",  \
+			__FILE__, __LINE__, c, reftable_error_str(c)); \
+		abort();                                               \
+	}
+
+#define EXPECT_STREQ(a, b)                                               \
+	if (strcmp(a, b)) {                                              \
+		fflush(stderr);                                          \
+		fflush(stdout);                                          \
+		fprintf(stderr, "%s:%d: %s (%s) != %s (%s)\n", __FILE__, \
+			__LINE__, #a, a, #b, b);                         \
+		abort();                                                 \
+	}
+
+#define EXPECT(c)                                                          \
+	if (!(c)) {                                                        \
+		fflush(stderr);                                            \
+		fflush(stdout);                                            \
+		fprintf(stderr, "%s: %d: failed assertion %s\n", __FILE__, \
+			__LINE__, #c);                                     \
+		abort();                                                   \
+	}
+
+#define RUN_TEST(f)                          \
+	fprintf(stderr, "running %s\n", #f); \
+	fflush(stderr);                      \
+	f();
+
+void set_test_hash(uint8_t *p, int i);
+
+/* Like strbuf_add, but suitable for passing to reftable_new_writer
+ */
+ssize_t strbuf_add_void(void *b, const void *data, size_t sz);
+
+#endif
diff --git a/t/helper/test-reftable.c b/t/helper/test-reftable.c
new file mode 100644
index 00000000000..3b58e423e7b
--- /dev/null
+++ b/t/helper/test-reftable.c
@@ -0,0 +1,9 @@
+#include "reftable/reftable-tests.h"
+#include "test-tool.h"
+
+int cmd__reftable(int argc, const char **argv)
+{
+	basics_test_main(argc, argv);
+
+	return 0;
+}
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 3ce5585e53a..f7c888ffda7 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -53,13 +53,14 @@ static struct test_cmd cmds[] = {
 	{ "pcre2-config", cmd__pcre2_config },
 	{ "pkt-line", cmd__pkt_line },
 	{ "prio-queue", cmd__prio_queue },
-	{ "proc-receive", cmd__proc_receive},
+	{ "proc-receive", cmd__proc_receive },
 	{ "progress", cmd__progress },
 	{ "reach", cmd__reach },
 	{ "read-cache", cmd__read_cache },
 	{ "read-graph", cmd__read_graph },
 	{ "read-midx", cmd__read_midx },
 	{ "ref-store", cmd__ref_store },
+	{ "reftable", cmd__reftable },
 	{ "regex", cmd__regex },
 	{ "repository", cmd__repository },
 	{ "revision-walking", cmd__revision_walking },
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 9f0f5228508..25f77469146 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -49,6 +49,7 @@ int cmd__read_cache(int argc, const char **argv);
 int cmd__read_graph(int argc, const char **argv);
 int cmd__read_midx(int argc, const char **argv);
 int cmd__ref_store(int argc, const char **argv);
+int cmd__reftable(int argc, const char **argv);
 int cmd__regex(int argc, const char **argv);
 int cmd__repository(int argc, const char **argv);
 int cmd__revision_walking(int argc, const char **argv);
diff --git a/t/t0032-reftable-unittest.sh b/t/t0032-reftable-unittest.sh
new file mode 100755
index 00000000000..0ed14971a58
--- /dev/null
+++ b/t/t0032-reftable-unittest.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# Copyright (c) 2020 Google LLC
+#
+
+test_description='reftable unittests'
+
+. ./test-lib.sh
+
+test_expect_success 'unittests' '
+	TMPDIR=$(pwd) && export TMPDIR &&
+	test-tool reftable
+'
+
+test_done
-- 
gitgitgadget


^ permalink raw reply related	[relevance 7%]

* [PATCH v5] compat: auto-detect if zlib has uncompress2()
  @ 2022-01-24 18:27  7%           ` Junio C Hamano
  0 siblings, 0 replies; 200+ results
From: Junio C Hamano @ 2022-01-24 18:27 UTC (permalink / raw)
  To: git
  Cc: Beat Bolli, Ævar Arnfjörð Bjarmason, David Aguilar,
	Randall S . Becker, Taylor Blau, Carlo Marcelo Arenas Belón,
	René Scharfe

From: Ævar Arnfjörð Bjarmason <avarab@gmail.com>

We have a copy of uncompress2() implementation in compat/ so that we
can build with an older version of zlib that lack the function, and
the build procedure selects if it is used via the NO_UNCOMPRESS2
$(MAKE) variable.  This is yet another "annoying" knob the porters
need to tweak on platforms that are not common enough to have the
default set in the config.mak.uname file.

Attempt to instead ask the system header <zlib.h> to decide if we
need the compatibility implementation.  This is a deviation from the
way we have been handling the "compatiblity" features so far, and if
it can be done cleanly enough, it could work as a model for features
that need compatibility definition we discover in the future.  With
that goal in mind, avoid expedient but ugly hacks, like shoving the
code that is conditionally compiled into an unrelated .c file, which
may not work in future cases---instead, take an approach that uses a
file that is independently compiled and stands on its own.

Compile and link compat/zlib-uncompress2.c file unconditionally, but
conditionally hide the implementation behind #if/#endif when zlib
version is 1.2.9 or newer, and unconditionally archive the resulting
object file in the libgit.a to be picked up by the linker.

There are a few things to note in the shape of the code base after
this change:

 - We no longer use NO_UNCOMPRESS2 knob; if the system header
   <zlib.h> claims a version that is more cent than the library
   actually is, this would break, but it is easy to add it back when
   we find such a system.

 - The object file compat/zlib-uncompress2.o is always compiled and
   archived in libgit.a, just like a few other compat/ object files
   already are.

 - The inclusion of <zlib.h> is done in <git-compat-util.h>; we used
   to do so from <cache.h> which includes <git-compat-util.h> as the
   first thing it does, so from the *.c codes, there is no practical
   change.

 - Until objects in libgit.a that is already used gains a reference
   to the function, the reftable code will be the only one that
   wants it, so libgit.a on the linker command line needs to appear
   once more at the end to satisify the mutual dependency.

 - Beat found a trick used by OpenSSL to avoid making the
   conditionally-compiled object truly empty (apparently because
   they had to deal with compilers that do not want to see an
   effectively empty input file).  Our compat/zlib-uncompress2.c
   file borrows the same trick for portabilty.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * With a single-liner update to the Makefile with an updated log
   message that explains the change.  I am not sure if this version
   can become the model of future "compat" support, or we should
   just discard the new approach and use the Makefile macro approach
   that has worked well for all of our existing compat support
   already.

Range-diff against v4:
1:  d26c9073bf ! 1:  63c5753c6f compat: auto-detect if zlib has uncompress2()
    @@ Commit message
         need to tweak on platforms that are not common enough to have the
         default set in the config.mak.uname file.
     
    -    Ævar came up with an idea to instead ask the system header <zlib.h>
    -    to decide if we need the compatibility implementation.  We can
    -    compile and link compat/zlib-uncompress2.c file unconditionally, but
    +    Attempt to instead ask the system header <zlib.h> to decide if we
    +    need the compatibility implementation.  This is a deviation from the
    +    way we have been handling the "compatiblity" features so far, and if
    +    it can be done cleanly enough, it could work as a model for features
    +    that need compatibility definition we discover in the future.  With
    +    that goal in mind, avoid expedient but ugly hacks, like shoving the
    +    code that is conditionally compiled into an unrelated .c file, which
    +    may not work in future cases---instead, take an approach that uses a
    +    file that is independently compiled and stands on its own.
    +
    +    Compile and link compat/zlib-uncompress2.c file unconditionally, but
         conditionally hide the implementation behind #if/#endif when zlib
         version is 1.2.9 or newer, and unconditionally archive the resulting
         object file in the libgit.a to be picked up by the linker.
    @@ Commit message
            first thing it does, so from the *.c codes, there is no practical
            change.
     
    +     - Until objects in libgit.a that is already used gains a reference
    +       to the function, the reftable code will be the only one that
    +       wants it, so libgit.a on the linker command line needs to appear
    +       once more at the end to satisify the mutual dependency.
    +
          - Beat found a trick used by OpenSSL to avoid making the
            conditionally-compiled object truly empty (apparently because
            they had to deal with compilers that do not want to see an
    @@ Makefile: THIRD_PARTY_SOURCES += compat/regex/%
      THIRD_PARTY_SOURCES += sha1dc/%
      
     -GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB)
    ++# xdiff and reftable libs may in turn depend on what is in libgit.a
     +GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE)
      EXTLIBS =
      

 Makefile                  | 11 +++--------
 cache.h                   |  1 -
 ci/lib.sh                 |  1 -
 compat/zlib-uncompress2.c | 11 ++++++-----
 config.mak.uname          |  7 -------
 configure.ac              | 13 -------------
 git-compat-util.h         | 12 ++++++++++++
 reftable/system.h         | 11 -----------
 8 files changed, 21 insertions(+), 46 deletions(-)

diff --git a/Makefile b/Makefile
index 5580859afd..f194b2afc6 100644
--- a/Makefile
+++ b/Makefile
@@ -256,8 +256,6 @@ all::
 #
 # Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
 #
-# Define NO_UNCOMPRESS2 if your zlib does not have uncompress2.
-#
 # Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
 # as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
 #
@@ -862,6 +860,7 @@ LIB_OBJS += commit-reach.o
 LIB_OBJS += commit.o
 LIB_OBJS += compat/obstack.o
 LIB_OBJS += compat/terminal.o
+LIB_OBJS += compat/zlib-uncompress2.o
 LIB_OBJS += config.o
 LIB_OBJS += connect.o
 LIB_OBJS += connected.o
@@ -1194,7 +1193,8 @@ THIRD_PARTY_SOURCES += compat/regex/%
 THIRD_PARTY_SOURCES += sha1collisiondetection/%
 THIRD_PARTY_SOURCES += sha1dc/%
 
-GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB)
+# xdiff and reftable libs may in turn depend on what is in libgit.a
+GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE)
 EXTLIBS =
 
 GIT_USER_AGENT = git/$(GIT_VERSION)
@@ -1726,11 +1726,6 @@ ifdef NO_DEFLATE_BOUND
 	BASIC_CFLAGS += -DNO_DEFLATE_BOUND
 endif
 
-ifdef NO_UNCOMPRESS2
-	BASIC_CFLAGS += -DNO_UNCOMPRESS2
-	REFTABLE_OBJS += compat/zlib-uncompress2.o
-endif
-
 ifdef NO_POSIX_GOODIES
 	BASIC_CFLAGS += -DNO_POSIX_GOODIES
 endif
diff --git a/cache.h b/cache.h
index 281f00ab1b..3a0142aa56 100644
--- a/cache.h
+++ b/cache.h
@@ -18,7 +18,6 @@
 #include "repository.h"
 #include "mem-pool.h"
 
-#include <zlib.h>
 typedef struct git_zstream {
 	z_stream z;
 	unsigned long avail_in;
diff --git a/ci/lib.sh b/ci/lib.sh
index 9d28ab50fb..cbc2f8f1ca 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -197,7 +197,6 @@ esac
 case "$jobname" in
 linux32)
 	CC=gcc
-	MAKEFLAGS="$MAKEFLAGS NO_UNCOMPRESS2=1"
 	;;
 linux-musl)
 	CC=gcc
diff --git a/compat/zlib-uncompress2.c b/compat/zlib-uncompress2.c
index 722610b971..77a1b08048 100644
--- a/compat/zlib-uncompress2.c
+++ b/compat/zlib-uncompress2.c
@@ -1,3 +1,6 @@
+#include "git-compat-util.h"
+
+#if ZLIB_VERNUM < 0x1290
 /* taken from zlib's uncompr.c
 
    commit cacf7f1d4e3d44d871b605da3b647f07d718623f
@@ -8,16 +11,11 @@
 
 */
 
-#include "../reftable/system.h"
-#define z_const
-
 /*
  * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-#include <zlib.h>
-
 /* clang-format off */
 
 /* ===========================================================================
@@ -93,3 +91,6 @@ int ZEXPORT uncompress2 (
 	   err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR :
 	   err;
 }
+#else
+static void *dummy_variable = &dummy_variable;
+#endif
diff --git a/config.mak.uname b/config.mak.uname
index c48db45106..92ea00c219 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -66,7 +66,6 @@ ifeq ($(uname_S),Linux)
 	# centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7.
 	ifneq ($(findstring .el7.,$(uname_R)),)
 		BASIC_CFLAGS += -std=c99
-		NO_UNCOMPRESS2 = YesPlease
 	endif
 endif
 ifeq ($(uname_S),GNU/kFreeBSD)
@@ -266,10 +265,6 @@ ifeq ($(uname_S),FreeBSD)
 	FILENO_IS_A_MACRO = UnfortunatelyYes
 endif
 ifeq ($(uname_S),OpenBSD)
-	# Versions < 7.0 need compatibility layer
-	ifeq ($(shell expr "$(uname_R)" : "[1-6]\."),2)
-		NO_UNCOMPRESS2 = UnfortunatelyYes
-	endif
 	NO_STRCASESTR = YesPlease
 	NO_MEMMEM = YesPlease
 	USE_ST_TIMESPEC = YesPlease
@@ -525,7 +520,6 @@ ifeq ($(uname_S),Interix)
 	endif
 endif
 ifeq ($(uname_S),Minix)
-	NO_UNCOMPRESS2 = YesPlease
 	NO_IPV6 = YesPlease
 	NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
 	NO_NSEC = YesPlease
@@ -581,7 +575,6 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
 	NO_SETENV = YesPlease
 	NO_UNSETENV = YesPlease
 	NO_MKDTEMP = YesPlease
-	NO_UNCOMPRESS2 = YesPlease
 	# Currently libiconv-1.9.1.
 	OLD_ICONV = UnfortunatelyYes
 	NO_REGEX = NeedsStartEnd
diff --git a/configure.ac b/configure.ac
index d60d494ee4..5ee25ec95c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -664,22 +664,9 @@ AC_LINK_IFELSE([ZLIBTEST_SRC],
 	NO_DEFLATE_BOUND=yes])
 LIBS="$old_LIBS"
 
-AC_DEFUN([ZLIBTEST_UNCOMPRESS2_SRC], [
-AC_LANG_PROGRAM([#include <zlib.h>],
- [uncompress2(NULL,NULL,NULL,NULL);])])
-AC_MSG_CHECKING([for uncompress2 in -lz])
-old_LIBS="$LIBS"
-LIBS="$LIBS -lz"
-AC_LINK_IFELSE([ZLIBTEST_UNCOMPRESS2_SRC],
-	[AC_MSG_RESULT([yes])],
-	[AC_MSG_RESULT([no])
-	NO_UNCOMPRESS2=yes])
-LIBS="$old_LIBS"
-
 GIT_UNSTASH_FLAGS($ZLIB_PATH)
 
 GIT_CONF_SUBST([NO_DEFLATE_BOUND])
-GIT_CONF_SUBST([NO_UNCOMPRESS2])
 
 #
 # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
diff --git a/git-compat-util.h b/git-compat-util.h
index 1229c8296b..ea111a7b48 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -1386,6 +1386,18 @@ void unleak_memory(const void *ptr, size_t len);
 #define UNLEAK(var) do {} while (0)
 #endif
 
+#define z_const
+#include <zlib.h>
+
+#if ZLIB_VERNUM < 0x1290
+/*
+ * This is uncompress2, which is only available in zlib >= 1.2.9
+ * (released as of early 2017). See compat/zlib-uncompress2.c.
+ */
+int uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source,
+		uLong *sourceLen);
+#endif
+
 /*
  * This include must come after system headers, since it introduces macros that
  * replace system names.
diff --git a/reftable/system.h b/reftable/system.h
index 4907306c0c..18f9207dfe 100644
--- a/reftable/system.h
+++ b/reftable/system.h
@@ -16,17 +16,6 @@ license that can be found in the LICENSE file or at
 #include "hash.h" /* hash ID, sizes.*/
 #include "dir.h" /* remove_dir_recursively, for tests.*/
 
-#include <zlib.h>
-
-#ifdef NO_UNCOMPRESS2
-/*
- * This is uncompress2, which is only available in zlib >= 1.2.9
- * (released as of early 2017)
- */
-int uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source,
-		uLong *sourceLen);
-#endif
-
 int hash_size(uint32_t id);
 
 #endif
-- 
2.35.0-155-g0eb5153edc


^ permalink raw reply related	[relevance 7%]

* [PATCH 04/19] reftable: utility functions
  @ 2021-08-30 14:57  7% ` Han-Wen Nienhuys via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Han-Wen Nienhuys via GitGitGadget @ 2021-08-30 14:57 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Han-Wen Nienhuys

From: Han-Wen Nienhuys <hanwen@google.com>

This commit provides basic utility classes for the reftable library.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                                   |  25 +++-
 contrib/buildsystems/CMakeLists.txt        |  14 ++-
 contrib/buildsystems/Generators/Vcxproj.pm |  11 +-
 reftable/basics.c                          | 128 +++++++++++++++++++++
 reftable/basics.h                          |  60 ++++++++++
 reftable/basics_test.c                     |  98 ++++++++++++++++
 reftable/publicbasics.c                    |  58 ++++++++++
 reftable/reftable-malloc.h                 |  18 +++
 reftable/reftable-tests.h                  |  22 ++++
 reftable/system.h                          |  24 ++++
 reftable/test_framework.c                  |  23 ++++
 reftable/test_framework.h                  |  53 +++++++++
 t/helper/test-reftable.c                   |   9 ++
 t/helper/test-tool.c                       |   3 +-
 t/helper/test-tool.h                       |   1 +
 t/t0032-reftable-unittest.sh               |  15 +++
 16 files changed, 555 insertions(+), 7 deletions(-)
 create mode 100644 reftable/basics.c
 create mode 100644 reftable/basics.h
 create mode 100644 reftable/basics_test.c
 create mode 100644 reftable/publicbasics.c
 create mode 100644 reftable/reftable-malloc.h
 create mode 100644 reftable/reftable-tests.h
 create mode 100644 reftable/system.h
 create mode 100644 reftable/test_framework.c
 create mode 100644 reftable/test_framework.h
 create mode 100644 t/helper/test-reftable.c
 create mode 100755 t/t0032-reftable-unittest.sh

diff --git a/Makefile b/Makefile
index d1feab008fc..98c965c61fd 100644
--- a/Makefile
+++ b/Makefile
@@ -743,6 +743,7 @@ TEST_BUILTINS_OBJS += test-read-cache.o
 TEST_BUILTINS_OBJS += test-read-graph.o
 TEST_BUILTINS_OBJS += test-read-midx.o
 TEST_BUILTINS_OBJS += test-ref-store.o
+TEST_BUILTINS_OBJS += test-reftable.o
 TEST_BUILTINS_OBJS += test-regex.o
 TEST_BUILTINS_OBJS += test-repository.o
 TEST_BUILTINS_OBJS += test-revision-walking.o
@@ -821,6 +822,8 @@ TEST_SHELL_PATH = $(SHELL_PATH)
 
 LIB_FILE = libgit.a
 XDIFF_LIB = xdiff/lib.a
+REFTABLE_LIB = reftable/libreftable.a
+REFTABLE_TEST_LIB = reftable/libreftable_test.a
 
 GENERATED_H += command-list.h
 GENERATED_H += config-list.h
@@ -1195,7 +1198,7 @@ THIRD_PARTY_SOURCES += compat/regex/%
 THIRD_PARTY_SOURCES += sha1collisiondetection/%
 THIRD_PARTY_SOURCES += sha1dc/%
 
-GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
+GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB)
 EXTLIBS =
 
 GIT_USER_AGENT = git/$(GIT_VERSION)
@@ -2446,7 +2449,15 @@ XDIFF_OBJS += xdiff/xutils.o
 .PHONY: xdiff-objs
 xdiff-objs: $(XDIFF_OBJS)
 
+REFTABLE_OBJS += reftable/basics.o
+REFTABLE_OBJS += reftable/error.o
+REFTABLE_OBJS += reftable/publicbasics.o
+
+REFTABLE_TEST_OBJS += reftable/test_framework.o
+REFTABLE_TEST_OBJS += reftable/basics_test.o
+
 TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
+
 .PHONY: test-objs
 test-objs: $(TEST_OBJS)
 
@@ -2462,6 +2473,8 @@ OBJECTS += $(PROGRAM_OBJS)
 OBJECTS += $(TEST_OBJS)
 OBJECTS += $(XDIFF_OBJS)
 OBJECTS += $(FUZZ_OBJS)
+OBJECTS += $(REFTABLE_OBJS) $(REFTABLE_TEST_OBJS)
+
 ifndef NO_CURL
 	OBJECTS += http.o http-walker.o remote-curl.o
 endif
@@ -2612,6 +2625,12 @@ $(LIB_FILE): $(LIB_OBJS)
 $(XDIFF_LIB): $(XDIFF_OBJS)
 	$(QUIET_AR)$(AR) $(ARFLAGS) $@ $^
 
+$(REFTABLE_LIB): $(REFTABLE_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
+
+$(REFTABLE_TEST_LIB): $(REFTABLE_TEST_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
+
 export DEFAULT_EDITOR DEFAULT_PAGER
 
 Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
@@ -2904,7 +2923,7 @@ perf: all
 
 t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
 
-t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
+t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS) $(REFTABLE_TEST_LIB)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
 
 check-sha1:: t/helper/test-tool$X
@@ -3234,7 +3253,7 @@ cocciclean:
 clean: profile-clean coverage-clean cocciclean
 	$(RM) *.res
 	$(RM) $(OBJECTS)
-	$(RM) $(LIB_FILE) $(XDIFF_LIB)
+	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
 	$(RM) $(TEST_PROGRAMS)
 	$(RM) $(FUZZ_PROGRAMS)
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 171b4124afe..c2bf5bdffc6 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -640,6 +640,12 @@ parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
 list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
 add_library(xdiff STATIC ${libxdiff_SOURCES})
 
+#reftable
+parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+
+list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+add_library(reftable STATIC ${reftable_SOURCES})
+
 if(WIN32)
 	if(NOT MSVC)#use windres when compiling with gcc and clang
 		add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
@@ -662,7 +668,7 @@ endif()
 #link all required libraries to common-main
 add_library(common-main OBJECT ${CMAKE_SOURCE_DIR}/common-main.c)
 
-target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES})
+target_link_libraries(common-main libgit xdiff reftable ${ZLIB_LIBRARIES})
 if(Intl_FOUND)
 	target_link_libraries(common-main ${Intl_LIBRARIES})
 endif()
@@ -902,11 +908,15 @@ if(BUILD_TESTING)
 add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
 target_link_libraries(test-fake-ssh common-main)
 
+#reftable-tests
+parse_makefile_for_sources(test-reftable_SOURCES "REFTABLE_TEST_OBJS")
+list(TRANSFORM test-reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+
 #test-tool
 parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
 
 list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
-add_executable(test-tool ${CMAKE_SOURCE_DIR}/t/helper/test-tool.c ${test-tool_SOURCES})
+add_executable(test-tool ${CMAKE_SOURCE_DIR}/t/helper/test-tool.c ${test-tool_SOURCES} ${test-reftable_SOURCES})
 target_link_libraries(test-tool common-main)
 
 set_target_properties(test-fake-ssh test-tool
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index d2584450ba1..1a25789d285 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libexpat\.lib/libexpatd\.lib/g;
@@ -232,6 +232,7 @@ EOM
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -241,6 +242,14 @@ EOM
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
diff --git a/reftable/basics.c b/reftable/basics.c
new file mode 100644
index 00000000000..f761e48028c
--- /dev/null
+++ b/reftable/basics.c
@@ -0,0 +1,128 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "basics.h"
+
+void put_be24(uint8_t *out, uint32_t i)
+{
+	out[0] = (uint8_t)((i >> 16) & 0xff);
+	out[1] = (uint8_t)((i >> 8) & 0xff);
+	out[2] = (uint8_t)(i & 0xff);
+}
+
+uint32_t get_be24(uint8_t *in)
+{
+	return (uint32_t)(in[0]) << 16 | (uint32_t)(in[1]) << 8 |
+	       (uint32_t)(in[2]);
+}
+
+void put_be16(uint8_t *out, uint16_t i)
+{
+	out[0] = (uint8_t)((i >> 8) & 0xff);
+	out[1] = (uint8_t)(i & 0xff);
+}
+
+int binsearch(size_t sz, int (*f)(size_t k, void *args), void *args)
+{
+	size_t lo = 0;
+	size_t hi = sz;
+
+	/* Invariants:
+	 *
+	 *  (hi == sz) || f(hi) == true
+	 *  (lo == 0 && f(0) == true) || fi(lo) == false
+	 */
+	while (hi - lo > 1) {
+		size_t mid = lo + (hi - lo) / 2;
+
+		if (f(mid, args))
+			hi = mid;
+		else
+			lo = mid;
+	}
+
+	if (lo)
+		return hi;
+
+	return f(0, args) ? 0 : 1;
+}
+
+void free_names(char **a)
+{
+	char **p;
+	if (!a) {
+		return;
+	}
+	for (p = a; *p; p++) {
+		reftable_free(*p);
+	}
+	reftable_free(a);
+}
+
+int names_length(char **names)
+{
+	char **p = names;
+	for (; *p; p++) {
+		/* empty */
+	}
+	return p - names;
+}
+
+void parse_names(char *buf, int size, char ***namesp)
+{
+	char **names = NULL;
+	size_t names_cap = 0;
+	size_t names_len = 0;
+
+	char *p = buf;
+	char *end = buf + size;
+	while (p < end) {
+		char *next = strchr(p, '\n');
+		if (next && next < end) {
+			*next = 0;
+		} else {
+			next = end;
+		}
+		if (p < next) {
+			if (names_len == names_cap) {
+				names_cap = 2 * names_cap + 1;
+				names = reftable_realloc(
+					names, names_cap * sizeof(*names));
+			}
+			names[names_len++] = xstrdup(p);
+		}
+		p = next + 1;
+	}
+
+	names = reftable_realloc(names, (names_len + 1) * sizeof(*names));
+	names[names_len] = NULL;
+	*namesp = names;
+}
+
+int names_equal(char **a, char **b)
+{
+	int i = 0;
+	for (; a[i] && b[i]; i++) {
+		if (strcmp(a[i], b[i])) {
+			return 0;
+		}
+	}
+
+	return a[i] == b[i];
+}
+
+int common_prefix_size(struct strbuf *a, struct strbuf *b)
+{
+	int p = 0;
+	for (; p < a->len && p < b->len; p++) {
+		if (a->buf[p] != b->buf[p])
+			break;
+	}
+
+	return p;
+}
diff --git a/reftable/basics.h b/reftable/basics.h
new file mode 100644
index 00000000000..096b36862b9
--- /dev/null
+++ b/reftable/basics.h
@@ -0,0 +1,60 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef BASICS_H
+#define BASICS_H
+
+/*
+ * miscellaneous utilities that are not provided by Git.
+ */
+
+#include "system.h"
+
+/* Bigendian en/decoding of integers */
+
+void put_be24(uint8_t *out, uint32_t i);
+uint32_t get_be24(uint8_t *in);
+void put_be16(uint8_t *out, uint16_t i);
+
+/*
+ * find smallest index i in [0, sz) at which f(i) is true, assuming
+ * that f is ascending. Return sz if f(i) is false for all indices.
+ *
+ * Contrary to bsearch(3), this returns something useful if the argument is not
+ * found.
+ */
+int binsearch(size_t sz, int (*f)(size_t k, void *args), void *args);
+
+/*
+ * Frees a NULL terminated array of malloced strings. The array itself is also
+ * freed.
+ */
+void free_names(char **a);
+
+/* parse a newline separated list of names. `size` is the length of the buffer,
+ * without terminating '\0'. Empty names are discarded. */
+void parse_names(char *buf, int size, char ***namesp);
+
+/* compares two NULL-terminated arrays of strings. */
+int names_equal(char **a, char **b);
+
+/* returns the array size of a NULL-terminated array of strings. */
+int names_length(char **names);
+
+/* Allocation routines; they invoke the functions set through
+ * reftable_set_alloc() */
+void *reftable_malloc(size_t sz);
+void *reftable_realloc(void *p, size_t sz);
+void reftable_free(void *p);
+void *reftable_calloc(size_t sz);
+
+/* Find the longest shared prefix size of `a` and `b` */
+struct strbuf;
+int common_prefix_size(struct strbuf *a, struct strbuf *b);
+
+#endif
diff --git a/reftable/basics_test.c b/reftable/basics_test.c
new file mode 100644
index 00000000000..1fcd2297256
--- /dev/null
+++ b/reftable/basics_test.c
@@ -0,0 +1,98 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "system.h"
+
+#include "basics.h"
+#include "test_framework.h"
+#include "reftable-tests.h"
+
+struct binsearch_args {
+	int key;
+	int *arr;
+};
+
+static int binsearch_func(size_t i, void *void_args)
+{
+	struct binsearch_args *args = void_args;
+
+	return args->key < args->arr[i];
+}
+
+static void test_binsearch(void)
+{
+	int arr[] = { 2, 4, 6, 8, 10 };
+	size_t sz = ARRAY_SIZE(arr);
+	struct binsearch_args args = {
+		.arr = arr,
+	};
+
+	int i = 0;
+	for (i = 1; i < 11; i++) {
+		int res;
+		args.key = i;
+		res = binsearch(sz, &binsearch_func, &args);
+
+		if (res < sz) {
+			EXPECT(args.key < arr[res]);
+			if (res > 0) {
+				EXPECT(args.key >= arr[res - 1]);
+			}
+		} else {
+			EXPECT(args.key == 10 || args.key == 11);
+		}
+	}
+}
+
+static void test_names_length(void)
+{
+	char *a[] = { "a", "b", NULL };
+	EXPECT(names_length(a) == 2);
+}
+
+static void test_parse_names_normal(void)
+{
+	char in[] = "a\nb\n";
+	char **out = NULL;
+	parse_names(in, strlen(in), &out);
+	EXPECT(!strcmp(out[0], "a"));
+	EXPECT(!strcmp(out[1], "b"));
+	EXPECT(!out[2]);
+	free_names(out);
+}
+
+static void test_parse_names_drop_empty(void)
+{
+	char in[] = "a\n\n";
+	char **out = NULL;
+	parse_names(in, strlen(in), &out);
+	EXPECT(!strcmp(out[0], "a"));
+	EXPECT(!out[1]);
+	free_names(out);
+}
+
+static void test_common_prefix(void)
+{
+	struct strbuf s1 = STRBUF_INIT;
+	struct strbuf s2 = STRBUF_INIT;
+	strbuf_addstr(&s1, "abcdef");
+	strbuf_addstr(&s2, "abc");
+	EXPECT(common_prefix_size(&s1, &s2) == 3);
+	strbuf_release(&s1);
+	strbuf_release(&s2);
+}
+
+int basics_test_main(int argc, const char *argv[])
+{
+	RUN_TEST(test_common_prefix);
+	RUN_TEST(test_parse_names_normal);
+	RUN_TEST(test_parse_names_drop_empty);
+	RUN_TEST(test_binsearch);
+	RUN_TEST(test_names_length);
+	return 0;
+}
diff --git a/reftable/publicbasics.c b/reftable/publicbasics.c
new file mode 100644
index 00000000000..bd0a02d3f68
--- /dev/null
+++ b/reftable/publicbasics.c
@@ -0,0 +1,58 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "reftable-malloc.h"
+
+#include "basics.h"
+#include "system.h"
+
+static void *(*reftable_malloc_ptr)(size_t sz) = &malloc;
+static void *(*reftable_realloc_ptr)(void *, size_t) = &realloc;
+static void (*reftable_free_ptr)(void *) = &free;
+
+void *reftable_malloc(size_t sz)
+{
+	return (*reftable_malloc_ptr)(sz);
+}
+
+void *reftable_realloc(void *p, size_t sz)
+{
+	return (*reftable_realloc_ptr)(p, sz);
+}
+
+void reftable_free(void *p)
+{
+	reftable_free_ptr(p);
+}
+
+void *reftable_calloc(size_t sz)
+{
+	void *p = reftable_malloc(sz);
+	memset(p, 0, sz);
+	return p;
+}
+
+void reftable_set_alloc(void *(*malloc)(size_t),
+			void *(*realloc)(void *, size_t), void (*free)(void *))
+{
+	reftable_malloc_ptr = malloc;
+	reftable_realloc_ptr = realloc;
+	reftable_free_ptr = free;
+}
+
+int hash_size(uint32_t id)
+{
+	switch (id) {
+	case 0:
+	case GIT_SHA1_FORMAT_ID:
+		return GIT_SHA1_RAWSZ;
+	case GIT_SHA256_FORMAT_ID:
+		return GIT_SHA256_RAWSZ;
+	}
+	abort();
+}
diff --git a/reftable/reftable-malloc.h b/reftable/reftable-malloc.h
new file mode 100644
index 00000000000..5f2185f1f34
--- /dev/null
+++ b/reftable/reftable-malloc.h
@@ -0,0 +1,18 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef REFTABLE_H
+#define REFTABLE_H
+
+#include <stddef.h>
+
+/* Overrides the functions to use for memory management. */
+void reftable_set_alloc(void *(*malloc)(size_t),
+			void *(*realloc)(void *, size_t), void (*free)(void *));
+
+#endif
diff --git a/reftable/reftable-tests.h b/reftable/reftable-tests.h
new file mode 100644
index 00000000000..5e7698ae654
--- /dev/null
+++ b/reftable/reftable-tests.h
@@ -0,0 +1,22 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef REFTABLE_TESTS_H
+#define REFTABLE_TESTS_H
+
+int basics_test_main(int argc, const char **argv);
+int block_test_main(int argc, const char **argv);
+int merged_test_main(int argc, const char **argv);
+int record_test_main(int argc, const char **argv);
+int refname_test_main(int argc, const char **argv);
+int reftable_test_main(int argc, const char **argv);
+int stack_test_main(int argc, const char **argv);
+int tree_test_main(int argc, const char **argv);
+int reftable_dump_main(int argc, char *const *argv);
+
+#endif
diff --git a/reftable/system.h b/reftable/system.h
new file mode 100644
index 00000000000..4f62827b83b
--- /dev/null
+++ b/reftable/system.h
@@ -0,0 +1,24 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef SYSTEM_H
+#define SYSTEM_H
+
+/* This header glues the reftable library to the rest of Git */
+
+#include "git-compat-util.h"
+#include "strbuf.h"
+#include "hash.h" /* hash ID, sizes.*/
+#include "dir.h" /* remove_dir_recursively, for tests.*/
+
+#include <zlib.h>
+
+struct strbuf;
+int hash_size(uint32_t id);
+
+#endif
diff --git a/reftable/test_framework.c b/reftable/test_framework.c
new file mode 100644
index 00000000000..84ac972cad0
--- /dev/null
+++ b/reftable/test_framework.c
@@ -0,0 +1,23 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#include "system.h"
+#include "test_framework.h"
+
+#include "basics.h"
+
+void set_test_hash(uint8_t *p, int i)
+{
+	memset(p, (uint8_t)i, hash_size(GIT_SHA1_FORMAT_ID));
+}
+
+ssize_t strbuf_add_void(void *b, const void *data, size_t sz)
+{
+	strbuf_add(b, data, sz);
+	return sz;
+}
diff --git a/reftable/test_framework.h b/reftable/test_framework.h
new file mode 100644
index 00000000000..774cb275bf6
--- /dev/null
+++ b/reftable/test_framework.h
@@ -0,0 +1,53 @@
+/*
+Copyright 2020 Google LLC
+
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file or at
+https://developers.google.com/open-source/licenses/bsd
+*/
+
+#ifndef TEST_FRAMEWORK_H
+#define TEST_FRAMEWORK_H
+
+#include "system.h"
+#include "reftable-error.h"
+
+#define EXPECT_ERR(c)                                                  \
+	if (c != 0) {                                                  \
+		fflush(stderr);                                        \
+		fflush(stdout);                                        \
+		fprintf(stderr, "%s: %d: error == %d (%s), want 0\n",  \
+			__FILE__, __LINE__, c, reftable_error_str(c)); \
+		abort();                                               \
+	}
+
+#define EXPECT_STREQ(a, b)                                               \
+	if (strcmp(a, b)) {                                              \
+		fflush(stderr);                                          \
+		fflush(stdout);                                          \
+		fprintf(stderr, "%s:%d: %s (%s) != %s (%s)\n", __FILE__, \
+			__LINE__, #a, a, #b, b);                         \
+		abort();                                                 \
+	}
+
+#define EXPECT(c)                                                          \
+	if (!(c)) {                                                        \
+		fflush(stderr);                                            \
+		fflush(stdout);                                            \
+		fprintf(stderr, "%s: %d: failed assertion %s\n", __FILE__, \
+			__LINE__, #c);                                     \
+		abort();                                                   \
+	}
+
+#define RUN_TEST(f)                          \
+	fprintf(stderr, "running %s\n", #f); \
+	fflush(stderr);                      \
+	f();
+
+void set_test_hash(uint8_t *p, int i);
+
+/* Like strbuf_add, but suitable for passing to reftable_new_writer
+ */
+ssize_t strbuf_add_void(void *b, const void *data, size_t sz);
+
+#endif
diff --git a/t/helper/test-reftable.c b/t/helper/test-reftable.c
new file mode 100644
index 00000000000..3b58e423e7b
--- /dev/null
+++ b/t/helper/test-reftable.c
@@ -0,0 +1,9 @@
+#include "reftable/reftable-tests.h"
+#include "test-tool.h"
+
+int cmd__reftable(int argc, const char **argv)
+{
+	basics_test_main(argc, argv);
+
+	return 0;
+}
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 3ce5585e53a..f7c888ffda7 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -53,13 +53,14 @@ static struct test_cmd cmds[] = {
 	{ "pcre2-config", cmd__pcre2_config },
 	{ "pkt-line", cmd__pkt_line },
 	{ "prio-queue", cmd__prio_queue },
-	{ "proc-receive", cmd__proc_receive},
+	{ "proc-receive", cmd__proc_receive },
 	{ "progress", cmd__progress },
 	{ "reach", cmd__reach },
 	{ "read-cache", cmd__read_cache },
 	{ "read-graph", cmd__read_graph },
 	{ "read-midx", cmd__read_midx },
 	{ "ref-store", cmd__ref_store },
+	{ "reftable", cmd__reftable },
 	{ "regex", cmd__regex },
 	{ "repository", cmd__repository },
 	{ "revision-walking", cmd__revision_walking },
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 9f0f5228508..25f77469146 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -49,6 +49,7 @@ int cmd__read_cache(int argc, const char **argv);
 int cmd__read_graph(int argc, const char **argv);
 int cmd__read_midx(int argc, const char **argv);
 int cmd__ref_store(int argc, const char **argv);
+int cmd__reftable(int argc, const char **argv);
 int cmd__regex(int argc, const char **argv);
 int cmd__repository(int argc, const char **argv);
 int cmd__revision_walking(int argc, const char **argv);
diff --git a/t/t0032-reftable-unittest.sh b/t/t0032-reftable-unittest.sh
new file mode 100755
index 00000000000..0ed14971a58
--- /dev/null
+++ b/t/t0032-reftable-unittest.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# Copyright (c) 2020 Google LLC
+#
+
+test_description='reftable unittests'
+
+. ./test-lib.sh
+
+test_expect_success 'unittests' '
+	TMPDIR=$(pwd) && export TMPDIR &&
+	test-tool reftable
+'
+
+test_done
-- 
gitgitgadget


^ permalink raw reply related	[relevance 7%]

* [PATCH 6/6] Add mkfile to build git and subcommands for Plan 9
  @ 2019-08-03 23:52  7% ` lufia via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: lufia via GitGitGadget @ 2019-08-03 23:52 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, lufia

From: lufia <lufia@lufia.org>

Signed-off-by: lufia <lufia@lufia.org>
---
 mkfile | 195 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 195 insertions(+)
 create mode 100644 mkfile

diff --git a/mkfile b/mkfile
new file mode 100644
index 0000000000..f0b06437ed
--- /dev/null
+++ b/mkfile
@@ -0,0 +1,195 @@
+</sys/src/ape/config
+
+CFILES=`{sed -n '/^BUILTIN_OBJS *\+= *(.*)\.o$/s//\1.c/p' Makefile}
+OFILES=\
+	${CFILES:%.c=%.$O}\
+	common-main.$O\
+
+X_CFILES=`{sed -n '/^BUILT_INS *\+= *git-(.*)\$X$/s//\1/p' Makefile}
+
+#APP_CFILES=`{sed -n '/^PROGRAM_OBJS *\+= *(.*)\.o$/s//\1.c/p' Makefile}
+APP_CFILES=\
+	credential-store.c\
+	http-fetch.c\
+	http-push.c\
+
+TARG=\
+	git\
+	${CFILES:builtin/%.c=git-%}\
+	${X_CFILES:%=git-%}\
+	${APP_CFILES:%.c=git-%}\
+	git-remote-http\
+	git-remote-https\
+	git-remote-ftp\
+	git-remote-ftps\
+
+# NO_UNIXSOCK
+#	git-credential-cache\
+#	git-credential-cache--daemon\
+
+#GIT_HOST_CPU=i386|i686|x86_64
+
+ROOT=`{pwd}
+<GIT-VERSION-FILE
+COMMIT_HASH=`{git rev-parse -q --verify HEAD}
+
+# -w flag isn't intentionally set because it is noisy.
+# -T flag isn't intentionally set.
+CFLAGS=-FVB+ -c\
+	-I$ROOT\
+	-I$ROOT/compat/plan9\
+	-I$ROOT/compat/regex\
+	-D__PLAN9__\
+	-D_POSIX_SOURCE\
+	-D_BSD_EXTENSION\
+	-D_SUSV2_SOURCE\
+	-D_PLAN9_SOURCE\
+	-D_RESEARCH_SOURCE\
+	-D_REENTRANT_SOURCE\
+	-DHAVE_SOCK_OPTS\
+	-DNO_NSEC\
+	-DNO_SYMLINK_HEAD\
+	-DNO_GECOS_IN_PWENT\
+	-DNO_GETTEXT\
+	-DNO_STRCASESTR\
+	-DNO_STRLCPY\
+	-DNO_STRTOUMAX\
+	-DNO_MBSUPPORT\
+	-DNO_MKDTEMP\
+	-DNO_UNSETENV\
+	-DNEEDS_SYS_PARAM_H\
+	-DNO_INITGROUPS\
+	-DNO_MMAP\
+	-DNO_ST_BLOCKS_IN_STRUCT_STAT\
+	-DNO_STRUCT_ITIMERVAL\
+	-DNO_SETITIMER\
+	-Dsockaddr_storage=sockaddr_in6\
+	-DNO_UNIX_SOCKETS\
+	-DNO_ICONV\
+	-DSHA1_OPENSSL\
+	-DSHA256_OPENSSL\
+	-DNO_MEMMEM\
+	-DHAVE_STDBOOL_H\
+	-DHAVE_STDINT_H\
+	-DHAVE_LOCALE_H\
+	-DHAVE_CLOCK_GETTIME\
+	-DGIT_VERSION="$GIT_VERSION"\
+	-DGIT_BUILT_FROM_COMMIT="$COMMIT_HASH"\
+	-DGIT_USER_AGENT="git/$GIT_VERSION"\
+	-DETC_GITCONFIG="/sys/lib/git/config"\
+	-DETC_GITATTRIBUTES="/sys/lib/git/attributes"\
+	-DUSER_GITCONFIG="~/lib/git/config"\
+	-DUSER_GITCREDENTIALS="~/lib/git/credentials"\
+	-DUSER_GITCREDENTIAL_CACHE="~/lib/git/credential-cache"\
+	-DDEFAULT_GIT_TEMPLATE_DIR="/sys/lib/git/templates"\
+	-DGIT_HOST_CPU="i386"\
+	-DGIT_EXEC_PATH="/bin/git-core"\
+	-DGIT_MAN_PATH="/sys/man"\
+	-DGIT_INFO_PATH=""\
+	-DGIT_HTML_PATH=""\
+	-DFALLBACK_RUNTIME_PREFIX="/bin/git-core"\
+	-DDEFAULT_PAGER="/bin/p"\
+	-DPAGER_ENV="terminal="\
+	-DHOME_ENVIRONMENT="home"\
+	-DPATH_ENVIRONMENT="path"\
+	-D_PATH_SEP=1\
+	-D_PATH_DEFPATH="/bin"\
+	-DSHELL_PATH="/bin/rc"\
+
+LIB_CFILES=`{sed -n '/^LIB_OBJS *\+= *(.*)\.o$/s//\1.c/p' Makefile}
+LIB_OFILES=\
+	${LIB_CFILES:%.c=%.$O}\
+	compat/qsort_s.$O\
+	compat/strcasestr.$O\
+	compat/strlcpy.$O\
+	compat/strtoumax.$O\
+	compat/strtoimax.$O\
+	compat/setenv.$O\
+	compat/mkdtemp.$O\
+	compat/unsetenv.$O\
+	compat/mmap.$O\
+	compat/memmem.$O\
+	compat/regex/regex.$O\
+
+XDIFF_CFILES=`{sed -n '/^XDIFF_OBJS *\+= *(.*)\.o$/s//\1.c/p' Makefile}
+XDIFF_OFILES=${XDIFF_CFILES:%.c=%.$O}
+
+HFILES=\
+	`{ls *.h}\
+	`{ls */*.h}\
+	`{ls */*/*.h}\
+	`{ls */*/*/*.h}\
+	command-list.h\
+
+BIN=/$objtype/bin/git-core
+OBJBIN=/$objtype/bin
+
+LIB=\
+	libgit.a$O\
+	xdiff/lib.a$O\
+	/$objtype/lib/ape/libcurl.a\
+	/$objtype/lib/ape/libssl.a\
+	/$objtype/lib/ape/libcrypto.a\
+	/$objtype/lib/ape/libexpat.a\
+	/$objtype/lib/ape/libz.a\
+
+CLEANFILES=command-list.h
+
+</sys/src/cmd/mkmany
+
+LIBGIT=libgit.a$O
+LIBGITOBJ=${LIB_OFILES:%=$LIBGIT(%)}
+LIBXDIFF=xdiff/lib.a$O
+LIBXDIFFOBJ=${XDIFF_OFILES:%=$LIBXDIFF(%)}
+
+command-list.h:D:	command-list.txt
+	rc ./generate-cmdlist.rc $prereq >$target
+
+${CFILES:builtin/%.c=$O.git-%} ${X_CFILES:%=$O.git-%}:D:	plan9/wrap.c
+	for(i in $target)
+		$CC -FTVw -o $i $prereq
+
+$O.git-credential-store:	credential-store.$O common-main.$O $LIB
+	$LD $LDFLAGS -o $target $prereq
+
+$O.git-http-fetch:	http-fetch.$O http.$O http-walker.$O common-main.$O $LIB
+	$LD $LDFLAGS -o $target $prereq
+
+$O.git-http-push:	http-push.$O http.$O common-main.$O $LIB
+	$LD $LDFLAGS -o $target $prereq
+
+git-http-%.$O:	http-%.c
+	$CC $CFLAGS -o $target $prereq
+
+$O.git-remote-http:	remote-curl.$O http.$O http-walker.$O common-main.$O $LIB
+	$LD $LDFLAGS -o $target $prereq
+
+$O.git-remote-https:	remote-curl.$O http.$O http-walker.$O common-main.$O $LIB
+	$LD $LDFLAGS -o $target $prereq
+
+$O.git-remote-ftp:	remote-curl.$O http.$O http-walker.$O common-main.$O $LIB
+	$LD $LDFLAGS -o $target $prereq
+
+$O.git-remote-ftps:	remote-curl.$O http.$O http-walker.$O common-main.$O $LIB
+	$LD $LDFLAGS -o $target $prereq
+
+# git should be copied into both $BIN and $OBJBIN
+git.install:V:	$O.git
+	cp $O.git $OBJBIN/git
+
+$LIBGIT:	$LIBGITOBJ
+	ar vu $target $newmember
+
+$LIBXDIFF:	$LIBXDIFFOBJ
+	ar vu $target $newmember
+
+%.$O:	%.c
+	$CC $CFLAGS -o $target $stem.c
+
+$LIBGIT(%.$O):N:	%.$O
+
+$LIBXDIFF(%.$O):N:	%.$O
+
+clean:V:
+	rm -f *.[$OS] [$OS].out y.tab.? lex.yy.c y.debug y.output $CLEANFILES
+	rm -f */*.[$OS] */*/*.[$OS]
-- 
gitgitgadget

^ permalink raw reply related	[relevance 7%]

* [PATCH 4/7] Move setup_diff_pager to libgit.a
  2012-10-26 15:53 10%       ` [PATCH 0/7] Move code from builtin " Nguyễn Thái Ngọc Duy
  2012-10-26 15:53  8%         ` [PATCH 3/7] Move print_commit_list " Nguyễn Thái Ngọc Duy
  2012-10-26 15:53  8%         ` [PATCH 2/7] Move estimate_bisect_steps " Nguyễn Thái Ngọc Duy
@ 2012-10-26 15:53  7%         ` Nguyễn Thái Ngọc Duy
  2012-10-26 15:53  5%         ` [PATCH 1/7] Move try_merge_command and checkout_fast_forward " Nguyễn Thái Ngọc Duy
  3 siblings, 0 replies; 200+ results
From: Nguyễn Thái Ngọc Duy @ 2012-10-26 15:53 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Nguyễn Thái Ngọc Duy

This is used by diff-no-index.c, part of libgit.a while it stays in
builtin/diff.c. Move it to diff.c so that we won't get undefined
reference if a program that uses libgit.a happens to pull it in.

While at it, move check_pager from git.c to pager.c. It makes more
sense there and pager.c is also part of libgit.a

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin.h      |  4 ----
 builtin/diff.c | 16 ----------------
 cache.h        |  1 +
 diff.c         | 16 ++++++++++++++++
 diff.h         |  1 +
 git.c          | 33 ---------------------------------
 pager.c        | 34 ++++++++++++++++++++++++++++++++++
 7 files changed, 52 insertions(+), 53 deletions(-)

diff --git a/builtin.h b/builtin.h
index 95116b8..3faf9d6 100644
--- a/builtin.h
+++ b/builtin.h
@@ -37,10 +37,6 @@ int copy_note_for_rewrite(struct notes_rewrite_cfg *c,
 			  const unsigned char *from_obj, const unsigned char *to_obj);
 void finish_copy_notes_for_rewrite(struct notes_rewrite_cfg *c);
 
-extern int check_pager_config(const char *cmd);
-struct diff_options;
-extern void setup_diff_pager(struct diff_options *);
-
 extern int textconv_object(const char *path, unsigned mode, const unsigned char *sha1, int sha1_valid, char **buf, unsigned long *buf_size);
 
 extern int cmd_add(int argc, const char **argv, const char *prefix);
diff --git a/builtin/diff.c b/builtin/diff.c
index 9650be2..9c70e40 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -418,19 +418,3 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 		refresh_index_quietly();
 	return result;
 }
-
-void setup_diff_pager(struct diff_options *opt)
-{
-	/*
-	 * If the user asked for our exit code, then either they want --quiet
-	 * or --exit-code. We should definitely not bother with a pager in the
-	 * former case, as we will generate no output. Since we still properly
-	 * report our exit code even when a pager is run, we _could_ run a
-	 * pager with --exit-code. But since we have not done so historically,
-	 * and because it is easy to find people oneline advising "git diff
-	 * --exit-code" in hooks and other scripts, we do not do so.
-	 */
-	if (!DIFF_OPT_TST(opt, EXIT_WITH_STATUS) &&
-	    check_pager_config("diff") != 0)
-		setup_pager();
-}
diff --git a/cache.h b/cache.h
index 2dc4dec..dbd8018 100644
--- a/cache.h
+++ b/cache.h
@@ -1183,6 +1183,7 @@ extern int pager_in_use(void);
 extern int pager_use_color;
 extern int term_columns(void);
 extern int decimal_width(int);
+extern int check_pager_config(const char *cmd);
 
 extern const char *editor_program;
 extern const char *askpass_program;
diff --git a/diff.c b/diff.c
index 35d3f07..1b5727d 100644
--- a/diff.c
+++ b/diff.c
@@ -4871,3 +4871,19 @@ size_t fill_textconv(struct userdiff_driver *driver,
 
 	return size;
 }
+
+void setup_diff_pager(struct diff_options *opt)
+{
+	/*
+	 * If the user asked for our exit code, then either they want --quiet
+	 * or --exit-code. We should definitely not bother with a pager in the
+	 * former case, as we will generate no output. Since we still properly
+	 * report our exit code even when a pager is run, we _could_ run a
+	 * pager with --exit-code. But since we have not done so historically,
+	 * and because it is easy to find people oneline advising "git diff
+	 * --exit-code" in hooks and other scripts, we do not do so.
+	 */
+	if (!DIFF_OPT_TST(opt, EXIT_WITH_STATUS) &&
+	    check_pager_config("diff") != 0)
+		setup_pager();
+}
diff --git a/diff.h b/diff.h
index a658f85..a47bae4 100644
--- a/diff.h
+++ b/diff.h
@@ -335,5 +335,6 @@ extern int parse_rename_score(const char **cp_p);
 
 extern int print_stat_summary(FILE *fp, int files,
 			      int insertions, int deletions);
+extern void setup_diff_pager(struct diff_options *);
 
 #endif /* DIFF_H */
diff --git a/git.c b/git.c
index 8788b32..d33f9b3 100644
--- a/git.c
+++ b/git.c
@@ -17,39 +17,6 @@ const char git_more_info_string[] =
 
 static struct startup_info git_startup_info;
 static int use_pager = -1;
-struct pager_config {
-	const char *cmd;
-	int want;
-	char *value;
-};
-
-static int pager_command_config(const char *var, const char *value, void *data)
-{
-	struct pager_config *c = data;
-	if (!prefixcmp(var, "pager.") && !strcmp(var + 6, c->cmd)) {
-		int b = git_config_maybe_bool(var, value);
-		if (b >= 0)
-			c->want = b;
-		else {
-			c->want = 1;
-			c->value = xstrdup(value);
-		}
-	}
-	return 0;
-}
-
-/* returns 0 for "no pager", 1 for "use pager", and -1 for "not specified" */
-int check_pager_config(const char *cmd)
-{
-	struct pager_config c;
-	c.cmd = cmd;
-	c.want = -1;
-	c.value = NULL;
-	git_config(pager_command_config, &c);
-	if (c.value)
-		pager_program = c.value;
-	return c.want;
-}
 
 static void commit_pager_choice(void) {
 	switch (use_pager) {
diff --git a/pager.c b/pager.c
index 4dcb08d..060fa88 100644
--- a/pager.c
+++ b/pager.c
@@ -6,6 +6,12 @@
 #define DEFAULT_PAGER "less"
 #endif
 
+struct pager_config {
+	const char *cmd;
+	int want;
+	char *value;
+};
+
 /*
  * This is split up from the rest of git so that we can do
  * something different on Windows.
@@ -159,3 +165,31 @@ int decimal_width(int number)
 		i *= 10;
 	return width;
 }
+
+static int pager_command_config(const char *var, const char *value, void *data)
+{
+	struct pager_config *c = data;
+	if (!prefixcmp(var, "pager.") && !strcmp(var + 6, c->cmd)) {
+		int b = git_config_maybe_bool(var, value);
+		if (b >= 0)
+			c->want = b;
+		else {
+			c->want = 1;
+			c->value = xstrdup(value);
+		}
+	}
+	return 0;
+}
+
+/* returns 0 for "no pager", 1 for "use pager", and -1 for "not specified" */
+int check_pager_config(const char *cmd)
+{
+	struct pager_config c;
+	c.cmd = cmd;
+	c.want = -1;
+	c.value = NULL;
+	git_config(pager_command_config, &c);
+	if (c.value)
+		pager_program = c.value;
+	return c.want;
+}
-- 
1.8.0.rc2.23.g1fb49df

^ permalink raw reply related	[relevance 7%]

* Using VC build git (new patch)
@ 2009-08-15 16:21  7% Frank Li
  0 siblings, 0 replies; 200+ results
From: Frank Li @ 2009-08-15 16:21 UTC (permalink / raw)
  To: git, msysGit

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

New patch.

pull from git://repo.or.cz/tgit.git
branch vcpatch

[-- Attachment #2: 0001-Enable-Visual-Studio-2008-Build-Git.patch --]
[-- Type: application/octet-stream, Size: 52895 bytes --]

From 3136d3b72e199ad1484629e8ff4563a918cad953 Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Tue, 4 Aug 2009 23:53:38 +0800
Subject: [PATCH] Enable Visual Studio 2008 Build Git

Enable VC Build Git. Reuse many msysgit porting working.
Build Git need some external library, such zlib.
Please read Readme to get how to build git with VS2008

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 builtin-fast-export.c               |    1 +
 compat/fnmatch/fnmatch.c            |    2 +
 compat/mingw.c                      |   68 ++-
 compat/mingw.h                      |   21 +-
 compat/regex/regex.c                |    8 +-
 compat/snprintf.c                   |    7 +-
 compat/vcbuild/.gitignore           |    3 +
 compat/vcbuild/ReadMe               |   13 +
 compat/vcbuild/git/git.vcproj       |  197 +++++
 compat/vcbuild/include/dirent.h     |  127 ++++
 compat/vcbuild/include/unistd.h     |  174 +++++
 compat/vcbuild/libgit/libgit.vcproj | 1347 +++++++++++++++++++++++++++++++++++
 compat/vcbuild/porting.c            |   13 +
 compat/vcbuild/sys/time.h           |   21 +
 compat/winansi.c                    |    8 +
 git-compat-util.h                   |    2 +-
 help.c                              |    5 +-
 pager.c                             |    4 +-
 run-command.c                       |   11 +-
 run-command.h                       |    2 +-
 setup.c                             |    2 +-
 21 files changed, 2011 insertions(+), 25 deletions(-)
 create mode 100644 compat/vcbuild/.gitignore
 create mode 100644 compat/vcbuild/ReadMe
 create mode 100644 compat/vcbuild/git/git.vcproj
 create mode 100644 compat/vcbuild/include/dirent.h
 create mode 100644 compat/vcbuild/include/unistd.h
 create mode 100644 compat/vcbuild/include/utime.h
 create mode 100644 compat/vcbuild/libgit/libgit.vcproj
 create mode 100644 compat/vcbuild/porting.c
 create mode 100644 compat/vcbuild/sys/param.h
 create mode 100644 compat/vcbuild/sys/socket.h
 create mode 100644 compat/vcbuild/sys/time.h

diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index c48c18d..24a50ae 100644
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -24,6 +24,7 @@ static const char *fast_export_usage[] = {
 
 static int progress;
 static enum { ABORT, VERBATIM, WARN, STRIP } signed_tag_mode = ABORT;
+#undef ERROR
 static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ABORT;
 static int fake_missing_tagger;
 
diff --git a/compat/fnmatch/fnmatch.c b/compat/fnmatch/fnmatch.c
index 14feac7..4e3d8e7 100644
--- a/compat/fnmatch/fnmatch.c
+++ b/compat/fnmatch/fnmatch.c
@@ -16,6 +16,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include "git-compat-util.h"
+
 #if HAVE_CONFIG_H
 # include <config.h>
 #endif
diff --git a/compat/mingw.c b/compat/mingw.c
index bed4178..4ff2e84 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -123,13 +123,19 @@ int mingw_open (const char *filename, int oflags, ...)
 {
 	va_list args;
 	unsigned mode;
+	int fd;
+
 	va_start(args, oflags);
 	mode = va_arg(args, int);
 	va_end(args);
 
 	if (!strcmp(filename, "/dev/null"))
 		filename = "nul";
-	int fd = open(filename, oflags, mode);
+#if defined(_MSC_VER)
+	fd = _open(filename, oflags|_O_BINARY, mode);
+#else
+	fd = open(filename, oflags, mode);
+#endif
 	if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {
 		DWORD attrs = GetFileAttributes(filename);
 		if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY))
@@ -274,7 +280,11 @@ int mkstemp(char *template)
 	char *filename = mktemp(template);
 	if (filename == NULL)
 		return -1;
+#if defined(_MSC_VER)
+	return _open(filename, _O_RDWR | _O_CREAT | _O_BINARY, 0600);
+#else
 	return open(filename, O_RDWR | O_CREAT, 0600);
+#endif
 }
 
 int gettimeofday(struct timeval *tv, void *tz)
@@ -580,10 +590,11 @@ static char **get_path_split(void)
 
 static void free_path_split(char **path)
 {
+	char **p = path;
+
 	if (!path)
 		return;
-
-	char **p = path;
+	
 	while (*p)
 		free(*p++);
 	free(path);
@@ -938,7 +949,6 @@ int mingw_rename(const char *pold, const char *pnew)
 	DWORD attrs, gle;
 	int tries = 0;
 	static const int delay[] = { 0, 1, 10, 20, 40 };
-
 	/*
 	 * Try native rename() first to get errno right.
 	 * It is based on MoveFile(), which cannot overwrite existing files.
@@ -1011,7 +1021,9 @@ static sig_handler_t timer_fn = SIG_DFL;
  * But ticktack() interrupts the wait state after the timer's interval
  * length to call the signal handler.
  */
-
+#if defined(_MSC_VER)
+#define __stdcall
+#endif
 static __stdcall unsigned ticktack(void *dummy)
 {
 	while (WaitForSingleObject(timer_event, timer_interval) == WAIT_TIMEOUT) {
@@ -1108,9 +1120,11 @@ int sigaction(int sig, struct sigaction *in, struct sigaction *out)
 #undef signal
 sig_handler_t mingw_signal(int sig, sig_handler_t handler)
 {
+	sig_handler_t old;
+
 	if (sig != SIGALRM)
 		return signal(sig, handler);
-	sig_handler_t old = timer_fn;
+	old = timer_fn;
 	timer_fn = handler;
 	return old;
 }
@@ -1141,6 +1155,12 @@ int link(const char *oldpath, const char *newpath)
 {
 	typedef BOOL WINAPI (*T)(const char*, const char*, LPSECURITY_ATTRIBUTES);
 	static T create_hard_link = NULL;
+
+#if defined(_MSC_VER)	
+	errno = ENOSYS;
+	return -1;
+#endif
+
 	if (!create_hard_link) {
 		create_hard_link = (T) GetProcAddress(
 			GetModuleHandle("kernel32.dll"), "CreateHardLinkA");
@@ -1197,8 +1217,9 @@ struct dirent *mingw_readdir(DIR *dir)
 
 	if (dir->dd_handle == (long)INVALID_HANDLE_VALUE && dir->dd_stat == 0)
 	{
+		DWORD lasterr;
 		handle = FindFirstFileA(dir->dd_name, &buf);
-		DWORD lasterr = GetLastError();
+		lasterr = GetLastError();
 		dir->dd_handle = (long)handle;
 		if (handle == INVALID_HANDLE_VALUE && (lasterr != ERROR_NO_MORE_FILES)) {
 			errno = err_win_to_posix(lasterr);
@@ -1230,4 +1251,37 @@ struct dirent *mingw_readdir(DIR *dir)
 
 	return (struct dirent*)&dir->dd_dir;
 }
+#if defined(_MSC_VER)
+DIR *opendir(const char *name)
+{
+	int len;
+	DIR *p;
+	p=(DIR*)malloc(sizeof(DIR));
+	memset(p,0,sizeof(DIR));
+	strncpy(p->dd_name,name,PATH_MAX);
+	len=strlen(p->dd_name);
+	p->dd_name[len]='/';
+	p->dd_name[len+1]='*';
+
+	if(p==NULL)
+		return NULL;
+
+	p->dd_handle=_findfirst(p->dd_name,&p->dd_dta);
+
+	if(p->dd_handle == -1) 
+	{
+		free(p);
+		return NULL;
+	}
+	return p;
+}
+int closedir(DIR *dir)
+{
+	_findclose(dir->dd_handle);
+	free(dir);
+	return 0;
+}
+#endif //_MSC_VER
+
 #endif // !NO_MINGW_REPLACE_READDIR
+
diff --git a/compat/mingw.h b/compat/mingw.h
index c1859c5..0eb2bc7 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -171,14 +171,31 @@ int mingw_getpagesize(void);
 /* Use mingw_lstat() instead of lstat()/stat() and
  * mingw_fstat() instead of fstat() on Windows.
  */
+#undef off_t
 #define off_t off64_t
+
+#ifdef _MSC_VER
+#define stat(x,y) mingw_lstat(x,y)
+#define stat _stat64
+#else
 #define stat _stati64
+#endif
+
+#undef lseek
 #define lseek _lseeki64
+
 int mingw_lstat(const char *file_name, struct stat *buf);
 int mingw_fstat(int fd, struct stat *buf);
+
+#undef fstat
 #define fstat mingw_fstat
+
+#undef lstat
 #define lstat mingw_lstat
+
+#ifndef _MSC_VER
 #define _stati64(x,y) mingw_lstat(x,y)
+#endif
 
 int mingw_utime(const char *file_name, const struct utimbuf *times);
 #define utime mingw_utime
@@ -197,7 +214,9 @@ sig_handler_t mingw_signal(int sig, sig_handler_t handler);
 /*
  * ANSI emulation wrappers
  */
-
+#ifdef _MSC_VER
+#define __attribute__(x)
+#endif
 int winansi_fputs(const char *str, FILE *stream);
 int winansi_printf(const char *format, ...) __attribute__((format (printf, 1, 2)));
 int winansi_fprintf(FILE *stream, const char *format, ...) __attribute__((format (printf, 2, 3)));
diff --git a/compat/regex/regex.c b/compat/regex/regex.c
index 5ea0075..a291543 100644
--- a/compat/regex/regex.c
+++ b/compat/regex/regex.c
@@ -20,6 +20,8 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 /* AIX requires this to be the first thing in the file. */
+#include "git-compat-util.h"
+
 #if defined (_AIX) && !defined (REGEX_MALLOC)
   #pragma alloca
 #endif
@@ -4852,11 +4854,7 @@ regexec (preg, string, nmatch, pmatch, eflags)
    from either regcomp or regexec.   We don't use PREG here.  */
 
 size_t
-regerror (errcode, preg, errbuf, errbuf_size)
-    int errcode;
-    const regex_t *preg;
-    char *errbuf;
-    size_t errbuf_size;
+regerror (int errcode, const regex_t * preg, char * errbuf,size_t errbuf_size)
 {
   const char *msg;
   size_t msg_size;
diff --git a/compat/snprintf.c b/compat/snprintf.c
index 6c0fb05..47b2b8a 100644
--- a/compat/snprintf.c
+++ b/compat/snprintf.c
@@ -6,7 +6,7 @@
  * number of characters to write without the trailing NUL.
  */
 #ifndef SNPRINTF_SIZE_CORR
-#if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ < 4
+#if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ < 4 || defined(_MSC_VER)
 #define SNPRINTF_SIZE_CORR 1
 #else
 #define SNPRINTF_SIZE_CORR 0
@@ -14,6 +14,11 @@
 #endif
 
 #undef vsnprintf
+
+#if defined(_MSC_VER)
+#define vsnprintf _vsnprintf
+#endif
+
 int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)
 {
 	char *s;
diff --git a/compat/vcbuild/.gitignore b/compat/vcbuild/.gitignore
new file mode 100644
index 0000000..7796990
--- /dev/null
+++ b/compat/vcbuild/.gitignore
@@ -0,0 +1,3 @@
+Debug
+Release
+*.user
\ No newline at end of file
diff --git a/compat/vcbuild/ReadMe b/compat/vcbuild/ReadMe
new file mode 100644
index 0000000..47c089e
--- /dev/null
+++ b/compat/vcbuild/ReadMe
@@ -0,0 +1,13 @@
+The Steps of Build Git with VS2008
+
+1. Create VC Build Environment.
+
+   git clone git://repo.or.cz/gitbuild.git
+
+   gitbuild include VS solution file and library such as zlib.
+ 
+2. Get Submodule
+  
+   git submodule update
+
+3. Open gitbuild\gitbuild.sln with VS2008. Then press F7.
\ No newline at end of file
diff --git a/compat/vcbuild/git/git.vcproj b/compat/vcbuild/git/git.vcproj
new file mode 100644
index 0000000..6f85de3
--- /dev/null
+++ b/compat/vcbuild/git/git.vcproj
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="git"
+	ProjectGUID="{E3E30E51-C5AD-407B-AB43-985E4111474A}"
+	RootNamespace="git"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="wininet.lib ws2_32.lib "
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="wininet.lib ws2_32.lib "
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\git.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/compat/vcbuild/include/dirent.h b/compat/vcbuild/include/dirent.h
new file mode 100644
index 0000000..a6b6f4c
--- /dev/null
+++ b/compat/vcbuild/include/dirent.h
@@ -0,0 +1,127 @@
+/*
+ * DIRENT.H (formerly DIRLIB.H)
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is a part of the mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within the package.
+ *
+ */
+#ifndef _DIRENT_H_
+#define _DIRENT_H_
+
+/* All the headers include this file. */
+//#include <_mingw.h>
+
+#include <io.h>
+
+#define PATH_MAX 512
+
+#define __MINGW_NOTHROW
+
+#ifndef RC_INVOKED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct dirent
+{
+	long		d_ino;		/* Always zero. */
+	unsigned short	d_reclen;	/* Always zero. */
+	unsigned short	d_namlen;	/* Length of name in d_name. */
+	char		d_name[FILENAME_MAX]; /* File name. */
+};
+
+/*
+ * This is an internal data structure. Good programmers will not use it
+ * except as an argument to one of the functions below.
+ * dd_stat field is now int (was short in older versions).
+ */
+typedef struct
+{
+	/* disk transfer area for this dir */
+	struct _finddata_t	dd_dta;
+
+	/* dirent struct to return from dir (NOTE: this makes this thread
+	 * safe as long as only one thread uses a particular DIR struct at
+	 * a time) */
+	struct dirent		dd_dir;
+
+	/* _findnext handle */
+	long			dd_handle;
+
+	/*
+         * Status of search:
+	 *   0 = not started yet (next entry to read is first entry)
+	 *  -1 = off the end
+	 *   positive = 0 based index of next entry
+	 */
+	int			dd_stat;
+
+	/* given path for dir with search pattern (struct is extended) */
+	char			dd_name[PATH_MAX+3];
+} DIR;
+
+DIR* __cdecl __MINGW_NOTHROW opendir (const char*);
+struct dirent* __cdecl __MINGW_NOTHROW readdir (DIR*);
+int __cdecl __MINGW_NOTHROW closedir (DIR*);
+void __cdecl __MINGW_NOTHROW rewinddir (DIR*);
+long __cdecl __MINGW_NOTHROW telldir (DIR*);
+void __cdecl __MINGW_NOTHROW seekdir (DIR*, long);
+
+
+/* wide char versions */
+
+struct _wdirent
+{
+	long		d_ino;		/* Always zero. */
+	unsigned short	d_reclen;	/* Always zero. */
+	unsigned short	d_namlen;	/* Length of name in d_name. */
+	wchar_t		d_name[FILENAME_MAX]; /* File name. */
+};
+
+/*
+ * This is an internal data structure. Good programmers will not use it
+ * except as an argument to one of the functions below.
+ */
+typedef struct
+{
+	/* disk transfer area for this dir */
+	//struct _wfinddata_t	dd_dta;
+
+	/* dirent struct to return from dir (NOTE: this makes this thread
+	 * safe as long as only one thread uses a particular DIR struct at
+	 * a time) */
+	struct _wdirent		dd_dir;
+
+	/* _findnext handle */
+	long			dd_handle;
+
+	/*
+         * Status of search:
+	 *   0 = not started yet (next entry to read is first entry)
+	 *  -1 = off the end
+	 *   positive = 0 based index of next entry
+	 */
+	int			dd_stat;
+
+	/* given path for dir with search pattern (struct is extended) */
+	wchar_t			dd_name[1];
+} _WDIR;
+
+
+
+_WDIR* __cdecl __MINGW_NOTHROW _wopendir (const wchar_t*);
+struct _wdirent*  __cdecl __MINGW_NOTHROW _wreaddir (_WDIR*);
+int __cdecl __MINGW_NOTHROW _wclosedir (_WDIR*);
+void __cdecl __MINGW_NOTHROW _wrewinddir (_WDIR*);
+long __cdecl __MINGW_NOTHROW _wtelldir (_WDIR*);
+void __cdecl __MINGW_NOTHROW _wseekdir (_WDIR*, long);
+
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* Not RC_INVOKED */
+
+#endif	/* Not _DIRENT_H_ */
diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h
new file mode 100644
index 0000000..0c06957
--- /dev/null
+++ b/compat/vcbuild/include/unistd.h
@@ -0,0 +1,174 @@
+#ifndef _UNISTD_
+#define _UNISTD_
+
+/*Configuration*/
+
+#define NO_PREAD
+#define NO_OPENSSL
+#define NO_LIBGEN_H
+#define NO_SYMLINK_HEAD
+#define NO_IPV6
+#define NO_SETENV
+#define NO_UNSETENV
+#define NO_STRCASESTR
+#define NO_STRLCPY
+#define NO_MEMMEM
+#define NO_C99_FORMAT
+#define NO_STRTOUMAX
+#define NO_MKDTEMP
+#define NO_MKSTEMPS
+
+#define RUNTIME_PREFIX
+#define NO_ST_BLOCKS_IN_STRUCT_STAT
+#define NO_NSEC
+#define USE_WIN32_MMAP
+#define USE_NED_ALLOCATOR
+
+#define NO_REGEX
+
+#define NO_SYS_SELECT_H
+#define NO_PTHEADS
+#define HAVE_STRING_H 1
+#define STDC_HEADERS
+#define NO_ICONV
+
+#define WINVER 0x0500
+#define _WIN32_WINNT 0x0500
+#define _WIN32_WINDOWS 0x0410
+#define _WIN32_IE 0x0700
+#define NTDDI_VERSION NTDDI_WIN2KSP1
+#define inline __inline
+#define __inline__ __inline
+
+#define SNPRINTF_RETURNS_BOGUS
+
+#define SHA1_HEADER "mozilla-sha1\\sha1.h"
+
+#define ETC_GITCONFIG "%HOME%"
+
+#define NO_PTHREADS
+#define NO_CURL
+
+
+#define va_copy va_start
+#define NO_STRTOUMAX
+#define REGEX_MALLOC
+
+
+
+
+/* Win32 define for porting git*/
+
+#ifndef _MODE_T_
+#define	_MODE_T_
+typedef unsigned short _mode_t;
+
+#ifndef	_NO_OLDNAMES
+typedef _mode_t	mode_t;
+#endif
+#endif	/* Not _MODE_T_ */
+
+#ifndef _SSIZE_T_
+#define _SSIZE_T_
+typedef long _ssize_t;
+
+#ifndef	_OFF_T_
+#define	_OFF_T_
+typedef long _off_t;
+
+#ifndef	_NO_OLDNAMES
+typedef _off_t	off_t;
+#endif
+#endif	/* Not _OFF_T_ */
+
+
+#ifndef	_NO_OLDNAMES
+typedef _ssize_t ssize_t;
+#endif
+#endif /* Not _SSIZE_T_ */
+
+typedef signed char int8_t;
+typedef unsigned char   uint8_t;
+typedef short  int16_t;
+typedef unsigned short  uint16_t;
+typedef int  int32_t;
+typedef unsigned   uint32_t;
+typedef long long  int64_t;
+typedef unsigned long long   uint64_t;
+
+typedef long long  intmax_t;
+typedef unsigned long long uintmax_t;
+
+typedef int64_t off64_t;
+
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+/* Some defines for _access nAccessMode (MS doesn't define them, but
+ * it doesn't seem to hurt to add them). */
+#define	F_OK	0	/* Check for file existence */
+/* Well maybe it does hurt.  On newer versions of MSVCRT, an access mode
+   of 1 causes invalid parameter error. */ 
+#define	X_OK	0	/* MS access() doesn't check for execute permission. */
+#define	W_OK	2	/* Check for write permission */
+#define	R_OK	4	/* Check for read permission */
+
+#define	_S_IFIFO	0x1000	/* FIFO */
+#define	_S_IFCHR	0x2000	/* Character */
+#define	_S_IFBLK	0x3000	/* Block: Is this ever set under w32? */
+#define	_S_IFDIR	0x4000	/* Directory */
+#define	_S_IFREG	0x8000	/* Regular */
+
+#define	_S_IFMT		0xF000	/* File type mask */
+
+#define	_S_IXUSR	_S_IEXEC
+#define	_S_IWUSR	_S_IWRITE
+#define	_S_IRUSR	_S_IREAD
+#define	_S_ISDIR(m)	(((m) & _S_IFMT) == _S_IFDIR)
+
+#define	S_IFIFO		_S_IFIFO
+#define	S_IFCHR		_S_IFCHR
+#define	S_IFBLK		_S_IFBLK
+#define	S_IFDIR		_S_IFDIR
+#define	S_IFREG		_S_IFREG
+#define	S_IFMT		_S_IFMT
+#define	S_IEXEC		_S_IEXEC
+#define	S_IWRITE	_S_IWRITE
+#define	S_IREAD		_S_IREAD
+#define	S_IRWXU		_S_IRWXU
+#define	S_IXUSR		_S_IXUSR
+#define	S_IWUSR		_S_IWUSR
+#define	S_IRUSR		_S_IRUSR
+
+
+#define	S_ISDIR(m)	(((m) & S_IFMT) == S_IFDIR)
+#define	S_ISREG(m)	(((m) & S_IFMT) == S_IFREG)
+#define	S_ISFIFO(m)	(((m) & S_IFMT) == S_IFIFO)
+
+//#define S_IWGRP	_S_IWGRP
+
+
+#define GIT_EXEC_PATH "bin"
+#define GIT_VERSION "1.6"
+#define BINDIR "bin"
+#define PREFIX "."
+#define GIT_MAN_PATH "man"
+#define GIT_INFO_PATH "info"
+#define GIT_HTML_PATH "html"
+#define DEFAULT_GIT_TEMPLATE_DIR "templates"
+
+#define NO_STRLCPY
+#define NO_UNSETENV
+#define NO_SETENV
+
+#define strdup _strdup
+#define read _read
+#define close _close
+#define dup _dup
+#define dup2 _dup2
+#define strncasecmp _strnicmp
+#define strtoull _strtoui64
+
+//#define lseek _lseek
+//#define write vs_write
+#endif
\ No newline at end of file
diff --git a/compat/vcbuild/include/utime.h b/compat/vcbuild/include/utime.h
new file mode 100644
index 0000000..e69de29
diff --git a/compat/vcbuild/libgit/libgit.vcproj b/compat/vcbuild/libgit/libgit.vcproj
new file mode 100644
index 0000000..06dcdef
--- /dev/null
+++ b/compat/vcbuild/libgit/libgit.vcproj
@@ -0,0 +1,1347 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libgit"
+	ProjectGUID="{F6DEC8C3-B803-4A86-8848-430F08B499E3}"
+	RootNamespace="libgit"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\porting.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mozilla-sha1\sha1.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\archive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\delta.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fetch-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\git-compat-util.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\http.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\notes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\send-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shortlog.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tar.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="compat"
+			>
+			<File
+				RelativePath="..\..\..\compat\basename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\cygwin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fopen.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\memmem.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkdtemp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkstemps.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\pread.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\qsort.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\setenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\snprintf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strcasestr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strlcpy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strtoumax.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\unsetenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32mmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\winansi.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="git"
+			>
+			<File
+				RelativePath="..\..\..\abspath.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alias.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alloc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-tar.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-zip.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\base85.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bisect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-add.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-annotate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-apply.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bisect--helper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-blame.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-cat-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-ref-format.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clean.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clone.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-count-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-describe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fast-export.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch--tool.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fmt-merge-msg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-for-each-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-gc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-init-db.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-log.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailinfo.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailsplit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-base.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-ours.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mktree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-name-rev.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune-packed.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-push.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-read-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-receive-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reflog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reset.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-parse.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-revert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rm.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-send-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-shortlog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-stripspace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-symbolic-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tar-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-unpack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-upload-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-write-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\combine-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\connect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\convert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\copy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ctype.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\date.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-lib.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-no-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-break.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-order.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-pickaxe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-rename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\editor.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\entry.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\environment.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ident.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lockfile.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\match-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\name-hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-check.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-write.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pager.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\path.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\preload-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pretty.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\read-cache.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\server-info.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\setup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_name.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shallow.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\symlinks.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\trace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\usage.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wrapper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\write_or_die.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ws.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="xdiff"
+			>
+			<File
+				RelativePath="..\..\..\xdiff\xdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xinclude.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmacros.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmerge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xpatience.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xtypes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/compat/vcbuild/porting.c b/compat/vcbuild/porting.c
new file mode 100644
index 0000000..f9bd82d
--- /dev/null
+++ b/compat/vcbuild/porting.c
@@ -0,0 +1,13 @@
+#include "stdio.h"
+#include "STDARG.H"
+#include <string.h>
+#include "dirent.h"
+#include "unistd.h"
+
+int strcasecmp (const char *s1, const char *s2)
+{
+	int size1=strlen(s1);
+	int sisz2=strlen(s2);
+
+	return _strnicmp(s1,s2,sisz2>size1?sisz2:size1);
+}
\ No newline at end of file
diff --git a/compat/vcbuild/sys/param.h b/compat/vcbuild/sys/param.h
new file mode 100644
index 0000000..e69de29
diff --git a/compat/vcbuild/sys/socket.h b/compat/vcbuild/sys/socket.h
new file mode 100644
index 0000000..e69de29
diff --git a/compat/vcbuild/sys/time.h b/compat/vcbuild/sys/time.h
new file mode 100644
index 0000000..6ed82c0
--- /dev/null
+++ b/compat/vcbuild/sys/time.h
@@ -0,0 +1,21 @@
+#ifndef	_UTIME_H_
+#define	_UTIME_H_
+/*
+ * Structure used by _utime function.
+ */
+struct _utimbuf
+{
+	time_t	actime;		/* Access time */
+	time_t	modtime;	/* Modification time */
+};
+
+#ifndef	_NO_OLDNAMES
+/* NOTE: Must be the same as _utimbuf above. */
+struct utimbuf
+{
+	time_t	actime;
+	time_t	modtime;
+};
+#endif	/* Not _NO_OLDNAMES */
+
+#endif
diff --git a/compat/winansi.c b/compat/winansi.c
index 9217c24..6091138 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -3,7 +3,11 @@
  */
 
 #include <windows.h>
+#ifdef _MSC_VER
+#include <stdio.h>
+#else
 #include "../git-compat-util.h"
+#endif
 
 /*
  Functions to be wrapped:
@@ -310,9 +314,13 @@ static int winansi_vfprintf(FILE *stream, const char *format, va_list list)
 	if (!console)
 		goto abort;
 
+#ifndef _MSC_VER 
 	va_copy(cp, list);
 	len = vsnprintf(small_buf, sizeof(small_buf), format, cp);
 	va_end(cp);
+#else
+	len= sizeof(small_buf) ;
+#endif
 
 	if (len > sizeof(small_buf) - 1) {
 		buf = malloc(len + 1);
diff --git a/git-compat-util.h b/git-compat-util.h
index 9f941e4..3b683e6 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -87,7 +87,7 @@
 #include <assert.h>
 #include <regex.h>
 #include <utime.h>
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 #include <sys/wait.h>
 #include <sys/poll.h>
 #include <sys/socket.h>
diff --git a/help.c b/help.c
index 6c46d8b..a311241 100644
--- a/help.c
+++ b/help.c
@@ -126,8 +126,8 @@ static int is_executable(const char *name)
 	    !S_ISREG(st.st_mode))
 		return 0;
 
-#ifdef __MINGW32__
-	/* cannot trust the executable bit, peek into the file instead */
+#if defined(__MINGW32__) || defined(_MSC_VER)
+{	/* cannot trust the executable bit, peek into the file instead */
 	char buf[3] = { 0 };
 	int n;
 	int fd = open(name, O_RDONLY);
@@ -140,6 +140,7 @@ static int is_executable(const char *name)
 				st.st_mode |= S_IXUSR;
 		close(fd);
 	}
+}
 #endif
 	return st.st_mode & S_IXUSR;
 }
diff --git a/pager.c b/pager.c
index 4921843..28122c5 100644
--- a/pager.c
+++ b/pager.c
@@ -9,7 +9,7 @@
 
 static int spawned_pager;
 
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 static void pager_preexec(void)
 {
 	/*
@@ -70,7 +70,7 @@ void setup_pager(void)
 	pager_argv[2] = pager;
 	pager_process.argv = pager_argv;
 	pager_process.in = -1;
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 	pager_process.preexec_cb = pager_preexec;
 #endif
 	if (start_command(&pager_process))
diff --git a/run-command.c b/run-command.c
index ff3d8e2..1ea1c16 100644
--- a/run-command.c
+++ b/run-command.c
@@ -67,7 +67,7 @@ int start_command(struct child_process *cmd)
 
 	trace_argv_printf(cmd->argv, "trace: run_command:");
 
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 	fflush(NULL);
 	cmd->pid = fork();
 	if (!cmd->pid) {
@@ -123,6 +123,7 @@ int start_command(struct child_process *cmd)
 		exit(127);
 	}
 #else
+{
 	int s0 = -1, s1 = -1, s2 = -1;	/* backups of stdin, stdout, stderr */
 	const char **sargv = cmd->argv;
 	char **env = environ;
@@ -186,6 +187,7 @@ int start_command(struct child_process *cmd)
 		dup2(s1, 1), close(s1);
 	if (s2 >= 0)
 		dup2(s2, 2), close(s2);
+}
 #endif
 
 	if (cmd->pid < 0) {
@@ -292,7 +294,8 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const
 	return run_command(&cmd);
 }
 
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(_MSC_VER)
+#define __stdcall
 static __stdcall unsigned run_thread(void *data)
 {
 	struct async *async = data;
@@ -308,7 +311,7 @@ int start_async(struct async *async)
 		return error("cannot create pipe: %s", strerror(errno));
 	async->out = pipe_out[0];
 
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 	/* Flush stdio before fork() to avoid cloning buffers */
 	fflush(NULL);
 
@@ -337,7 +340,7 @@ int start_async(struct async *async)
 
 int finish_async(struct async *async)
 {
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 	int ret = 0;
 
 	if (wait_or_whine(async->pid))
diff --git a/run-command.h b/run-command.h
index e345502..57a707b 100644
--- a/run-command.h
+++ b/run-command.h
@@ -79,7 +79,7 @@ struct async {
 	int (*proc)(int fd, void *data);
 	void *data;
 	int out;	/* caller reads from here and closes it */
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 	pid_t pid;
 #else
 	HANDLE tid;
diff --git a/setup.c b/setup.c
index e3781b6..14e3ca7 100644
--- a/setup.c
+++ b/setup.c
@@ -41,7 +41,7 @@ const char *prefix_path(const char *prefix, int len, const char *path)
 const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
 {
 	static char path[PATH_MAX];
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
 	if (!pfx || !*pfx || is_absolute_path(arg))
 		return arg;
 	memcpy(path, pfx, pfx_len);
-- 
1.6.4.msysgit.0


^ permalink raw reply related	[relevance 7%]

* [PATCH 2/3] Include the objects needed for the builtin functions into libgit.a
  @ 2007-12-02  2:54  7%                                   ` Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2007-12-02  2:54 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Eyvind Bernhardsen, Nicolas Pitre, Nguyen Thai Ngoc Duy,
	Jan Hudec, git


For the upcoming change in execv_git_cmd() to call builtin functions
directly, it is necessary to be able to access the builtins, so
move the corresponding objects into libgit.a.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index f000a5e..f9a62eb 100644
--- a/Makefile
+++ b/Makefile
@@ -314,7 +314,8 @@ LIB_OBJS = \
 	alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \
 	color.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o \
 	convert.o attr.o decorate.o progress.o mailmap.o symlinks.o remote.o \
-	transport.o bundle.o walker.o parse-options.o
+	transport.o bundle.o walker.o parse-options.o \
+	$(BUILTIN_OBJS)
 
 BUILTIN_OBJS = \
 	builtin-add.o \
@@ -785,12 +786,12 @@ strip: $(PROGRAMS) git$X
 	$(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
 
 git.o: git.c common-cmds.h GIT-CFLAGS
-	$(QUIET_CC)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
+	$(QUIET_CC)$(CC) \
 		$(ALL_CFLAGS) -c $(filter %.c,$^)
 
 git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
-		$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
+		$(ALL_LDFLAGS) $(LIBS)
 
 help.o: common-cmds.h
 
@@ -894,7 +895,10 @@ git.o git.spec \
 	$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
 
 exec_cmd.o: exec_cmd.c GIT-CFLAGS
-	$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $<
+	$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \
+		-DGIT_EXEC_PATH='"$(gitexecdir_SQ)"' \
+		-DGIT_VERSION='"$(GIT_VERSION)"' \
+		$<
 builtin-init-db.o: builtin-init-db.c GIT-CFLAGS
 	$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
 
@@ -920,7 +924,7 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 
-$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
+$(LIB_OBJS): $(LIB_H)
 $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
 builtin-revert.o builtin-runstatus.o wt-status.o: wt-status.h
 
-- 
1.5.3.6.2112.ge2263

^ permalink raw reply related	[relevance 7%]

* [PATCH] Git.pm: Kill Git.xs for now
@ 2006-09-23 18:20  7% Petr Baudis
  0 siblings, 0 replies; 200+ results
From: Petr Baudis @ 2006-09-23 18:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This patch removes Git.xs from the repository for the time being. This
should hopefully enable Git.pm to finally make its way to master.

Git.xs is not going away forever. When the Git libification makes some
progress, it will hopefully return (but most likely as an optional
component, due to the portability woes) since the performance boosts are
really important for applications like Gitweb or Cogito. It needs to go
away now since it is not really reliable in case you use it for several
repositories in the scope of a single process, and that is not possible
to fix without some either very ugly or very intrusive core changes.

Rest in peace. (While you can.)

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 Makefile         |   17 ++-----
 perl/.gitignore  |    3 -
 perl/Git.pm      |   76 ++++---------------------------
 perl/Git.xs      |  134 ------------------------------------------------------
 perl/Makefile.PL |    9 ----
 5 files changed, 15 insertions(+), 224 deletions(-)

diff --git a/Makefile b/Makefile
index dd74908..58848e4 100644
--- a/Makefile
+++ b/Makefile
@@ -116,8 +116,6 @@ PIC_FLAG = -fPIC
 LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-PERL_CFLAGS =
-PERL_LDFLAGS =
 STRIP ?= strip
 
 prefix = $(HOME)
@@ -158,9 +156,10 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powe
 ### --- END CONFIGURATION SECTION ---
 
 # Those must not be GNU-specific; they are shared with perl/ which may
-# be built by a different compiler.
-BASIC_CFLAGS = $(PERL_CFLAGS)
-BASIC_LDFLAGS = $(PERL_LDFLAGS)
+# be built by a different compiler. (Note that this is an artifact now
+# but it still might be nice to keep that distinction.)
+BASIC_CFLAGS = 
+BASIC_LDFLAGS = 
 
 SCRIPT_SH = \
 	git-bisect.sh git-branch.sh git-checkout.sh \
@@ -784,15 +783,9 @@ XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare
 	rm -f $@ && $(AR) rcs $@ $(XDIFF_OBJS)
 
 
-PERL_DEFINE = $(BASIC_CFLAGS) -DGIT_VERSION='"$(GIT_VERSION)"'
-PERL_DEFINE_SQ = $(subst ','\'',$(PERL_DEFINE))
-PERL_LIBS = $(BASIC_LDFLAGS) $(EXTLIBS)
-PERL_LIBS_SQ = $(subst ','\'',$(PERL_LIBS))
 perl/Makefile: perl/Git.pm perl/Makefile.PL GIT-CFLAGS
 	(cd perl && $(PERL_PATH) Makefile.PL \
-		PREFIX='$(prefix_SQ)' \
-		DEFINE='$(PERL_DEFINE_SQ)' \
-		LIBS='$(PERL_LIBS_SQ)')
+		PREFIX='$(prefix_SQ)')
 
 doc:
 	$(MAKE) -C Documentation all
diff --git a/perl/.gitignore b/perl/.gitignore
index 6d778f3..e990cae 100644
--- a/perl/.gitignore
+++ b/perl/.gitignore
@@ -1,7 +1,4 @@
-Git.bs
-Git.c
 Makefile
 blib
 blibdirs
 pm_to_blib
-ppport.h
diff --git a/perl/Git.pm b/perl/Git.pm
index 9ce9fcd..2b26b65 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -93,9 +93,6 @@ use Carp qw(carp croak); # but croak is 
 use Error qw(:try);
 use Cwd qw(abs_path);
 
-require XSLoader;
-XSLoader::load('Git', $VERSION);
-
 }
 
 
@@ -413,12 +410,13 @@ sub command_noisy {
 
 Return the Git version in use.
 
-Implementation of this function is very fast; no external command calls
-are involved.
-
 =cut
 
-# Implemented in Git.xs.
+sub version {
+	my $verstr = command_oneline('--version');
+	$verstr =~ s/^git version //;
+	$verstr;
+}
 
 
 =item exec_path ()
@@ -426,12 +424,9 @@ # Implemented in Git.xs.
 Return path to the Git sub-command executables (the same as
 C<git --exec-path>). Useful mostly only internally.
 
-Implementation of this function is very fast; no external command calls
-are involved.
-
 =cut
 
-# Implemented in Git.xs.
+sub exec_path { command_oneline('--exec-path') }
 
 
 =item repo_path ()
@@ -572,41 +567,21 @@ sub ident_person {
 
 =item hash_object ( TYPE, FILENAME )
 
-=item hash_object ( TYPE, FILEHANDLE )
-
 Compute the SHA1 object id of the given C<FILENAME> (or data waiting in
 C<FILEHANDLE>) considering it is of the C<TYPE> object type (C<blob>,
 C<commit>, C<tree>).
 
-In case of C<FILEHANDLE> passed instead of file name, all the data
-available are read and hashed, and the filehandle is automatically
-closed. The file handle should be freshly opened - if you have already
-read anything from the file handle, the results are undefined (since
-this function works directly with the file descriptor and internal
-PerlIO buffering might have messed things up).
-
 The method can be called without any instance or on a specified Git repository,
 it makes zero difference.
 
 The function returns the SHA1 hash.
 
-Implementation of this function is very fast; no external command calls
-are involved.
-
 =cut
 
+# TODO: Support for passing FILEHANDLE instead of FILENAME
 sub hash_object {
 	my ($self, $type, $file) = _maybe_self(@_);
-
-	# hash_object_* implemented in Git.xs.
-
-	if (ref($file) eq 'GLOB') {
-		my $hash = hash_object_pipe($type, fileno($file));
-		close $file;
-		return $hash;
-	} else {
-		hash_object_file($type, $file);
-	}
+	command_oneline('hash-object', '-t', $type, $file);
 }
 
 
@@ -802,7 +777,7 @@ sub _cmd_exec {
 
 # Execute the given Git command ($_[0]) with arguments ($_[1..])
 # by searching for it at proper places.
-# _execv_git_cmd(), implemented in Git.xs.
+sub _execv_git_cmd { exec('git', @_); }
 
 # Close pipe to a subprocess.
 sub _cmd_close {
@@ -821,39 +796,6 @@ sub _cmd_close {
 }
 
 
-# Trickery for .xs routines: In order to avoid having some horrid
-# C code trying to do stuff with undefs and hashes, we gate all
-# xs calls through the following and in case we are being ran upon
-# an instance call a C part of the gate which will set up the
-# environment properly.
-sub _call_gate {
-	my $xsfunc = shift;
-	my ($self, @args) = _maybe_self(@_);
-
-	if (defined $self) {
-		# XXX: We ignore the WorkingCopy! To properly support
-		# that will require heavy changes in libgit.
-
-		# XXX: And we ignore everything else as well. libgit
-		# at least needs to be extended to let us specify
-		# the $GIT_DIR instead of looking it up in environment.
-		#xs_call_gate($self->{opts}->{Repository});
-	}
-
-	# Having to call throw from the C code is a sure path to insanity.
-	local $SIG{__DIE__} = sub { throw Error::Simple("@_"); };
-	&$xsfunc(@args);
-}
-
-sub AUTOLOAD {
-	my $xsname;
-	our $AUTOLOAD;
-	($xsname = $AUTOLOAD) =~ s/.*:://;
-	throw Error::Simple("&Git::$xsname not defined") if $xsname =~ /^xs_/;
-	$xsname = 'xs_'.$xsname;
-	_call_gate(\&$xsname, @_);
-}
-
 sub DESTROY { }
 
 
diff --git a/perl/Git.xs b/perl/Git.xs
deleted file mode 100644
index 2bbec43..0000000
--- a/perl/Git.xs
+++ /dev/null
@@ -1,134 +0,0 @@
-/* By carefully stacking #includes here (even if WE don't really need them)
- * we strive to make the thing actually compile. Git header files aren't very
- * nice. Perl headers are one of the signs of the coming apocalypse. */
-#include <ctype.h>
-/* Ok, it hasn't been so bad so far. */
-
-/* libgit interface */
-#include "../cache.h"
-#include "../exec_cmd.h"
-
-/* XS and Perl interface */
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-
-
-static char *
-report_xs(const char *prefix, const char *err, va_list params)
-{
-	static char buf[4096];
-	strcpy(buf, prefix);
-	vsnprintf(buf + strlen(prefix), 4096 - strlen(prefix), err, params);
-	return buf;
-}
-
-static void NORETURN
-die_xs(const char *err, va_list params)
-{
-	char *str;
-	str = report_xs("fatal: ", err, params);
-	croak(str);
-}
-
-static void
-error_xs(const char *err, va_list params)
-{
-	char *str;
-	str = report_xs("error: ", err, params);
-	warn(str);
-}
-
-
-MODULE = Git		PACKAGE = Git
-
-PROTOTYPES: DISABLE
-
-
-BOOT:
-{
-	set_error_routine(error_xs);
-	set_die_routine(die_xs);
-}
-
-
-# /* TODO: xs_call_gate(). See Git.pm. */
-
-
-char *
-xs_version()
-CODE:
-{
-	RETVAL = GIT_VERSION;
-}
-OUTPUT:
-	RETVAL
-
-
-char *
-xs_exec_path()
-CODE:
-{
-	RETVAL = (char *)git_exec_path();
-}
-OUTPUT:
-	RETVAL
-
-
-void
-xs__execv_git_cmd(...)
-CODE:
-{
-	const char **argv;
-	int i;
-
-	argv = malloc(sizeof(const char *) * (items + 1));
-	if (!argv)
-		croak("malloc failed");
-	for (i = 0; i < items; i++)
-		argv[i] = strdup(SvPV_nolen(ST(i)));
-	argv[i] = NULL;
-
-	execv_git_cmd(argv);
-
-	for (i = 0; i < items; i++)
-		if (argv[i])
-			free((char *) argv[i]);
-	free((char **) argv);
-}
-
-char *
-xs_hash_object_pipe(type, fd)
-	char *type;
-	int fd;
-CODE:
-{
-	unsigned char sha1[20];
-
-	if (index_pipe(sha1, fd, type, 0))
-		croak("Unable to hash given filehandle");
-	RETVAL = sha1_to_hex(sha1);
-}
-OUTPUT:
-	RETVAL
-
-char *
-xs_hash_object_file(type, path)
-	char *type;
-	char *path;
-CODE:
-{
-	unsigned char sha1[20];
-	int fd = open(path, O_RDONLY);
-	struct stat st;
-
-	if (fd < 0 ||
-	    fstat(fd, &st) < 0 ||
-	    index_fd(sha1, fd, &st, 0, type))
-		croak("Unable to hash %s", path);
-	close(fd);
-
-	RETVAL = sha1_to_hex(sha1);
-}
-OUTPUT:
-	RETVAL
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
index ef9d82d..de73235 100644
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -3,12 +3,7 @@ use ExtUtils::MakeMaker;
 sub MY::postamble {
 	return <<'MAKE_FRAG';
 instlibdir:
-	@echo '$(INSTALLSITEARCH)'
-
-check:
-	perl -MDevel::PPPort -le 'Devel::PPPort::WriteFile(".ppport.h")' && \
-	perl .ppport.h --compat-version=5.6.0 Git.xs && \
-	rm .ppport.h
+	@echo '$(INSTALLSITELIB)'
 
 MAKE_FRAG
 }
@@ -29,7 +24,5 @@ WriteMakefile(
 	NAME            => 'Git',
 	VERSION_FROM    => 'Git.pm',
 	PM		=> \%pm,
-	MYEXTLIB        => '../libgit.a',
-	INC             => '-I. -I..',
 	%extra
 );

^ permalink raw reply related	[relevance 7%]

* [PATCH] Makefile: whitespace style fixes in macro definitions
@ 2012-12-09 10:36  7% Stefano Lattarini
  0 siblings, 0 replies; 200+ results
From: Stefano Lattarini @ 2012-12-09 10:36 UTC (permalink / raw)
  To: git; +Cc: gitster

Consistently use a single space before and after the "=" (or ":=", "+=",
etc.) in assignments to make macros.  Granted, this was not a big deal,
but I did find the needless inconsistency quite distracting.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
---
 Makefile      | 56 ++++++++++++++++++++++++++++----------------------------
 config.mak.in |  2 +-
 t/Makefile    |  2 +-
 3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/Makefile b/Makefile
index 4ad6fbd..736ecd4 100644
--- a/Makefile
+++ b/Makefile
@@ -374,7 +374,7 @@ htmldir = share/doc/git-doc
 ETC_GITCONFIG = $(sysconfdir)/gitconfig
 ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
 lib = lib
-# DESTDIR=
+# DESTDIR =
 pathsep = :
 
 export prefix bindir sharedir sysconfdir gitwebdir localedir
@@ -575,9 +575,9 @@ endif
 export PERL_PATH
 export PYTHON_PATH
 
-LIB_FILE=libgit.a
-XDIFF_LIB=xdiff/lib.a
-VCSSVN_LIB=vcs-svn/lib.a
+LIB_FILE = libgit.a
+XDIFF_LIB = xdiff/lib.a
+VCSSVN_LIB = vcs-svn/lib.a
 
 LIB_H += xdiff/xinclude.h
 LIB_H += xdiff/xmacros.h
@@ -1139,7 +1139,7 @@ ifeq ($(uname_S),NetBSD)
 endif
 ifeq ($(uname_S),AIX)
 	DEFAULT_PAGER = more
-	NO_STRCASESTR=YesPlease
+	NO_STRCASESTR = YesPlease
 	NO_MEMMEM = YesPlease
 	NO_MKDTEMP = YesPlease
 	NO_MKSTEMPS = YesPlease
@@ -1147,7 +1147,7 @@ ifeq ($(uname_S),AIX)
 	NO_NSEC = YesPlease
 	FREAD_READS_DIRECTORIES = UnfortunatelyYes
 	INTERNAL_QSORT = UnfortunatelyYes
-	NEEDS_LIBICONV=YesPlease
+	NEEDS_LIBICONV = YesPlease
 	BASIC_CFLAGS += -D_LARGE_FILES
 	ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
 		NO_PTHREADS = YesPlease
@@ -1155,13 +1155,13 @@ ifeq ($(uname_S),AIX)
 		PTHREAD_LIBS = -lpthread
 	endif
 	ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.1'),3)
-		INLINE=''
+		INLINE = ''
 	endif
 	GIT_TEST_CMP = cmp
 endif
 ifeq ($(uname_S),GNU)
 	# GNU/Hurd
-	NO_STRLCPY=YesPlease
+	NO_STRLCPY = YesPlease
 	NO_MKSTEMPS = YesPlease
 	HAVE_PATHS_H = YesPlease
 	LIBC_CONTAINS_LIBINTL = YesPlease
@@ -1187,9 +1187,9 @@ ifeq ($(uname_S),IRIX)
 	NEEDS_LIBGEN = YesPlease
 endif
 ifeq ($(uname_S),IRIX64)
-	NO_SETENV=YesPlease
+	NO_SETENV = YesPlease
 	NO_UNSETENV = YesPlease
-	NO_STRCASESTR=YesPlease
+	NO_STRCASESTR = YesPlease
 	NO_MEMMEM = YesPlease
 	NO_MKSTEMPS = YesPlease
 	NO_MKDTEMP = YesPlease
@@ -1203,14 +1203,14 @@ ifeq ($(uname_S),IRIX64)
 	NO_REGEX = YesPlease
 	NO_FNMATCH_CASEFOLD = YesPlease
 	SNPRINTF_RETURNS_BOGUS = YesPlease
-	SHELL_PATH=/usr/gnu/bin/bash
+	SHELL_PATH = /usr/gnu/bin/bash
 	NEEDS_LIBGEN = YesPlease
 endif
 ifeq ($(uname_S),HP-UX)
 	INLINE = __inline
-	NO_IPV6=YesPlease
-	NO_SETENV=YesPlease
-	NO_STRCASESTR=YesPlease
+	NO_IPV6 = YesPlease
+	NO_SETENV = YesPlease
+	NO_STRCASESTR = YesPlease
 	NO_MEMMEM = YesPlease
 	NO_MKSTEMPS = YesPlease
 	NO_STRLCPY = YesPlease
@@ -1386,10 +1386,10 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
 	MKDIR_WO_TRAILING_SLASH = YesPlease
 	# RFE 10-120912-4693 submitted to HP NonStop development.
 	NO_SETITIMER = UnfortunatelyYes
-	SANE_TOOL_PATH=/usr/coreutils/bin:/usr/local/bin
-	SHELL_PATH=/usr/local/bin/bash
+	SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
+	SHELL_PATH = /usr/local/bin/bash
 	# as of H06.25/J06.14, we might better use this
-	#SHELL_PATH=/usr/coreutils/bin/bash
+	#SHELL_PATH = /usr/coreutils/bin/bash
 endif
 ifneq (,$(findstring MINGW,$(uname_S)))
 	pathsep = ;
@@ -1437,7 +1437,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 	X = .exe
 	SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
 ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
-	htmldir=doc/git/html/
+	htmldir = doc/git/html/
 	prefix =
 	INSTALL = /bin/install
 	EXTLIBS += /mingw/lib/libz.a
@@ -1559,7 +1559,7 @@ else
 		CURL_LIBCURL = -lcurl
 	endif
 	ifdef NEEDS_SSL_WITH_CURL
-		CURL_LIBCURL +=	-lssl
+		CURL_LIBCURL += -lssl
 		ifdef NEEDS_CRYPTO_WITH_SSL
 			CURL_LIBCURL += -lcrypto
 		endif
@@ -1768,7 +1768,7 @@ ifdef OBJECT_CREATION_USES_RENAMES
 endif
 ifdef NO_STRUCT_ITIMERVAL
 	COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL
-	NO_SETITIMER=YesPlease
+	NO_SETITIMER = YesPlease
 endif
 ifdef NO_SETITIMER
 	COMPAT_CFLAGS += -DNO_SETITIMER
@@ -1920,15 +1920,15 @@ ifneq (,$(XDL_FAST_HASH))
 endif
 
 ifeq ($(TCLTK_PATH),)
-NO_TCLTK=NoThanks
+NO_TCLTK = NoThanks
 endif
 
 ifeq ($(PERL_PATH),)
-NO_PERL=NoThanks
+NO_PERL = NoThanks
 endif
 
 ifeq ($(PYTHON_PATH),)
-NO_PYTHON=NoThanks
+NO_PYTHON = NoThanks
 endif
 
 QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
@@ -1975,13 +1975,13 @@ PROFILE_DIR := $(CURDIR)
 ifeq ("$(PROFILE)","GEN")
 	CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
 	EXTLIBS += -lgcov
-	export CCACHE_DISABLE=t
-	V=1
+	export CCACHE_DISABLE = t
+	V = 1
 else
 ifneq ("$(PROFILE)","")
 	CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
-	export CCACHE_DISABLE=t
-	V=1
+	export CCACHE_DISABLE = t
+	V = 1
 endif
 endif
 
@@ -2830,7 +2830,7 @@ git.spec: git.spec.in GIT-VERSION-FILE
 	sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@+
 	mv $@+ $@
 
-GIT_TARNAME=git-$(GIT_VERSION)
+GIT_TARNAME = git-$(GIT_VERSION)
 dist: git.spec git-archive$(X) configure
 	./git-archive --format=tar \
 		--prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
diff --git a/config.mak.in b/config.mak.in
index 69d4838..e8a9bb4 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -18,7 +18,7 @@ datarootdir = @datarootdir@
 template_dir = @datadir@/git-core/templates
 sysconfdir = @sysconfdir@
 
-mandir=@mandir@
+mandir = @mandir@
 
 srcdir = @srcdir@
 VPATH = @srcdir@
diff --git a/t/Makefile b/t/Makefile
index 88e289f..3025418 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -6,7 +6,7 @@
 -include ../config.mak.autogen
 -include ../config.mak
 
-#GIT_TEST_OPTS=--verbose --debug
+#GIT_TEST_OPTS = --verbose --debug
 SHELL_PATH ?= $(SHELL)
 PERL_PATH ?= /usr/bin/perl
 TAR ?= $(TAR)
-- 
1.8.0.1.347.gf94c325

^ permalink raw reply related	[relevance 7%]

* [RFC PATCH 2/3] test: add basic unit testing framework
  @ 2023-05-02  4:11  8% ` Felipe Contreras
  2023-05-02  4:11  6% ` [RFC PATCH 1/3] test: add simple shared library Felipe Contreras
  1 sibling, 0 replies; 200+ results
From: Felipe Contreras @ 2023-05-02  4:11 UTC (permalink / raw)
  To: git; +Cc: Calvin Wan, Felipe Contreras

Testing full git commands is helpful, but so it is to test specific
functions, which is not easy to do from the shell, which is how the
current testing framework is implemented.

A much more modern way to test specific functions is to write a binding
for a modern language--like Ruby--and then use that binding on a modern
testing framework using the same language.

This makes the testing framework much simpler, and also has the
advantage that writing the Ruby bindings spots libification issues.

Moreover no forks are needed, and crashes are handled nicely due to
Ruby's exception handling.

This is the best of all worlds.

This step doesn't add any actual unit tests, simply prepares the
groundwork for writing them.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 t/Makefile       | 13 +++++++++
 t/ruby/git.c     |  7 +++++
 t/ruby/testox.rb | 68 ++++++++++++++++++++++++++++++++++++++++++++++++
 t/unit-test.t    | 10 +++++++
 4 files changed, 98 insertions(+)
 create mode 100644 t/ruby/git.c
 create mode 100644 t/ruby/testox.rb
 create mode 100644 t/unit-test.t

diff --git a/t/Makefile b/t/Makefile
index d85e3e661d..4fdad529ab 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -47,6 +47,9 @@ CHAINLINT = '$(PERL_PATH_SQ)' chainlint.pl
 # scripts not to run the external "chainlint.pl" script themselves
 CHAINLINTSUPPRESS = GIT_TEST_EXT_CHAIN_LINT=0 && export GIT_TEST_EXT_CHAIN_LINT &&
 
+RUBY_LIBS = $(shell pkg-config --libs ruby-3.0)
+RUBY_CFLAGS = $(shell pkg-config --cflags ruby-3.0)
+
 all: $(DEFAULT_TEST_TARGET)
 
 test: pre-clean check-chainlint $(TEST_LINT)
@@ -65,6 +68,13 @@ prove: pre-clean check-chainlint $(TEST_LINT)
 $(T):
 	@echo "*** $@ ***"; '$(TEST_SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
 
+ruby/git.o: ruby/git.c
+	$(QUIET_CC)$(COMPILE.c) -o $@ $<
+
+ruby/git.so: CFLAGS := -fPIC $(RUBY_CFLAGS) -Ilib/ $(CFLAGS)
+ruby/git.so: LIBS := $(RUBY_LIBS) -Llib/ -lgit $(LIBS)
+ruby/git.so: ruby/git.o | lib/libgit.so
+
 lib/git.o: lib/git.c
 	$(QUIET_CC)$(COMPILE.c) -o $@ $<
 
@@ -74,6 +84,9 @@ lib/libgit.so: lib/git.o
 %.so::
 	$(QUIET_LINK)$(CC) -shared -o $@ $^ $(LIBS)
 
+test-unit: ruby/git.so
+	@LD_LIBRARY_PATH=lib/ ruby -Iruby unit-test.t
+
 pre-clean:
 	$(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
 
diff --git a/t/ruby/git.c b/t/ruby/git.c
new file mode 100644
index 0000000000..e75692c582
--- /dev/null
+++ b/t/ruby/git.c
@@ -0,0 +1,7 @@
+#include <ruby.h>
+#include <git.h>
+
+void Init_git(void)
+{
+	VALUE mod = rb_define_module("Git");
+}
diff --git a/t/ruby/testox.rb b/t/ruby/testox.rb
new file mode 100644
index 0000000000..1cc58a3ab3
--- /dev/null
+++ b/t/ruby/testox.rb
@@ -0,0 +1,68 @@
+# Copyright (c) 2023 Felipe Contreras
+
+require 'singleton'
+
+class TestOxException < StandardError
+  attr_reader :actual, :expected
+
+  def initialize(actual, expected)
+    @actual, @expected = actual, expected
+  end
+end
+
+class TestOx
+  include Singleton
+
+  @tests = []
+
+  class << self
+
+    def add(desc, &block)
+      @tests << [ desc, block ]
+    end
+
+    def run
+      success = true
+
+      puts '1..%d' % @tests.length
+
+      @tests.each_with_index do |(desc, block),i|
+        begin
+          instance.instance_exec(&block)
+          puts 'ok %d - %s' % [i + 1, desc]
+        rescue => e
+          success = false
+          puts 'not ok %d - %s' % [i + 1, desc]
+          if e.is_a?(TestOxException)
+            puts '# -%s' % e.expected
+            puts '# +%s' % e.actual
+          else
+            puts '# exception: %s' % e
+          end
+        end
+      end
+
+      return success
+    end
+
+  end
+
+  def assert(string)
+    raise string
+  end
+
+  def ok(bool)
+    raise TestOxException.new(bool.inspect, true) unless bool
+  end
+
+  def is(actual, expected)
+    raise TestOxException.new(actual, expected) unless actual == expected
+  end
+
+end
+
+def test(*args, &block)
+  TestOx.add(*args, &block)
+end
+
+at_exit { exit TestOx.run }
diff --git a/t/unit-test.t b/t/unit-test.t
new file mode 100644
index 0000000000..97d8a14ec3
--- /dev/null
+++ b/t/unit-test.t
@@ -0,0 +1,10 @@
+#!/bin/env ruby
+
+require 'testox'
+require 'git'
+
+test 'basic' do
+  ok(true)
+end
+
+# vim: ft=ruby
-- 
2.40.0+fc1


^ permalink raw reply related	[relevance 8%]

* Re: How to properly find git config in a libgit.a-using executable?
  2019-03-22 14:19  8%     ` Mike Hommey
@ 2019-03-25 14:37  8%       ` Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2019-03-25 14:37 UTC (permalink / raw)
  To: Mike Hommey; +Cc: Jeff King, git

Hi Mike,

On Fri, 22 Mar 2019, Mike Hommey wrote:

> On Fri, Mar 22, 2019 at 02:39:43PM +0100, Johannes Schindelin wrote:
> > Hi Peff & Mike,
> >
> > On Fri, 22 Mar 2019, Jeff King wrote:
> >
> > > On Wed, Mar 20, 2019 at 07:19:41PM +0900, Mike Hommey wrote:
> > >
> > > > I thought of a few options (it's worth noting the helper is invoked in a
> > > > way that makes $GIT_EXEC_PATH set, which can help a little):
> > > > - spawn `$GIT_EXEC_PATH/git-config -l -z`, parse its output, and set the
> > > >   internal config from that. That's the barbarian option.
> > > > - build the helper with RUNTIME_PREFIX, and modify the RUNTIME_PREFIX
> > > >   code to use $GIT_EXEC_PATH if it's set, rather than the path the
> > > >   executable is in. That actually sounds reasonable enough that I'd send
> > > >   a patch for git itself. But that doesn't quite address the nitpick case
> > > >   where ETC_GITCONFIG could be either `/etc/gitconfig` or
> > > >   `etc/gitconfig` depending how git was compiled, and there's no way to
> > > >   know which is the right one.
> > >
> > > I'm not entirely sure I understand the problem, but it sounds like you
> > > want to know the baked-in ETC_GITCONFIG for a built version of git (that
> > > isn't necessarily the one that shares your build of libgit.a).
> > >
> > > There's no direct way to have Git print that out. It would be reasonable
> > > to add one to rev-parse, I think.
> > >
> > > Barring that, here's a hack:
> > >
> > >   git config --system --show-origin --list -z |
> > >   perl -lne '/^file:(.*?)\0/ and print $1 and exit 0'
> > >
> > > If the file is empty, it won't print anything, of course. But then,
> > > you'd know that it also has no config in it. :)
> >
> > How about
> >
> > 	GIT_EDITOR=echo git config --system -e 2>/dev/null
> >
> > It will error out if the directory does not exist, for some reason, e.g.
> > when you installed Git in your home directory via `make install` from a
> > fresh clone. So you'll have to cope with that contingency.
>
> Thank you both, I can probably work with this, although I might have to
> alter the git init sequence.

If you spawn this, you should not need to alter any Git init sequence.

Also, I failed to mention that the error message when the directory does
not exist is quite helpful, too: it mentions the path to that directory.

Oh, and I forgot one really crucial thing: you want to set `LANG=C`, too,
to make the output parseable.

> I'm not sure my usecase needs git to cater for it more generally,
> though.

I guess the idea of Git is that the command-line interface is "the API".
With that idea, you should indeed not have to know the exact location of
the system config, as you can simply consume the output of `git config -l
-z`.

However, given all those really impressive performance wins we get out of
all those conversions from shell/Perl to C, I am inclined to agree with
you: any remotely serious application that uses Git either has to access
libgit.a directly (even if that is discouraged), or has to have
non-trivial code inside Git to support their use cases (all those
`for-each-ref` pattern enhancements we had to introduce, for example, to
make it remotely feasible for a 3rd-party application to work with the
amounts of branches we sometimes have to deal with, for example).

> Who else uses libgit.a?

I only know of cgit, the fast alternative to gitweb.

Ciao,
Dscho

^ permalink raw reply	[relevance 8%]

* [PATCH v2 5/6] move run_commit_hook() to libgit and use it there
  @ 2019-10-15 10:25  8%   ` Phillip Wood via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Phillip Wood via GitGitGadget @ 2019-10-15 10:25 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Junio C Hamano, Phillip Wood

From: Phillip Wood <phillip.wood@dunelm.org.uk>

This function was declared in commit.h but was implemented in
builtin/commit.c so was not part of libgit. Move it to libgit so we can
use it in the sequencer. This simplifies the implementation of
run_prepare_commit_msg_hook() and will be used in the next commit.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
---
 builtin/commit.c | 22 ----------------------
 commit.c         | 24 ++++++++++++++++++++++++
 sequencer.c      | 23 ++++++++++-------------
 3 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 1921401117..d898a57f5d 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1443,28 +1443,6 @@ static int git_commit_config(const char *k, const char *v, void *cb)
 	return git_status_config(k, v, s);
 }
 
-int run_commit_hook(int editor_is_used, const char *index_file, const char *name, ...)
-{
-	struct argv_array hook_env = ARGV_ARRAY_INIT;
-	va_list args;
-	int ret;
-
-	argv_array_pushf(&hook_env, "GIT_INDEX_FILE=%s", index_file);
-
-	/*
-	 * Let the hook know that no editor will be launched.
-	 */
-	if (!editor_is_used)
-		argv_array_push(&hook_env, "GIT_EDITOR=:");
-
-	va_start(args, name);
-	ret = run_hook_ve(hook_env.argv,name, args);
-	va_end(args);
-	argv_array_clear(&hook_env);
-
-	return ret;
-}
-
 int cmd_commit(int argc, const char **argv, const char *prefix)
 {
 	const char *argv_gc_auto[] = {"gc", "--auto", NULL};
diff --git a/commit.c b/commit.c
index 26ce0770f6..7ca8d12174 100644
--- a/commit.c
+++ b/commit.c
@@ -19,6 +19,7 @@
 #include "advice.h"
 #include "refs.h"
 #include "commit-reach.h"
+#include "run-command.h"
 
 static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
 
@@ -1581,3 +1582,26 @@ size_t ignore_non_trailer(const char *buf, size_t len)
 	}
 	return boc ? len - boc : len - cutoff;
 }
+
+int run_commit_hook(int editor_is_used, const char *index_file,
+		    const char *name, ...)
+{
+	struct argv_array hook_env = ARGV_ARRAY_INIT;
+	va_list args;
+	int ret;
+
+	argv_array_pushf(&hook_env, "GIT_INDEX_FILE=%s", index_file);
+
+	/*
+	 * Let the hook know that no editor will be launched.
+	 */
+	if (!editor_is_used)
+		argv_array_push(&hook_env, "GIT_EDITOR=:");
+
+	va_start(args, name);
+	ret = run_hook_ve(hook_env.argv,name, args);
+	va_end(args);
+	argv_array_clear(&hook_env);
+
+	return ret;
+}
diff --git a/sequencer.c b/sequencer.c
index 2adcf5a639..cdc0d1dfba 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1127,25 +1127,22 @@ static int run_prepare_commit_msg_hook(struct repository *r,
 				       struct strbuf *msg,
 				       const char *commit)
 {
-	struct argv_array hook_env = ARGV_ARRAY_INIT;
-	int ret;
-	const char *name;
+	int ret = 0;
+	const char *name, *arg1 = NULL, *arg2 = NULL;
 
 	name = git_path_commit_editmsg();
 	if (write_message(msg->buf, msg->len, name, 0))
 		return -1;
 
-	argv_array_pushf(&hook_env, "GIT_INDEX_FILE=%s", r->index_file);
-	argv_array_push(&hook_env, "GIT_EDITOR=:");
-	if (commit)
-		ret = run_hook_le(hook_env.argv, "prepare-commit-msg", name,
-				  "commit", commit, NULL);
-	else
-		ret = run_hook_le(hook_env.argv, "prepare-commit-msg", name,
-				  "message", NULL);
-	if (ret)
+	if (commit) {
+		arg1 = "commit";
+		arg2 = commit;
+	} else {
+		arg1 = "message";
+	}
+	if (run_commit_hook(0, r->index_file, "prepare-commit-msg", name,
+			    arg1, arg2, NULL))
 		ret = error(_("'prepare-commit-msg' hook failed"));
-	argv_array_clear(&hook_env);
 
 	return ret;
 }
-- 
gitgitgadget


^ permalink raw reply related	[relevance 8%]

* [PATCH v2 17/23] contrib/buildsystems: add a backend for modern Visual Studio versions
  @ 2019-07-29 20:08  8%   ` Johannes Schindelin via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2019-07-29 20:08 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

Based on the previous patches in this patch series that fixed the
generator for `.vcproj` files (which were used by Visual Studio prior to
2015 to define projects), this patch offers to generate project
definitions for neweer versions of Visual Studio (which use `.vcxproj`
files).

To that end, this patch copy-edits the generator of the `.vcproj`.

In addition, we now use the `vcpkg` system which allows us to build
Git's dependencies (e.g. curl, libexpat) conveniently. The support
scripts were introduced in the `jh/msvc` patch series, and with this
patch we initialize the `vcpkg` conditionally, in the `libgit` project's
`PreBuildEvent`. To allow for parallel building of the projects, we
therefore put `libgit` at the bottom of the project hierarchy.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 contrib/buildsystems/Generators/Vcxproj.pm | 385 +++++++++++++++++++++
 1 file changed, 385 insertions(+)
 create mode 100644 contrib/buildsystems/Generators/Vcxproj.pm

diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
new file mode 100644
index 0000000000..e65d78e16d
--- /dev/null
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -0,0 +1,385 @@
+package Generators::Vcxproj;
+require Exporter;
+
+use strict;
+use vars qw($VERSION);
+use Digest::SHA qw(sha256_hex);
+
+our $VERSION = '1.00';
+our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);
+@ISA = qw(Exporter);
+
+BEGIN {
+    push @EXPORT_OK, qw(generate);
+}
+
+sub generate_guid ($) {
+	my $hex = sha256_hex($_[0]);
+	$hex =~ s/^(.{8})(.{4})(.{4})(.{4})(.{12}).*/{$1-$2-$3-$4-$5}/;
+	$hex =~ tr/a-z/A-Z/;
+	return $hex;
+}
+
+sub generate {
+    my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
+    my @libs = @{$build_structure{"LIBS"}};
+    foreach (@libs) {
+        createProject($_, $git_dir, $out_dir, $rel_dir, \%build_structure, 1);
+    }
+
+    my @apps = @{$build_structure{"APPS"}};
+    foreach (@apps) {
+        createProject($_, $git_dir, $out_dir, $rel_dir, \%build_structure, 0);
+    }
+
+    createGlueProject($git_dir, $out_dir, $rel_dir, %build_structure);
+    return 0;
+}
+
+sub createProject {
+    my ($name, $git_dir, $out_dir, $rel_dir, $build_structure, $static_library) = @_;
+    my $label = $static_library ? "lib" : "app";
+    my $prefix = $static_library ? "LIBS_" : "APPS_";
+    my $config_type = $static_library ? "StaticLibrary" : "Application";
+    print "Generate $name vcxproj $label project\n";
+    my $cdup = $name;
+    $cdup =~ s/[^\/]+/../g;
+    $cdup =~ s/\//\\/g;
+    $rel_dir = $rel_dir eq "." ? $cdup : "$cdup\\$rel_dir";
+    $rel_dir =~ s/\//\\/g;
+
+    my $target = $name;
+    if ($static_library) {
+      $target =~ s/\.a//;
+    } else {
+      $target =~ s/\.exe//;
+    }
+
+    my $uuid = generate_guid($name);
+    $$build_structure{"$prefix${target}_GUID"} = $uuid;
+    my $vcxproj = $target;
+    $vcxproj =~ s/(.*\/)?(.*)/$&\/$2.vcxproj/;
+    $vcxproj =~ s/([^\/]*)(\/lib)\/(lib.vcxproj)/$1$2\/$1_$3/;
+    $$build_structure{"$prefix${target}_VCXPROJ"} = $vcxproj;
+
+    my @srcs = sort(map("$rel_dir\\$_", @{$$build_structure{"$prefix${name}_SOURCES"}}));
+    my @sources;
+    foreach (@srcs) {
+        $_ =~ s/\//\\/g;
+        push(@sources, $_);
+    }
+    my $defines = join(";", sort(@{$$build_structure{"$prefix${name}_DEFINES"}}));
+    my $includes= join(";", sort(map { s/^-I//; s/\//\\/g; File::Spec->file_name_is_absolute($_) ? $_ : "$rel_dir\\$_" } @{$$build_structure{"$prefix${name}_INCLUDES"}}));
+    my $cflags = join(" ", sort(map { s/^-[GLMOWZ].*//; s/.* .*/"$&"/; $_; } @{$$build_structure{"$prefix${name}_CFLAGS"}}));
+    $cflags =~ s/</&lt;/g;
+    $cflags =~ s/>/&gt;/g;
+
+    my $libs_release = "\n    ";
+    my $libs_debug = "\n    ";
+    if (!$static_library) {
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_debug = $libs_release;
+      $libs_debug =~ s/zlib\.lib/zlibd\.lib/;
+    }
+
+    $defines =~ s/-D//g;
+    $defines =~ s/</&lt;/g;
+    $defines =~ s/>/&gt;/g;
+    $defines =~ s/\'//g;
+
+    die "Could not create the directory $target for $label project!\n" unless (-d "$target" || mkdir "$target");
+
+    open F, ">$vcxproj" or die "Could not open $vcxproj for writing!\n";
+    binmode F, ":crlf :utf8";
+    print F chr(0xFEFF);
+    print F << "EOM";
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>$uuid</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <VCPKGArch Condition="'\$(Platform)'=='Win32'">x86-windows</VCPKGArch>
+    <VCPKGArch Condition="'\$(Platform)'!='Win32'">x64-windows</VCPKGArch>
+    <VCPKGArchDirectory>$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)</VCPKGArchDirectory>
+    <VCPKGBinDirectory Condition="'\(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\bin</VCPKGBinDirectory>
+    <VCPKGLibDirectory Condition="'\(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\lib</VCPKGLibDirectory>
+    <VCPKGBinDirectory Condition="'\(Configuration)'!='Debug'">\$(VCPKGArchDirectory)\\bin</VCPKGBinDirectory>
+    <VCPKGLibDirectory Condition="'\(Configuration)'!='Debug'">\$(VCPKGArchDirectory)\\lib</VCPKGLibDirectory>
+    <VCPKGIncludeDirectory>\$(VCPKGArchDirectory)\\include</VCPKGIncludeDirectory>
+    <VCPKGLibs Condition="'\(Configuration)'=='Debug'">$libs_debug</VCPKGLibs>
+    <VCPKGLibs Condition="'\(Configuration)'!='Debug'">$libs_release</VCPKGLibs>
+  </PropertyGroup>
+  <Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'\$(Configuration)'=='Debug'" Label="Configuration">
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'\$(Configuration)'=='Release'" Label="Configuration">
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup>
+    <ConfigurationType>$config_type</ConfigurationType>
+    <PlatformToolset>v140</PlatformToolset>
+    <!-- <CharacterSet>UTF-8</CharacterSet> -->
+    <OutDir>..\\</OutDir>
+    <!-- <IntDir>\$(ProjectDir)\$(Configuration)\\</IntDir> -->
+  </PropertyGroup>
+  <Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets">
+    <Import Project="\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props" Condition="exists('\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <GenerateManifest>false</GenerateManifest>
+    <EnableManagedIncrementalBuild>true</EnableManagedIncrementalBuild>
+  </PropertyGroup>
+  <ItemDefinitionGroup>
+    <ClCompile>
+      <AdditionalOptions>$cflags %(AdditionalOptions)</AdditionalOptions>
+      <AdditionalIncludeDirectories>$cdup;$cdup\\compat;$cdup\\compat\\regex;$cdup\\compat\\win32;$cdup\\compat\\poll;$cdup\\compat\\vcbuild\\include;\$(VCPKGIncludeDirectory);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <EnableParallelCodeGeneration />
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <PrecompiledHeader />
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Lib>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+    </Lib>
+    <Link>
+      <AdditionalLibraryDirectories>\$(VCPKGLibDirectory);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>\$(VCPKGLibs);\$(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalOptions>invalidcontinue.obj %(AdditionalOptions)</AdditionalOptions>
+      <EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
+      <ManifestFile>$cdup\\compat\\win32\\git.manifest</ManifestFile>
+      <SubSystem>Console</SubSystem>
+    </Link>
+EOM
+    if ($target eq 'libgit') {
+        print F << "EOM";
+    <PreBuildEvent Condition="!Exists('$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)\\include\\openssl\\ssl.h')">
+      <Message>Initialize VCPKG</Message>
+      <Command>del "$cdup\\compat\\vcbuild\\vcpkg"</Command>
+      <Command>call "$cdup\\compat\\vcbuild\\vcpkg_install.bat"</Command>
+    </PreBuildEvent>
+EOM
+    }
+    print F << "EOM";
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'\$(Platform)'=='Win32'">
+    <Link>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'\$(Configuration)'=='Debug'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;$defines;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'\$(Configuration)'=='Release'">
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;$defines;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+EOM
+    foreach(@sources) {
+        print F << "EOM";
+    <ClCompile Include="$_" />
+EOM
+    }
+    print F << "EOM";
+  </ItemGroup>
+EOM
+    if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
+      my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
+
+      print F << "EOM";
+  <ItemGroup>
+    <ProjectReference Include="$cdup\\libgit\\libgit.vcxproj">
+      <Project>$uuid_libgit</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      if (!($name =~ 'xdiff')) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
+      <Project>$uuid_xdiff_lib</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
+      if ($name =~ /(test-(line-buffer|svn-fe)|^git-remote-testsvn)\.exe$/) {
+        my $uuid_vcs_svn_lib = $$build_structure{"LIBS_vcs-svn/lib_GUID"};
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\vcs-svn\\lib\\vcs-svn_lib.vcxproj">
+      <Project>$uuid_vcs_svn_lib</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
+      print F << "EOM";
+  </ItemGroup>
+EOM
+    }
+    print F << "EOM";
+  <Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.targets" />
+EOM
+    if (!$static_library) {
+      print F << "EOM";
+  <Target Name="${target}_AfterBuild" AfterTargets="AfterBuild">
+    <ItemGroup>
+      <DLLsAndPDBs Include="\$(VCPKGBinDirectory)\\*.dll;\$(VCPKGBinDirectory)\\*.pdb" />
+    </ItemGroup>
+    <Copy SourceFiles="@(DLLsAndPDBs)" DestinationFolder="\$(OutDir)" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />
+    <MakeDir Directories="..\\templates\\blt\\branches" />
+  </Target>
+EOM
+    }
+    print F << "EOM";
+</Project>
+EOM
+    close F;
+}
+
+sub createGlueProject {
+    my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
+    print "Generate solutions file\n";
+    $rel_dir = "..\\$rel_dir";
+    $rel_dir =~ s/\//\\/g;
+    my $SLN_HEAD = "Microsoft Visual Studio Solution File, Format Version 11.00\n# Visual Studio 2010\n";
+    my $SLN_PRE  = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = ";
+    my $SLN_POST = "\nEndProject\n";
+
+    my @libs = @{$build_structure{"LIBS"}};
+    my @tmp;
+    foreach (@libs) {
+        $_ =~ s/\.a//;
+        push(@tmp, $_);
+    }
+    @libs = @tmp;
+
+    my @apps = @{$build_structure{"APPS"}};
+    @tmp = ();
+    foreach (@apps) {
+        $_ =~ s/\.exe//;
+        if ($_ eq "git" ) {
+            unshift(@tmp, $_);
+        } else {
+            push(@tmp, $_);
+        }
+    }
+    @apps = @tmp;
+
+    open F, ">git.sln" || die "Could not open git.sln for writing!\n";
+    binmode F, ":crlf :utf8";
+    print F chr(0xFEFF);
+    print F "$SLN_HEAD";
+
+    foreach (@apps) {
+        my $appname = $_;
+        my $uuid = $build_structure{"APPS_${appname}_GUID"};
+        print F "$SLN_PRE";
+	my $vcxproj = $build_structure{"APPS_${appname}_VCXPROJ"};
+	$vcxproj =~ s/\//\\/g;
+        $appname =~ s/.*\///;
+        print F "\"${appname}\", \"${vcxproj}\", \"${uuid}\"";
+        print F "$SLN_POST";
+    }
+    foreach (@libs) {
+        my $libname = $_;
+        my $uuid = $build_structure{"LIBS_${libname}_GUID"};
+        print F "$SLN_PRE";
+        my $vcxproj = $build_structure{"LIBS_${libname}_VCXPROJ"};
+	$vcxproj =~ s/\//\\/g;
+        $libname =~ s/\//_/g;
+        print F "\"${libname}\", \"${vcxproj}\", \"${uuid}\"";
+        print F "$SLN_POST";
+    }
+
+    print F << "EOM";
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+EOM
+    print F << "EOM";
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+EOM
+    foreach (@apps) {
+        my $appname = $_;
+        my $uuid = $build_structure{"APPS_${appname}_GUID"};
+        print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
+        print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
+        print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
+        print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
+        print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
+        print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
+        print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
+        print F "\t\t${uuid}.Release|x86.Build.0 = Release|Win32\n";
+    }
+    foreach (@libs) {
+        my $libname = $_;
+        my $uuid = $build_structure{"LIBS_${libname}_GUID"};
+        print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
+        print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
+        print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
+        print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
+        print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
+        print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
+        print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
+        print F "\t\t${uuid}.Release|x86.Build.0 = Release|Win32\n";
+    }
+
+    print F << "EOM";
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
+EOM
+    close F;
+}
+
+1;
-- 
gitgitgadget


^ permalink raw reply related	[relevance 8%]

* Re: linking libgit.a in C++ projects
  @ 2008-07-31 12:34  8%     ` Dmitry Potapov
  0 siblings, 0 replies; 200+ results
From: Dmitry Potapov @ 2008-07-31 12:34 UTC (permalink / raw)
  To: Petr Baudis; +Cc: cte, git

On Thu, Jul 31, 2008 at 01:14:46PM +0200, Petr Baudis wrote:
> 
> I don't think this is that big a problem; there are applications that
> are doing this already, e.g. cgit, and if you tie your application to
> a particular git version by for example making git a submodule of your
> source, this is pretty safe; it will just mean that you will have to
> do some non-trivial porting of your code to the new interface each time
> you update - but I think large changes in the interface are pretty rare
> in practice by now, and there shouldn't be much on the horizon either(?).

What you see as large changes depend on how well you know git internals.
Git develops very quickly and if someone who is trying to use libgit.a
does not follow git development closely, it may happen pretty soon that
even not so big changes will become a huge problem to accomadate them.
As result, the program may stick with an old Git version, and that puts
users of this program in the situation where they cannot use their
favorite frontend with new repositories.

> What would be the reason to disallow C++ users? The costs aren't that
> high, and (modulo, say, extern "C" { }) there should be no C-C++
> compatibility issues, right?

I mean that putting  extern "C" { } around should be sufficient to use
this library in C++. But I see now some current headers contains some
C++ keywords and that causes the problem. So, yes, those headers should
be corrected if they become part of external available API. I am not
sure whether it makes sense to correct them now, but there are only
three places where C++ keywords are used:

diff.h:135:extern int diff_tree_sha1(const unsigned char *old, const
diff.h:137:extern int diff_root_tree_sha1(const unsigned char *new,
object.h:38:extern const char *typename(unsigned int type);

So, the patch should not be large, and it is up to Junio to decide
what to do about it.

Dmitry

^ permalink raw reply	[relevance 8%]

* [PATCH 17/24] contrib/buildsystems: add a backend for modern Visual Studio versions
  @ 2019-07-18 13:19  8% ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2019-07-18 13:19 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

Based on the previous patches in this patch series that fixed the
generator for `.vcproj` files (which were used by Visual Studio prior to
2015 to define projects), this patch offers to generate project
definitions for neweer versions of Visual Studio (which use `.vcxproj`
files).

To that end, this patch copy-edits the generator of the `.vcproj`.

In addition, we now use the `vcpkg` system which allows us to build
Git's dependencies (e.g. curl, libexpat) conveniently. The support
scripts were introduced in the `jh/msvc` patch series, and with this
patch we initialize the `vcpkg` conditionally, in the `libgit` project's
`PreBuildEvent`. To allow for parallel building of the projects, we
therefore put `libgit` at the bottom of the project hierarchy.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 contrib/buildsystems/Generators/Vcxproj.pm | 384 +++++++++++++++++++++
 1 file changed, 384 insertions(+)
 create mode 100644 contrib/buildsystems/Generators/Vcxproj.pm

diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
new file mode 100644
index 0000000000..9e7ed24912
--- /dev/null
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -0,0 +1,384 @@
+package Generators::Vcxproj;
+require Exporter;
+
+use strict;
+use vars qw($VERSION);
+use Digest::SHA qw(sha256_hex);
+
+our $VERSION = '1.00';
+our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);
+@ISA = qw(Exporter);
+
+BEGIN {
+    push @EXPORT_OK, qw(generate);
+}
+
+sub generate_guid ($) {
+	my $hex = sha256_hex($_[0]);
+	$hex =~ s/^(.{8})(.{4})(.{4})(.{4})(.{12}).*/{$1-$2-$3-$4-$5}/;
+	$hex =~ tr/a-z/A-Z/;
+	return $hex;
+}
+
+sub generate {
+    my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
+    my @libs = @{$build_structure{"LIBS"}};
+    foreach (@libs) {
+        createProject($_, $git_dir, $out_dir, $rel_dir, \%build_structure, 1);
+    }
+
+    my @apps = @{$build_structure{"APPS"}};
+    foreach (@apps) {
+        createProject($_, $git_dir, $out_dir, $rel_dir, \%build_structure, 0);
+    }
+
+    createGlueProject($git_dir, $out_dir, $rel_dir, %build_structure);
+    return 0;
+}
+
+sub createProject {
+    my ($name, $git_dir, $out_dir, $rel_dir, $build_structure, $static_library) = @_;
+    my $label = $static_library ? "lib" : "app";
+    my $prefix = $static_library ? "LIBS_" : "APPS_";
+    my $config_type = $static_library ? "StaticLibrary" : "Application";
+    print "Generate $name vcxproj $label project\n";
+    my $cdup = $name;
+    $cdup =~ s/[^\/]+/../g;
+    $cdup =~ s/\//\\/g;
+    $rel_dir = $rel_dir eq "." ? $cdup : "$cdup\\$rel_dir";
+    $rel_dir =~ s/\//\\/g;
+
+    my $target = $name;
+    if ($static_library) {
+      $target =~ s/\.a//;
+    } else {
+      $target =~ s/\.exe//;
+    }
+
+    my $uuid = generate_guid($name);
+    $$build_structure{"$prefix${target}_GUID"} = $uuid;
+    my $vcxproj = $target;
+    $vcxproj =~ s/(.*\/)?(.*)/$&\/$2.vcxproj/;
+    $vcxproj =~ s/([^\/]*)(\/lib)\/(lib.vcxproj)/$1$2\/$1_$3/;
+    $$build_structure{"$prefix${target}_VCXPROJ"} = $vcxproj;
+
+    my @srcs = sort(map("$rel_dir\\$_", @{$$build_structure{"$prefix${name}_SOURCES"}}));
+    my @sources;
+    foreach (@srcs) {
+        $_ =~ s/\//\\/g;
+        push(@sources, $_);
+    }
+    my $defines = join(";", sort(@{$$build_structure{"$prefix${name}_DEFINES"}}));
+    my $includes= join(";", sort(map { s/^-I//; s/\//\\/g; File::Spec->file_name_is_absolute($_) ? $_ : "$rel_dir\\$_" } @{$$build_structure{"$prefix${name}_INCLUDES"}}));
+    my $cflags = join(" ", sort(map { s/^-[GLMOWZ].*//; s/.* .*/"$&"/; $_; } @{$$build_structure{"$prefix${name}_CFLAGS"}}));
+    $cflags =~ s/</&lt;/g;
+    $cflags =~ s/>/&gt;/g;
+
+    my $libs_release = "\n    ";
+    my $libs_debug = "\n    ";
+    if (!$static_library) {
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_debug = $libs_release;
+      $libs_debug =~ s/zlib\.lib/zlibd\.lib/;
+    }
+
+    $defines =~ s/-D//g;
+    $defines =~ s/</&lt;/g;
+    $defines =~ s/>/&gt;/g;
+    $defines =~ s/\'//g;
+
+    die "Could not create the directory $target for $label project!\n" unless (-d "$target" || mkdir "$target");
+
+    open F, ">$vcxproj" or die "Could not open $vcxproj for writing!\n";
+    binmode F, ":crlf :utf8";
+    print F chr(0xFEFF);
+    print F << "EOM";
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>$uuid</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <VCPKGArch Condition="'\$(Platform)'=='Win32'">x86-windows</VCPKGArch>
+    <VCPKGArch Condition="'\$(Platform)'!='Win32'">x64-windows</VCPKGArch>
+    <VCPKGArchDirectory>$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)</VCPKGArchDirectory>
+    <VCPKGBinDirectory Condition="'\(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\bin</VCPKGBinDirectory>
+    <VCPKGLibDirectory Condition="'\(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\lib</VCPKGLibDirectory>
+    <VCPKGBinDirectory Condition="'\(Configuration)'!='Debug'">\$(VCPKGArchDirectory)\\bin</VCPKGBinDirectory>
+    <VCPKGLibDirectory Condition="'\(Configuration)'!='Debug'">\$(VCPKGArchDirectory)\\lib</VCPKGLibDirectory>
+    <VCPKGIncludeDirectory>\$(VCPKGArchDirectory)\\include</VCPKGIncludeDirectory>
+    <VCPKGLibs Condition="'\(Configuration)'=='Debug'">$libs_debug</VCPKGLibs>
+    <VCPKGLibs Condition="'\(Configuration)'!='Debug'">$libs_release</VCPKGLibs>
+  </PropertyGroup>
+  <Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'\$(Configuration)'=='Debug'" Label="Configuration">
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'\$(Configuration)'=='Release'" Label="Configuration">
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup>
+    <ConfigurationType>$config_type</ConfigurationType>
+    <PlatformToolset>v140</PlatformToolset>
+    <!-- <CharacterSet>UTF-8</CharacterSet> -->
+    <OutDir>..\\</OutDir>
+    <!-- <IntDir>\$(ProjectDir)\$(Configuration)\\</IntDir> -->
+  </PropertyGroup>
+  <Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets">
+    <Import Project="\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props" Condition="exists('\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <GenerateManifest>false</GenerateManifest>
+    <EnableManagedIncrementalBuild>true</EnableManagedIncrementalBuild>
+  </PropertyGroup>
+  <ItemDefinitionGroup>
+    <ClCompile>
+      <AdditionalOptions>$cflags %(AdditionalOptions)</AdditionalOptions>
+      <AdditionalIncludeDirectories>$cdup;$cdup\\compat;$cdup\\compat\\regex;$cdup\\compat\\win32;$cdup\\compat\\poll;$cdup\\compat\\vcbuild\\include;\$(VCPKGIncludeDirectory);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <EnableParallelCodeGeneration />
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <PrecompiledHeader />
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Lib>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+    </Lib>
+    <Link>
+      <AdditionalLibraryDirectories>\$(VCPKGLibDirectory);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>\$(VCPKGLibs);\$(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalOptions>invalidcontinue.obj %(AdditionalOptions)</AdditionalOptions>
+      <EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
+      <ManifestFile>$cdup\\compat\\win32\\git.manifest</ManifestFile>
+      <SubSystem>Console</SubSystem>
+    </Link>
+EOM
+    if ($target eq 'libgit') {
+        print F << "EOM";
+    <PreBuildEvent Condition="!Exists('$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)\\include\\openssl\\ssl.h')">
+      <Message>Initialize VCPKG</Message>
+      <Command>del "$cdup\\compat\\vcbuild\\vcpkg"</Command>
+      <Command>call "$cdup\\compat\\vcbuild\\vcpkg_install.bat"</Command>
+    </PreBuildEvent>
+EOM
+    }
+    print F << "EOM";
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'\$(Platform)'=='Win32'">
+    <Link>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'\$(Configuration)'=='Debug'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;$defines;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'\$(Configuration)'=='Release'">
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;$defines;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+EOM
+    foreach(@sources) {
+        print F << "EOM";
+    <ClCompile Include="$_" />
+EOM
+    }
+    print F << "EOM";
+  </ItemGroup>
+EOM
+    if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
+      my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
+
+      print F << "EOM";
+  <ItemGroup>
+    <ProjectReference Include="$cdup\\libgit\\libgit.vcxproj">
+      <Project>$uuid_libgit</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      if (!($name =~ 'xdiff')) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
+      <Project>$uuid_xdiff_lib</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
+      if ($name =~ /(test-(line-buffer|svn-fe)|^git-remote-testsvn)\.exe$/) {
+        my $uuid_vcs_svn_lib = $$build_structure{"LIBS_vcs-svn/lib_GUID"};
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\vcs-svn\\lib\\vcs-svn_lib.vcxproj">
+      <Project>$uuid_vcs_svn_lib</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
+      print F << "EOM";
+  </ItemGroup>
+EOM
+    }
+    print F << "EOM";
+  <Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.targets" />
+EOM
+    if (!$static_library) {
+      print F << "EOM";
+  <Target Name="${target}_AfterBuild" AfterTargets="AfterBuild">
+    <ItemGroup>
+      <DLLsAndPDBs Include="\$(VCPKGBinDirectory)\\*.dll;\$(VCPKGBinDirectory)\\*.pdb" />
+    </ItemGroup>
+    <Copy SourceFiles="@(DLLsAndPDBs)" DestinationFolder="\$(OutDir)" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />
+  </Target>
+EOM
+    }
+    print F << "EOM";
+</Project>
+EOM
+    close F;
+}
+
+sub createGlueProject {
+    my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
+    print "Generate solutions file\n";
+    $rel_dir = "..\\$rel_dir";
+    $rel_dir =~ s/\//\\/g;
+    my $SLN_HEAD = "Microsoft Visual Studio Solution File, Format Version 11.00\n# Visual Studio 2010\n";
+    my $SLN_PRE  = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = ";
+    my $SLN_POST = "\nEndProject\n";
+
+    my @libs = @{$build_structure{"LIBS"}};
+    my @tmp;
+    foreach (@libs) {
+        $_ =~ s/\.a//;
+        push(@tmp, $_);
+    }
+    @libs = @tmp;
+
+    my @apps = @{$build_structure{"APPS"}};
+    @tmp = ();
+    foreach (@apps) {
+        $_ =~ s/\.exe//;
+        if ($_ eq "git" ) {
+            unshift(@tmp, $_);
+        } else {
+            push(@tmp, $_);
+        }
+    }
+    @apps = @tmp;
+
+    open F, ">git.sln" || die "Could not open git.sln for writing!\n";
+    binmode F, ":crlf :utf8";
+    print F chr(0xFEFF);
+    print F "$SLN_HEAD";
+
+    foreach (@apps) {
+        my $appname = $_;
+        my $uuid = $build_structure{"APPS_${appname}_GUID"};
+        print F "$SLN_PRE";
+	my $vcxproj = $build_structure{"APPS_${appname}_VCXPROJ"};
+	$vcxproj =~ s/\//\\/g;
+        $appname =~ s/.*\///;
+        print F "\"${appname}\", \"${vcxproj}\", \"${uuid}\"";
+        print F "$SLN_POST";
+    }
+    foreach (@libs) {
+        my $libname = $_;
+        my $uuid = $build_structure{"LIBS_${libname}_GUID"};
+        print F "$SLN_PRE";
+        my $vcxproj = $build_structure{"LIBS_${libname}_VCXPROJ"};
+	$vcxproj =~ s/\//\\/g;
+        $libname =~ s/\//_/g;
+        print F "\"${libname}\", \"${vcxproj}\", \"${uuid}\"";
+        print F "$SLN_POST";
+    }
+
+    print F << "EOM";
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+EOM
+    print F << "EOM";
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+EOM
+    foreach (@apps) {
+        my $appname = $_;
+        my $uuid = $build_structure{"APPS_${appname}_GUID"};
+        print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
+        print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
+        print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
+        print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
+        print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
+        print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
+        print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
+        print F "\t\t${uuid}.Release|x86.Build.0 = Release|Win32\n";
+    }
+    foreach (@libs) {
+        my $libname = $_;
+        my $uuid = $build_structure{"LIBS_${libname}_GUID"};
+        print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
+        print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
+        print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
+        print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
+        print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
+        print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
+        print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
+        print F "\t\t${uuid}.Release|x86.Build.0 = Release|Win32\n";
+    }
+
+    print F << "EOM";
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
+EOM
+    close F;
+}
+
+1;
-- 
gitgitgadget


^ permalink raw reply related	[relevance 8%]

* [PATCH] Move sha1_file_to_archive into libgit
@ 2008-01-14 16:36  8% Lars Hjemli
  0 siblings, 0 replies; 200+ results
From: Lars Hjemli @ 2008-01-14 16:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

When the specfile (export-subst) attribute was introduced, it added a
dependency from archive-{tar|zip}.c to builtin-archive.c. This broke the
support for archive-operations in libgit.a since builtin-archive.o doesn't
belong in libgit.a.

This patch moves the functions required by libgit.a from builtin-archive.c
to the new file archive.c (which becomes part of libgit.a).

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
 Makefile          |    2 +-
 archive.c         |   84 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 builtin-archive.c |   80 --------------------------------------------------
 3 files changed, 85 insertions(+), 81 deletions(-)
 create mode 100644 archive.c

diff --git a/Makefile b/Makefile
index 21c80e6..c9b482a 100644
--- a/Makefile
+++ b/Makefile
@@ -316,7 +316,7 @@ LIB_OBJS = \
 	alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \
 	color.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o \
 	convert.o attr.o decorate.o progress.o mailmap.o symlinks.o remote.o \
-	transport.o bundle.o walker.o parse-options.o ws.o
+	transport.o bundle.o walker.o parse-options.o ws.o archive.o
 
 BUILTIN_OBJS = \
 	builtin-add.o \
diff --git a/archive.c b/archive.c
new file mode 100644
index 0000000..fb159fe
--- /dev/null
+++ b/archive.c
@@ -0,0 +1,84 @@
+#include "cache.h"
+#include "commit.h"
+#include "attr.h"
+
+static void format_subst(const struct commit *commit,
+                         const char *src, size_t len,
+                         struct strbuf *buf)
+{
+	char *to_free = NULL;
+	struct strbuf fmt;
+
+	if (src == buf->buf)
+		to_free = strbuf_detach(buf, NULL);
+	strbuf_init(&fmt, 0);
+	for (;;) {
+		const char *b, *c;
+
+		b = memmem(src, len, "$Format:", 8);
+		if (!b || src + len < b + 9)
+			break;
+		c = memchr(b + 8, '$', len - 8);
+		if (!c)
+			break;
+
+		strbuf_reset(&fmt);
+		strbuf_add(&fmt, b + 8, c - b - 8);
+
+		strbuf_add(buf, src, b - src);
+		format_commit_message(commit, fmt.buf, buf);
+		len -= c + 1 - src;
+		src  = c + 1;
+	}
+	strbuf_add(buf, src, len);
+	strbuf_release(&fmt);
+	free(to_free);
+}
+
+static int convert_to_archive(const char *path,
+                              const void *src, size_t len,
+                              struct strbuf *buf,
+                              const struct commit *commit)
+{
+	static struct git_attr *attr_export_subst;
+	struct git_attr_check check[1];
+
+	if (!commit)
+		return 0;
+
+	if (!attr_export_subst)
+		attr_export_subst = git_attr("export-subst", 12);
+
+	check[0].attr = attr_export_subst;
+	if (git_checkattr(path, ARRAY_SIZE(check), check))
+		return 0;
+	if (!ATTR_TRUE(check[0].value))
+		return 0;
+
+	format_subst(commit, src, len, buf);
+	return 1;
+}
+
+void *sha1_file_to_archive(const char *path, const unsigned char *sha1,
+                           unsigned int mode, enum object_type *type,
+                           unsigned long *sizep,
+                           const struct commit *commit)
+{
+	void *buffer;
+
+	buffer = read_sha1_file(sha1, type, sizep);
+	if (buffer && S_ISREG(mode)) {
+		struct strbuf buf;
+		size_t size = 0;
+
+		strbuf_init(&buf, 0);
+		strbuf_attach(&buf, buffer, *sizep, *sizep + 1);
+		convert_to_working_tree(path, buf.buf, buf.len, &buf);
+		convert_to_archive(path, buf.buf, buf.len, &buf, commit);
+		buffer = strbuf_detach(&buf, &size);
+		*sizep = size;
+	}
+
+	return buffer;
+}
+
diff --git a/builtin-archive.c b/builtin-archive.c
index 14a1b30..c2e0c1e 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -79,86 +79,6 @@ static int run_remote_archiver(const char *remote, int argc,
 	return !!rv;
 }
 
-static void format_subst(const struct commit *commit,
-                         const char *src, size_t len,
-                         struct strbuf *buf)
-{
-	char *to_free = NULL;
-	struct strbuf fmt;
-
-	if (src == buf->buf)
-		to_free = strbuf_detach(buf, NULL);
-	strbuf_init(&fmt, 0);
-	for (;;) {
-		const char *b, *c;
-
-		b = memmem(src, len, "$Format:", 8);
-		if (!b || src + len < b + 9)
-			break;
-		c = memchr(b + 8, '$', len - 8);
-		if (!c)
-			break;
-
-		strbuf_reset(&fmt);
-		strbuf_add(&fmt, b + 8, c - b - 8);
-
-		strbuf_add(buf, src, b - src);
-		format_commit_message(commit, fmt.buf, buf);
-		len -= c + 1 - src;
-		src  = c + 1;
-	}
-	strbuf_add(buf, src, len);
-	strbuf_release(&fmt);
-	free(to_free);
-}
-
-static int convert_to_archive(const char *path,
-                              const void *src, size_t len,
-                              struct strbuf *buf,
-                              const struct commit *commit)
-{
-	static struct git_attr *attr_export_subst;
-	struct git_attr_check check[1];
-
-	if (!commit)
-		return 0;
-
-	if (!attr_export_subst)
-		attr_export_subst = git_attr("export-subst", 12);
-
-	check[0].attr = attr_export_subst;
-	if (git_checkattr(path, ARRAY_SIZE(check), check))
-		return 0;
-	if (!ATTR_TRUE(check[0].value))
-		return 0;
-
-	format_subst(commit, src, len, buf);
-	return 1;
-}
-
-void *sha1_file_to_archive(const char *path, const unsigned char *sha1,
-                           unsigned int mode, enum object_type *type,
-                           unsigned long *sizep,
-                           const struct commit *commit)
-{
-	void *buffer;
-
-	buffer = read_sha1_file(sha1, type, sizep);
-	if (buffer && S_ISREG(mode)) {
-		struct strbuf buf;
-		size_t size = 0;
-
-		strbuf_init(&buf, 0);
-		strbuf_attach(&buf, buffer, *sizep, *sizep + 1);
-		convert_to_working_tree(path, buf.buf, buf.len, &buf);
-		convert_to_archive(path, buf.buf, buf.len, &buf, commit);
-		buffer = strbuf_detach(&buf, &size);
-		*sizep = size;
-	}
-
-	return buffer;
-}
-
 static int init_archiver(const char *name, struct archiver *ar)
 {
 	int rv = -1, i;
-- 
1.5.4.rc2.69.g047fe-dirty

^ permalink raw reply related	[relevance 8%]

* Re: [PATCH v4 1/8] Introduce CMake support for configuring Git
  @ 2020-06-15 14:00  8% ` Øystein Walle
  0 siblings, 0 replies; 200+ results
From: Øystein Walle @ 2020-06-15 14:00 UTC (permalink / raw)
  To: gitgitgadget; +Cc: git, sibisiddharthan.github, Øystein Walle

Hi,

I haven't been able to pay much attention lately. I see this is v4 of this
patch series and thought I took a quick look and didn't find anything, it's
possible some of this has been addressed already. If so I apologize.

> So let's start building CMake support for Git.

Yay!

> +
> +Instructions to run CMake:
> +
> +cmake `relative-path-to-CMakeLists.txt` -DCMAKE_BUILD_TYPE=Release
> +Eg.
> +From the root of git source tree
> +	`cmake contrib/buildsystems/ `
> +This will build the git binaries at the root
> +
> +For out of source builds, say build in 'git/git-build/'
> +	`mkdir git-build;cd git-build; cmake ../contrib/buildsystems/`
> +This will build the git binaries in git-build directory
> +

Since the mininum required version is sufficiently high I suggest you
recommend the following as well:

    cmake -B build-dir -S contrib/buildsystems

This might be easier for scripted tasks (packaging and whatnot) since cd
and mkdir aren't necessary.

> +#set the source directory to root of git
> +set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)

See if you can avoid this. This this will break if another project includes Git
as part of itself with add_subdirectory() or the ExternalProject module. If all
you use it for is paths to other files then you might as well do this:

    set(repo_root "${CMAKE_CURRENT_LIST_DIR}/../..")

and use ${repo_root} the places you use ${CMAKE_SOURCE_DIR} now.

AFAIK the places CMake accepts relative paths it's usually relative to
CMAKE_CURRENT_SOURCE_DIR and not CMAKE_SOURCE_DIR, anyway. I don't think it's
automagically updated when CMAKE_SOURCE_DIR is changed.

> +include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS})
> +if(CURL_FOUND)
> +	include_directories(SYSTEM ${CURL_INCLUDE_DIRS})
> +endif()

This is better handled like this these days:

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 8367b73e94..ca1f90e58c 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -121,10 +121,6 @@ if(NOT Intl_FOUND)
 	endif()
 endif()
 
-include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS})
-if(CURL_FOUND)
-	include_directories(SYSTEM ${CURL_INCLUDE_DIRS})
-endif()
 if(EXPAT_FOUND)
 	include_directories(SYSTEM ${EXPAT_INCLUDE_DIRS})
 endif()
@@ -606,7 +602,7 @@ endif()
 #link all required libraries to common-main
 add_library(common-main OBJECT ${CMAKE_SOURCE_DIR}/common-main.c)
 
-target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES})
+target_link_libraries(common-main libgit xdiff ZLIB::ZLIB)
 if(Intl_FOUND)
 	target_link_libraries(common-main ${Intl_LIBRARIES})
 endif()
@@ -659,17 +655,17 @@ if(CURL_FOUND)
 	add_library(http_obj OBJECT ${CMAKE_SOURCE_DIR}/http.c)
 
 	add_executable(git-imap-send ${CMAKE_SOURCE_DIR}/imap-send.c)
-	target_link_libraries(git-imap-send http_obj common-main ${CURL_LIBRARIES})
+	target_link_libraries(git-imap-send http_obj common-main CURL::libcurl)
 
 	add_executable(git-http-fetch ${CMAKE_SOURCE_DIR}/http-walker.c ${CMAKE_SOURCE_DIR}/http-fetch.c)
-	target_link_libraries(git-http-fetch http_obj common-main ${CURL_LIBRARIES})
+	target_link_libraries(git-http-fetch http_obj common-main CURL::libcurl)
 
 	add_executable(git-remote-http ${CMAKE_SOURCE_DIR}/http-walker.c ${CMAKE_SOURCE_DIR}/remote-curl.c)
-	target_link_libraries(git-remote-http http_obj common-main ${CURL_LIBRARIES} )
+	target_link_libraries(git-remote-http http_obj common-main CURL::libcurl)
 
 	if(EXPAT_FOUND)
 		add_executable(git-http-push ${CMAKE_SOURCE_DIR}/http-push.c)
-		target_link_libraries(git-http-push http_obj common-main ${CURL_LIBRARIES} ${EXPAT_LIBRARIES})
+		target_link_libraries(git-http-push http_obj common-main CURL::libcurl ${EXPAT_LIBRARIES})
 	endif()
 endif()
 
With this change we're feeding proper CMake targets to target_link_libraries()
instead of just a bunch of strings. CMake can know a lot about a target, such
as it's dependencies, required macros and so on[1]. This means some boilerplate
code can be removed: Notice that the manual handling of Zlib's include path is
gone. The same can perhaps be done for the other libraries as well but I
haven't checked that.

> +include_directories(${CMAKE_SOURCE_DIR})
> +(...)
> +include_directories(${CMAKE_BINARY_DIR})

See if CMAKE_INCLUDE_CURRENT_DIR[2] makes this unneeded. It might not since you
overwrite CMAKE_SOURCE_DIR manually.

Øsse

[1]: https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#properties-on-targets
[2]: https://cmake.org/cmake/help/latest/variable/CMAKE_INCLUDE_CURRENT_DIR.html

^ permalink raw reply related	[relevance 8%]

* Re: [PATCH] Move try_merge_command and checkout_fast_forward to libgit.a
  2012-10-25 12:50  8%   ` Nguyen Thai Ngoc Duy
@ 2012-10-26 12:02  8%     ` Jeff King
  2012-10-26 15:53 10%       ` [PATCH 0/7] Move code from builtin " Nguyễn Thái Ngọc Duy
  0 siblings, 1 reply; 200+ results
From: Jeff King @ 2012-10-26 12:02 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git

On Thu, Oct 25, 2012 at 07:50:26PM +0700, Nguyen Thai Ngoc Duy wrote:

> On Thu, Oct 25, 2012 at 4:45 PM, Jeff King <peff@peff.net> wrote:
> > On Tue, Oct 23, 2012 at 09:24:51AM +0700, Nguyen Thai Ngoc Duy wrote:
> >
> >> These functions are called in sequencer.c, which is part of
> >> libgit.a. This makes libgit.a potentially require builtin/merge.c for
> >> external git commands.
> >>
> >> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> >> ---
> >>  I made some unrelated changes in sequencer.c and this problem shown
> >>  up. merge-recursive.c is probably not the best place for these
> >>  functions. I just don't want to create merge.c for them.
> >
> > I'm fine with this conceptually, but merge-recursive really is the wrong
> > place. I'd much rather see a new merge.c to collect merge-related helper
> > functions that are not strategy-specific.
> 
> OK. I checked around for similar issues and found these used by
> libgit.a but stay in builtin/ instead:

Yeah, we have traditionally been kind of lazy about the distinction,
because it doesn't really matter for our build system (i.e., libgit.a is
not _really_ a library, but just a convenience in the build process). So
one option is just not caring about these. I'm also fine with fixing.

> estimate_bisect_steps: bisect.c and builtin/rev-list.c
> print_commit_list: bisect.c and builtin/rev-list.c
> 
>  -> move them to bisect.c? another candidate is revision.c.

I'd probably say bisect.c for the first, and commit.c for the latter
(that is where commit_list functions are defined, and it is really about
that).

> fetch_pack: transport.c and builtin/fetch-pack.c
> send_pack: transport.c and builtin/send-pack.c
> 
>  -> move them to transport.c? or new files fetch-pack.c and
> send-pack.c? I haven't check how many functions they may pull
> together.

I think I'd rather have fetch-pack.c and send-pack.c than putting them
into transport.c (which is getting kind of bloated already).

> setup_diff_pager: diff-no-index.c and builtin/diff.c
> 
>  -> to diff-lib.c?

I'm not sure (to be honest, I am not even sure of the intended
difference between diff.c and diff-lib.c). That function is really not
for general diffing, but for diff-like commands. Probably it would be OK
in diff.c.

-Peff

^ permalink raw reply	[relevance 8%]

* [PATCH 2/7] Move estimate_bisect_steps to libgit.a
  2012-10-26 15:53 10%       ` [PATCH 0/7] Move code from builtin " Nguyễn Thái Ngọc Duy
  2012-10-26 15:53  8%         ` [PATCH 3/7] Move print_commit_list " Nguyễn Thái Ngọc Duy
@ 2012-10-26 15:53  8%         ` Nguyễn Thái Ngọc Duy
  2012-10-26 15:53  7%         ` [PATCH 4/7] Move setup_diff_pager " Nguyễn Thái Ngọc Duy
  2012-10-26 15:53  5%         ` [PATCH 1/7] Move try_merge_command and checkout_fast_forward " Nguyễn Thái Ngọc Duy
  3 siblings, 0 replies; 200+ results
From: Nguyễn Thái Ngọc Duy @ 2012-10-26 15:53 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Nguyễn Thái Ngọc Duy

This function is used by bisect.c, part of libgit.a while
estimate_bisect_steps stays in builtin/rev-list.c. Move it to bisect.a
so we won't have undefine reference if a standalone program that uses
libgit.a happens to pull it in.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 bisect.c           | 38 ++++++++++++++++++++++++++++++++++++++
 builtin/rev-list.c | 39 ---------------------------------------
 2 files changed, 38 insertions(+), 39 deletions(-)

diff --git a/bisect.c b/bisect.c
index 1aad49b..bd1b7b5 100644
--- a/bisect.c
+++ b/bisect.c
@@ -956,3 +956,41 @@ int bisect_next_all(const char *prefix, int no_checkout)
 	return bisect_checkout(bisect_rev_hex, no_checkout);
 }
 
+static inline int log2i(int n)
+{
+	int log2 = 0;
+
+	for (; n > 1; n >>= 1)
+		log2++;
+
+	return log2;
+}
+
+static inline int exp2i(int n)
+{
+	return 1 << n;
+}
+
+/*
+ * Estimate the number of bisect steps left (after the current step)
+ *
+ * For any x between 0 included and 2^n excluded, the probability for
+ * n - 1 steps left looks like:
+ *
+ * P(2^n + x) == (2^n - x) / (2^n + x)
+ *
+ * and P(2^n + x) < 0.5 means 2^n < 3x
+ */
+int estimate_bisect_steps(int all)
+{
+	int n, x, e;
+
+	if (all < 3)
+		return 0;
+
+	n = log2i(all);
+	e = exp2i(n);
+	x = all - e;
+
+	return (e < 3 * x) ? n : n - 1;
+}
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index ff5a383..a0ec84e 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -201,45 +201,6 @@ static void show_edge(struct commit *commit)
 	printf("-%s\n", sha1_to_hex(commit->object.sha1));
 }
 
-static inline int log2i(int n)
-{
-	int log2 = 0;
-
-	for (; n > 1; n >>= 1)
-		log2++;
-
-	return log2;
-}
-
-static inline int exp2i(int n)
-{
-	return 1 << n;
-}
-
-/*
- * Estimate the number of bisect steps left (after the current step)
- *
- * For any x between 0 included and 2^n excluded, the probability for
- * n - 1 steps left looks like:
- *
- * P(2^n + x) == (2^n - x) / (2^n + x)
- *
- * and P(2^n + x) < 0.5 means 2^n < 3x
- */
-int estimate_bisect_steps(int all)
-{
-	int n, x, e;
-
-	if (all < 3)
-		return 0;
-
-	n = log2i(all);
-	e = exp2i(n);
-	x = all - e;
-
-	return (e < 3 * x) ? n : n - 1;
-}
-
 void print_commit_list(struct commit_list *list,
 		       const char *format_cur,
 		       const char *format_last)
-- 
1.8.0.rc2.23.g1fb49df

^ permalink raw reply related	[relevance 8%]

* Re: Reducing git size by building libgit.so
  2019-06-11 23:48  9% ` brian m. carlson
@ 2019-06-12  9:29  8%   ` Duy Nguyen
    1 sibling, 0 replies; 200+ results
From: Duy Nguyen @ 2019-06-12  9:29 UTC (permalink / raw)
  To: brian m. carlson, Elmar Pruesse, git@vger.kernel.org

On Wed, Jun 12, 2019 at 2:11 PM brian m. carlson
<sandals@crustytoothpaste.net> wrote:
>
> On 2019-06-11 at 19:52:18, Elmar Pruesse wrote:
> > Hi!
> >
> > The total compiled size of libexec/git-core is currently somewhere
> > around 30 MB. This is largely due to a number of binaries linking
> > statically against libgit.a. For some folks, every byte counts. I
> > meddled with the Makefile briefly to make it build and use a libgit.so
> > instead, which dropped package size down to 5MB.
> >
> > Are there, beyond the ~20 ms in extra startup time and the slightly
> > bigger hassle with DSO locations, reasons for the choice to link statically?
>
> I think the reason is that libgit is not API stable and we definitely
> don't want people linking against it.

Having .so files does not mean it's stable API though. If we don't
ever install header files, there's no way for outside people to use it
(people who dlopen() it anyway deserve whatever they get). I do agree
with some hassles from .so files though.

If installation size is a problem I think we can still shrink it a bit
down. Some non-builtin commands (fast-import, sh-i18n--subst...) could
be merged back in "git" binary. Some other for remote side (or
background daemons) could also be bundled together unless there's
security concerns.

We could also have a look at function distribution in libgit.a. I'm
surprised git-credential-store is 5.6 MB on my machine. We probably
pull more stuff than needed somewhere due to dependency between .o
files.

> Before libgit2 existed, projects
> like cgit built their own libgit and it required pinning to a specific
> version of Git.
>
> Also, some people install Git into their home directories, and a shared
> library means that they'll have to use LD_LIBRARY_PATH (or equivalent)
> to run Git.
>
> Finally, we have support for a runtime relocatable Git which can be run
> out of any path and still automatically find its dependent binaries.
> That won't work with a shared library.
>
> So if we did allow for building a shared library, it would have to be an
> option that defaulted to off, I think.
> --
> brian m. carlson: Houston, Texas, US
> OpenPGP: https://keybase.io/bk2204



-- 
Duy

^ permalink raw reply	[relevance 8%]

* [PATCH 3/7] Move print_commit_list to libgit.a
  2012-10-26 15:53 10%       ` [PATCH 0/7] Move code from builtin " Nguyễn Thái Ngọc Duy
@ 2012-10-26 15:53  8%         ` Nguyễn Thái Ngọc Duy
  2012-10-26 15:53  8%         ` [PATCH 2/7] Move estimate_bisect_steps " Nguyễn Thái Ngọc Duy
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 200+ results
From: Nguyễn Thái Ngọc Duy @ 2012-10-26 15:53 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Nguyễn Thái Ngọc Duy

This is used by bisect.c, part of libgit.a while it stays in
builtin/rev-list.c. Move it to commit.c so that we won't get undefined
reference if a program that uses libgit.a happens to pull it in.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 bisect.h           |  4 ----
 builtin/rev-list.c | 10 ----------
 commit.c           | 10 ++++++++++
 commit.h           |  4 ++++
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/bisect.h b/bisect.h
index ec3c3ff..2a6c831 100644
--- a/bisect.h
+++ b/bisect.h
@@ -11,10 +11,6 @@ extern struct commit_list *filter_skipped(struct commit_list *list,
 					  int *count,
 					  int *skipped_first);
 
-extern void print_commit_list(struct commit_list *list,
-			      const char *format_cur,
-			      const char *format_last);
-
 #define BISECT_SHOW_ALL		(1<<0)
 #define REV_LIST_QUIET		(1<<1)
 
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index a0ec84e..67701be 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -201,16 +201,6 @@ static void show_edge(struct commit *commit)
 	printf("-%s\n", sha1_to_hex(commit->object.sha1));
 }
 
-void print_commit_list(struct commit_list *list,
-		       const char *format_cur,
-		       const char *format_last)
-{
-	for ( ; list; list = list->next) {
-		const char *format = list->next ? format_cur : format_last;
-		printf(format, sha1_to_hex(list->item->object.sha1));
-	}
-}
-
 static void print_var_str(const char *var, const char *val)
 {
 	printf("%s='%s'\n", var, val);
diff --git a/commit.c b/commit.c
index 213bc98..e8eb0ae 100644
--- a/commit.c
+++ b/commit.c
@@ -1347,3 +1347,13 @@ struct commit_list **commit_list_append(struct commit *commit,
 	new->next = NULL;
 	return &new->next;
 }
+
+void print_commit_list(struct commit_list *list,
+		       const char *format_cur,
+		       const char *format_last)
+{
+	for ( ; list; list = list->next) {
+		const char *format = list->next ? format_cur : format_last;
+		printf(format, sha1_to_hex(list->item->object.sha1));
+	}
+}
diff --git a/commit.h b/commit.h
index 9f21313..c4cd046 100644
--- a/commit.h
+++ b/commit.h
@@ -222,4 +222,8 @@ struct commit *get_merge_parent(const char *name);
 
 extern int parse_signed_commit(const unsigned char *sha1,
 			       struct strbuf *message, struct strbuf *signature);
+extern void print_commit_list(struct commit_list *list,
+			      const char *format_cur,
+			      const char *format_last);
+
 #endif /* COMMIT_H */
-- 
1.8.0.rc2.23.g1fb49df

^ permalink raw reply related	[relevance 8%]

* Re: status of libgit.a
  2010-03-07 10:27 10%       ` status of libgit.a Paul Menzel
  2010-03-07 13:26 10%         ` Dmitry Potapov
  2010-03-07 16:36 10%         ` Johannes Schindelin
@ 2010-03-07 12:18  8%         ` Miklos Vajna
  2 siblings, 0 replies; 200+ results
From: Miklos Vajna @ 2010-03-07 12:18 UTC (permalink / raw)
  To: Paul Menzel; +Cc: git, Marc Oscar Singer, 407722

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

On Sun, Mar 07, 2010 at 11:27:35AM +0100, Paul Menzel <pm.debian@googlemail.com> wrote:
> > You really need to talk to upstream if you want this libgit.a.
> 
> could you please give an update on the status of libgit.a. For example
> cgit still could not be packaged yet for Debian [1] because of this bug
> [2].
> 
> cgit is used by a lot of projects out there, so I am wondering if the
> current libgit.a can be released in its current state.

libgit.a is not a public library, so it will never have a stable
API/ABI. There is a libgit2 project which tries to do this, but it's far
from complete:

http://repo.or.cz/w/libgit2.git

> By the way, is there a web site/page for libgit.a?

No, there isn't.

I think the only sane solution is what Fedora does as well:

http://cvs.fedoraproject.org/viewvc/devel/cgit/

When cgit-1.2.3 is released, have a look at its Makefile, check what Git
version does it want and add the relevant Git source to the cgit source
package.

[ I remember Debian did not support having multiple upstream sources /
one source package, I hope this is no longer the situation. ;-) ]

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

^ permalink raw reply	[relevance 8%]

* Re: linking libgit.a in C++ projects
  2008-07-31  9:53  8% linking libgit.a in C++ projects cte
@ 2008-07-31 10:57  8% ` Dmitry Potapov
  2008-07-31 11:10  9%   ` cte
      1 sibling, 2 replies; 200+ results
From: Dmitry Potapov @ 2008-07-31 10:57 UTC (permalink / raw)
  To: cte; +Cc: git

On Thu, Jul 31, 2008 at 02:53:37AM -0700, cte wrote:
> I'm writing a git gui for OS X using cocoa/Objective-C++, and rather
> than being lame and parsing the output the various git commands, I'm
> using libgit.a to provide all of the needed functionality for my app.

Don't do that! libgit.a is an internal library used solely to build
git binaries. It means that its interface can be cahnged at any time.
Though, there is an idea of creating the real git library that other
applications can use, but AFAIK no one is working on it. So parsing
output is the only correct solution right now. In fact, it is not
difficult to do, because most plumbing commands are rather flexibly
in what they output and how.

> However, the git source uses a few reserved C++ keywords; namely
> 'typename', and 'new'.

Because this source code are meant to be compiled by C and not by C++!
Even if we will have real git library for other applications to use,
it still be compiled only by C. Thus, C++ keywords are not issue.

Dmitry

^ permalink raw reply	[relevance 8%]

* Re: How to properly find git config in a libgit.a-using executable?
  @ 2019-03-22 14:19  8%     ` Mike Hommey
  2019-03-25 14:37  8%       ` Johannes Schindelin
  0 siblings, 1 reply; 200+ results
From: Mike Hommey @ 2019-03-22 14:19 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Jeff King, git

On Fri, Mar 22, 2019 at 02:39:43PM +0100, Johannes Schindelin wrote:
> Hi Peff & Mike,
> 
> On Fri, 22 Mar 2019, Jeff King wrote:
> 
> > On Wed, Mar 20, 2019 at 07:19:41PM +0900, Mike Hommey wrote:
> >
> > > I thought of a few options (it's worth noting the helper is invoked in a
> > > way that makes $GIT_EXEC_PATH set, which can help a little):
> > > - spawn `$GIT_EXEC_PATH/git-config -l -z`, parse its output, and set the
> > >   internal config from that. That's the barbarian option.
> > > - build the helper with RUNTIME_PREFIX, and modify the RUNTIME_PREFIX
> > >   code to use $GIT_EXEC_PATH if it's set, rather than the path the
> > >   executable is in. That actually sounds reasonable enough that I'd send
> > >   a patch for git itself. But that doesn't quite address the nitpick case
> > >   where ETC_GITCONFIG could be either `/etc/gitconfig` or
> > >   `etc/gitconfig` depending how git was compiled, and there's no way to
> > >   know which is the right one.
> >
> > I'm not entirely sure I understand the problem, but it sounds like you
> > want to know the baked-in ETC_GITCONFIG for a built version of git (that
> > isn't necessarily the one that shares your build of libgit.a).
> >
> > There's no direct way to have Git print that out. It would be reasonable
> > to add one to rev-parse, I think.
> >
> > Barring that, here's a hack:
> >
> >   git config --system --show-origin --list -z |
> >   perl -lne '/^file:(.*?)\0/ and print $1 and exit 0'
> >
> > If the file is empty, it won't print anything, of course. But then,
> > you'd know that it also has no config in it. :)
> 
> How about
> 
> 	GIT_EDITOR=echo git config --system -e 2>/dev/null
> 
> It will error out if the directory does not exist, for some reason, e.g.
> when you installed Git in your home directory via `make install` from a
> fresh clone. So you'll have to cope with that contingency.

Thank you both, I can probably work with this, although I might have to
alter the git init sequence. I'm not sure my usecase needs git to cater
for it more generally, though. Who else uses libgit.a?

Mike

^ permalink raw reply	[relevance 8%]

* Re: How to properly find git config in a libgit.a-using executable?
  2019-03-20 10:19  7% How to properly find git config in a libgit.a-using executable? Mike Hommey
@ 2019-03-22  7:33  8% ` Jeff King
    0 siblings, 1 reply; 200+ results
From: Jeff King @ 2019-03-22  7:33 UTC (permalink / raw)
  To: Mike Hommey; +Cc: git

On Wed, Mar 20, 2019 at 07:19:41PM +0900, Mike Hommey wrote:

> I thought of a few options (it's worth noting the helper is invoked in a
> way that makes $GIT_EXEC_PATH set, which can help a little):
> - spawn `$GIT_EXEC_PATH/git-config -l -z`, parse its output, and set the
>   internal config from that. That's the barbarian option.
> - build the helper with RUNTIME_PREFIX, and modify the RUNTIME_PREFIX
>   code to use $GIT_EXEC_PATH if it's set, rather than the path the
>   executable is in. That actually sounds reasonable enough that I'd send
>   a patch for git itself. But that doesn't quite address the nitpick case
>   where ETC_GITCONFIG could be either `/etc/gitconfig` or
>   `etc/gitconfig` depending how git was compiled, and there's no way to
>   know which is the right one.

I'm not entirely sure I understand the problem, but it sounds like you
want to know the baked-in ETC_GITCONFIG for a built version of git (that
isn't necessarily the one that shares your build of libgit.a).

There's no direct way to have Git print that out. It would be reasonable
to add one to rev-parse, I think.

Barring that, here's a hack:

  git config --system --show-origin --list -z |
  perl -lne '/^file:(.*?)\0/ and print $1 and exit 0'

If the file is empty, it won't print anything, of course. But then,
you'd know that it also has no config in it. :)

-Peff

^ permalink raw reply	[relevance 8%]

* Re: [PATCH] Move try_merge_command and checkout_fast_forward to libgit.a
  @ 2012-10-25 12:50  8%   ` Nguyen Thai Ngoc Duy
  2012-10-26 12:02  8%     ` Jeff King
  0 siblings, 1 reply; 200+ results
From: Nguyen Thai Ngoc Duy @ 2012-10-25 12:50 UTC (permalink / raw)
  To: Jeff King; +Cc: git

On Thu, Oct 25, 2012 at 4:45 PM, Jeff King <peff@peff.net> wrote:
> On Tue, Oct 23, 2012 at 09:24:51AM +0700, Nguyen Thai Ngoc Duy wrote:
>
>> These functions are called in sequencer.c, which is part of
>> libgit.a. This makes libgit.a potentially require builtin/merge.c for
>> external git commands.
>>
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>> ---
>>  I made some unrelated changes in sequencer.c and this problem shown
>>  up. merge-recursive.c is probably not the best place for these
>>  functions. I just don't want to create merge.c for them.
>
> I'm fine with this conceptually, but merge-recursive really is the wrong
> place. I'd much rather see a new merge.c to collect merge-related helper
> functions that are not strategy-specific.

OK. I checked around for similar issues and found these used by
libgit.a but stay in builtin/ instead:

estimate_bisect_steps: bisect.c and builtin/rev-list.c
print_commit_list: bisect.c and builtin/rev-list.c

 -> move them to bisect.c? another candidate is revision.c.

fetch_pack: transport.c and builtin/fetch-pack.c
send_pack: transport.c and builtin/send-pack.c

 -> move them to transport.c? or new files fetch-pack.c and
send-pack.c? I haven't check how many functions they may pull
together.

setup_diff_pager: diff-no-index.c and builtin/diff.c

 -> to diff-lib.c?
-- 
Duy

^ permalink raw reply	[relevance 8%]

* Re: [PATCH/RFC] Move contents of libgit.a to lib subdirectory
  @ 2011-06-20  1:21  8%   ` Peter Foley
  0 siblings, 0 replies; 200+ results
From: Peter Foley @ 2011-06-20  1:21 UTC (permalink / raw)
  To: Shawn Pearce; +Cc: Peter Foley, git



On Sun, 19 Jun 2011, Shawn Pearce wrote:

> On Sun, Jun 19, 2011 at 17:50, Peter Foley <pefoley2@verizon.net> wrote:
> > This patch tries to organize the git source tree by moving the files which
> > make up libgit.a to a lib subdirectory.
> > Before this patch the toplevel source directory contained 285 files.
> > After this patch the root directory will contain 167 files and
> > the lib subdirectory will contain 119 files
> ...
> 
> Thanks. But why is this amount of churn necessary or being
> recommended? What problem does this address? Is that worth the pain
> this puts on every other in-flight change that is still being
> developed, or is already in the review pipeline?
> 
> -- 
> Shawn.
> 

The basic idea is to organize the git source directory more than it is 
right now (a flat directory with all the source files at the toplevel).
Moving the contents of libgit.a seemed to be a logical way to start.
 
Thanks,

Peter

^ permalink raw reply	[relevance 8%]

* Re: libgit api & external integration
  2009-07-11 21:17  8% ` libgit api & external integration devzero2000
@ 2009-07-16 10:03  8%   ` Jeff King
  0 siblings, 0 replies; 200+ results
From: Jeff King @ 2009-07-16 10:03 UTC (permalink / raw)
  To: devzero2000; +Cc: git

On Sat, Jul 11, 2009 at 11:17:20PM +0200, devzero2000 wrote:

> We, the rpm5 community, would like to incorporate in the rpm package
> manager (rpm5 branch) a  VCS - the history is lonk and probably not of
> interest. I personally have recommend git, for too much reason that
> everyone on this list can agreed. Unfortunately there seems to be no
> clear API or usable libgit to do this now: some comment on this ?
> Thanks in advance.

No, there is currently no linkable libgit. The official stable interface
for interacting with git is the set of plumbing commands.

-Peff

^ permalink raw reply	[relevance 8%]

* Re: libgit api & external integration
       [not found]     <b086760e0907111409w602f4338u868729dcfa188908@mail.gmail.com>
@ 2009-07-11 21:17  8% ` devzero2000
  2009-07-16 10:03  8%   ` Jeff King
  0 siblings, 1 reply; 200+ results
From: devzero2000 @ 2009-07-11 21:17 UTC (permalink / raw)
  To: git

We, the rpm5 community, would like to incorporate in the rpm package
manager (rpm5 branch) a  VCS - the history is lonk and probably not of
interest. I personally have recommend git, for too much reason that
everyone on this list can agreed. Unfortunately there seems to be no
clear API or usable libgit to do this now: some comment on this ?
Thanks in advance.

^ permalink raw reply	[relevance 8%]

* Re: linking libgit.a in C++ projects
  @ 2008-08-03 20:12  8%       ` Alex Riesen
  0 siblings, 0 replies; 200+ results
From: Alex Riesen @ 2008-08-03 20:12 UTC (permalink / raw)
  To: Avery Pennarun; +Cc: Boaz Harrosh, cte, git

Avery Pennarun, Thu, Jul 31, 2008 20:55:26 +0200:
> On 7/31/08, Alex Riesen <raa.lkml@gmail.com> wrote:
> > Boaz Harrosh, Thu, Jul 31, 2008 15:04:50 +0200:
> > > Produce a C file and header that defines some stable API to your
> >  > GUI application, that does not expose any git internal headers.
> >  > Then compile that, say git_api.c, with C compiler in Makefile
> >  > and extern "C" link that file to your C++ application. This will
> >  > completely insulate you from any git code.
> >
> > no, it wont. He still have to resolve name conflicts at the link time.
> 
> Language keywords (as opposed to function names) like 'new' and
> 'typename' are definitely not exported to the object files.  Moreover,
> function parameter names aren't either.
> 

Didn't mean them. Meant the globally visible names. libgit does not
use a prefix for its exported symbols. They will clash with the
symbols of the programs it is linked to.

^ permalink raw reply	[relevance 8%]

* Re: linking libgit.a in C++ projects
  2008-07-31 11:16  8%     ` Pedro Melo
@ 2008-07-31 11:20  8%       ` cte
  2008-07-31 11:20  8%       ` Petr Baudis
  1 sibling, 0 replies; 200+ results
From: cte @ 2008-07-31 11:20 UTC (permalink / raw)
  To: Pedro Melo; +Cc: Dmitry Potapov, git

>> Fortunately, g++ can compile C programs and link static libraries that
>> were compiled by C compilers, unless of course, they use C++ keywords.
>> I don't think it is unreasonable to rename the _very few_ C++ keywords
>> in git's source in the interest of allowing C++ projects to leverage
>> libgit.
>
> I think the point Dmitry was trying to make is that you should compile
> libgit as C, using gcc, and then link it with your C++/Objective C code.
>
> No patch is required to git, only to your makefile/xcode project file.

The git .h files must be in your include path, and must not contain
C++ keywords in order to link against libgit.a.

^ permalink raw reply	[relevance 8%]

* Re: linking libgit.a in C++ projects
  2008-07-31 11:16  8%     ` Pedro Melo
  2008-07-31 11:20  8%       ` cte
@ 2008-07-31 11:20  8%       ` Petr Baudis
  1 sibling, 0 replies; 200+ results
From: Petr Baudis @ 2008-07-31 11:20 UTC (permalink / raw)
  To: Pedro Melo; +Cc: cte, Dmitry Potapov, git

On Thu, Jul 31, 2008 at 12:16:45PM +0100, Pedro Melo wrote:
> I think the point Dmitry was trying to make is that you should compile 
> libgit as C, using gcc, and then link it with your C++/Objective C code.
>
> No patch is required to git, only to your makefile/xcode project file.

libgit has a certain (albeit currently unofficial and non-settled) API
and the API is defined in header files that must be eatable by C++
compilers in order to do this.

				Petr "Pasky" Baudis

^ permalink raw reply	[relevance 8%]

* Re: linking libgit.a in C++ projects
  2008-07-31 11:10  9%   ` cte
@ 2008-07-31 11:16  8%     ` Pedro Melo
  2008-07-31 11:20  8%       ` cte
  2008-07-31 11:20  8%       ` Petr Baudis
  0 siblings, 2 replies; 200+ results
From: Pedro Melo @ 2008-07-31 11:16 UTC (permalink / raw)
  To: cte; +Cc: Dmitry Potapov, git


On Jul 31, 2008, at 12:10 PM, cte wrote:
> On Thu, Jul 31, 2008 at 3:57 AM, Dmitry Potapov <dpotapov@gmail.com>  
> wrote:
>> On Thu, Jul 31, 2008 at 02:53:37AM -0700, cte wrote:
>>> However, the git source uses a few reserved C++ keywords; namely
>>> 'typename', and 'new'.
>>
>> Because this source code are meant to be compiled by C and not by C+ 
>> +!
>> Even if we will have real git library for other applications to use,
>> it still be compiled only by C. Thus, C++ keywords are not issue.
>
[...]
> Fortunately, g++ can compile C programs and link static libraries that
> were compiled by C compilers, unless of course, they use C++ keywords.
> I don't think it is unreasonable to rename the _very few_ C++ keywords
> in git's source in the interest of allowing C++ projects to leverage
> libgit.

I think the point Dmitry was trying to make is that you should compile  
libgit as C, using gcc, and then link it with your C++/Objective C code.

No patch is required to git, only to your makefile/xcode project file.

Best regards,
-- 
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: melo@simplicidade.org
Use XMPP!

^ permalink raw reply	[relevance 8%]

* linking libgit.a in C++ projects
@ 2008-07-31  9:53  8% cte
  2008-07-31 10:57  8% ` Dmitry Potapov
    0 siblings, 2 replies; 200+ results
From: cte @ 2008-07-31  9:53 UTC (permalink / raw)
  To: git

I'm writing a git gui for OS X using cocoa/Objective-C++, and rather
than being lame and parsing the output the various git commands, I'm
using libgit.a to provide all of the needed functionality for my app.
However, the git source uses a few reserved C++ keywords; namely
'typename', and 'new'. So, I was wondering if it is worth submitting a
patch to fix these issues... I'm asking because I'm new to the whole
open source thing, and I don't want to get yelled at by the git
maintainers for submitting stupid patches that no one in their right
mind would accept :)

Thanks!

^ permalink raw reply	[relevance 8%]

* Re: [PATCH] add install-lib target to install libgit.a library plus headers.
    2007-02-14 18:24  9% ` Junio C Hamano
@ 2007-02-14 15:51  8% ` Johannes Schindelin
  1 sibling, 0 replies; 200+ results
From: Johannes Schindelin @ 2007-02-14 15:51 UTC (permalink / raw)
  To: Gerrit Pape; +Cc: git

Hi,

On Wed, 14 Feb 2007, Gerrit Pape wrote:

> Patch from Luca Falavigna to install git static library and header files
> into $(prefix)/lib/, $(prefix)/include/git/, see

This would make sense, _iff_ libgit.a was libified. As it is, too many 
functions assume that you can die() anytime something goes awry.

Ciao,
Dscho

^ permalink raw reply	[relevance 8%]

* Re: Reducing git size by building libgit.so
  @ 2019-06-13  7:51  8%     ` Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2019-06-13  7:51 UTC (permalink / raw)
  To: Paul Smith; +Cc: brian m. carlson, Elmar Pruesse, git@vger.kernel.org

Hi Paul,

On Wed, 12 Jun 2019, Paul Smith wrote:

> On Tue, 2019-06-11 at 23:48 +0000, brian m. carlson wrote:
> > Also, some people install Git into their home directories, and a
> > shared library means that they'll have to use LD_LIBRARY_PATH (or
> > equivalent) to run Git.
>
> I don't have strong feeling about .so's although obviously less disk
> space used is always a good thing, everything else being equal.
>
> However, the above concern isn't actually an issue.  You can install
> the .so in a known location relative to the binaries, then link the
> binaries with an RPATH setting using $ORIGIN (or the equivalent on
> MacOS which does exist but I forget the name).

Hassles aside, you mentioned Linux and macOS. What about literally *all*
the other platforms we support? Like AIX, NonStop, HP/UX, etc?

Sure, you can hunt down all of them, and maybe even come up with a
workaround for platforms that do not have a $ORIGIN equivalent. You can
pile workaround on workaround all you want.

In the end, it seems to be a clear indicator that this is a complicator's
glove, and the only reasonably simple way forward would be to either leave
things as-are, or have an *opt-in* to build a shared libgit.

But.

And this is a really big but.

While you can try to document _all you want_ how libgit.so is not supposed
to be used as a library, how its API is not an API or at least not a
stable one, if you have _some_ experience with software development you
will know that it won't matter one bit. It _will_ be used, people _will_
complain, and it will turn out to simply not have been a good idea in the
first place.

> On Windows, DLLs are installed in the same directory as the binary,
> typically.
>
> Allowing relocatable binaries with .so dependencies without requiring
> LD_LIBRARY_PATH settings is a solved problem, to the best of my
> understanding.

You're probably right, as long as you restrict your view to mainstream
Operating Systems.

To put things into perspective, you might be interested in reading up on
https://github.com/git/git/commit/0f50c8e32c87 (Makefile: remove the
NO_R_TO_GCC_LINKER flag, 2019-05-17) and related commit history.

Sure, you could still argue that it is a "solved" problem. Where "solved"
is a different term than "desirable".

> One thing to think about is that runtime loading a .so can take some
> time if it has lots of public symbols.  If someone really wanted to do
> this, the ideal thing would be to make all symbols hidden except those
> needed by the binary front-ends and have those be very small shells
> that just had a very limited number of entry points into the .so.

That would fall squarely into the "pile on workaround on workaround"
category I mentioned above.

> Maybe for git this doesn't matter but for some projects I've worked on
> the time to dlopen() a library was a blocking issue that the above
> procedure solved nicely.

Sure, sometimes you cannot control whether it is an ill-designed `.so` you
need to consume.

As far as Git is concerned, this is not the case. At least when you look
at libgit.

When you look at libcurl, it is a different matter. But then, we do not
need to play RPATH games there: we expect it to be in the system's
preferred location.

BTW Duy hinted at problems with libcurl that made us split apart
`git-remote-https` from the main `git` executable. The full story is here:

1. The Linus complained about some "crazy" shared library loading behavior
   five months before Christmas 2009:

   https://public-inbox.org/git/alpine.LFD.2.01.0907241349390.3960@localhost.localdomain/

2. Daniel Barkalow was working on some "foreign VCS" support and thought
   that HTTPS/HTTP support could be handled via the same route, to avoid
   having to load libcurl for every Git operation no matter what:

   https://public-inbox.org/git/alpine.LNX.2.00.0907242242310.2147@iabervon.org/

3. Daniel then sent a patch series about two weeks later:

   https://public-inbox.org/git/alpine.LNX.2.00.0908050052390.2147@iabervon.org/

4. Those patches were accepted via cd03eebbfdae (Merge branch
   'db/vcs-helper', 2009-09-13)

So yes, I think that a patch or patch series to turn libgit.a into
libgit.so would need to be crafted *very* carefully, and _in the least_
offer a sound performance analysis in the commit messages.

It would obviously need to be proven beyond doubt that the startup time
does not deteriorate noticeably, otherwise the patch (series) would likely
be rejected.

Ciao,
Johannes

^ permalink raw reply	[relevance 8%]

* [PATCH v5 2/3] git-std-lib: introduce Git Standard Library
  @ 2024-02-22 17:50  9% ` Calvin Wan
    0 siblings, 1 reply; 200+ results
From: Calvin Wan @ 2024-02-22 17:50 UTC (permalink / raw)
  To: git; +Cc: Calvin Wan, Jonathan Tan, phillip.wood123, Junio C Hamano

This commit contains:
- Makefile rules for git-std-lib.a
- code and Makefile rules for git-stub-lib.a
- description and rationale of the above in Documentation/

Quoting from documentation introduced in this commit:

  The Git Standard Library intends to serve as the foundational library
  and root dependency that other libraries in Git will be built off
  of. That is to say, suppose we have libraries X and Y; a user that
  wants to use X and Y would need to include X, Y, and this Git Standard
  Library.

Code demonstrating the use of git-std-lib.a and git-stub-lib.a will be
in a subsequent commit.

Signed-off-by: Calvin Wan <calvinwan@google.com>
Helped-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 Documentation/Makefile                  |   1 +
 Documentation/technical/git-std-lib.txt | 170 ++++++++++++++++++++++++
 Makefile                                |  48 +++++--
 stubs/misc.c                            |  33 +++++
 stubs/pager.c                           |   6 +
 stubs/trace2.c                          |  27 ++++
 6 files changed, 274 insertions(+), 11 deletions(-)
 create mode 100644 Documentation/technical/git-std-lib.txt
 create mode 100644 stubs/misc.c
 create mode 100644 stubs/pager.c
 create mode 100644 stubs/trace2.c

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 3f2383a12c..f1dc673838 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -110,6 +110,7 @@ TECH_DOCS += SubmittingPatches
 TECH_DOCS += ToolsForGit
 TECH_DOCS += technical/bitmap-format
 TECH_DOCS += technical/bundle-uri
+TECH_DOCS += technical/git-std-lib
 TECH_DOCS += technical/hash-function-transition
 TECH_DOCS += technical/long-running-process-protocol
 TECH_DOCS += technical/multi-pack-index
diff --git a/Documentation/technical/git-std-lib.txt b/Documentation/technical/git-std-lib.txt
new file mode 100644
index 0000000000..3d9aa121ac
--- /dev/null
+++ b/Documentation/technical/git-std-lib.txt
@@ -0,0 +1,170 @@
+= Git Standard Library
+
+The Git Standard Library intends to serve as the foundational library
+and root dependency that other libraries in Git will be built off of.
+That is to say, suppose we have libraries X and Y; a user that wants to
+use X and Y would need to include X, Y, and this Git Standard Library.
+This does not mean that the Git Standard Library will be the only
+possible root dependency in the future, but rather the most significant
+and widely used one. Git itself is also built off of the Git Standard
+Library.
+
+== Dependency graph in libified Git
+
+Before the introduction of the Git Standard Library, all objects defined
+in the Git library are compiled and archived into a singular file,
+libgit.a, which is then linked against by common-main.o with other
+external dependencies and turned into the Git executable. In other
+words, the Git executable has dependencies on libgit.a and a couple of
+external libraries. The libfication of Git slightly alters this build
+flow by separating out libgit.a into libgit.a and git-std-lib.a. 
+
+With our current method of building Git, we can imagine the dependency
+graph as such:
+
+	Git
+	 /\
+	/  \
+       /    \
+  libgit.a   ext deps
+
+We want to separate out potential libraries from libgit.a and have
+libgit.a depend on them, which would possibly look like:
+
+		Git
+		/\
+	       /  \
+	      /    \
+	  libgit.a  ext deps
+	     /\
+	    /  \
+	   /    \
+object-store.a  (other lib)
+      |        /
+      |       /
+      |      /
+      |     /
+      |    /
+      |   /
+      |  /
+git-std-lib.a
+
+Instead of containing all objects in Git, libgit.a would contain objects
+that are not built by libraries it links against. Consequently, if
+someone wanted a custom build of Git with a custom implementation of the
+object store, they would only have to swap out object-store.a rather
+than do a hard fork of Git.
+
+== Rationale behind Git Standard Library
+
+The rationale behind the selected object files in the Git Standard
+Library is the result of two observations within the Git
+codebase:
+  1. every file includes git-compat-util.h which defines functions
+     in a couple of different files
+  2. wrapper.c + usage.c have difficult-to-separate circular
+     dependencies with each other and other files.
+
+=== Ubiquity of git-compat-util.h and circular dependencies
+
+Every file in the Git codebase includes git-compat-util.h. It serves as
+"a compatibility aid that isolates the knowledge of platform specific
+inclusion order and what feature macros to define before including which
+system header" (Junio[1]). Since every file includes git-compat-util.h,
+and git-compat-util.h includes wrapper.h and usage.h, it would make
+sense for wrapper.c and usage.c to be a part of the root library. They
+have difficult to separate circular dependencies with each other so it
+would impractical for them to be independent libraries. Wrapper.c has
+dependencies on parse.c, abspath.c, strbuf.c, which in turn also have
+dependencies on usage.c and wrapper.c - more circular dependencies.
+
+=== Tradeoff between swappability and refactoring
+
+From the above dependency graph, we can see that git-std-lib.a could be
+many smaller libraries rather than a singular library. So why choose a
+singular library when multiple libraries can be individually easier to
+swap and are more modular? A singular library requires less work to
+separate out circular dependencies within itself so it becomes a
+tradeoff question between work and reward. While there may be a point in
+the future where a file like usage.c would want its own library so that
+someone can have custom die() or error(), the work required to refactor
+out the circular dependencies in some files would be enormous due to
+their ubiquity so therefore I believe it is not worth the tradeoff
+currently. Additionally, we can in the future choose to do this refactor
+and change the API for the library if there becomes enough of a reason
+to do so (remember we are avoiding promising stability of the interfaces
+of those libraries).
+
+=== Reuse of compatibility functions in git-compat-util.h
+
+Most functions defined in git-compat-util.h are implemented in compat/
+and have dependencies limited to strbuf.h and wrapper.h so they can be
+easily included in git-std-lib.a, which as a root dependency means that
+higher level libraries do not have to worry about compatibility files in
+compat/. The rest of the functions defined in git-compat-util.h are
+implemented in top level files and are hidden behind
+an #ifdef if their implementation is not in git-std-lib.a.
+
+=== Rationale summary
+
+The Git Standard Library allows us to get the libification ball rolling
+with other libraries in Git. By not spending many more months attempting
+to refactor difficult circular dependencies and instead spending that
+time getting to a state where we can test out swapping a library out
+such as config or object store, we can prove the viability of Git
+libification on a much faster time scale. Additionally the code cleanups
+that have happened so far have been minor and beneficial for the
+codebase. It is probable that making large movements would negatively
+affect code clarity.
+
+== Git Standard Library boundary
+
+While I have described above some useful heuristics for identifying
+potential candidates for git-std-lib.a, a standard library should not
+have a shaky definition for what belongs in it.
+
+ - Low-level files (aka operates only on other primitive types) that are
+   used everywhere within the codebase (wrapper.c, usage.c, strbuf.c)
+   - Dependencies that are low-level and widely used
+     (abspath.c, date.c, hex-ll.c, parse.c, utf8.c)
+ - low-level git/* files with functions defined in git-compat-util.h
+   (ctype.c)
+ - compat/*
+
+There are other files that might fit this definition, but that does not
+mean it should belong in git-std-lib.a. Those files should start as
+their own separate library since any file added to git-std-lib.a loses
+its flexibility of being easily swappable.
+
+Wrapper.c and usage.c have dependencies on pager and trace2 that are
+possible to remove at the cost of sacrificing the ability for standard Git
+to be able to trace functions in those files and other files in git-std-lib.a.
+In order for git-std-lib.a to compile with those dependencies, stubbed out
+versions of those files are implemented and swapped in during compilation time
+(see STUB_LIB_OBJS in the Makefile).
+
+== Files inside of Git Standard Library
+
+The set of files in git-std-lib.a can be found in STD_LIB_OBJS and COMPAT_OBJS
+in the Makefile.
+
+When these files are compiled together with the files in STUB_LIB_OBJS (or
+user-provided files that provide the same functions), they form a complete
+library.
+
+== Pitfalls
+
+There are a small amount of files under compat/* that have dependencies
+not inside of git-std-lib.a. While those functions are not called on
+Linux, other OSes might call those problematic functions. I don't see
+this as a major problem, just moreso an observation that libification in
+general may also require some minor compatibility work in the future.
+
+== Testing
+
+Unit tests should catch any breakages caused by changes to files in
+git-std-lib.a (i.e. introduction of a out of scope dependency) and new
+functions introduced to git-std-lib.a will require unit tests written
+for them.
+
+[1] https://lore.kernel.org/git/xmqqwn17sydw.fsf@gitster.g/
diff --git a/Makefile b/Makefile
index 4e255c81f2..d37ea9d34b 100644
--- a/Makefile
+++ b/Makefile
@@ -669,6 +669,8 @@ FUZZ_PROGRAMS =
 GIT_OBJS =
 LIB_OBJS =
 SCALAR_OBJS =
+STD_LIB_OBJS =
+STUB_LIB_OBJS =
 OBJECTS =
 OTHER_PROGRAMS =
 PROGRAM_OBJS =
@@ -923,6 +925,8 @@ TEST_SHELL_PATH = $(SHELL_PATH)
 
 LIB_FILE = libgit.a
 XDIFF_LIB = xdiff/lib.a
+STD_LIB_FILE = git-std-lib.a
+STUB_LIB_FILE = git-stub-lib.a
 REFTABLE_LIB = reftable/libreftable.a
 REFTABLE_TEST_LIB = reftable/libreftable_test.a
 
@@ -962,7 +966,6 @@ COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
 
 LIB_H = $(FOUND_H_SOURCES)
 
-LIB_OBJS += abspath.o
 LIB_OBJS += add-interactive.o
 LIB_OBJS += add-patch.o
 LIB_OBJS += advice.o
@@ -1004,8 +1007,6 @@ LIB_OBJS += convert.o
 LIB_OBJS += copy.o
 LIB_OBJS += credential.o
 LIB_OBJS += csum-file.o
-LIB_OBJS += ctype.o
-LIB_OBJS += date.o
 LIB_OBJS += decorate.o
 LIB_OBJS += delta-islands.o
 LIB_OBJS += diagnose.o
@@ -1046,7 +1047,6 @@ LIB_OBJS += hash-lookup.o
 LIB_OBJS += hashmap.o
 LIB_OBJS += help.o
 LIB_OBJS += hex.o
-LIB_OBJS += hex-ll.o
 LIB_OBJS += hook.o
 LIB_OBJS += ident.o
 LIB_OBJS += json-writer.o
@@ -1097,7 +1097,6 @@ LIB_OBJS += pack-write.o
 LIB_OBJS += packfile.o
 LIB_OBJS += pager.o
 LIB_OBJS += parallel-checkout.o
-LIB_OBJS += parse.o
 LIB_OBJS += parse-options-cb.o
 LIB_OBJS += parse-options.o
 LIB_OBJS += patch-delta.o
@@ -1152,7 +1151,6 @@ LIB_OBJS += sparse-index.o
 LIB_OBJS += split-index.o
 LIB_OBJS += stable-qsort.o
 LIB_OBJS += statinfo.o
-LIB_OBJS += strbuf.o
 LIB_OBJS += streaming.o
 LIB_OBJS += string-list.o
 LIB_OBJS += strmap.o
@@ -1189,21 +1187,32 @@ LIB_OBJS += unpack-trees.o
 LIB_OBJS += upload-pack.o
 LIB_OBJS += url.o
 LIB_OBJS += urlmatch.o
-LIB_OBJS += usage.o
 LIB_OBJS += userdiff.o
-LIB_OBJS += utf8.o
 LIB_OBJS += varint.o
 LIB_OBJS += version.o
 LIB_OBJS += versioncmp.o
 LIB_OBJS += walker.o
 LIB_OBJS += wildmatch.o
 LIB_OBJS += worktree.o
-LIB_OBJS += wrapper.o
 LIB_OBJS += write-or-die.o
 LIB_OBJS += ws.o
 LIB_OBJS += wt-status.o
 LIB_OBJS += xdiff-interface.o
 
+STD_LIB_OBJS += abspath.o
+STD_LIB_OBJS += ctype.o
+STD_LIB_OBJS += date.o
+STD_LIB_OBJS += hex-ll.o
+STD_LIB_OBJS += parse.o
+STD_LIB_OBJS += strbuf.o
+STD_LIB_OBJS += usage.o
+STD_LIB_OBJS += utf8.o
+STD_LIB_OBJS += wrapper.o
+
+STUB_LIB_OBJS += stubs/trace2.o
+STUB_LIB_OBJS += stubs/pager.o
+STUB_LIB_OBJS += stubs/misc.o
+
 BUILTIN_OBJS += builtin/add.o
 BUILTIN_OBJS += builtin/am.o
 BUILTIN_OBJS += builtin/annotate.o
@@ -1352,7 +1361,7 @@ UNIT_TEST_OBJS = $(patsubst %,$(UNIT_TEST_DIR)/%.o,$(UNIT_TEST_PROGRAMS))
 UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o
 
 # xdiff and reftable libs may in turn depend on what is in libgit.a
-GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE)
+GITLIBS = common-main.o $(STD_LIB_FILE) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE)
 EXTLIBS =
 
 GIT_USER_AGENT = git/$(GIT_VERSION)
@@ -2693,6 +2702,8 @@ OBJECTS += $(XDIFF_OBJS)
 OBJECTS += $(FUZZ_OBJS)
 OBJECTS += $(REFTABLE_OBJS) $(REFTABLE_TEST_OBJS)
 OBJECTS += $(UNIT_TEST_OBJS)
+OBJECTS += $(STD_LIB_OBJS)
+OBJECTS += $(STUB_LIB_OBJS)
 
 ifndef NO_CURL
 	OBJECTS += http.o http-walker.o remote-curl.o
@@ -3686,7 +3697,7 @@ clean: profile-clean coverage-clean cocciclean
 	$(RM) git.res
 	$(RM) $(OBJECTS)
 	$(RM) headless-git.o
-	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
+	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB) $(STD_LIB_FILE) $(STUB_LIB_FILE)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS)
 	$(RM) $(TEST_PROGRAMS)
 	$(RM) $(FUZZ_PROGRAMS)
@@ -3878,3 +3889,18 @@ $(UNIT_TEST_PROGS): $(UNIT_TEST_BIN)/%$X: $(UNIT_TEST_DIR)/%.o $(UNIT_TEST_DIR)/
 build-unit-tests: $(UNIT_TEST_PROGS)
 unit-tests: $(UNIT_TEST_PROGS)
 	$(MAKE) -C t/ unit-tests
+
+### Libified Git rules
+
+# git-std-lib.a
+# Programs other than git should compile this with
+#     make NO_GETTEXT=YesPlease git-std-lib.a
+# and link against git-stub-lib.a (if the default no-op functionality is fine)
+# or a custom .a file with the same interface as git-stub-lib.a (if custom
+# functionality is needed) as well.
+$(STD_LIB_FILE): $(STD_LIB_OBJS) $(COMPAT_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
+
+# git-stub-lib.a
+$(STUB_LIB_FILE): $(STUB_LIB_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
diff --git a/stubs/misc.c b/stubs/misc.c
new file mode 100644
index 0000000000..92da76fd46
--- /dev/null
+++ b/stubs/misc.c
@@ -0,0 +1,33 @@
+#include <assert.h>
+#include <stdlib.h>
+
+#ifndef NO_GETTEXT
+/*
+ * NEEDSWORK: This is enough to link our unit tests against
+ * git-std-lib.a built with gettext support. We don't really support
+ * programs other than git using git-std-lib.a with gettext support
+ * yet. To do that we need to start using dgettext() rather than
+ * gettext() in our code.
+ */
+int git_gettext_enabled = 0;
+#endif
+
+int common_exit(const char *file, int line, int code);
+
+int common_exit(const char *file, int line, int code)
+{
+	exit(code);
+}
+
+#if !defined(__MINGW32__) && !defined(_MSC_VER)
+int lstat_cache_aware_rmdir(const char *path);
+
+int lstat_cache_aware_rmdir(const char *path)
+{
+	/*
+	 * This function should not be called by programs linked
+	 * against git-stub-lib.a
+	 */
+	assert(0);
+}
+#endif
diff --git a/stubs/pager.c b/stubs/pager.c
new file mode 100644
index 0000000000..4f575cada7
--- /dev/null
+++ b/stubs/pager.c
@@ -0,0 +1,6 @@
+#include "pager.h"
+
+int pager_in_use(void)
+{
+	return 0;
+}
diff --git a/stubs/trace2.c b/stubs/trace2.c
new file mode 100644
index 0000000000..7d89482228
--- /dev/null
+++ b/stubs/trace2.c
@@ -0,0 +1,27 @@
+#include "git-compat-util.h"
+#include "trace2.h"
+
+struct child_process { int stub; };
+struct repository { int stub; };
+struct json_writer { int stub; };
+
+void trace2_region_enter_fl(const char *file, int line, const char *category,
+			    const char *label, const struct repository *repo, ...) { }
+void trace2_region_leave_fl(const char *file, int line, const char *category,
+			    const char *label, const struct repository *repo, ...) { }
+void trace2_data_string_fl(const char *file, int line, const char *category,
+			   const struct repository *repo, const char *key,
+			   const char *value) { }
+void trace2_cmd_ancestry_fl(const char *file, int line, const char **parent_names) { }
+void trace2_cmd_error_va_fl(const char *file, int line, const char *fmt,
+			    va_list ap) { }
+void trace2_cmd_name_fl(const char *file, int line, const char *name) { }
+void trace2_thread_start_fl(const char *file, int line,
+			    const char *thread_base_name) { }
+void trace2_thread_exit_fl(const char *file, int line) { }
+void trace2_data_intmax_fl(const char *file, int line, const char *category,
+			   const struct repository *repo, const char *key,
+			   intmax_t value) { }
+int trace2_is_enabled(void) { return 0; }
+void trace2_counter_add(enum trace2_counter_id cid, uint64_t value) { }
+void trace2_collect_process_info(enum trace2_process_info_reason reason) { }
-- 
2.44.0.rc0.258.g7320e95886-goog



^ permalink raw reply related	[relevance 9%]

* [RFC PATCH 00/10] Add blame to libgit
@ 2017-05-05  5:27  9% Jeff Smith
  2017-05-14  3:14 10% ` [RFC PATCH v2 00/22] " Jeff Smith
  0 siblings, 1 reply; 200+ results
From: Jeff Smith @ 2017-05-05  5:27 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Jeff Smith

In adding blame functionality to cgit, I do not wish to duplicate huge
portions of builtin/blame.c there.  I would rather shift its core
functionality into libgit.a -- which cgit already uses -- and in cgit I
can focus on the web presentation aspect.

I was able to split three separate cohesive pieces from blame.c into
libgit.  The functionality left in blame.c mostly relates to terminal
presentation.

Jeff Smith (10):
  Remove unneeded dependency on blob.h from blame
  Move textconv_object to be with other textconv methods
  Add some missing definitions to header files
  Remove unused parameter from get_origin()
  Split blame origin into its own file
  Move fake_working_tree_commit() to lib
  Break out scoreboard a little better
  Split blame scoreboard into its own file
  Break out scoreboard init and setup
  Move scoreboard init and setup to lib

 Makefile           |    3 +
 builtin.h          |    2 -
 builtin/blame.c    | 2045 ++--------------------------------------------------
 builtin/cat-file.c |    1 +
 commit-fake.c      |  200 +++++
 commit-fake.h      |    9 +
 diff.c             |   23 +
 diff.h             |    7 +
 object.h           |    2 +
 origin.c           |   62 ++
 origin.h           |  101 +++
 pathspec.h         |    4 +
 refs.h             |    3 +
 scoreboard.c       | 1569 ++++++++++++++++++++++++++++++++++++++++
 scoreboard.h       |   77 ++
 tree-walk.h        |    2 +
 16 files changed, 2108 insertions(+), 2002 deletions(-)
 create mode 100644 commit-fake.c
 create mode 100644 commit-fake.h
 create mode 100644 origin.c
 create mode 100644 origin.h
 create mode 100644 scoreboard.c
 create mode 100644 scoreboard.h

-- 
2.9.3


^ permalink raw reply	[relevance 9%]

* [PATCH] Link git-shell only to a subset of libgit.a
  @ 2008-07-18  1:04  9% ` Stephan Beyer
  0 siblings, 0 replies; 200+ results
From: Stephan Beyer @ 2008-07-18  1:04 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Dmitry Potapov, Junio C Hamano, git, Stephan Beyer

Commit 5b8e6f85 introduced stubs for three functions that make no sense
for git-shell. But those stubs defined libgit.a functions a second time
so that a linker can complain.

Now git-shell is only linked to a subset of libgit.a.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---
Hi Shawn,

does this compile on Solaris?


For Dmitry: this is even smaller, but not significant ;-)

Before:
  text    data     bss     dec     hex filename
 24798    1304    8232   34334    861e git-shell

After:
   text    data     bss     dec     hex filename
  24504    1264    8248   34016    84e0 git-shell

*hide&run*
Stephan.

 Makefile |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 4bec4b3..a5626dc 100644
--- a/Makefile
+++ b/Makefile
@@ -1204,6 +1204,9 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 
+git-shell$X: compat/strlcpy.o abspath.o ctype.o exec_cmd.o quote.o strbuf.o usage.o wrapper.o shell.o
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^)
+
 $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
 $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
 builtin-revert.o wt-status.o: wt-status.h
-- 
1.5.6.3.390.g7b30

^ permalink raw reply related	[relevance 9%]

* thread-safe libgit.a as a GSoC project, was Re: [SoC RFC] libsvn-fs-git: A git backend for the subversion filesystem
  @ 2008-03-22 11:35  9%   ` Johannes Schindelin
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2008-03-22 11:35 UTC (permalink / raw)
  To: Bryan Donlan
  Cc: git, Sam Vilain, Shawn O. Pearce, Harvey Harrison,
	Julian Phillips, Jakub Narebski

Hi,

On Sat, 22 Mar 2008, Bryan Donlan wrote:

> On Wed, Mar 19, 2008 at 12:08 AM, Bryan Donlan <bdonlan@gmail.com> wrote:
>
> >  I'm planning to apply for the git summer of code project. My proposal 
> >  is based on the project idea of a subversion gateway for git, 
> >  implemented with a new subversion filesystem layer. A draft of my 
> >  proposal follows; I'd appreciate any comments/questions on it before 
> >  the application period proper begins.
> 
> Thanks for all the comments. To try to avoid spamming the list, I've
> replied in a single message, if it'd be better to reply individually
> in the future please let me know.

My preference is to have single replies, possibly changing the subject 
("xyz, was Re: blabla"), but it is maybe just me.

> Also, after looking at libgit in a bit more detail, I think it might be 
> necessary to not use it after all, as subversion requires support for 
> multiple open repositories, as well as thread safety (at least when 
> accessing different open repo from different threads). Perhaps a 
> thread-safe git library would be a nice SoC project as well?

As I said on IRC yesterday, I think that such a libgit.a would be nice, 
_but_

- a lot of git programs expect to be one-shot, and libgit.a shows that,

- not many people will help you with your effort, but just ignore it and 
  actively introduce things that do not help libification (at least that's 
  my experience),

- unless you have a proper need for such a library, I do not think there 
  is enough motivation to actually get it to completion.

I once thought that libification would be nice, and important, but as I do 
not need it myself, I reversed my opinion.

Ciao,
Dscho

^ permalink raw reply	[relevance 9%]

* [PATCH v2 03/13] vcxproj: adjust for the reftable changes
  @ 2020-10-01 16:10  9%   ` Johannes Schindelin via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-10-01 16:10 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Jeff King, Han-Wen Nienhuys,
	Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This allows Git to be compiled via Visual Studio again after integrating
the `hn/reftable` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname                           |  2 +-
 contrib/buildsystems/Generators/Vcxproj.pm | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index c7eba69e54..ae4e25a1a4 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -709,7 +709,7 @@ vcxproj:
 	# Make .vcxproj files and add them
 	unset QUIET_GEN QUIET_BUILT_IN; \
 	perl contrib/buildsystems/generate -g Vcxproj
-	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+	git add -f git.sln {*,*/lib,*/libreftable,t/helper/*}/*.vcxproj
 
 	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
 	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index d2584450ba..1a25789d28 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libexpat\.lib/libexpatd\.lib/g;
@@ -232,6 +232,7 @@ sub createProject {
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -241,6 +242,14 @@ sub createProject {
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
-- 
gitgitgadget


^ permalink raw reply related	[relevance 9%]

* [PATCH v2] contrib/svn-fe: fix Makefile
@ 2014-08-28 17:00  9% Maxim Bublis
  0 siblings, 0 replies; 200+ results
From: Maxim Bublis @ 2014-08-28 17:00 UTC (permalink / raw)
  To: git; +Cc: Torsten Bögershausen, Maxim Bublis

Fixes several problems:
  * include config.mak.uname, config.mak.autogen and config.mak
    in order to use settings for prefix and other such things;
  * link xdiff/lib.a as it is a requirement for libgit.a;
  * fix CFLAGS, LDFLAGS and EXTLIBS for Linux and Mac OS X.

Signed-off-by: Maxim Bublis <satori@yandex-team.ru>
---
Changes from previous version:
  * added possibility to disable MacPorts and Fink;
  * respecting NEEDS_CRYPTO_WITH_SSL.
 contrib/svn-fe/Makefile | 60 +++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 51 insertions(+), 9 deletions(-)

diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
index 360d8da..e8651aa 100644
--- a/contrib/svn-fe/Makefile
+++ b/contrib/svn-fe/Makefile
@@ -1,18 +1,58 @@
 all:: svn-fe$X
 
-CC = gcc
+CC = cc
 RM = rm -f
 MV = mv
 
 CFLAGS = -g -O2 -Wall
 LDFLAGS =
-ALL_CFLAGS = $(CFLAGS)
-ALL_LDFLAGS = $(LDFLAGS)
-EXTLIBS =
+EXTLIBS = -lz
+
+include ../../config.mak.uname
+-include ../../config.mak.autogen
+-include ../../config.mak
+
+ifeq ($(uname_S),Darwin)
+	ifndef NO_FINK
+		ifeq ($(shell test -d /sw/lib && echo y),y)
+			CFLAGS += -I/sw/include
+			LDFLAGS += -L/sw/lib
+		endif
+	endif
+	ifndef NO_DARWIN_PORTS
+		ifeq ($(shell test -d /opt/local/lib && echo y),y)
+			CFLAGS += -I/opt/local/include
+			LDFLAGS += -L/opt/local/lib
+		endif
+	endif
+endif
+
+ifndef NO_OPENSSL
+	EXTLIBS += -lssl
+	ifdef NEEDS_CRYPTO_WITH_SSL
+		EXTLIBS += -lcrypto
+	endif
+endif
+
+ifndef NO_PTHREADS
+	CFLAGS += $(PTHREADS_CFLAGS)
+	EXTLIBS += $(PTHREAD_LIBS)
+endif
+
+ifdef HAVE_CLOCK_GETTIME
+	CFLAGS += -DHAVE_CLOCK_GETTIME
+	EXTLIBS += -lrt
+endif
+
+ifdef NEEDS_LIBICONV
+	EXTLIBS += -liconv
+endif
 
 GIT_LIB = ../../libgit.a
 VCSSVN_LIB = ../../vcs-svn/lib.a
-LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(EXTLIBS)
+XDIFF_LIB = ../../xdiff/lib.a
+
+LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(XDIFF_LIB)
 
 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
 QUIET_SUBDIR1 =
@@ -33,12 +73,11 @@ ifndef V
 endif
 endif
 
-svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(GIT_LIB)
-	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ svn-fe.o \
-		$(ALL_LDFLAGS) $(LIBS)
+svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(XDIFF_LIB) $(GIT_LIB)
+	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(EXTLIBS) -o $@ svn-fe.o $(LIBS)
 
 svn-fe.o: svn-fe.c ../../vcs-svn/svndump.h
-	$(QUIET_CC)$(CC) -I../../vcs-svn -o $*.o -c $(ALL_CFLAGS) $<
+	$(QUIET_CC)$(CC) $(CFLAGS) -I../../vcs-svn -o $*.o -c $<
 
 svn-fe.html: svn-fe.txt
 	$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
@@ -54,6 +93,9 @@ svn-fe.1: svn-fe.txt
 ../../vcs-svn/lib.a: FORCE
 	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) vcs-svn/lib.a
 
+../../xdiff/lib.a: FORCE
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) xdiff/lib.a
+
 ../../libgit.a: FORCE
 	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
 
-- 
1.8.5.2 (Apple Git-48)

^ permalink raw reply related	[relevance 9%]

* [PATCH 6/6] vcxproj: adjust for the reftable changes
  @ 2020-05-04 13:31  9% ` Johannes Schindelin via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-05-04 13:31 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This allows Git to be compiled via Visual Studio again after integrating
the `hn/reftable` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname                           |  2 +-
 contrib/buildsystems/Generators/Vcxproj.pm | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 0ab8e009383..8a01a0da3f1 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -700,7 +700,7 @@ vcxproj:
 	# Make .vcxproj files and add them
 	unset QUIET_GEN QUIET_BUILT_IN; \
 	perl contrib/buildsystems/generate -g Vcxproj
-	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+	git add -f git.sln {*,*/lib,*/libreftable,t/helper/*}/*.vcxproj
 
 	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
 	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index 5c666f9ac03..33a08d31652 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libcurl\.lib/libcurl-d\.lib/g;
@@ -231,6 +231,7 @@ sub createProject {
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -240,6 +241,14 @@ sub createProject {
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
-- 
gitgitgadget

^ permalink raw reply related	[relevance 9%]

* [PATCH v13 12/13] vcxproj: adjust for the reftable changes
  @ 2020-05-11 19:46  9%       ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-05-11 19:46 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This allows Git to be compiled via Visual Studio again after integrating
the `hn/reftable` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname                           |  2 +-
 contrib/buildsystems/Generators/Vcxproj.pm | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 5ad43c80b1a..484aec15ac2 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -710,7 +710,7 @@ vcxproj:
 	# Make .vcxproj files and add them
 	unset QUIET_GEN QUIET_BUILT_IN; \
 	perl contrib/buildsystems/generate -g Vcxproj
-	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+	git add -f git.sln {*,*/lib,*/libreftable,t/helper/*}/*.vcxproj
 
 	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
 	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index 5c666f9ac03..33a08d31652 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libcurl\.lib/libcurl-d\.lib/g;
@@ -231,6 +231,7 @@ sub createProject {
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -240,6 +241,14 @@ sub createProject {
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
-- 
gitgitgadget


^ permalink raw reply related	[relevance 9%]

* [PATCH v17 15/17] vcxproj: adjust for the reftable changes
  @ 2020-06-16 19:20  9%               ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-06-16 19:20 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This allows Git to be compiled via Visual Studio again after integrating
the `hn/reftable` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname                           |  2 +-
 contrib/buildsystems/Generators/Vcxproj.pm | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index c7eba69e54e..ae4e25a1a42 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -709,7 +709,7 @@ vcxproj:
 	# Make .vcxproj files and add them
 	unset QUIET_GEN QUIET_BUILT_IN; \
 	perl contrib/buildsystems/generate -g Vcxproj
-	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+	git add -f git.sln {*,*/lib,*/libreftable,t/helper/*}/*.vcxproj
 
 	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
 	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index 5c666f9ac03..33a08d31652 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libcurl\.lib/libcurl-d\.lib/g;
@@ -231,6 +231,7 @@ sub createProject {
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -240,6 +241,14 @@ sub createProject {
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
-- 
gitgitgadget


^ permalink raw reply related	[relevance 9%]

* [PATCH v16 13/14] vcxproj: adjust for the reftable changes
  @ 2020-06-05 18:03  9%             ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-06-05 18:03 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This allows Git to be compiled via Visual Studio again after integrating
the `hn/reftable` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname                           |  2 +-
 contrib/buildsystems/Generators/Vcxproj.pm | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index c7eba69e54e..ae4e25a1a42 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -709,7 +709,7 @@ vcxproj:
 	# Make .vcxproj files and add them
 	unset QUIET_GEN QUIET_BUILT_IN; \
 	perl contrib/buildsystems/generate -g Vcxproj
-	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+	git add -f git.sln {*,*/lib,*/libreftable,t/helper/*}/*.vcxproj
 
 	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
 	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index 5c666f9ac03..33a08d31652 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libcurl\.lib/libcurl-d\.lib/g;
@@ -231,6 +231,7 @@ sub createProject {
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -240,6 +241,14 @@ sub createProject {
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
-- 
gitgitgadget


^ permalink raw reply related	[relevance 9%]

* [PATCH v15 12/13] vcxproj: adjust for the reftable changes
  @ 2020-05-28 19:46  9%           ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-05-28 19:46 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This allows Git to be compiled via Visual Studio again after integrating
the `hn/reftable` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname                           |  2 +-
 contrib/buildsystems/Generators/Vcxproj.pm | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index c7eba69e54e..ae4e25a1a42 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -709,7 +709,7 @@ vcxproj:
 	# Make .vcxproj files and add them
 	unset QUIET_GEN QUIET_BUILT_IN; \
 	perl contrib/buildsystems/generate -g Vcxproj
-	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+	git add -f git.sln {*,*/lib,*/libreftable,t/helper/*}/*.vcxproj
 
 	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
 	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index 5c666f9ac03..33a08d31652 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libcurl\.lib/libcurl-d\.lib/g;
@@ -231,6 +231,7 @@ sub createProject {
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -240,6 +241,14 @@ sub createProject {
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
-- 
gitgitgadget


^ permalink raw reply related	[relevance 9%]

* [PATCH v14 8/9] vcxproj: adjust for the reftable changes
  @ 2020-05-18 20:31  9%         ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-05-18 20:31 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This allows Git to be compiled via Visual Studio again after integrating
the `hn/reftable` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname                           |  2 +-
 contrib/buildsystems/Generators/Vcxproj.pm | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 5ad43c80b1a..484aec15ac2 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -710,7 +710,7 @@ vcxproj:
 	# Make .vcxproj files and add them
 	unset QUIET_GEN QUIET_BUILT_IN; \
 	perl contrib/buildsystems/generate -g Vcxproj
-	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+	git add -f git.sln {*,*/lib,*/libreftable,t/helper/*}/*.vcxproj
 
 	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
 	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index 5c666f9ac03..33a08d31652 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libcurl\.lib/libcurl-d\.lib/g;
@@ -231,6 +231,7 @@ sub createProject {
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -240,6 +241,14 @@ sub createProject {
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
-- 
gitgitgadget


^ permalink raw reply related	[relevance 9%]

* [PATCH v18 16/19] vcxproj: adjust for the reftable changes
  @ 2020-06-22 21:55  9%                 ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-06-22 21:55 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This allows Git to be compiled via Visual Studio again after integrating
the `hn/reftable` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname                           |  2 +-
 contrib/buildsystems/Generators/Vcxproj.pm | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index c7eba69e54e..ae4e25a1a42 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -709,7 +709,7 @@ vcxproj:
 	# Make .vcxproj files and add them
 	unset QUIET_GEN QUIET_BUILT_IN; \
 	perl contrib/buildsystems/generate -g Vcxproj
-	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+	git add -f git.sln {*,*/lib,*/libreftable,t/helper/*}/*.vcxproj
 
 	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
 	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index 5c666f9ac03..33a08d31652 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libcurl\.lib/libcurl-d\.lib/g;
@@ -231,6 +231,7 @@ sub createProject {
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -240,6 +241,14 @@ sub createProject {
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
-- 
gitgitgadget


^ permalink raw reply related	[relevance 9%]

* [PATCH v12 10/12] vcxproj: adjust for the reftable changes
  @ 2020-05-07  9:59  9%     ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-05-07  9:59 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This allows Git to be compiled via Visual Studio again after integrating
the `hn/reftable` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname                           |  2 +-
 contrib/buildsystems/Generators/Vcxproj.pm | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 5ad43c80b1a..484aec15ac2 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -710,7 +710,7 @@ vcxproj:
 	# Make .vcxproj files and add them
 	unset QUIET_GEN QUIET_BUILT_IN; \
 	perl contrib/buildsystems/generate -g Vcxproj
-	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+	git add -f git.sln {*,*/lib,*/libreftable,t/helper/*}/*.vcxproj
 
 	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
 	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index 5c666f9ac03..33a08d31652 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libcurl\.lib/libcurl-d\.lib/g;
@@ -231,6 +231,7 @@ sub createProject {
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -240,6 +241,14 @@ sub createProject {
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
-- 
gitgitgadget


^ permalink raw reply related	[relevance 9%]

* [PATCH v11 10/12] vcxproj: adjust for the reftable changes
  @ 2020-05-04 19:03  9%   ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-05-04 19:03 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This allows Git to be compiled via Visual Studio again after integrating
the `hn/reftable` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname                           |  2 +-
 contrib/buildsystems/Generators/Vcxproj.pm | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index 5ad43c80b1a..484aec15ac2 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -710,7 +710,7 @@ vcxproj:
 	# Make .vcxproj files and add them
 	unset QUIET_GEN QUIET_BUILT_IN; \
 	perl contrib/buildsystems/generate -g Vcxproj
-	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+	git add -f git.sln {*,*/lib,*/libreftable,t/helper/*}/*.vcxproj
 
 	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
 	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index 5c666f9ac03..33a08d31652 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libcurl\.lib/libcurl-d\.lib/g;
@@ -231,6 +231,7 @@ sub createProject {
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -240,6 +241,14 @@ sub createProject {
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
-- 
gitgitgadget


^ permalink raw reply related	[relevance 9%]

* [PATCH v19 17/20] vcxproj: adjust for the reftable changes
  @ 2020-06-29 18:56  9%                   ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-06-29 18:56 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This allows Git to be compiled via Visual Studio again after integrating
the `hn/reftable` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname                           |  2 +-
 contrib/buildsystems/Generators/Vcxproj.pm | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index c7eba69e54..ae4e25a1a4 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -709,7 +709,7 @@ vcxproj:
 	# Make .vcxproj files and add them
 	unset QUIET_GEN QUIET_BUILT_IN; \
 	perl contrib/buildsystems/generate -g Vcxproj
-	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+	git add -f git.sln {*,*/lib,*/libreftable,t/helper/*}/*.vcxproj
 
 	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
 	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index 5c666f9ac0..33a08d3165 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libcurl\.lib/libcurl-d\.lib/g;
@@ -231,6 +231,7 @@ sub createProject {
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -240,6 +241,14 @@ sub createProject {
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
-- 
gitgitgadget


^ permalink raw reply related	[relevance 9%]

* [PATCH v20 18/21] vcxproj: adjust for the reftable changes
  @ 2020-07-31 15:27  9%                     ` Johannes Schindelin via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-07-31 15:27 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This allows Git to be compiled via Visual Studio again after integrating
the `hn/reftable` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname                           |  2 +-
 contrib/buildsystems/Generators/Vcxproj.pm | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index c7eba69e54..ae4e25a1a4 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -709,7 +709,7 @@ vcxproj:
 	# Make .vcxproj files and add them
 	unset QUIET_GEN QUIET_BUILT_IN; \
 	perl contrib/buildsystems/generate -g Vcxproj
-	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+	git add -f git.sln {*,*/lib,*/libreftable,t/helper/*}/*.vcxproj
 
 	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
 	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index 5c666f9ac0..33a08d3165 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libcurl\.lib/libcurl-d\.lib/g;
@@ -231,6 +231,7 @@ sub createProject {
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -240,6 +241,14 @@ sub createProject {
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
-- 
gitgitgadget


^ permalink raw reply related	[relevance 9%]

* [PATCH 03/13] vcxproj: adjust for the reftable changes
  @ 2020-09-16 19:10  9% ` Johannes Schindelin via GitGitGadget
    1 sibling, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-09-16 19:10 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

This allows Git to be compiled via Visual Studio again after integrating
the `hn/reftable` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname                           |  2 +-
 contrib/buildsystems/Generators/Vcxproj.pm | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/config.mak.uname b/config.mak.uname
index c7eba69e54..ae4e25a1a4 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -709,7 +709,7 @@ vcxproj:
 	# Make .vcxproj files and add them
 	unset QUIET_GEN QUIET_BUILT_IN; \
 	perl contrib/buildsystems/generate -g Vcxproj
-	git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj
+	git add -f git.sln {*,*/lib,*/libreftable,t/helper/*}/*.vcxproj
 
 	# Generate the LinkOrCopyBuiltins.targets and LinkOrCopyRemoteHttp.targets file
 	(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm
index d2584450ba..1a25789d28 100644
--- a/contrib/buildsystems/Generators/Vcxproj.pm
+++ b/contrib/buildsystems/Generators/Vcxproj.pm
@@ -77,7 +77,7 @@ sub createProject {
     my $libs_release = "\n    ";
     my $libs_debug = "\n    ";
     if (!$static_library) {
-      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
+      $libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib|reftable\/libreftable\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
       $libs_debug = $libs_release;
       $libs_debug =~ s/zlib\.lib/zlibd\.lib/g;
       $libs_debug =~ s/libexpat\.lib/libexpatd\.lib/g;
@@ -232,6 +232,7 @@ sub createProject {
 EOM
     if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
       my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
+      my $uuid_libreftable = $$build_structure{"LIBS_reftable/libreftable_GUID"};
       my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};
 
       print F << "EOM";
@@ -241,6 +242,14 @@ sub createProject {
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
 EOM
+      if (!($name =~ /xdiff|libreftable/)) {
+        print F << "EOM";
+    <ProjectReference Include="$cdup\\reftable\\libreftable\\libreftable.vcxproj">
+      <Project>$uuid_libreftable</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+EOM
+      }
       if (!($name =~ 'xdiff')) {
         print F << "EOM";
     <ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
-- 
gitgitgadget


^ permalink raw reply related	[relevance 9%]

* Re: linking libgit.a in C++ projects
  2008-07-31 10:57  8% ` Dmitry Potapov
@ 2008-07-31 11:10  9%   ` cte
  2008-07-31 11:16  8%     ` Pedro Melo
    1 sibling, 1 reply; 200+ results
From: cte @ 2008-07-31 11:10 UTC (permalink / raw)
  To: Dmitry Potapov; +Cc: git

On Thu, Jul 31, 2008 at 3:57 AM, Dmitry Potapov <dpotapov@gmail.com> wrote:
> On Thu, Jul 31, 2008 at 02:53:37AM -0700, cte wrote:
>> I'm writing a git gui for OS X using cocoa/Objective-C++, and rather
>> than being lame and parsing the output the various git commands, I'm
>> using libgit.a to provide all of the needed functionality for my app.
>
> Don't do that! libgit.a is an internal library used solely to build
> git binaries. It means that its interface can be cahnged at any time.
> Though, there is an idea of creating the real git library that other
> applications can use, but AFAIK no one is working on it. So parsing
> output is the only correct solution right now. In fact, it is not
> difficult to do, because most plumbing commands are rather flexibly
> in what they output and how.

I'm not worried about the interfaces changing; the gui is tied to a
particular version of git, and I will update the code that calls into
libgit I pull new changes from the mainline into my local clone. Also,
who's to say that the output of the various commands won't change
formats with future releases of git? There is no correct solution if
you are worried about forward compatibility, unless a well defined API
is created (which would be sweet btw, but is probably not a priority).

>> However, the git source uses a few reserved C++ keywords; namely
>> 'typename', and 'new'.
>
> Because this source code are meant to be compiled by C and not by C++!
> Even if we will have real git library for other applications to use,
> it still be compiled only by C. Thus, C++ keywords are not issue.

Clearly ;)

Fortunately, g++ can compile C programs and link static libraries that
were compiled by C compilers, unless of course, they use C++ keywords.
I don't think it is unreasonable to rename the _very few_ C++ keywords
in git's source in the interest of allowing C++ projects to leverage
libgit.

^ permalink raw reply	[relevance 9%]

* Re: Reducing git size by building libgit.so
  2019-06-11 19:52  9% Reducing git size by building libgit.so Elmar Pruesse
@ 2019-06-11 23:48  9% ` brian m. carlson
  2019-06-12  9:29  8%   ` Duy Nguyen
    0 siblings, 2 replies; 200+ results
From: brian m. carlson @ 2019-06-11 23:48 UTC (permalink / raw)
  To: Elmar Pruesse; +Cc: git@vger.kernel.org

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

On 2019-06-11 at 19:52:18, Elmar Pruesse wrote:
> Hi!
> 
> The total compiled size of libexec/git-core is currently somewhere
> around 30 MB. This is largely due to a number of binaries linking
> statically against libgit.a. For some folks, every byte counts. I
> meddled with the Makefile briefly to make it build and use a libgit.so
> instead, which dropped package size down to 5MB.
> 
> Are there, beyond the ~20 ms in extra startup time and the slightly
> bigger hassle with DSO locations, reasons for the choice to link statically?

I think the reason is that libgit is not API stable and we definitely
don't want people linking against it. Before libgit2 existed, projects
like cgit built their own libgit and it required pinning to a specific
version of Git.

Also, some people install Git into their home directories, and a shared
library means that they'll have to use LD_LIBRARY_PATH (or equivalent)
to run Git.

Finally, we have support for a runtime relocatable Git which can be run
out of any path and still automatically find its dependent binaries.
That won't work with a shared library.

So if we did allow for building a shared library, it would have to be an
option that defaulted to off, I think.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 868 bytes --]

^ permalink raw reply	[relevance 9%]

* [ANNOUNCE]: PyGit and libgit-thin
@ 2007-07-23 12:35  9% Luiz Fernando N. Capitulino
  0 siblings, 0 replies; 200+ results
From: Luiz Fernando N. Capitulino @ 2007-07-23 12:35 UTC (permalink / raw)
  To: git, Shawn O. Pearce

Hi there,

I'm the student working on the gsoc libfication project with Shawn and it
has reached the point where I need some feedback in order to decide
what to do next.

The project's goal was/is to change what is needed in GIT in order to make
it easier to use as library. This is useful for 'external'
applications which wants
to be able to perform GIT operations w/o having to fork-exec GIT process (and
also w/o having to parse git's programs output). Example of such applications
are language bindings and IDEs' plugins.

However, the need for this is not a consensus. Some disagree (Linus included
I think) and IIRC Junio has stated that he'd probably be against a stable API.

So, in order to make things simple and have a clear separation of what is
additional interface not needed by GIT we (Shawn and I) have decided to work
on a new library which uses git's low-level interface.

That library is called libgit-thin and currently it's capable of
revision listing,
commit parsing and some other things.

To demonstrate how to use the library, I've also written a python module which
exports to python all the library's functionality.

Now I need to know whether this' really useful to other people and if so, what
would be missing for you to start using it.

The project can be found at:

http://repo.or.cz/w/git/libgit-gsoc.git

Look into the 'libgit-thin' directory. Note that it's a fork of
Junio's tree, so if you have
his repository around do:

$ git clone --reference /path/to/junio/repo git://repo.or.cz/git/libgit-gsoc.git

A demo of the python's module is available here:

http://repo.or.cz/w/git/libgit-gsoc.git?a=blob;f=libgit-thin/pygit/demo.txt;h=f4f9cb726e06ac18a3bf125f3caa7c50dd095361;hb=HEAD

Please, keep in mind that the library's code is still experimental and most of
the python module's code is untested.

It's also important to say that there's no much documentation
available, you'll have
to know a bit about git's implementation for this stuff to be useful for you.

 Thanks a lot for reading this and any kind of feedback is welcome.

-- 
Luiz Fernando N. Capitulino

^ permalink raw reply	[relevance 9%]

* Reducing git size by building libgit.so
@ 2019-06-11 19:52  9% Elmar Pruesse
  2019-06-11 23:48  9% ` brian m. carlson
  0 siblings, 1 reply; 200+ results
From: Elmar Pruesse @ 2019-06-11 19:52 UTC (permalink / raw)
  To: git@vger.kernel.org

Hi!

The total compiled size of libexec/git-core is currently somewhere 
around 30 MB. This is largely due to a number of binaries linking 
statically against libgit.a. For some folks, every byte counts. I 
meddled with the Makefile briefly to make it build and use a libgit.so 
instead, which dropped package size down to 5MB.

Are there, beyond the ~20 ms in extra startup time and the slightly 
bigger hassle with DSO locations, reasons for the choice to link statically?

best,

Elmar


^ permalink raw reply	[relevance 9%]

* Re: [PATCH] add install-lib target to install libgit.a library plus headers.
  @ 2007-02-14 18:24  9% ` Junio C Hamano
  2007-02-14 15:51  8% ` Johannes Schindelin
  1 sibling, 0 replies; 200+ results
From: Junio C Hamano @ 2007-02-14 18:24 UTC (permalink / raw)
  To: Gerrit Pape; +Cc: git

Sorry, but libgit.a is not a publically usable/useful library at
this moment, as its internal API is not cast in stone yet.

Installing it in /usr/lib and /usr/include would give the false
impression to the users that linking with user's programs is
supported and upgrading git won't break them.  Please do not
create libgit-dev package.

^ permalink raw reply	[relevance 9%]

* Re: [PATCH] libgit
  2005-04-17  3:12 10% [PATCH] libgit Mike Taht
@ 2005-04-17  3:46  9% ` Randy.Dunlap
  0 siblings, 0 replies; 200+ results
From: Randy.Dunlap @ 2005-04-17  3:46 UTC (permalink / raw)
  To: Mike Taht; +Cc: git

On Sat, 16 Apr 2005 20:12:56 -0700 Mike Taht wrote:

| commit b0550573055abcf8ad19dcb8a036c32dd00a3be4
| tree b77882b170769c07732381b9f19ff2dd5c9f1520
| parent 866b4aea9313513612f2b0d66814a2f526d17f21
| author Mike Taht <m@picketwyre.com> 1113704772 -0700
| committer Mike Taht <m@ipbx.taht.net> 1113704772 -0700
| 
| looks my 1878 line patch to convert git to libgit got eaten by vger..
| I put it up at http://pbx.picketwyre.com/~mtaht/libgit.patch if anyone 
| wants to comment. from my log:

Connection refused.

---
~Randy

^ permalink raw reply	[relevance 9%]

* [PATCH] contrib/svn-fe: fix Makefile
@ 2014-08-26 12:44 10% Maxim Bublis
  0 siblings, 0 replies; 200+ results
From: Maxim Bublis @ 2014-08-26 12:44 UTC (permalink / raw)
  To: git; +Cc: Maxim Bublis

Fixes several problems:
  * include config.mak.uname, config.mak.autogen and config.mak
    in order to use settings for prefix and other such things;
  * link xdiff/lib.a as it is a requirement for libgit.a;
  * fix CFLAGS and EXTLIBS for Linux and Mac OS X.
---
 contrib/svn-fe/Makefile | 47 ++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 38 insertions(+), 9 deletions(-)

diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
index 360d8da..8e1d622 100644
--- a/contrib/svn-fe/Makefile
+++ b/contrib/svn-fe/Makefile
@@ -1,18 +1,45 @@
 all:: svn-fe$X
 
-CC = gcc
+CC = cc
 RM = rm -f
 MV = mv
 
 CFLAGS = -g -O2 -Wall
 LDFLAGS =
-ALL_CFLAGS = $(CFLAGS)
-ALL_LDFLAGS = $(LDFLAGS)
-EXTLIBS =
+EXTLIBS = -lz
+
+include ../../config.mak.uname
+-include ../../config.mak.autogen
+-include ../../config.mak
+
+ifeq ($(uname_S),Darwin)
+	CFLAGS += -I/opt/local/include
+	LDFLAGS += -L/opt/local/lib
+endif
+
+ifndef NO_OPENSSL
+	EXTLIBS += -lssl -lcrypto
+endif
+
+ifndef NO_PTHREADS
+	CFLAGS += $(PTHREADS_CFLAGS)
+	EXTLIBS += $(PTHREAD_LIBS)
+endif
+
+ifdef HAVE_CLOCK_GETTIME
+	CFLAGS += -DHAVE_CLOCK_GETTIME
+	EXTLIBS += -lrt
+endif
+
+ifdef NEEDS_LIBICONV
+	EXTLIBS += -liconv
+endif
 
 GIT_LIB = ../../libgit.a
 VCSSVN_LIB = ../../vcs-svn/lib.a
-LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(EXTLIBS)
+XDIFF_LIB = ../../xdiff/lib.a
+
+LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(XDIFF_LIB)
 
 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
 QUIET_SUBDIR1 =
@@ -33,12 +60,11 @@ ifndef V
 endif
 endif
 
-svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(GIT_LIB)
-	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ svn-fe.o \
-		$(ALL_LDFLAGS) $(LIBS)
+svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(XDIFF_LIB) $(GIT_LIB)
+	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(EXTLIBS) -o $@ svn-fe.o $(LIBS)
 
 svn-fe.o: svn-fe.c ../../vcs-svn/svndump.h
-	$(QUIET_CC)$(CC) -I../../vcs-svn -o $*.o -c $(ALL_CFLAGS) $<
+	$(QUIET_CC)$(CC) $(CFLAGS) -I../../vcs-svn -o $*.o -c $<
 
 svn-fe.html: svn-fe.txt
 	$(QUIET_SUBDIR0)../../Documentation $(QUIET_SUBDIR1) \
@@ -54,6 +80,9 @@ svn-fe.1: svn-fe.txt
 ../../vcs-svn/lib.a: FORCE
 	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) vcs-svn/lib.a
 
+../../xdiff/lib.a: FORCE
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) xdiff/lib.a
+
 ../../libgit.a: FORCE
 	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
 
-- 
1.8.5.2 (Apple Git-48)

^ permalink raw reply related	[relevance 10%]

* [PATCH 2/6] fixup! reftable: utility functions
  @ 2020-11-28  6:44 10% ` Johannes Schindelin via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2020-11-28  6:44 UTC (permalink / raw)
  To: git
  Cc: Han-Wen Nienhuys, Han-Wen Nienhuys, Jeff King,
	Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

Let's not forget our CMake configuration.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 contrib/buildsystems/CMakeLists.txt | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index df539a44fa..f3a2fd3561 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -591,6 +591,12 @@ parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
 list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
 add_library(xdiff STATIC ${libxdiff_SOURCES})
 
+#reftable
+parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+
+list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+add_library(reftable STATIC ${reftable_SOURCES})
+
 if(WIN32)
 	if(NOT MSVC)#use windres when compiling with gcc and clang
 		add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
@@ -613,7 +619,7 @@ endif()
 #link all required libraries to common-main
 add_library(common-main OBJECT ${CMAKE_SOURCE_DIR}/common-main.c)
 
-target_link_libraries(common-main libgit xdiff ${ZLIB_LIBRARIES})
+target_link_libraries(common-main libgit xdiff reftable ${ZLIB_LIBRARIES})
 if(Intl_FOUND)
 	target_link_libraries(common-main ${Intl_LIBRARIES})
 endif()
@@ -848,11 +854,15 @@ if(BUILD_TESTING)
 add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
 target_link_libraries(test-fake-ssh common-main)
 
+#reftable-tests
+parse_makefile_for_sources(test-reftable_SOURCES "REFTABLE_TEST_OBJS")
+list(TRANSFORM test-reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+
 #test-tool
 parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
 
 list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
-add_executable(test-tool ${CMAKE_SOURCE_DIR}/t/helper/test-tool.c ${test-tool_SOURCES})
+add_executable(test-tool ${CMAKE_SOURCE_DIR}/t/helper/test-tool.c ${test-tool_SOURCES} ${test-reftable_SOURCES})
 target_link_libraries(test-tool common-main)
 
 set_target_properties(test-fake-ssh test-tool
-- 
gitgitgadget


^ permalink raw reply related	[relevance 10%]

* [PATCH 00/29] Add blame to libgit
@ 2017-05-24  5:15 10% Jeff Smith
  0 siblings, 0 replies; 200+ results
From: Jeff Smith @ 2017-05-24  5:15 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Jeff Smith

Rather than duplicate large portions of builtin/blame.c in cgit, it
would be better to shift its core functionality into libgit.a.  The
functionality left in builtin/blame.c mostly relates to terminal
presentation.

Since RFC v2 patchset:
  Rebased (merged in timestamp_t changes)
  Reorganized to split out and group 'mechanical' changes

Jeff Smith (29):
  blame: remove unneeded dependency on blob.h
  blame: move textconv_object with related functions
  blame: remove unused parameters
  blame: rename origin structure to blame_origin
  blame: rename scoreboard structure to blame_scoreboard
  blame: rename origin-related functions
  blame: rename coalesce function
  blame: rename ent_score function
  blame: rename nth_line function
  blame: move stat counters to scoreboard
  blame: move copy/move thresholds to scoreboard
  blame: move contents_from to scoreboard
  blame: move reverse flag to scoreboard
  blame: move show_root flag to scoreboard
  blame: move xdl_opts flags to scoreboard
  blame: move no_whole_file_rename flag to scoreboard
  blame: make sanity_check use a callback in scoreboard
  blame: move progess updates to a scoreboard callback
  blame: wrap blame_sort and compare_blame_final
  blame: rework methods that determine 'final' commit
  blame: create scoreboard init function
  blame: create scoreboard setup function
  blame: create entry prepend function
  blame: move core structures to header
  blame: move origin-related methods to libgit
  blame: move fake-commit-related methods to libgit
  blame: move scoreboard-related methods to libgit
  blame: move scoreboard setup to libgit
  blame: move entry prepend to libgit

 Makefile           |    1 +
 blame.c            | 1863 +++++++++++++++++++++++++++++++++++++++++++++
 blame.h            |  175 +++++
 builtin.h          |    2 -
 builtin/blame.c    | 2130 ++--------------------------------------------------
 builtin/cat-file.c |    1 +
 diff.c             |   23 +
 diff.h             |    7 +
 8 files changed, 2143 insertions(+), 2059 deletions(-)
 create mode 100644 blame.c
 create mode 100644 blame.h

-- 
2.9.3


^ permalink raw reply	[relevance 10%]

* [PATCH 0/7] Move code from builtin to libgit.a
  2012-10-26 12:02  8%     ` Jeff King
@ 2012-10-26 15:53 10%       ` Nguyễn Thái Ngọc Duy
  2012-10-26 15:53  8%         ` [PATCH 3/7] Move print_commit_list " Nguyễn Thái Ngọc Duy
                           ` (3 more replies)
  0 siblings, 4 replies; 200+ results
From: Nguyễn Thái Ngọc Duy @ 2012-10-26 15:53 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Nguyễn Thái Ngọc Duy

On Fri, Oct 26, 2012 at 7:02 PM, Jeff King <peff@peff.net> wrote:
>> OK. I checked around for similar issues and found these used by
>> libgit.a but stay in builtin/ instead:
>
> Yeah, we have traditionally been kind of lazy about the distinction,
> because it doesn't really matter for our build system (i.e., libgit.a is
> not _really_ a library, but just a convenience in the build process). So
> one option is just not caring about these.

Yeah. We can fix it up when we encounter new undefined reference
errors (e.g. a new test program that links to libgit.a). Anyway it
does not look too difficult to do. Take it or drop it. Your call.

> I'm also fine with fixing.
>
>> estimate_bisect_steps: bisect.c and builtin/rev-list.c
>> print_commit_list: bisect.c and builtin/rev-list.c
>>
>>  -> move them to bisect.c? another candidate is revision.c.
>
> I'd probably say bisect.c for the first, and commit.c for the latter
> (that is where commit_list functions are defined, and it is really about
> that).

Makes sense.

>> setup_diff_pager: diff-no-index.c and builtin/diff.c
>>
>>  -> to diff-lib.c?
>
> I'm not sure (to be honest, I am not even sure of the intended
> difference between diff.c and diff-lib.c). That function is really not
> for general diffing, but for diff-like commands. Probably it would be OK
> in diff.c.

Ditto. check_pager_config() is also moved from git.c to pager.c.

>> fetch_pack: transport.c and builtin/fetch-pack.c
>> send_pack: transport.c and builtin/send-pack.c
>>
>>  -> move them to transport.c? or new files fetch-pack.c and
>> send-pack.c? I haven't check how many functions they may pull
>> together.
>
> I think I'd rather have fetch-pack.c and send-pack.c than putting them
> into transport.c (which is getting kind of bloated already).

These two are big code moves, basically all {fetch,send}-pack code.
While I think this is good cleanup (I get surprise every time I look
at transport.c and it leads to buitin/fetch-pack.c), this is probably
not a good idea if we have on flight topics, which may cause lots of
conflicts for you and Junio. Fortunately we don't at the moment.

Nguyễn Thái Ngọc Duy (7):
  Move try_merge_command and checkout_fast_forward to libgit.a
  Move estimate_bisect_steps to libgit.a
  Move print_commit_list to libgit.a
  Move setup_diff_pager to libgit.a
  send-pack: move core code to libgit.a
  fetch-pack: remove global (static) configuration variable "args"
  fetch-pack: move core code to libgit.a

 Makefile             |   3 +
 bisect.c             |  38 ++
 bisect.h             |   4 -
 builtin.h            |   4 -
 builtin/diff.c       |  16 -
 builtin/fetch-pack.c | 951 +--------------------------------------------------
 builtin/merge.c      | 106 +-----
 builtin/rev-list.c   |  49 ---
 builtin/send-pack.c  | 333 ------------------
 cache.h              |  12 +-
 commit.c             |  10 +
 commit.h             |   4 +
 diff.c               |  16 +
 diff.h               |   1 +
 fetch-pack.c         | 951 +++++++++++++++++++++++++++++++++++++++++++++++++++
 git.c                |  33 --
 merge-recursive.h    |   5 -
 merge.c              | 112 ++++++
 pager.c              |  34 ++
 send-pack.c          | 344 +++++++++++++++++++
 sequencer.c          |   2 +-
 transport.h          |   5 +
 22 files changed, 1535 insertions(+), 1498 deletions(-)
 create mode 100644 fetch-pack.c
 create mode 100644 merge.c
 create mode 100644 send-pack.c

-- 
1.8.0.rc2.23.g1fb49df

^ permalink raw reply	[relevance 10%]

* [PATCH] libgit
@ 2005-04-17  3:12 10% Mike Taht
  2005-04-17  3:46  9% ` Randy.Dunlap
  0 siblings, 1 reply; 200+ results
From: Mike Taht @ 2005-04-17  3:12 UTC (permalink / raw)
  To: git

commit b0550573055abcf8ad19dcb8a036c32dd00a3be4
tree b77882b170769c07732381b9f19ff2dd5c9f1520
parent 866b4aea9313513612f2b0d66814a2f526d17f21
author Mike Taht <m@picketwyre.com> 1113704772 -0700
committer Mike Taht <m@ipbx.taht.net> 1113704772 -0700

looks my 1878 line patch to convert git to libgit got eaten by vger..
I put it up at http://pbx.picketwyre.com/~mtaht/libgit.patch if anyone 
wants to comment. from my log:

Converted git to libgit. Moved all the main() calls into a single 
multi-call binary - git-main.
Made extern a bunch of functions that were static. Verified it at least 
still minimally worked.
Note: this is only a first step towards creating a generic library. 
Figuring out what functions and variables *truly* need to be exported, 
renaming them to a git_<function> api, making it thread safe
... and not least of all, keeping up with everybody working out of the 
base tree... are problems that remain. Also - cleaning up the UI.




^ permalink raw reply	[relevance 10%]

* Re: status of libgit.a
  2010-03-07 10:27 10%       ` status of libgit.a Paul Menzel
  2010-03-07 13:26 10%         ` Dmitry Potapov
@ 2010-03-07 16:36 10%         ` Johannes Schindelin
  2010-03-07 12:18  8%         ` Miklos Vajna
  2 siblings, 0 replies; 200+ results
From: Johannes Schindelin @ 2010-03-07 16:36 UTC (permalink / raw)
  To: Paul Menzel; +Cc: git, Marc Oscar Singer, 407722

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1409 bytes --]

Hi,

On Sun, 7 Mar 2010, Paul Menzel wrote:

> Am Donnerstag, den 19.02.2009, 09:24 +0000 schrieb Gerrit Pape:
> > On Wed, Feb 18, 2009 at 09:10:02AM -0800, Marc Oscar Singer wrote:
> > > Gerrit Pape wrote:
> 
> […]
> 
> > > >It depends on upstream.  Back then, Junio asked to not provide such 
> > > >a library package in Debian, and I respect that.  There've been 
> > > >some plans and effort to stabilize the lib in the past, but I'm not 
> > > >sure about the status.
> > > >  
> > > Would it be a compromise to provide libgit.a as a static library for 
> > > until it stabilizes?
> > 
> > That's not the compromise, that's the option, I don't know any plans 
> > about a shared library.  The git-core-dev package that was available 
> > for short included such a static library.
> > 
> > You really need to talk to upstream if you want this libgit.a.
> 
> could you please give an update on the status of libgit.a.

There had been some people who worked towards a re-entrant libgit.a (read: 
non-die()ing in library functions). But there were too many others, so 
that effort stopped.

The most likely route for people needing libgit.a would be libgit2:

http://git.wiki.kernel.org/index.php/SoC2010Ideas#Complete_libgit2

> For example cgit still could not be packaged yet for Debian [1] because 
> of this bug [2].

cgit should not depend on libgit.a, as it is linked statically anyway.

Ciao,
Dscho

^ permalink raw reply	[relevance 10%]

* status of libgit.a
       [not found]         ` <20090219092446.23272.qmail@3b5a9fa637f270.315fe32.mid.smarden.org>
@ 2010-03-07 10:27 10%       ` Paul Menzel
  2010-03-07 13:26 10%         ` Dmitry Potapov
                           ` (2 more replies)
  0 siblings, 3 replies; 200+ results
From: Paul Menzel @ 2010-03-07 10:27 UTC (permalink / raw)
  To: git; +Cc: Marc Oscar Singer, 407722

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

Dear Git folks,


Am Donnerstag, den 19.02.2009, 09:24 +0000 schrieb Gerrit Pape:
> On Wed, Feb 18, 2009 at 09:10:02AM -0800, Marc Oscar Singer wrote:
> > Gerrit Pape wrote:

[…]

> > >It depends on upstream.  Back then, Junio asked to not provide such a
> > >library package in Debian, and I respect that.  There've been some plans
> > >and effort to stabilize the lib in the past, but I'm not sure about the
> > >status.
> > >  
> > Would it be a compromise to provide libgit.a as a static library for 
> > until it stabilizes?
> 
> That's not the compromise, that's the option, I don't know any plans
> about a shared library.  The git-core-dev package that was available for
> short included such a static library.
> 
> You really need to talk to upstream if you want this libgit.a.

could you please give an update on the status of libgit.a. For example
cgit still could not be packaged yet for Debian [1] because of this bug
[2].

cgit is used by a lot of projects out there, so I am wondering if the
current libgit.a can be released in its current state.

By the way, is there a web site/page for libgit.a?


Thanks and sorry if I got something wrong,

Paul


[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=515793
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=407722

[-- Attachment #2: Dies ist ein digital signierter Nachrichtenteil --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[relevance 10%]

* [RFC PATCH v2 00/22] Add blame to libgit
  2017-05-05  5:27  9% [RFC PATCH 00/10] Add blame to libgit Jeff Smith
@ 2017-05-14  3:14 10% ` Jeff Smith
  0 siblings, 0 replies; 200+ results
From: Jeff Smith @ 2017-05-14  3:14 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Jeff Smith

Rather than duplicate large portions of builtin/blame.c in cgit, it
would be better to shift its core functionality into libgit.a.  The
functionality left in builtin/blame.c mostly relates to terminal
presentation.

Since initial patchset:
  Made commit titles consistent
  Broke some commits into more atomic pieces
  Fleshed out commit message bodies
  Made public structure and method names more clearly blame-related

Jeff Smith (22):
  blame: remove unneeded dependency on blob.h
  blame: move textconv_object with related functions
  blame: remove unused parameters
  blame: move origin and entry structures to header
  blame: move scoreboard structure to header
  blame: move stat counters to scoreboard
  blame: move copy/move thresholds to scoreboard
  blame: move contents_from to scoreboard
  blame: move reverse flag to scoreboard
  blame: move show_root flag to scoreboard
  blame: move xdl_opts flags to scoreboard
  blame: move no_whole_file_rename flag to scoreboard
  blame: make sanity_check use a callback in scoreboard
  blame: move progess updates to a scoreboard callback
  blame: wrap blame_sort and compare_blame_final
  blame: rework methods that determine 'final' commit
  blame: move origin-related methods to libgit
  blame: move fake-commit-related methods to libgit
  blame: move scoreboard-related methods to libgit
  blame: create scoreboard init function in libgit
  blame: create scoreboard setup function in libgit
  blame: create entry prepend function in libgit

 Makefile           |    1 +
 blame.c            | 1863 +++++++++++++++++++++++++++++++++++++++++++++
 blame.h            |  175 +++++
 builtin.h          |    2 -
 builtin/blame.c    | 2130 ++--------------------------------------------------
 builtin/cat-file.c |    1 +
 diff.c             |   23 +
 diff.h             |    7 +
 8 files changed, 2143 insertions(+), 2059 deletions(-)
 create mode 100644 blame.c
 create mode 100644 blame.h

-- 
2.9.3


^ permalink raw reply	[relevance 10%]

* Re: status of libgit.a
  2010-03-07 10:27 10%       ` status of libgit.a Paul Menzel
@ 2010-03-07 13:26 10%         ` Dmitry Potapov
  2010-03-07 16:36 10%         ` Johannes Schindelin
  2010-03-07 12:18  8%         ` Miklos Vajna
  2 siblings, 0 replies; 200+ results
From: Dmitry Potapov @ 2010-03-07 13:26 UTC (permalink / raw)
  To: Paul Menzel; +Cc: git, Marc Oscar Singer, 407722

On Sun, Mar 07, 2010 at 11:27:35AM +0100, Paul Menzel wrote:
> 
> could you please give an update on the status of libgit.a. For example
> cgit still could not be packaged yet for Debian [1] because of this bug
> [2].
> 
> cgit is used by a lot of projects out there, so I am wondering if the
> current libgit.a can be released in its current state.
> 
> By the way, is there a web site/page for libgit.a?

libgit.a has never been meant to use outside of Git. It was created just
to assist with the building process, and there is no clear defined API.
So, using libgit.a outside of Git is no different than copying source
files and using them in another project.

AFAIK, there is no plan to create a stable API for the existing libgit.a
Another project (libgit2) started some time ago to create a Git library
with a stable API, but it does not share much code with Git, and so far
it provides only basic functionality and has very few contributors, who
are also busy with other projects. So, in no way it can be considered as
a replacement of existing libgit.a.

On the other hand, libgit.a includes plumbing functions, which may be
considered as stable API. So, if cgit uses only those functions just to
avoid fork(), it makes sense; but it should be done carefully, because
libgit.a can call exit() on error. It may be not a problem for cgit, but
it is just another reason why libgit.a cannot be considered as a general
purpose library that provides Git functionality...


Dmitry

^ permalink raw reply	[relevance 10%]

* Re: [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory
  2011-02-18  2:31 28%     ` [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory Jonathan Nieder
  2011-02-18  3:47 12%       ` Nguyen Thai Ngoc Duy
@ 2011-02-18  4:31 11%       ` Nguyen Thai Ngoc Duy
  1 sibling, 0 replies; 200+ results
From: Nguyen Thai Ngoc Duy @ 2011-02-18  4:31 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git, Junio C Hamano, Nicolas Pitre

2011/2/18 Jonathan Nieder <jrnieder@gmail.com>:
> Perhaps some day the libgit/ subdirectory can be managed as an
> independent subproject (for example if it gets merged with libgit2).

Another note. The boundary between libgit and "git" binary is not
perfectly clear. For example transport.c can make fetch_pack() call,
which resides in builtin/fetch-pack.c. But this is a good move anyway.
We can gradually move all shared functionalities to libgit.
-- 
Duy

^ permalink raw reply	[relevance 11%]

* Re: [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory
  2011-02-18  4:14 27%         ` Jonathan Nieder
@ 2011-02-18  4:18 11%           ` Jeff King
  2011-02-18  5:58 12%             ` Jonathan Nieder
  0 siblings, 1 reply; 200+ results
From: Jeff King @ 2011-02-18  4:18 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Nguyen Thai Ngoc Duy, git, Junio C Hamano, Nicolas Pitre

On Thu, Feb 17, 2011 at 10:14:05PM -0600, Jonathan Nieder wrote:

> Nguyen Thai Ngoc Duy wrote:
> > 2011/2/18 Jonathan Nieder <jrnieder@gmail.com>:
> 
> >> Move sources for libgit.a to a libgit/ subdirectory.  This way, a
> >> person wanting to tackle the reusable part of git will know where to
> >> look, and those looking to work on individual commands know to look
> >> elsewhere.
> >
> > You missed a few (on purpose?): block-sha1, ppc and compat.
> 
> Yes, on purpose.  They're separately reusable.

I wonder if there should perhaps be lib/, with all of the libgit.a
sources in it, and then lib/block-sha1, lib/ppc, lib/compat, etc. Those
things do end up inside libgit.a, don't they?

-Peff

^ permalink raw reply	[relevance 11%]

* [PATCH 13/14] Add MSVC project files
  @ 2009-08-21 13:30 11%                         ` Marius Storm-Olsen
  0 siblings, 0 replies; 200+ results
From: Marius Storm-Olsen @ 2009-08-21 13:30 UTC (permalink / raw)
  To: Johannes.Schindelin; +Cc: msysgit, git, lznuaa

From: Frank Li <lznuaa@gmail.com>

Add libgit.vcproj to build common library, and git.vcproj to
build git itself.

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/vcbuild/git/git.vcproj       |  197 +++++
 compat/vcbuild/libgit/libgit.vcproj | 1359 +++++++++++++++++++++++++++++++++++
 2 files changed, 1556 insertions(+), 0 deletions(-)
 create mode 100644 compat/vcbuild/git/git.vcproj
 create mode 100644 compat/vcbuild/libgit/libgit.vcproj

diff --git a/compat/vcbuild/git/git.vcproj b/compat/vcbuild/git/git.vcproj
new file mode 100644
index 0000000..6f85de3
--- /dev/null
+++ b/compat/vcbuild/git/git.vcproj
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="git"
+	ProjectGUID="{E3E30E51-C5AD-407B-AB43-985E4111474A}"
+	RootNamespace="git"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="wininet.lib ws2_32.lib "
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="wininet.lib ws2_32.lib "
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\git.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/compat/vcbuild/libgit/libgit.vcproj b/compat/vcbuild/libgit/libgit.vcproj
new file mode 100644
index 0000000..e333873
--- /dev/null
+++ b/compat/vcbuild/libgit/libgit.vcproj
@@ -0,0 +1,1359 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="libgit"
+	ProjectGUID="{F6DEC8C3-B803-4A86-8848-430F08B499E3}"
+	RootNamespace="libgit"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\include;..\..;..\..\..;..\..\fnmatch;..\..\regex;..\..\..\..\zlib"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_STRING_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\block-sha1\sha1.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\archive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\delta.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fetch-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\git-compat-util.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\http.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\notes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\send-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shortlog.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tar.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="compat"
+			>
+			<File
+				RelativePath="..\..\..\compat\basename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\cygwin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fopen.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\memmem.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkdtemp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkstemps.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\msvc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\pread.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\qsort.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\regex\regex.c"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						PreprocessorDefinitions="REGEX_MALLOC"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						PreprocessorDefinitions="REGEX_MALLOC"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\setenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\snprintf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strcasestr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strlcpy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strtoumax.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\unsetenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32mmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\winansi.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="git"
+			>
+			<File
+				RelativePath="..\..\..\abspath.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alias.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alloc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-tar.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-zip.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\base85.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bisect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-add.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-annotate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-apply.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bisect--helper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-blame.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-cat-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-ref-format.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clean.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clone.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-count-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-describe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fast-export.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch--tool.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fmt-merge-msg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-for-each-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-gc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-init-db.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-log.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailinfo.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailsplit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-base.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-ours.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mktree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-name-rev.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune-packed.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-push.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-read-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-receive-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reflog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reset.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-parse.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-revert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rm.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-send-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-shortlog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-stripspace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-symbolic-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tar-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-unpack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-upload-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-write-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\combine-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\connect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\convert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\copy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ctype.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\date.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-lib.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-no-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-break.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-order.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-pickaxe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-rename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\editor.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\entry.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\environment.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ident.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lockfile.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\match-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\name-hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-check.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-write.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pager.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\path.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\preload-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pretty.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\read-cache.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\server-info.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\setup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_name.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shallow.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\symlinks.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\trace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\usage.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wrapper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\write_or_die.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ws.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="xdiff"
+			>
+			<File
+				RelativePath="..\..\..\xdiff\xdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xinclude.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmacros.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmerge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xpatience.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xtypes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
-- 
1.6.3.msysgit.0.18.gef407

^ permalink raw reply related	[relevance 11%]

* [PATCH 11/12] Add MSVC Project file
  @ 2009-08-19 15:52 11%                   ` Frank Li
  0 siblings, 0 replies; 200+ results
From: Frank Li @ 2009-08-19 15:52 UTC (permalink / raw)
  To: git, msysgit; +Cc: Frank Li

Add libgit.vcproj to build common library.
Add git.vcproj to build git program.

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/vcbuild/git/git.vcproj       |  197 +++++
 compat/vcbuild/libgit/libgit.vcproj | 1363 +++++++++++++++++++++++++++++++++++
 2 files changed, 1560 insertions(+), 0 deletions(-)
 create mode 100644 compat/vcbuild/git/git.vcproj
 create mode 100644 compat/vcbuild/libgit/libgit.vcproj

diff --git a/compat/vcbuild/git/git.vcproj b/compat/vcbuild/git/git.vcproj
new file mode 100644
index 0000000..6f85de3
--- /dev/null
+++ b/compat/vcbuild/git/git.vcproj
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="git"
+	ProjectGUID="{E3E30E51-C5AD-407B-AB43-985E4111474A}"
+	RootNamespace="git"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="wininet.lib ws2_32.lib "
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="wininet.lib ws2_32.lib "
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\git.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/compat/vcbuild/libgit/libgit.vcproj b/compat/vcbuild/libgit/libgit.vcproj
new file mode 100644
index 0000000..b399dad
--- /dev/null
+++ b/compat/vcbuild/libgit/libgit.vcproj
@@ -0,0 +1,1363 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libgit"
+	ProjectGUID="{F6DEC8C3-B803-4A86-8848-430F08B499E3}"
+	RootNamespace="libgit"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_STRING_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_STRING_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\msvc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mozilla-sha1\sha1.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\archive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\delta.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fetch-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\git-compat-util.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\http.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\notes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\send-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shortlog.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tar.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="compat"
+			>
+			<File
+				RelativePath="..\..\..\compat\basename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\cygwin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fopen.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\memmem.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkdtemp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkstemps.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\pread.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\qsort.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\regex\regex.c"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						PreprocessorDefinitions="REGEX_MALLOC"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						PreprocessorDefinitions="REGEX_MALLOC"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\setenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\snprintf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strcasestr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strlcpy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strtoumax.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\unsetenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32mmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\winansi.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="git"
+			>
+			<File
+				RelativePath="..\..\..\abspath.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alias.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alloc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-tar.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-zip.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\base85.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bisect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-add.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-annotate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-apply.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bisect--helper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-blame.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-cat-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-ref-format.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clean.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clone.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-count-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-describe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fast-export.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch--tool.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fmt-merge-msg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-for-each-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-gc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-init-db.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-log.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailinfo.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailsplit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-base.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-ours.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mktree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-name-rev.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune-packed.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-push.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-read-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-receive-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reflog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reset.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-parse.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-revert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rm.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-send-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-shortlog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-stripspace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-symbolic-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tar-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-unpack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-upload-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-write-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\combine-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\connect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\convert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\copy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ctype.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\date.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-lib.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-no-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-break.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-order.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-pickaxe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-rename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\editor.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\entry.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\environment.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ident.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lockfile.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\match-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\name-hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-check.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-write.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pager.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\path.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\preload-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pretty.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\read-cache.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\server-info.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\setup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_name.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shallow.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\symlinks.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\trace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\usage.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wrapper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\write_or_die.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ws.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="xdiff"
+			>
+			<File
+				RelativePath="..\..\..\xdiff\xdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xinclude.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmacros.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmerge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xpatience.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xtypes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
-- 
1.6.4.msysgit.0

^ permalink raw reply related	[relevance 11%]

* [PATCH 10/11] Add MSVC Project file
  @ 2009-08-17 16:05 11%       ` Frank Li
  0 siblings, 0 replies; 200+ results
From: Frank Li @ 2009-08-17 16:05 UTC (permalink / raw)
  To: git, msysgit; +Cc: Johannes.Schindelin, Frank Li

Add libgit.vcproj to build common library.
Add git.vcproj to build git program.

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/vcbuild/git/git.vcproj       |  197 +++++
 compat/vcbuild/libgit/libgit.vcproj | 1347 +++++++++++++++++++++++++++++++++++
 2 files changed, 1544 insertions(+), 0 deletions(-)
 create mode 100644 compat/vcbuild/git/git.vcproj
 create mode 100644 compat/vcbuild/libgit/libgit.vcproj

diff --git a/compat/vcbuild/git/git.vcproj b/compat/vcbuild/git/git.vcproj
new file mode 100644
index 0000000..6f85de3
--- /dev/null
+++ b/compat/vcbuild/git/git.vcproj
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="git"
+	ProjectGUID="{E3E30E51-C5AD-407B-AB43-985E4111474A}"
+	RootNamespace="git"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="wininet.lib ws2_32.lib "
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="wininet.lib ws2_32.lib "
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\git.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/compat/vcbuild/libgit/libgit.vcproj b/compat/vcbuild/libgit/libgit.vcproj
new file mode 100644
index 0000000..bbc3aed
--- /dev/null
+++ b/compat/vcbuild/libgit/libgit.vcproj
@@ -0,0 +1,1347 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libgit"
+	ProjectGUID="{F6DEC8C3-B803-4A86-8848-430F08B499E3}"
+	RootNamespace="libgit"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..;..\..\..\..\zlib;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\msvc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mozilla-sha1\sha1.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\archive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\delta.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fetch-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\git-compat-util.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\http.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\notes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\send-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shortlog.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tar.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="compat"
+			>
+			<File
+				RelativePath="..\..\..\compat\basename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\cygwin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fopen.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\memmem.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkdtemp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkstemps.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\pread.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\qsort.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\setenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\snprintf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strcasestr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strlcpy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strtoumax.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\unsetenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32mmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\winansi.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="git"
+			>
+			<File
+				RelativePath="..\..\..\abspath.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alias.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alloc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-tar.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-zip.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\base85.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bisect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-add.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-annotate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-apply.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bisect--helper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-blame.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-cat-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-ref-format.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clean.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clone.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-count-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-describe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fast-export.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch--tool.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fmt-merge-msg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-for-each-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-gc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-init-db.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-log.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailinfo.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailsplit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-base.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-ours.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mktree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-name-rev.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune-packed.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-push.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-read-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-receive-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reflog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reset.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-parse.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-revert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rm.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-send-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-shortlog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-stripspace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-symbolic-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tar-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-unpack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-upload-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-write-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\combine-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\connect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\convert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\copy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ctype.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\date.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-lib.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-no-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-break.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-order.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-pickaxe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-rename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\editor.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\entry.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\environment.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ident.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lockfile.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\match-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\name-hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-check.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-write.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pager.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\path.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\preload-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pretty.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\read-cache.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\server-info.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\setup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_name.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shallow.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\symlinks.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\trace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\usage.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wrapper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\write_or_die.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ws.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="xdiff"
+			>
+			<File
+				RelativePath="..\..\..\xdiff\xdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xinclude.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmacros.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmerge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xpatience.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xtypes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
-- 
1.6.4.msysgit.0

^ permalink raw reply related	[relevance 11%]

* [PATCH 5/7] Make it possible to set up libgit directly (instead of from the environment)
  @ 2006-06-25  1:54 11% ` Petr Baudis
  0 siblings, 0 replies; 200+ results
From: Petr Baudis @ 2006-06-25  1:54 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This introduces a setup_git() function which is essentialy a (public)
backend for setup_git_env() which lets anyone specify custom sources
for the various paths instead of environment variables. Since the repositories
may get switched on the fly, this also updates code that caches paths to
invalidate them properly; I hope neither of those is a sweet spot.

It is used by Git.xs' xs__call_gate() to set up per-repository data
for libgit's consumption. No code actually takes advantage of it yet
but get_object() will in the next patches.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 cache.h       |    3 +++
 commit.c      |   23 +++++++++++++++++++----
 environment.c |   45 +++++++++++++++++++++++++++++++++++++++------
 perl/Git.pm   |    8 ++++----
 perl/Git.xs   |   16 +++++++++++++++-
 sha1_file.c   |   30 ++++++++++++++++++++++++------
 sha1_name.c   |   10 ++++++++--
 7 files changed, 112 insertions(+), 23 deletions(-)

diff --git a/cache.h b/cache.h
index efeafea..9844e88 100644
--- a/cache.h
+++ b/cache.h
@@ -116,6 +116,9 @@ extern struct cache_entry **active_cache
 extern unsigned int active_nr, active_alloc, active_cache_changed;
 extern struct cache_tree *active_cache_tree;
 
+extern void setup_git(char *new_git_dir, char *new_git_object_dir,
+                      char *new_git_index_file, char *new_git_graft_file);
+
 #define GIT_DIR_ENVIRONMENT "GIT_DIR"
 #define DEFAULT_GIT_DIR_ENVIRONMENT ".git"
 #define DB_ENVIRONMENT "GIT_OBJECT_DIRECTORY"
diff --git a/commit.c b/commit.c
index 946615d..6c4acc2 100644
--- a/commit.c
+++ b/commit.c
@@ -163,6 +163,14 @@ int register_commit_graft(struct commit_
 	return 0;
 }
 
+void free_commit_grafts(void)
+{
+	int pos = commit_graft_nr;
+	while (pos >= 0)
+		free(commit_graft[pos--]);
+	commit_graft_nr = 0;
+}
+
 struct commit_graft *read_graft_line(char *buf, int len)
 {
 	/* The format is just "Commit Parent1 Parent2 ...\n" */
@@ -215,11 +223,18 @@ int read_graft_file(const char *graft_fi
 static void prepare_commit_graft(void)
 {
 	static int commit_graft_prepared;
-	char *graft_file;
+	static char *last_graft_file;
+	char *graft_file = get_graft_file();
+
+	if (last_graft_file) {
+		if (!strcmp(graft_file, last_graft_file))
+			return;
+		free_commit_grafts();
+	}
+	if (last_graft_file)
+		free(last_graft_file);
+	last_graft_file = strdup(graft_file);
 
-	if (commit_graft_prepared)
-		return;
-	graft_file = get_graft_file();
 	read_graft_file(graft_file);
 	commit_graft_prepared = 1;
 }
diff --git a/environment.c b/environment.c
index 3de8eb3..6b64d11 100644
--- a/environment.c
+++ b/environment.c
@@ -21,28 +21,61 @@ char git_commit_encoding[MAX_ENCODING_LE
 int shared_repository = PERM_UMASK;
 const char *apply_default_whitespace = NULL;
 
+static int dyn_git_object_dir, dyn_git_index_file, dyn_git_graft_file;
 static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
 	*git_graft_file;
-static void setup_git_env(void)
+
+void setup_git(char *new_git_dir, char *new_git_object_dir,
+               char *new_git_index_file, char *new_git_graft_file)
 {
-	git_dir = getenv(GIT_DIR_ENVIRONMENT);
+	git_dir = new_git_dir;
 	if (!git_dir)
 		git_dir = DEFAULT_GIT_DIR_ENVIRONMENT;
-	git_object_dir = getenv(DB_ENVIRONMENT);
+
+	if (dyn_git_object_dir)
+		free(git_object_dir);
+	git_object_dir = new_git_object_dir;
 	if (!git_object_dir) {
 		git_object_dir = xmalloc(strlen(git_dir) + 9);
 		sprintf(git_object_dir, "%s/objects", git_dir);
+		dyn_git_object_dir = 1;
+	} else {
+		dyn_git_object_dir = 0;
 	}
+
+	if (git_refs_dir)
+		free(git_refs_dir);
 	git_refs_dir = xmalloc(strlen(git_dir) + 6);
 	sprintf(git_refs_dir, "%s/refs", git_dir);
-	git_index_file = getenv(INDEX_ENVIRONMENT);
+
+	if (dyn_git_index_file)
+		free(git_index_file);
+	git_index_file = new_git_index_file;
 	if (!git_index_file) {
 		git_index_file = xmalloc(strlen(git_dir) + 7);
 		sprintf(git_index_file, "%s/index", git_dir);
+		dyn_git_index_file = 1;
+	} else {
+		dyn_git_index_file = 0;
 	}
-	git_graft_file = getenv(GRAFT_ENVIRONMENT);
-	if (!git_graft_file)
+
+	if (dyn_git_graft_file)
+		free(git_graft_file);
+	git_graft_file = new_git_graft_file;
+	if (!git_graft_file) {
 		git_graft_file = strdup(git_path("info/grafts"));
+		dyn_git_graft_file = 1;
+	} else {
+		dyn_git_graft_file = 0;
+	}
+}
+
+static void setup_git_env(void)
+{
+	setup_git(getenv(GIT_DIR_ENVIRONMENT),
+	          getenv(DB_ENVIRONMENT),
+	          getenv(INDEX_ENVIRONMENT),
+	          getenv(GRAFT_ENVIRONMENT));
 }
 
 char *get_git_dir(void)
diff --git a/perl/Git.pm b/perl/Git.pm
index 1c3a2ec..c490e0c 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -92,6 +92,7 @@ increate nonwithstanding).
 use Carp qw(carp croak); # but croak is bad - throw instead
 use Error qw(:try);
 use Cwd qw(abs_path);
+use Scalar::Util;
 
 require XSLoader;
 XSLoader::load('Git', $VERSION);
@@ -822,11 +823,10 @@ sub _call_gate {
 	if (defined $self) {
 		# XXX: We ignore the WorkingCopy! To properly support
 		# that will require heavy changes in libgit.
+		# For now, when we will need to do it we could temporarily
+		# chdir() there and then chdir() back after the call is done.
 
-		# XXX: And we ignore everything else as well. libgit
-		# at least needs to be extended to let us specify
-		# the $GIT_DIR instead of looking it up in environment.
-		#xs_call_gate($self->{opts}->{Repository});
+		xs__call_gate(Scalar::Util::refaddr($self), $self->repo_path());
 	}
 
 	# Having to call throw from the C code is a sure path to insanity.
diff --git a/perl/Git.xs b/perl/Git.xs
index 2fd1c67..4e85d69 100644
--- a/perl/Git.xs
+++ b/perl/Git.xs
@@ -59,7 +59,21 @@ BOOT:
 }
 
 
-# /* TODO: xs_call_gate(). See Git.pm. */
+void
+xs__call_gate(repoid, git_dir)
+	long repoid;
+	char *git_dir;
+CODE:
+{
+	static long last_repoid;
+	if (repoid != last_repoid) {
+		setup_git(git_dir,
+		          getenv(DB_ENVIRONMENT),
+		          getenv(INDEX_ENVIRONMENT),
+		          getenv(GRAFT_ENVIRONMENT));
+		last_repoid = repoid;
+	}
+}
 
 
 const char *
diff --git a/sha1_file.c b/sha1_file.c
index c80528b..8d24f50 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -126,16 +126,22 @@ static void fill_sha1_path(char *pathbuf
 char *sha1_file_name(const unsigned char *sha1)
 {
 	static char *name, *base;
+	static const char *last_objdir;
+	const char *sha1_file_directory = get_object_directory();
 
-	if (!base) {
-		const char *sha1_file_directory = get_object_directory();
+	if (!last_objdir || strcmp(last_objdir, sha1_file_directory)) {
 		int len = strlen(sha1_file_directory);
+		if (base)
+			free(base);
 		base = xmalloc(len + 60);
 		memcpy(base, sha1_file_directory, len);
 		memset(base+len, 0, 60);
 		base[len] = '/';
 		base[len+3] = '/';
 		name = base + len + 1;
+		if (last_objdir)
+			free((char *) last_objdir);
+		last_objdir = strdup(sha1_file_directory);
 	}
 	fill_sha1_path(name, sha1);
 	return base;
@@ -145,14 +151,20 @@ char *sha1_pack_name(const unsigned char
 {
 	static const char hex[] = "0123456789abcdef";
 	static char *name, *base, *buf;
+	static const char *last_objdir;
+	const char *sha1_file_directory = get_object_directory();
 	int i;
 
-	if (!base) {
-		const char *sha1_file_directory = get_object_directory();
+	if (!last_objdir || strcmp(last_objdir, sha1_file_directory)) {
 		int len = strlen(sha1_file_directory);
+		if (base)
+			free(base);
 		base = xmalloc(len + 60);
 		sprintf(base, "%s/pack/pack-1234567890123456789012345678901234567890.pack", sha1_file_directory);
 		name = base + len + 11;
+		if (last_objdir)
+			free((char *) last_objdir);
+		last_objdir = strdup(sha1_file_directory);
 	}
 
 	buf = name;
@@ -170,14 +182,20 @@ char *sha1_pack_index_name(const unsigne
 {
 	static const char hex[] = "0123456789abcdef";
 	static char *name, *base, *buf;
+	static const char *last_objdir;
+	const char *sha1_file_directory = get_object_directory();
 	int i;
 
-	if (!base) {
-		const char *sha1_file_directory = get_object_directory();
+	if (!last_objdir || strcmp(last_objdir, sha1_file_directory)) {
 		int len = strlen(sha1_file_directory);
+		if (base)
+			free(base);
 		base = xmalloc(len + 60);
 		sprintf(base, "%s/pack/pack-1234567890123456789012345678901234567890.idx", sha1_file_directory);
 		name = base + len + 11;
+		if (last_objdir)
+			free((char *) last_objdir);
+		last_objdir = strdup(sha1_file_directory);
 	}
 
 	buf = name;
diff --git a/sha1_name.c b/sha1_name.c
index cd85d1f..1451cb6 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -12,15 +12,21 @@ static int find_short_object_filename(in
 	char hex[40];
 	int found = 0;
 	static struct alternate_object_database *fakeent;
+	static const char *last_objdir;
+	const char *objdir = get_object_directory();
 
-	if (!fakeent) {
-		const char *objdir = get_object_directory();
+	if (!last_objdir || strcmp(last_objdir, objdir)) {
 		int objdir_len = strlen(objdir);
 		int entlen = objdir_len + 43;
+		if (fakeent)
+			free(fakeent);
 		fakeent = xmalloc(sizeof(*fakeent) + entlen);
 		memcpy(fakeent->base, objdir, objdir_len);
 		fakeent->name = fakeent->base + objdir_len + 1;
 		fakeent->name[-1] = '/';
+		if (last_objdir)
+			free((char *) last_objdir);
+		last_objdir = strdup(objdir);
 	}
 	fakeent->next = alt_odb_list;
 

^ permalink raw reply related	[relevance 11%]

* Using VC build git
@ 2009-08-10 13:56 11% Frank Li
  0 siblings, 0 replies; 200+ results
From: Frank Li @ 2009-08-10 13:56 UTC (permalink / raw)
  To: git, msysGit

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

pull from git://repo.or.cz/tgit.git

[-- Attachment #2: 0005-git-commit-okay.patch --]
[-- Type: application/octet-stream, Size: 1970 bytes --]

From 62b705d074a3eeffe8af5c8c0334f12ec76d1cee Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Sat, 8 Aug 2009 13:35:40 +0800
Subject: [PATCH 5/5] git commit okay

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/mingw.c            |    6 +++++-
 contrib/vcbuild/porting.c |    2 +-
 editor.c                  |    2 ++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 1cc2cb7..79cbd9f 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -275,7 +275,7 @@ int mkstemp(char *template)
 	char *filename = mktemp(template);
 	if (filename == NULL)
 		return -1;
-	return open(filename, O_RDWR | O_CREAT, 0600);
+	return _open(filename, _O_RDWR | _O_CREAT | _O_BINARY, 0600);
 }
 
 int gettimeofday(struct timeval *tv, void *tz)
@@ -1144,6 +1144,10 @@ int link(const char *oldpath, const char *newpath)
 {
 	typedef BOOL WINAPI (*T)(const char*, const char*, LPSECURITY_ATTRIBUTES);
 	static T create_hard_link = NULL;
+	
+	errno = ENOSYS;
+	return -1;
+
 	if (!create_hard_link) {
 		create_hard_link = (T) GetProcAddress(
 			GetModuleHandle("kernel32.dll"), "CreateHardLinkA");
diff --git a/contrib/vcbuild/porting.c b/contrib/vcbuild/porting.c
index 0625bb4..cf83efc 100644
--- a/contrib/vcbuild/porting.c
+++ b/contrib/vcbuild/porting.c
@@ -10,7 +10,7 @@ int snprintf(char *buff,int size, char *fmt, ...)
 	int n;
 	va_list pArgList;
 	va_start(pArgList,fmt);
-	n=_snprintf(buff,size-1,fmt,pArgList);
+	n=_vsnprintf(buff,size-1,fmt,pArgList);
 	va_end(pArgList);
 	return n;
 }
diff --git a/editor.c b/editor.c
index 4d469d0..a9a3b7c 100644
--- a/editor.c
+++ b/editor.c
@@ -13,6 +13,8 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en
 		editor = getenv("VISUAL");
 	if (!editor)
 		editor = getenv("EDITOR");
+	if (!editor)
+		editor = "notepad2";
 
 	terminal = getenv("TERM");
 	if (!editor && (!terminal || !strcmp(terminal, "dumb")))
-- 
1.6.4.msysgit.0


[-- Attachment #3: 0001-build-git-library.patch --]
[-- Type: application/octet-stream, Size: 58215 bytes --]

From 5352796e16d5781613968dc4fcf74ad5e3d7306d Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Wed, 5 Aug 2009 12:51:46 +0800
Subject: [PATCH 1/5] build git library

---
 builtin-fast-export.c                |    1 +
 compat/fopen.c                       |    1 +
 compat/mingw.c                       |    4 +-
 compat/mingw.h                       |    9 +-
 contrib/vcbuild/include/unistd.h     |    8 +-
 contrib/vcbuild/libgit/libgit.vcproj | 2688 +++++++++++++++++-----------------
 contrib/vcbuild/vcbuild.sln          |   29 +
 help.c                               |    3 +-
 run-command.c                        |    3 +
 9 files changed, 1403 insertions(+), 1343 deletions(-)
 create mode 100644 contrib/vcbuild/vcbuild.sln

diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index c48c18d..24a50ae 100644
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -24,6 +24,7 @@ static const char *fast_export_usage[] = {
 
 static int progress;
 static enum { ABORT, VERBATIM, WARN, STRIP } signed_tag_mode = ABORT;
+#undef ERROR
 static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ABORT;
 static int fake_missing_tagger;
 
diff --git a/compat/fopen.c b/compat/fopen.c
index b5ca142..b9a02e4 100644
--- a/compat/fopen.c
+++ b/compat/fopen.c
@@ -10,6 +10,7 @@
  */
 #undef FREAD_READS_DIRECTORIES
 #include "../git-compat-util.h"
+#undef stat
 
 FILE *git_fopen(const char *path, const char *mode)
 {
diff --git a/compat/mingw.c b/compat/mingw.c
index 405a51e..f3a74f8 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -151,6 +151,7 @@ static inline time_t filetime_to_time_t(const FILETIME *ft)
  * When a path ends with a slash, the stat will fail with ENOENT. In
  * this case, we strip the trailing slashes and stat again.
  */
+#undef stat
 static int do_lstat(const char *file_name, struct stat *buf)
 {
 	WIN32_FILE_ATTRIBUTE_DATA fdata;
@@ -1200,8 +1201,9 @@ struct dirent *mingw_readdir(DIR *dir)
 
 	if (dir->dd_handle == (long)INVALID_HANDLE_VALUE && dir->dd_stat == 0)
 	{
+		DWORD lasterr;
 		handle = FindFirstFileA(dir->dd_name, &buf);
-		DWORD lasterr = GetLastError();
+		lasterr = GetLastError();
 		dir->dd_handle = (long)handle;
 		if (handle == INVALID_HANDLE_VALUE && (lasterr != ERROR_NO_MORE_FILES)) {
 			errno = err_win_to_posix(lasterr);
diff --git a/compat/mingw.h b/compat/mingw.h
index 0ede971..281bfde 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -171,13 +171,20 @@ int mingw_getpagesize(void);
 /* Use mingw_lstat() instead of lstat()/stat() and
  * mingw_fstat() instead of fstat() on Windows.
  */
+#undef off_t
 #define off_t off64_t
-#define stat _stati64
+#undef stat
+#define stat      _stat64
+#define stat(x,y) _stati64(x,y)
+#undef lseek
 #define lseek _lseeki64
 int mingw_lstat(const char *file_name, struct stat *buf);
 int mingw_fstat(int fd, struct stat *buf);
+#undef fstat
 #define fstat mingw_fstat
+#undef lstat
 #define lstat mingw_lstat
+#undef _stati64
 #define _stati64(x,y) mingw_lstat(x,y)
 
 int mingw_utime(const char *file_name, const struct utimbuf *times);
diff --git a/contrib/vcbuild/include/unistd.h b/contrib/vcbuild/include/unistd.h
index 311cbc0..5b4d780 100644
--- a/contrib/vcbuild/include/unistd.h
+++ b/contrib/vcbuild/include/unistd.h
@@ -4,6 +4,7 @@
 /*Configuration*/
 
 #define __MINGW32__
+#define NO_LIBGEN_H
 #define NO_SYS_SELECT_H
 #define NO_PTHEADS
 #define HAVE_STRING_H 1
@@ -17,7 +18,7 @@
 #define NTDDI_VERSION NTDDI_WIN2KSP1
 #define inline __inline
 #define __inline__ __inline
-#define NO_MMAP
+#define USE_WIN32_MMAP
 #define SHA1_HEADER "mozilla-sha1\\sha1.h"
 #define NO_ST_BLOCKS_IN_STRUCT_STAT
 #define ETC_GITCONFIG "%HOME%"
@@ -30,6 +31,7 @@
 #define va_copy va_start
 #define NO_STRTOUMAX
 #define REGEX_MALLOC
+#define NO_NSEC
 
 /* Win32 define for porting git*/
 
@@ -73,6 +75,8 @@ typedef unsigned long long   uint64_t;
 typedef long long  intmax_t;
 typedef unsigned long long uintmax_t;
 
+typedef int64_t off64_t;
+
 #define STDOUT_FILENO 1
 #define STDERR_FILENO 2
 
@@ -137,6 +141,6 @@ typedef unsigned long long uintmax_t;
 #define close _close
 #define dup _dup
 #define dup2 _dup2
-#define lseek _lseek
+//#define lseek _lseek
 #define write vs_write
 #endif
\ No newline at end of file
diff --git a/contrib/vcbuild/libgit/libgit.vcproj b/contrib/vcbuild/libgit/libgit.vcproj
index b6579e4..8bf9696 100644
--- a/contrib/vcbuild/libgit/libgit.vcproj
+++ b/contrib/vcbuild/libgit/libgit.vcproj
@@ -1,1338 +1,1350 @@
-<?xml version="1.0" encoding="gb2312"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9.00"
-	Name="libgit"
-	ProjectGUID="{F6DEC8C3-B803-4A86-8848-430F08B499E3}"
-	RootNamespace="libgit"
-	Keyword="Win32Proj"
-	TargetFrameworkVersion="196613"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			CharacterSet="0"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..\..;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				EnableIntrinsicFunctions="true"
-				AdditionalIncludeDirectories="..\include;..\..\compat;..\..\compat\fnmatch;..\..\compat\regex;.\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath="..\porting.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\mozilla-sha1\sha1.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath="..\..\..\archive.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\attr.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\blob.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\branch.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\bundle.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\cache-tree.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\cache.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\color.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\commit.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\csum-file.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\decorate.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\delta.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\dir.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\exec_cmd.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\fetch-pack.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\fsck.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\git-compat-util.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\graph.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\grep.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\hash.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\help.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\http.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\levenshtein.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\list-objects.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ll-merge.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\log-tree.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\mailmap.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\merge-recursive.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\notes.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\object.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-refs.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-revindex.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\parse-options.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\patch-ids.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pkt-line.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\progress.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\quote.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\reachable.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\reflog-walk.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\refs.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\remote.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\rerere.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\revision.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\run-command.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\send-pack.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sha1-lookup.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\shortlog.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sideband.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sigchain.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\strbuf.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\string-list.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tag.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tar.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\thread-utils.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\transport.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree-walk.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\unpack-trees.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\userdiff.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\utf8.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\walker.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\wt-status.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff-interface.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-		<Filter
-			Name="compat"
-			>
-			<File
-				RelativePath="..\..\..\compat\cygwin.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\fnmatch\fnmatch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\fnmatch\fnmatch.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\fopen.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\memmem.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\mingw.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\mingw.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\mkdtemp.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\mmap.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\pread.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\qsort.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\regex\regex.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\regex\regex.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\setenv.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\snprintf.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\strcasestr.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\strlcpy.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\strtoumax.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\unsetenv.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\win32.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\winansi.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="git"
-			>
-			<File
-				RelativePath="..\..\..\abspath.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\alias.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\alloc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\archive-tar.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\archive-zip.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\archive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\attr.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\base85.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\blob.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\branch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-add.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-annotate.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-apply.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-archive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-blame.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-branch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-bundle.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-cat-file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-check-attr.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-check-ref-format.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-checkout-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-checkout.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-clean.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-clone.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-commit-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-commit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-config.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-count-objects.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-describe.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-diff-files.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-diff-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-diff-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-diff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fast-export.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fetch--tool.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fetch-pack.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fetch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fmt-merge-msg.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-for-each-ref.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fsck.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-gc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-grep.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-help.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-init-db.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-log.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-ls-files.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-ls-remote.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-ls-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-mailinfo.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-mailsplit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge-base.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge-file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge-ours.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge-recursive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-mv.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-name-rev.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-pack-objects.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-pack-refs.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-prune-packed.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-prune.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-push.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-read-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-receive-pack.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-reflog.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-remote.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-replace.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-rerere.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-reset.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-rev-list.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-rev-parse.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-revert.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-rm.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-send-pack.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-shortlog.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-show-branch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-show-ref.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-stripspace.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-symbolic-ref.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-tag.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-tar-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-unpack-objects.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-update-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-update-ref.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-upload-archive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-verify-pack.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-verify-tag.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-write-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\bundle.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\cache-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\color.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\combine-diff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\commit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\config.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\connect.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\convert.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\copy.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\csum-file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ctype.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\date.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\decorate.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff-delta.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff-lib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff-no-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-break.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-delta.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-order.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-pickaxe.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-rename.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\dir.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\editor.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\entry.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\environment.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\exec_cmd.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\fsck.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\graph.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\grep.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\hash.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\help.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ident.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\levenshtein.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\list-objects.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ll-merge.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\lockfile.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\log-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\mailmap.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\match-trees.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\merge-file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\merge-recursive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\name-hash.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\notes.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\object.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-check.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-refs.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-revindex.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-write.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pager.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\parse-options.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\patch-delta.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\patch-ids.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\path.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pkt-line.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\preload-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pretty.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\progress.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\quote.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\reachable.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\read-cache.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\reflog-walk.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\refs.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\remote.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\replace_object.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\rerere.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\revision.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\run-command.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\server-info.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\setup.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sha1-lookup.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sha1_file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sha1_name.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\shallow.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sideband.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sigchain.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\strbuf.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\string-list.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\symlinks.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tag.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\thread-utils.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\trace.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\transport.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree-diff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree-walk.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\unpack-trees.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\usage.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\userdiff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\utf8.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\walker.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\wrapper.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\write_or_die.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ws.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\wt-status.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff-interface.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="xdiff"
-			>
-			<File
-				RelativePath="..\..\..\xdiff\xdiff.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xdiffi.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xdiffi.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xemit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xemit.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xinclude.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xmacros.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xmerge.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xpatience.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xprepare.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xprepare.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xtypes.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xutils.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xutils.h"
-				>
-			</File>
-		</Filter>
-		<File
-			RelativePath=".\ReadMe.txt"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libgit"
+	ProjectGUID="{F6DEC8C3-B803-4A86-8848-430F08B499E3}"
+	RootNamespace="libgit"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\..\..;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\include;..\..\compat;..\..\compat\fnmatch;..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\porting.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mozilla-sha1\sha1.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\archive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\delta.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fetch-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\git-compat-util.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\http.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\notes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\send-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shortlog.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tar.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="compat"
+			>
+			<File
+				RelativePath="..\..\..\compat\basename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\cygwin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fopen.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\memmem.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkdtemp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkstemps.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\pread.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\qsort.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\setenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\snprintf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strcasestr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strlcpy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strtoumax.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\unsetenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32mmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\winansi.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="git"
+			>
+			<File
+				RelativePath="..\..\..\abspath.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alias.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alloc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-tar.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-zip.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\base85.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bisect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-add.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-annotate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-apply.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bisect--helper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-blame.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-cat-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-ref-format.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clean.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clone.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-count-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-describe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fast-export.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch--tool.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fmt-merge-msg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-for-each-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-gc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-init-db.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-log.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailinfo.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailsplit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-base.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-ours.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mktree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-name-rev.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune-packed.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-push.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-read-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-receive-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reflog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reset.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-parse.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-revert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rm.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-send-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-shortlog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-stripspace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-symbolic-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tar-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-unpack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-upload-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-write-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\combine-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\connect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\convert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\copy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ctype.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\date.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-lib.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-no-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-break.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-order.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-pickaxe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-rename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\editor.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\entry.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\environment.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ident.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lockfile.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\match-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\name-hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-check.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-write.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pager.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\path.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\preload-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pretty.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\read-cache.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\server-info.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\setup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_name.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shallow.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\symlinks.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\trace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\usage.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wrapper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\write_or_die.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ws.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="xdiff"
+			>
+			<File
+				RelativePath="..\..\..\xdiff\xdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xinclude.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmacros.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmerge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xpatience.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xtypes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.h"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/contrib/vcbuild/vcbuild.sln b/contrib/vcbuild/vcbuild.sln
new file mode 100644
index 0000000..fbd1377
--- /dev/null
+++ b/contrib/vcbuild/vcbuild.sln
@@ -0,0 +1,29 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgit", "libgit\libgit.vcproj", "{F6DEC8C3-B803-4A86-8848-430F08B499E3}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "git", "git\git.vcproj", "{E3E30E51-C5AD-407B-AB43-985E4111474A}"
+	ProjectSection(ProjectDependencies) = postProject
+		{F6DEC8C3-B803-4A86-8848-430F08B499E3} = {F6DEC8C3-B803-4A86-8848-430F08B499E3}
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{F6DEC8C3-B803-4A86-8848-430F08B499E3}.Debug|Win32.ActiveCfg = Debug|Win32
+		{F6DEC8C3-B803-4A86-8848-430F08B499E3}.Debug|Win32.Build.0 = Debug|Win32
+		{F6DEC8C3-B803-4A86-8848-430F08B499E3}.Release|Win32.ActiveCfg = Release|Win32
+		{F6DEC8C3-B803-4A86-8848-430F08B499E3}.Release|Win32.Build.0 = Release|Win32
+		{E3E30E51-C5AD-407B-AB43-985E4111474A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E3E30E51-C5AD-407B-AB43-985E4111474A}.Debug|Win32.Build.0 = Debug|Win32
+		{E3E30E51-C5AD-407B-AB43-985E4111474A}.Release|Win32.ActiveCfg = Release|Win32
+		{E3E30E51-C5AD-407B-AB43-985E4111474A}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/help.c b/help.c
index 6c46d8b..399b0b4 100644
--- a/help.c
+++ b/help.c
@@ -127,7 +127,7 @@ static int is_executable(const char *name)
 		return 0;
 
 #ifdef __MINGW32__
-	/* cannot trust the executable bit, peek into the file instead */
+{	/* cannot trust the executable bit, peek into the file instead */
 	char buf[3] = { 0 };
 	int n;
 	int fd = open(name, O_RDONLY);
@@ -140,6 +140,7 @@ static int is_executable(const char *name)
 				st.st_mode |= S_IXUSR;
 		close(fd);
 	}
+}
 #endif
 	return st.st_mode & S_IXUSR;
 }
diff --git a/run-command.c b/run-command.c
index ff3d8e2..06cce47 100644
--- a/run-command.c
+++ b/run-command.c
@@ -123,6 +123,7 @@ int start_command(struct child_process *cmd)
 		exit(127);
 	}
 #else
+{
 	int s0 = -1, s1 = -1, s2 = -1;	/* backups of stdin, stdout, stderr */
 	const char **sargv = cmd->argv;
 	char **env = environ;
@@ -186,6 +187,7 @@ int start_command(struct child_process *cmd)
 		dup2(s1, 1), close(s1);
 	if (s2 >= 0)
 		dup2(s2, 2), close(s2);
+}
 #endif
 
 	if (cmd->pid < 0) {
@@ -293,6 +295,7 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const
 }
 
 #ifdef __MINGW32__
+#define __stdcall
 static __stdcall unsigned run_thread(void *data)
 {
 	struct async *async = data;
-- 
1.6.4.msysgit.0


[-- Attachment #4: 0002-enable-release-build.patch --]
[-- Type: application/octet-stream, Size: 55475 bytes --]

From ba67bc0341367ccaab1317902ae8acd7209214b7 Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Wed, 5 Aug 2009 14:39:01 +0800
Subject: [PATCH 2/5] enable release build

---
 compat/mingw.c                       |    1 -
 compat/mingw.h                       |   13 +-
 contrib/vcbuild/git/git.vcproj       |    6 +-
 contrib/vcbuild/include/unistd.h     |   39 +-
 contrib/vcbuild/libgit/libgit.vcproj | 2700 +++++++++++++++++-----------------
 5 files changed, 1394 insertions(+), 1365 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index f3a74f8..96c1a5f 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -151,7 +151,6 @@ static inline time_t filetime_to_time_t(const FILETIME *ft)
  * When a path ends with a slash, the stat will fail with ENOENT. In
  * this case, we strip the trailing slashes and stat again.
  */
-#undef stat
 static int do_lstat(const char *file_name, struct stat *buf)
 {
 	WIN32_FILE_ATTRIBUTE_DATA fdata;
diff --git a/compat/mingw.h b/compat/mingw.h
index 281bfde..b4276c4 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -173,19 +173,24 @@ int mingw_getpagesize(void);
  */
 #undef off_t
 #define off_t off64_t
-#undef stat
+
+
+#define stat(x,y) mingw_lstat(x,y)
 #define stat      _stat64
-#define stat(x,y) _stati64(x,y)
+
 #undef lseek
 #define lseek _lseeki64
+
 int mingw_lstat(const char *file_name, struct stat *buf);
 int mingw_fstat(int fd, struct stat *buf);
+
 #undef fstat
 #define fstat mingw_fstat
+
 #undef lstat
 #define lstat mingw_lstat
-#undef _stati64
-#define _stati64(x,y) mingw_lstat(x,y)
+
+
 
 int mingw_utime(const char *file_name, const struct utimbuf *times);
 #define utime mingw_utime
diff --git a/contrib/vcbuild/git/git.vcproj b/contrib/vcbuild/git/git.vcproj
index ff5e1d9..49ab8bf 100644
--- a/contrib/vcbuild/git/git.vcproj
+++ b/contrib/vcbuild/git/git.vcproj
@@ -91,10 +91,10 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
 			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="1"
-			CharacterSet="1"
+			CharacterSet="0"
 			WholeProgramOptimization="1"
 			>
 			<Tool
@@ -116,6 +116,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
@@ -134,6 +135,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
+				AdditionalDependencies="wininet.lib ws2_32.lib ../lib/zlib.lib"
 				LinkIncremental="1"
 				GenerateDebugInformation="true"
 				SubSystem="1"
diff --git a/contrib/vcbuild/include/unistd.h b/contrib/vcbuild/include/unistd.h
index 5b4d780..3450bc3 100644
--- a/contrib/vcbuild/include/unistd.h
+++ b/contrib/vcbuild/include/unistd.h
@@ -4,13 +4,35 @@
 /*Configuration*/
 
 #define __MINGW32__
+#define NO_PREAD
+#define NO_OPENSSL
 #define NO_LIBGEN_H
+#define NO_SYMLINK_HEAD
+#define NO_IPV6
+#define NO_SETENV
+#define NO_UNSETENV
+#define NO_STRCASESTR
+#define NO_STRLCPY
+#define NO_MEMMEM
+#define NO_C99_FORMAT
+#define NO_STRTOUMAX
+#define NO_MKDTEMP
+#define NO_MKSTEMPS
+
+#define RUNTIME_PREFIX
+#define NO_ST_BLOCKS_IN_STRUCT_STAT
+#define NO_NSEC
+#define USE_WIN32_MMAP
+#define USE_NED_ALLOCATOR
+
+#define NO_REGEX
+
 #define NO_SYS_SELECT_H
 #define NO_PTHEADS
 #define HAVE_STRING_H 1
 #define STDC_HEADERS
 #define NO_ICONV
-#define NO_OPENSSL
+
 #define WINVER 0x0500
 #define _WIN32_WINNT 0x0500
 #define _WIN32_WINDOWS 0x0410
@@ -18,20 +40,21 @@
 #define NTDDI_VERSION NTDDI_WIN2KSP1
 #define inline __inline
 #define __inline__ __inline
-#define USE_WIN32_MMAP
+
 #define SHA1_HEADER "mozilla-sha1\\sha1.h"
-#define NO_ST_BLOCKS_IN_STRUCT_STAT
+
 #define ETC_GITCONFIG "%HOME%"
-#define NO_IPV6
-#define RUNTIME_PREFIX
+
 #define NO_PTHREADS
 #define NO_CURL
-#define NO_MEMMEM
-#define NO_STRCASESTR
+
+
 #define va_copy va_start
 #define NO_STRTOUMAX
 #define REGEX_MALLOC
-#define NO_NSEC
+
+
+
 
 /* Win32 define for porting git*/
 
diff --git a/contrib/vcbuild/libgit/libgit.vcproj b/contrib/vcbuild/libgit/libgit.vcproj
index 8bf9696..7e45146 100644
--- a/contrib/vcbuild/libgit/libgit.vcproj
+++ b/contrib/vcbuild/libgit/libgit.vcproj
@@ -1,1350 +1,1350 @@
-<?xml version="1.0" encoding="gb2312"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9.00"
-	Name="libgit"
-	ProjectGUID="{F6DEC8C3-B803-4A86-8848-430F08B499E3}"
-	RootNamespace="libgit"
-	Keyword="Win32Proj"
-	TargetFrameworkVersion="196613"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			CharacterSet="0"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..\..;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				EnableIntrinsicFunctions="true"
-				AdditionalIncludeDirectories="..\include;..\..\compat;..\..\compat\fnmatch;..\..\compat\regex;.\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath="..\porting.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\mozilla-sha1\sha1.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath="..\..\..\archive.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\attr.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\blob.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\branch.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\bundle.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\cache-tree.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\cache.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\color.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\commit.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\csum-file.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\decorate.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\delta.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\dir.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\exec_cmd.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\fetch-pack.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\fsck.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\git-compat-util.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\graph.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\grep.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\hash.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\help.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\http.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\levenshtein.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\list-objects.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ll-merge.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\log-tree.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\mailmap.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\merge-recursive.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\notes.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\object.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-refs.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-revindex.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\parse-options.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\patch-ids.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pkt-line.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\progress.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\quote.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\reachable.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\reflog-walk.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\refs.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\remote.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\rerere.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\revision.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\run-command.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\send-pack.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sha1-lookup.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\shortlog.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sideband.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sigchain.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\strbuf.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\string-list.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tag.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tar.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\thread-utils.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\transport.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree-walk.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\unpack-trees.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\userdiff.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\utf8.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\walker.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\wt-status.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff-interface.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-		<Filter
-			Name="compat"
-			>
-			<File
-				RelativePath="..\..\..\compat\basename.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\cygwin.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\fnmatch\fnmatch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\fnmatch\fnmatch.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\fopen.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\memmem.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\mingw.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\mingw.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\mkdtemp.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\mkstemps.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\pread.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\qsort.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\regex\regex.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\regex\regex.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\setenv.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\snprintf.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\strcasestr.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\strlcpy.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\strtoumax.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\unsetenv.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\win32.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\win32mmap.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\winansi.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="git"
-			>
-			<File
-				RelativePath="..\..\..\abspath.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\alias.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\alloc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\archive-tar.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\archive-zip.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\archive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\attr.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\base85.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\bisect.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\blob.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\branch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-add.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-annotate.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-apply.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-archive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-bisect--helper.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-blame.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-branch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-bundle.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-cat-file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-check-attr.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-check-ref-format.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-checkout-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-checkout.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-clean.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-clone.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-commit-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-commit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-config.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-count-objects.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-describe.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-diff-files.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-diff-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-diff-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-diff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fast-export.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fetch--tool.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fetch-pack.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fetch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fmt-merge-msg.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-for-each-ref.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fsck.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-gc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-grep.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-help.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-init-db.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-log.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-ls-files.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-ls-remote.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-ls-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-mailinfo.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-mailsplit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge-base.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge-file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge-ours.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge-recursive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-mktree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-mv.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-name-rev.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-pack-objects.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-pack-refs.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-prune-packed.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-prune.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-push.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-read-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-receive-pack.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-reflog.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-remote.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-rerere.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-reset.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-rev-list.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-rev-parse.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-revert.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-rm.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-send-pack.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-shortlog.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-show-branch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-show-ref.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-stripspace.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-symbolic-ref.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-tag.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-tar-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-unpack-objects.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-update-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-update-ref.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-upload-archive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-verify-pack.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-verify-tag.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-write-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\bundle.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\cache-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\color.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\combine-diff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\commit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\config.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\connect.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\convert.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\copy.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\csum-file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ctype.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\date.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\decorate.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff-delta.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff-lib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff-no-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-break.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-delta.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-order.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-pickaxe.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-rename.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\dir.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\editor.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\entry.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\environment.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\exec_cmd.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\fsck.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\graph.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\grep.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\hash.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\help.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ident.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\levenshtein.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\list-objects.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ll-merge.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\lockfile.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\log-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\mailmap.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\match-trees.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\merge-file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\merge-recursive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\merge-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\name-hash.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\object.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-check.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-refs.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-revindex.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-write.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pager.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\parse-options.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\patch-delta.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\patch-ids.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\path.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pkt-line.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\preload-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pretty.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\progress.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\quote.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\reachable.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\read-cache.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\reflog-walk.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\refs.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\remote.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\rerere.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\revision.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\run-command.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\server-info.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\setup.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sha1-lookup.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sha1_file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sha1_name.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\shallow.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sideband.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sigchain.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\strbuf.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\string-list.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\symlinks.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tag.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\thread-utils.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\trace.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\transport.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree-diff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree-walk.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\unpack-trees.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\usage.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\userdiff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\utf8.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\walker.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\wrapper.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\write_or_die.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ws.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\wt-status.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff-interface.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="xdiff"
-			>
-			<File
-				RelativePath="..\..\..\xdiff\xdiff.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xdiffi.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xdiffi.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xemit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xemit.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xinclude.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xmacros.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xmerge.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xpatience.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xprepare.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xprepare.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xtypes.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xutils.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xutils.h"
-				>
-			</File>
-		</Filter>
-		<File
-			RelativePath=".\ReadMe.txt"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libgit"
+	ProjectGUID="{F6DEC8C3-B803-4A86-8848-430F08B499E3}"
+	RootNamespace="libgit"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\..\..;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\porting.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mozilla-sha1\sha1.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\archive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\delta.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fetch-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\git-compat-util.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\http.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\notes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\send-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shortlog.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tar.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="compat"
+			>
+			<File
+				RelativePath="..\..\..\compat\basename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\cygwin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fopen.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\memmem.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkdtemp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkstemps.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\pread.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\qsort.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\setenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\snprintf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strcasestr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strlcpy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strtoumax.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\unsetenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32mmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\winansi.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="git"
+			>
+			<File
+				RelativePath="..\..\..\abspath.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alias.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alloc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-tar.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-zip.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\base85.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bisect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-add.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-annotate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-apply.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bisect--helper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-blame.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-cat-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-ref-format.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clean.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clone.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-count-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-describe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fast-export.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch--tool.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fmt-merge-msg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-for-each-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-gc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-init-db.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-log.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailinfo.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailsplit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-base.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-ours.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mktree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-name-rev.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune-packed.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-push.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-read-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-receive-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reflog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reset.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-parse.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-revert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rm.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-send-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-shortlog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-stripspace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-symbolic-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tar-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-unpack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-upload-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-write-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\combine-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\connect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\convert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\copy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ctype.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\date.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-lib.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-no-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-break.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-order.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-pickaxe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-rename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\editor.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\entry.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\environment.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ident.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lockfile.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\match-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\name-hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-check.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-write.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pager.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\path.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\preload-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pretty.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\read-cache.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\server-info.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\setup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_name.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shallow.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\symlinks.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\trace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\usage.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wrapper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\write_or_die.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ws.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="xdiff"
+			>
+			<File
+				RelativePath="..\..\..\xdiff\xdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xinclude.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmacros.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmerge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xpatience.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xtypes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.h"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
-- 
1.6.4.msysgit.0


[-- Attachment #5: 0003-Release-log-command-okay.patch --]
[-- Type: application/octet-stream, Size: 848 bytes --]

From bbec8b9376d7183abda907de0e4f995f79fe9914 Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Wed, 5 Aug 2009 21:31:36 +0800
Subject: [PATCH 3/5] Release log command okay

---
 contrib/vcbuild/libgit/libgit.vcproj |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/contrib/vcbuild/libgit/libgit.vcproj b/contrib/vcbuild/libgit/libgit.vcproj
index 7e45146..4f2d234 100644
--- a/contrib/vcbuild/libgit/libgit.vcproj
+++ b/contrib/vcbuild/libgit/libgit.vcproj
@@ -105,6 +105,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="2"
+				InlineFunctionExpansion="1"
 				EnableIntrinsicFunctions="true"
 				AdditionalIncludeDirectories="..\..\..;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
 				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
-- 
1.6.4.msysgit.0


[-- Attachment #6: 0004-Move-open-dir-function-to-mingw.c.patch --]
[-- Type: application/octet-stream, Size: 55367 bytes --]

From b152ebd366280699a166c51466a031329e3d1300 Mon Sep 17 00:00:00 2001
From: Frank Li <lznuaa@gmail.com>
Date: Sat, 8 Aug 2009 11:45:17 +0800
Subject: [PATCH 4/5] Move open dir function to mingw.c

Signed-off-by: Frank Li <lznuaa@gmail.com>
---
 compat/mingw.c                       |   32 +
 contrib/vcbuild/include/unistd.h     |    9 +-
 contrib/vcbuild/libgit/libgit.vcproj | 2702 +++++++++++++++++-----------------
 contrib/vcbuild/porting.c            |   66 +-
 4 files changed, 1393 insertions(+), 1416 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 96c1a5f..1cc2cb7 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1234,4 +1234,36 @@ struct dirent *mingw_readdir(DIR *dir)
 
 	return (struct dirent*)&dir->dd_dir;
 }
+
+DIR *opendir(const char *name)
+{
+	int len;
+	DIR *p;
+	p=(DIR*)malloc(sizeof(DIR));
+	memset(p,0,sizeof(DIR));
+	strncpy(p->dd_name,name,PATH_MAX);
+	len=strlen(p->dd_name);
+	p->dd_name[len]='/';
+	p->dd_name[len+1]='*';
+
+	if(p==NULL)
+		return NULL;
+
+	p->dd_handle=_findfirst(p->dd_name,&p->dd_dta);
+
+	if(p->dd_handle == -1) 
+	{
+		free(p);
+		return NULL;
+	}
+	return p;
+}
+int closedir(DIR *dir)
+{
+	_findclose(dir->dd_handle);
+	free(dir);
+	return 0;
+}
+
 #endif // !NO_MINGW_REPLACE_READDIR
+
diff --git a/contrib/vcbuild/include/unistd.h b/contrib/vcbuild/include/unistd.h
index 3450bc3..93ecd74 100644
--- a/contrib/vcbuild/include/unistd.h
+++ b/contrib/vcbuild/include/unistd.h
@@ -151,9 +151,10 @@ typedef int64_t off64_t;
 #define GIT_VERSION "1.6"
 #define BINDIR "bin"
 #define PREFIX "."
-#define GIT_MAN_PATH "../man"
-#define GIT_INFO_PATH "../info"
-#define GIT_HTML_PATH "../html"
+#define GIT_MAN_PATH "man"
+#define GIT_INFO_PATH "info"
+#define GIT_HTML_PATH "html"
+#define DEFAULT_GIT_TEMPLATE_DIR "templates"
 
 #define NO_STRLCPY
 #define NO_UNSETENV
@@ -165,5 +166,5 @@ typedef int64_t off64_t;
 #define dup _dup
 #define dup2 _dup2
 //#define lseek _lseek
-#define write vs_write
+//#define write vs_write
 #endif
\ No newline at end of file
diff --git a/contrib/vcbuild/libgit/libgit.vcproj b/contrib/vcbuild/libgit/libgit.vcproj
index 4f2d234..5bac103 100644
--- a/contrib/vcbuild/libgit/libgit.vcproj
+++ b/contrib/vcbuild/libgit/libgit.vcproj
@@ -1,1351 +1,1351 @@
-<?xml version="1.0" encoding="gb2312"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9.00"
-	Name="libgit"
-	ProjectGUID="{F6DEC8C3-B803-4A86-8848-430F08B499E3}"
-	RootNamespace="libgit"
-	Keyword="Win32Proj"
-	TargetFrameworkVersion="196613"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			CharacterSet="0"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..\..;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			CharacterSet="0"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				EnableIntrinsicFunctions="true"
-				AdditionalIncludeDirectories="..\..\..;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath="..\porting.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\mozilla-sha1\sha1.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath="..\..\..\archive.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\attr.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\blob.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\branch.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\bundle.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\cache-tree.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\cache.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\color.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\commit.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\csum-file.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\decorate.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\delta.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\dir.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\exec_cmd.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\fetch-pack.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\fsck.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\git-compat-util.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\graph.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\grep.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\hash.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\help.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\http.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\levenshtein.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\list-objects.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ll-merge.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\log-tree.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\mailmap.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\merge-recursive.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\notes.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\object.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-refs.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-revindex.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\parse-options.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\patch-ids.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pkt-line.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\progress.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\quote.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\reachable.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\reflog-walk.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\refs.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\remote.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\rerere.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\revision.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\run-command.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\send-pack.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sha1-lookup.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\shortlog.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sideband.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sigchain.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\strbuf.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\string-list.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tag.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tar.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\thread-utils.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\transport.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree-walk.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\unpack-trees.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\userdiff.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\utf8.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\walker.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\wt-status.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff-interface.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-		<Filter
-			Name="compat"
-			>
-			<File
-				RelativePath="..\..\..\compat\basename.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\cygwin.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\fnmatch\fnmatch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\fnmatch\fnmatch.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\fopen.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\memmem.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\mingw.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\mingw.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\mkdtemp.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\mkstemps.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\pread.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\qsort.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\regex\regex.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\regex\regex.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\setenv.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\snprintf.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\strcasestr.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\strlcpy.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\strtoumax.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\unsetenv.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\win32.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\win32mmap.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\compat\winansi.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="git"
-			>
-			<File
-				RelativePath="..\..\..\abspath.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\alias.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\alloc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\archive-tar.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\archive-zip.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\archive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\attr.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\base85.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\bisect.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\blob.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\branch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-add.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-annotate.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-apply.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-archive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-bisect--helper.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-blame.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-branch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-bundle.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-cat-file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-check-attr.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-check-ref-format.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-checkout-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-checkout.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-clean.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-clone.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-commit-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-commit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-config.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-count-objects.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-describe.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-diff-files.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-diff-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-diff-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-diff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fast-export.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fetch--tool.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fetch-pack.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fetch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fmt-merge-msg.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-for-each-ref.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-fsck.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-gc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-grep.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-help.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-init-db.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-log.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-ls-files.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-ls-remote.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-ls-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-mailinfo.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-mailsplit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge-base.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge-file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge-ours.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge-recursive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-merge.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-mktree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-mv.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-name-rev.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-pack-objects.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-pack-refs.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-prune-packed.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-prune.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-push.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-read-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-receive-pack.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-reflog.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-remote.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-rerere.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-reset.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-rev-list.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-rev-parse.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-revert.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-rm.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-send-pack.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-shortlog.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-show-branch.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-show-ref.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-stripspace.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-symbolic-ref.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-tag.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-tar-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-unpack-objects.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-update-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-update-ref.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-upload-archive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-verify-pack.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-verify-tag.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\builtin-write-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\bundle.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\cache-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\color.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\combine-diff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\commit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\config.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\connect.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\convert.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\copy.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\csum-file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ctype.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\date.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\decorate.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff-delta.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff-lib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff-no-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-break.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-delta.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-order.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-pickaxe.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\diffcore-rename.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\dir.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\editor.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\entry.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\environment.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\exec_cmd.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\fsck.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\graph.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\grep.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\hash.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\help.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ident.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\levenshtein.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\list-objects.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ll-merge.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\lockfile.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\log-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\mailmap.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\match-trees.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\merge-file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\merge-recursive.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\merge-tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\name-hash.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\object.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-check.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-refs.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-revindex.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pack-write.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pager.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\parse-options.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\patch-delta.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\patch-ids.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\path.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pkt-line.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\preload-index.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\pretty.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\progress.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\quote.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\reachable.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\read-cache.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\reflog-walk.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\refs.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\remote.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\rerere.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\revision.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\run-command.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\server-info.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\setup.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sha1-lookup.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sha1_file.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sha1_name.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\shallow.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sideband.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sigchain.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\strbuf.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\string-list.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\symlinks.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tag.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\thread-utils.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\trace.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\transport.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree-diff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree-walk.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\tree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\unpack-trees.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\usage.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\userdiff.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\utf8.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\walker.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\wrapper.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\write_or_die.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\ws.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\wt-status.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff-interface.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="xdiff"
-			>
-			<File
-				RelativePath="..\..\..\xdiff\xdiff.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xdiffi.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xdiffi.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xemit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xemit.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xinclude.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xmacros.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xmerge.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xpatience.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xprepare.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xprepare.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xtypes.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xutils.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\xdiff\xutils.h"
-				>
-			</File>
-		</Filter>
-		<File
-			RelativePath=".\ReadMe.txt"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libgit"
+	ProjectGUID="{F6DEC8C3-B803-4A86-8848-430F08B499E3}"
+	RootNamespace="libgit"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\..\..;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="..\..\..;..\..;..\;..\include;..\..\..\compat;..\..\..\compat\fnmatch;..\..\..\compat\regex;.\"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\porting.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mozilla-sha1\sha1.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\archive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\delta.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fetch-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\git-compat-util.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\http.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\notes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\send-pack.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shortlog.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tar.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<Filter
+			Name="compat"
+			>
+			<File
+				RelativePath="..\..\..\compat\basename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\cygwin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fnmatch\fnmatch.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\fopen.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\memmem.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mingw.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkdtemp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\mkstemps.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\pread.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\qsort.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\regex\regex.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\setenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\snprintf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strcasestr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strlcpy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\strtoumax.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\unsetenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\win32mmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\compat\winansi.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="git"
+			>
+			<File
+				RelativePath="..\..\..\abspath.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alias.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\alloc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-tar.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive-zip.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\base85.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bisect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\blob.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-add.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-annotate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-apply.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bisect--helper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-blame.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-cat-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-attr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-check-ref-format.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-checkout.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clean.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-clone.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-count-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-describe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fast-export.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch--tool.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fetch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fmt-merge-msg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-for-each-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-gc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-init-db.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-log.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-ls-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailinfo.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mailsplit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-base.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-ours.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mktree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-mv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-name-rev.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune-packed.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-prune.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-push.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-read-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-receive-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reflog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-reset.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rev-parse.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-revert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-rm.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-send-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-shortlog.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-branch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-show-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-stripspace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-symbolic-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-tar-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-unpack-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-update-ref.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-upload-archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-pack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-verify-tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\builtin-write-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\bundle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\cache-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\color.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\combine-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\commit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\connect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\convert.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\copy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\csum-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ctype.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\date.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\decorate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-lib.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff-no-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-break.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-order.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-pickaxe.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\diffcore-rename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\dir.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\editor.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\entry.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\environment.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\exec_cmd.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\fsck.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\graph.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\grep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\help.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ident.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\levenshtein.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\list-objects.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ll-merge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lockfile.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\log-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\mailmap.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\match-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-recursive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\merge-tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\name-hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\object.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-check.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-revindex.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pack-write.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pager.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\parse-options.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-delta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\patch-ids.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\path.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pkt-line.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\preload-index.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\pretty.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\progress.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\quote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reachable.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\read-cache.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\reflog-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\refs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\remote.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\rerere.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\revision.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\run-command.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\server-info.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\setup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1-lookup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sha1_name.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\shallow.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sideband.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\sigchain.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\strbuf.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\string-list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\symlinks.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tag.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\thread-utils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\trace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\transport.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-diff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree-walk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\tree.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\unpack-trees.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\usage.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\userdiff.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\utf8.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\walker.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wrapper.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\write_or_die.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\ws.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\wt-status.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff-interface.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="xdiff"
+			>
+			<File
+				RelativePath="..\..\..\xdiff\xdiff.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xdiffi.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xemit.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xinclude.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmacros.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xmerge.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xpatience.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xprepare.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xtypes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\xdiff\xutils.h"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/contrib/vcbuild/porting.c b/contrib/vcbuild/porting.c
index 5381862..0625bb4 100644
--- a/contrib/vcbuild/porting.c
+++ b/contrib/vcbuild/porting.c
@@ -7,10 +7,12 @@
 
 int snprintf(char *buff,int size, char *fmt, ...)
 {
+	int n;
 	va_list pArgList;
 	va_start(pArgList,fmt);
-	_snprintf(buff,size-1,fmt,pArgList);
+	n=_snprintf(buff,size-1,fmt,pArgList);
 	va_end(pArgList);
+	return n;
 }
 
 int strcasecmp (const char *s1, const char *s2)
@@ -18,16 +20,12 @@ int strcasecmp (const char *s1, const char *s2)
 	int size1=strlen(s1);
 	int sisz2=strlen(s2);
 
-	_strnicmp(s1,s2,sisz2>size1?sisz2:size1);
+	return _strnicmp(s1,s2,sisz2>size1?sisz2:size1);
 }
 
 int strncasecmp (const char *s1, const char *s2,size_t n)
 {
-	_strnicmp(s1,s2,n);
-}
-size_t getpagesize(void)
-{
-	return 0x1000;
+	return _strnicmp(s1,s2,n);
 }
 
 unsigned long long int
@@ -35,57 +33,3 @@ strtoull(const char *nptr, char **endptr, int base)
 {
 	return _strtoui64(nptr,endptr,base);
 }
-
-DIR *opendir(const char *name)
-{
-	int len;
-	DIR *p;
-	p=(DIR*)malloc(sizeof(DIR));
-	memset(p,0,sizeof(DIR));
-	strncpy(p->dd_name,name,PATH_MAX);
-	len=strlen(p->dd_name);
-	p->dd_name[len]='/';
-	p->dd_name[len+1]='*';
-
-	if(p==NULL)
-		return NULL;
-
-	p->dd_handle=_findfirst(p->dd_name,&p->dd_dta);
-
-	if(p->dd_handle == -1) 
-	{
-		free(p);
-		return NULL;
-	}
-	return p;
-}
-int closedir(DIR *dir)
-{
-	_findclose(dir->dd_handle);
-	free(dir);
-	return 0;
-}
-struct dirent *readdir(DIR *dir)
-{
-	if(_findnext(dir->dd_handle,&dir->dd_dta))
-		return NULL;
-
-	strcpy(dir->dd_dir.d_name,dir->dd_dta.name);
-	dir->dd_dir.d_namlen = dir->dd_dta.size;
-	
-	return &dir->dd_dir;
-}
-char *mkdtemp(char *template)
-{
-	return NULL;
-}
-ssize_t pread(int fd, void *buf, size_t nbytes, off_t offset)
-{
-	_lseek(fd,offset,SEEK_SET);
-	return read(fd,buf,nbytes);
-}
-
-int vs_write(int fd, void * buf, size_t nbytes)
-{
-	return _write(fd,buf,nbytes);
-}
\ No newline at end of file
-- 
1.6.4.msysgit.0


^ permalink raw reply related	[relevance 11%]

* [PATCH 4/6] Make it possible to set up libgit directly (instead of from the environment)
  @ 2006-07-03 20:48 11% ` Petr Baudis
  0 siblings, 0 replies; 200+ results
From: Petr Baudis @ 2006-07-03 20:48 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This introduces a setup_git() function which is essentialy a (public)
backend for setup_git_env() which lets anyone specify custom sources
for the various paths instead of environment variables. Since the repositories
may get switched on the fly, this also updates code that caches paths to
invalidate them properly; I hope neither of those is a sweet spot.

It is used by Git.xs' xs__call_gate() to set up per-repository data
for libgit's consumption. No code actually takes advantage of it yet
but get_object() will in the next patches.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 cache.h       |    3 +++
 commit.c      |   23 +++++++++++++++++++----
 environment.c |   45 +++++++++++++++++++++++++++++++++++++++------
 perl/Git.pm   |    8 ++++----
 perl/Git.xs   |   16 +++++++++++++++-
 sha1_file.c   |   30 ++++++++++++++++++++++++------
 sha1_name.c   |   10 ++++++++--
 7 files changed, 112 insertions(+), 23 deletions(-)

diff --git a/cache.h b/cache.h
index 8719939..962f2fc 100644
--- a/cache.h
+++ b/cache.h
@@ -116,6 +116,9 @@ extern struct cache_entry **active_cache
 extern unsigned int active_nr, active_alloc, active_cache_changed;
 extern struct cache_tree *active_cache_tree;
 
+extern void setup_git(char *new_git_dir, char *new_git_object_dir,
+                      char *new_git_index_file, char *new_git_graft_file);
+
 #define GIT_DIR_ENVIRONMENT "GIT_DIR"
 #define DEFAULT_GIT_DIR_ENVIRONMENT ".git"
 #define DB_ENVIRONMENT "GIT_OBJECT_DIRECTORY"
diff --git a/commit.c b/commit.c
index a608faf..91f97c1 100644
--- a/commit.c
+++ b/commit.c
@@ -163,6 +163,14 @@ int register_commit_graft(struct commit_
 	return 0;
 }
 
+void free_commit_grafts(void)
+{
+	int pos = commit_graft_nr;
+	while (pos >= 0)
+		free(commit_graft[pos--]);
+	commit_graft_nr = 0;
+}
+
 struct commit_graft *read_graft_line(char *buf, int len)
 {
 	/* The format is just "Commit Parent1 Parent2 ...\n" */
@@ -215,11 +223,18 @@ int read_graft_file(const char *graft_fi
 static void prepare_commit_graft(void)
 {
 	static int commit_graft_prepared;
-	char *graft_file;
+	static char *last_graft_file;
+	char *graft_file = get_graft_file();
+
+	if (last_graft_file) {
+		if (!strcmp(graft_file, last_graft_file))
+			return;
+		free_commit_grafts();
+	}
+	if (last_graft_file)
+		free(last_graft_file);
+	last_graft_file = strdup(graft_file);
 
-	if (commit_graft_prepared)
-		return;
-	graft_file = get_graft_file();
 	read_graft_file(graft_file);
 	commit_graft_prepared = 1;
 }
diff --git a/environment.c b/environment.c
index 3de8eb3..6b64d11 100644
--- a/environment.c
+++ b/environment.c
@@ -21,28 +21,61 @@ char git_commit_encoding[MAX_ENCODING_LE
 int shared_repository = PERM_UMASK;
 const char *apply_default_whitespace = NULL;
 
+static int dyn_git_object_dir, dyn_git_index_file, dyn_git_graft_file;
 static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
 	*git_graft_file;
-static void setup_git_env(void)
+
+void setup_git(char *new_git_dir, char *new_git_object_dir,
+               char *new_git_index_file, char *new_git_graft_file)
 {
-	git_dir = getenv(GIT_DIR_ENVIRONMENT);
+	git_dir = new_git_dir;
 	if (!git_dir)
 		git_dir = DEFAULT_GIT_DIR_ENVIRONMENT;
-	git_object_dir = getenv(DB_ENVIRONMENT);
+
+	if (dyn_git_object_dir)
+		free(git_object_dir);
+	git_object_dir = new_git_object_dir;
 	if (!git_object_dir) {
 		git_object_dir = xmalloc(strlen(git_dir) + 9);
 		sprintf(git_object_dir, "%s/objects", git_dir);
+		dyn_git_object_dir = 1;
+	} else {
+		dyn_git_object_dir = 0;
 	}
+
+	if (git_refs_dir)
+		free(git_refs_dir);
 	git_refs_dir = xmalloc(strlen(git_dir) + 6);
 	sprintf(git_refs_dir, "%s/refs", git_dir);
-	git_index_file = getenv(INDEX_ENVIRONMENT);
+
+	if (dyn_git_index_file)
+		free(git_index_file);
+	git_index_file = new_git_index_file;
 	if (!git_index_file) {
 		git_index_file = xmalloc(strlen(git_dir) + 7);
 		sprintf(git_index_file, "%s/index", git_dir);
+		dyn_git_index_file = 1;
+	} else {
+		dyn_git_index_file = 0;
 	}
-	git_graft_file = getenv(GRAFT_ENVIRONMENT);
-	if (!git_graft_file)
+
+	if (dyn_git_graft_file)
+		free(git_graft_file);
+	git_graft_file = new_git_graft_file;
+	if (!git_graft_file) {
 		git_graft_file = strdup(git_path("info/grafts"));
+		dyn_git_graft_file = 1;
+	} else {
+		dyn_git_graft_file = 0;
+	}
+}
+
+static void setup_git_env(void)
+{
+	setup_git(getenv(GIT_DIR_ENVIRONMENT),
+	          getenv(DB_ENVIRONMENT),
+	          getenv(INDEX_ENVIRONMENT),
+	          getenv(GRAFT_ENVIRONMENT));
 }
 
 char *get_git_dir(void)
diff --git a/perl/Git.pm b/perl/Git.pm
index 9ce9fcd..895a939 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -92,6 +92,7 @@ increate nonwithstanding).
 use Carp qw(carp croak); # but croak is bad - throw instead
 use Error qw(:try);
 use Cwd qw(abs_path);
+use Scalar::Util;
 
 require XSLoader;
 XSLoader::load('Git', $VERSION);
@@ -833,11 +834,10 @@ sub _call_gate {
 	if (defined $self) {
 		# XXX: We ignore the WorkingCopy! To properly support
 		# that will require heavy changes in libgit.
+		# For now, when we will need to do it we could temporarily
+		# chdir() there and then chdir() back after the call is done.
 
-		# XXX: And we ignore everything else as well. libgit
-		# at least needs to be extended to let us specify
-		# the $GIT_DIR instead of looking it up in environment.
-		#xs_call_gate($self->{opts}->{Repository});
+		xs__call_gate(Scalar::Util::refaddr($self), $self->repo_path());
 	}
 
 	# Having to call throw from the C code is a sure path to insanity.
diff --git a/perl/Git.xs b/perl/Git.xs
index 2bbec43..6ed26a2 100644
--- a/perl/Git.xs
+++ b/perl/Git.xs
@@ -52,7 +52,21 @@ BOOT:
 }
 
 
-# /* TODO: xs_call_gate(). See Git.pm. */
+void
+xs__call_gate(repoid, git_dir)
+	long repoid;
+	char *git_dir;
+CODE:
+{
+	static long last_repoid;
+	if (repoid != last_repoid) {
+		setup_git(git_dir,
+		          getenv(DB_ENVIRONMENT),
+		          getenv(INDEX_ENVIRONMENT),
+		          getenv(GRAFT_ENVIRONMENT));
+		last_repoid = repoid;
+	}
+}
 
 
 char *
diff --git a/sha1_file.c b/sha1_file.c
index 8179630..ab64543 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -126,16 +126,22 @@ static void fill_sha1_path(char *pathbuf
 char *sha1_file_name(const unsigned char *sha1)
 {
 	static char *name, *base;
+	static const char *last_objdir;
+	const char *sha1_file_directory = get_object_directory();
 
-	if (!base) {
-		const char *sha1_file_directory = get_object_directory();
+	if (!last_objdir || strcmp(last_objdir, sha1_file_directory)) {
 		int len = strlen(sha1_file_directory);
+		if (base)
+			free(base);
 		base = xmalloc(len + 60);
 		memcpy(base, sha1_file_directory, len);
 		memset(base+len, 0, 60);
 		base[len] = '/';
 		base[len+3] = '/';
 		name = base + len + 1;
+		if (last_objdir)
+			free((char *) last_objdir);
+		last_objdir = strdup(sha1_file_directory);
 	}
 	fill_sha1_path(name, sha1);
 	return base;
@@ -145,14 +151,20 @@ char *sha1_pack_name(const unsigned char
 {
 	static const char hex[] = "0123456789abcdef";
 	static char *name, *base, *buf;
+	static const char *last_objdir;
+	const char *sha1_file_directory = get_object_directory();
 	int i;
 
-	if (!base) {
-		const char *sha1_file_directory = get_object_directory();
+	if (!last_objdir || strcmp(last_objdir, sha1_file_directory)) {
 		int len = strlen(sha1_file_directory);
+		if (base)
+			free(base);
 		base = xmalloc(len + 60);
 		sprintf(base, "%s/pack/pack-1234567890123456789012345678901234567890.pack", sha1_file_directory);
 		name = base + len + 11;
+		if (last_objdir)
+			free((char *) last_objdir);
+		last_objdir = strdup(sha1_file_directory);
 	}
 
 	buf = name;
@@ -170,14 +182,20 @@ char *sha1_pack_index_name(const unsigne
 {
 	static const char hex[] = "0123456789abcdef";
 	static char *name, *base, *buf;
+	static const char *last_objdir;
+	const char *sha1_file_directory = get_object_directory();
 	int i;
 
-	if (!base) {
-		const char *sha1_file_directory = get_object_directory();
+	if (!last_objdir || strcmp(last_objdir, sha1_file_directory)) {
 		int len = strlen(sha1_file_directory);
+		if (base)
+			free(base);
 		base = xmalloc(len + 60);
 		sprintf(base, "%s/pack/pack-1234567890123456789012345678901234567890.idx", sha1_file_directory);
 		name = base + len + 11;
+		if (last_objdir)
+			free((char *) last_objdir);
+		last_objdir = strdup(sha1_file_directory);
 	}
 
 	buf = name;
diff --git a/sha1_name.c b/sha1_name.c
index f2cbafa..c698c1b 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -12,15 +12,21 @@ static int find_short_object_filename(in
 	char hex[40];
 	int found = 0;
 	static struct alternate_object_database *fakeent;
+	static const char *last_objdir;
+	const char *objdir = get_object_directory();
 
-	if (!fakeent) {
-		const char *objdir = get_object_directory();
+	if (!last_objdir || strcmp(last_objdir, objdir)) {
 		int objdir_len = strlen(objdir);
 		int entlen = objdir_len + 43;
+		if (fakeent)
+			free(fakeent);
 		fakeent = xmalloc(sizeof(*fakeent) + entlen);
 		memcpy(fakeent->base, objdir, objdir_len);
 		fakeent->name = fakeent->base + objdir_len + 1;
 		fakeent->name[-1] = '/';
+		if (last_objdir)
+			free((char *) last_objdir);
+		last_objdir = strdup(objdir);
 	}
 	fakeent->next = alt_odb_list;
 

^ permalink raw reply related	[relevance 11%]

* Re: [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory
  2011-02-18  4:18 11%           ` Jeff King
@ 2011-02-18  5:58 12%             ` Jonathan Nieder
  0 siblings, 0 replies; 200+ results
From: Jonathan Nieder @ 2011-02-18  5:58 UTC (permalink / raw)
  To: Jeff King; +Cc: Nguyen Thai Ngoc Duy, git, Junio C Hamano, Nicolas Pitre

Jeff King wrote:

> I wonder if there should perhaps be lib/, with all of the libgit.a
> sources in it, and then lib/block-sha1, lib/ppc, lib/compat, etc. Those
> things do end up inside libgit.a, don't they?

Hmph.  Let's see:

 - our xdiff changes ought to move upstream so other projects can
   use them.  That is, xdiff ought to be installable as a shared
   library.  So maybe that can stay out of libgit/.

 - block-sha1/ and ppc/ are just alternatives to openssl sha1, which
   can be installed as a system library.  Maybe keeping block-sha1
   out of libgit/ would provide an incentive to make block-sha1 usable
   as a system library for other projects to try out, too.

 - most of compat/ is needed if Windows and old Unixen are to be able
   to build libgit/.  So it probably should be part of libgit.

 - compat/bswap.h is needed for libgit.

 - compat/strlcpy.c is part of libbsd, so if such dependencies are ok
   it could stay out.

I really didn't want too many extra levels of hierarchy, so except for
bswap.h I think this is okay for until libgit grows a Makefile.  I
might be overlooking some glibc-only functions, though.

^ permalink raw reply	[relevance 12%]

* Re: [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory
  2011-02-18  2:31 28%     ` [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory Jonathan Nieder
@ 2011-02-18  3:47 12%       ` Nguyen Thai Ngoc Duy
  2011-02-18  4:14 27%         ` Jonathan Nieder
  2011-02-18  4:31 11%       ` Nguyen Thai Ngoc Duy
  1 sibling, 1 reply; 200+ results
From: Nguyen Thai Ngoc Duy @ 2011-02-18  3:47 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git, Junio C Hamano, Nicolas Pitre

2011/2/18 Jonathan Nieder <jrnieder@gmail.com>:
> Move sources for libgit.a to a libgit/ subdirectory.  This way, a
> person wanting to tackle the reusable part of git will know where to
> look, and those looking to work on individual commands know to look
> elsewhere.

You missed a few (on purpose?): block-sha1, ppc and compat.

libgit.a is produced at toplevel so I need a few more keystrokes to
reach files inside libgit. Maybe move libgit.a to libgit too?

> Perhaps some day the libgit/ subdirectory can be managed as an
> independent subproject (for example if it gets merged with libgit2).

With die() all over the place in libgit.a, I doubt it would become an
independent project. Although this certainly makes it easier to
reimplement libgit as a thin wrapper around libgit2.

> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
-- 
Duy

^ permalink raw reply	[relevance 12%]

* [TIG PATCH] test: make diff/log work with git 2.9
@ 2016-06-14  8:34 12% Michael J Gruber
  0 siblings, 0 replies; 200+ results
From: Michael J Gruber @ 2016-06-14  8:34 UTC (permalink / raw)
  To: git; +Cc: Jonas Fonseca

git 2.9.0 switches the default for diff.renames to true.

Set this to false in config so that the test suite runs unmodified for
old and new git.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 test/tools/libgit.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/tools/libgit.sh b/test/tools/libgit.sh
index 6a8aa54..0bce451 100644
--- a/test/tools/libgit.sh
+++ b/test/tools/libgit.sh
@@ -33,6 +33,7 @@ git_config()
 {
 	git config --local user.name "Committer"
 	git config --local user.email "c.ommitter@example.net"
+	git config --local diff.renames false
 }
 
 git_init()
-- 
2.9.0.382.g87fd384

^ permalink raw reply related	[relevance 12%]

* [PATCH v3 02/10] svn-fe: add EXTLIBS needed for parse-options
  @ 2011-08-16  9:54 14% ` Dmitry Ivankov
  0 siblings, 0 replies; 200+ results
From: Dmitry Ivankov @ 2011-08-16  9:54 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder, David Barr, Ramkumar Ramachandra, Dmitry Ivankov

Currently parse-options.o pull quite a big bunch of dependencies
that are neither pulled in by svn-fe Makefile nor included in libgit.a.

Use a temporary hack: put hardcoded EXTLIBS, this may not work in all
setups because /Makefile logic is not repeated. The list of extlibs
is likely to be exhaustive, but one may need to adjust it.

-lcrypto is needed for SHA-1 routines unless NO_OPENSSL or BLK_SHA1
is set, -lpcre is for grep if USE_LIBPCRE is set, and -lz is needed
throughout.

In the future, none of these should be needed, after a little
rearranging to ensure that parse-options.o has no references to
translation units that need to access the object db.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 contrib/svn-fe/Makefile |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
index bc03a3e..8b12df1 100644
--- a/contrib/svn-fe/Makefile
+++ b/contrib/svn-fe/Makefile
@@ -8,11 +8,12 @@ CFLAGS = -g -O2 -Wall
 LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-EXTLIBS =
+EXTLIBS = -lssl -lcrypto -lpcre -lz -lpthread
 
 GIT_LIB = ../../libgit.a
 VCSSVN_LIB = ../../vcs-svn/lib.a
-LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(EXTLIBS)
+XDIFF_LIB = ../../xdiff/lib.a
+LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(XDIFF_LIB) $(EXTLIBS)
 
 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
 QUIET_SUBDIR1 =
@@ -53,11 +54,8 @@ svn-fe.1: svn-fe.txt
 		../contrib/svn-fe/$@
 	$(MV) ../../Documentation/svn-fe.1 .
 
-../../vcs-svn/lib.a: FORCE
-	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) vcs-svn/lib.a
-
-../../libgit.a: FORCE
-	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
+$(VCSSVN_LIB) $(GIT_LIB) $(XDIFF_LIB): ../../%.a: FORCE
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $*.a
 
 clean:
 	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
-- 
1.7.3.4

^ permalink raw reply related	[relevance 14%]

* [PATCH] cmake: adapt to the Git Standard Library
@ 2024-02-27 14:44 15% Johannes Schindelin via GitGitGadget
  0 siblings, 0 replies; 200+ results
From: Johannes Schindelin via GitGitGadget @ 2024-02-27 14:44 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Johannes Schindelin

From: Johannes Schindelin <johannes.schindelin@gmx.de>

In the commit "git-std-lib: introduce Git Standard Library" of the
`cw/git-std-lib` topic, the Makefile was restructured in a manner that
requires the CMake definition to follow suit to be able to build Git.

This commit adjusts the CMake definition accordingly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
    cmake: adapt to the Git Standard Library
    
    The usual CMake adjustments. This is based on cw/git-std-lib.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1677%2Fdscho%2Fcmake-vs-git-std-lib-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1677/dscho/cmake-vs-git-std-lib-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1677

 contrib/buildsystems/CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 804629c525b..6f46f8f9070 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -676,10 +676,12 @@ include_directories(${CMAKE_BINARY_DIR})
 #build
 #libgit
 parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
+parse_makefile_for_sources(std_lib_SOURCES "STD_LIB_OBJS")
 
 list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+list(TRANSFORM std_lib_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
 list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
-add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
+add_library(libgit ${libgit_SOURCES} ${std_lib_SOURCES} ${compat_SOURCES})
 
 #libxdiff
 parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")

base-commit: c9e04a1e1f954dd60b1373f75b710f64d34e502b
-- 
gitgitgadget


^ permalink raw reply related	[relevance 15%]

* [PATCH v2 03/11] svn-fe: add EXTLIBS needed for parse-options
  @ 2011-07-13 12:21 15% ` Dmitry Ivankov
  0 siblings, 0 replies; 200+ results
From: Dmitry Ivankov @ 2011-07-13 12:21 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder, David Barr, Ramkumar Ramachandra, Dmitry Ivankov

Currently parse-options.o pull quite a big bunch of dependencies
that are neither pulled in by svn-fe Makefile nor included in libgit.a.

Use a temporary hack: put hardcoded EXTLIBS, this may not work in all
setups because /Makefile logic is not repeated.

For example, one may need -lcrypto instead of -lssl or no crypto library
if BLK_SHA1 is set, also an additional -lz or -lpcre could be required.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
---
 contrib/svn-fe/Makefile |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
index bc03a3e..bf1625c 100644
--- a/contrib/svn-fe/Makefile
+++ b/contrib/svn-fe/Makefile
@@ -8,11 +8,12 @@ CFLAGS = -g -O2 -Wall
 LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-EXTLIBS =
+EXTLIBS = -lssl -lpthread
 
 GIT_LIB = ../../libgit.a
 VCSSVN_LIB = ../../vcs-svn/lib.a
-LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(EXTLIBS)
+XDIFF_LIB = ../../xdiff/lib.a
+LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(XDIFF_LIB) $(EXTLIBS)
 
 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
 QUIET_SUBDIR1 =
@@ -53,11 +54,8 @@ svn-fe.1: svn-fe.txt
 		../contrib/svn-fe/$@
 	$(MV) ../../Documentation/svn-fe.1 .
 
-../../vcs-svn/lib.a: FORCE
-	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) vcs-svn/lib.a
-
-../../libgit.a: FORCE
-	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
+$(VCSSVN_LIB) $(GIT_LIB) $(XDIFF_LIB): ../../%.a: FORCE
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $*.a
 
 clean:
 	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
-- 
1.7.3.4

^ permalink raw reply related	[relevance 15%]

* [PATCH 3/8] svn-fe: add EXTLIBS needed for parse-options
  @ 2011-07-03 17:57 15% ` Dmitry Ivankov
  0 siblings, 0 replies; 200+ results
From: Dmitry Ivankov @ 2011-07-03 17:57 UTC (permalink / raw)
  To: git; +Cc: Jonathan Nieder, David Barr, Dmitry Ivankov

Currently parse-options.o pull quite a big bunch of dependencies
that are neither pulled in by svn-fe Makefile nor included in libgit.a.

Use a temporary hack: put hardcoded EXTLIBS, this may not work in all
setups because /Makefile logic is not repeated.

For example, one may need -lcrypto instead of -lssl or no crypto library
if BLK_SHA1 is set, also an additional -lz or -lpcre could be required.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
---
 contrib/svn-fe/Makefile |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
index bc03a3e..bf1625c 100644
--- a/contrib/svn-fe/Makefile
+++ b/contrib/svn-fe/Makefile
@@ -8,11 +8,12 @@ CFLAGS = -g -O2 -Wall
 LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-EXTLIBS =
+EXTLIBS = -lssl -lpthread
 
 GIT_LIB = ../../libgit.a
 VCSSVN_LIB = ../../vcs-svn/lib.a
-LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(EXTLIBS)
+XDIFF_LIB = ../../xdiff/lib.a
+LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(XDIFF_LIB) $(EXTLIBS)
 
 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
 QUIET_SUBDIR1 =
@@ -53,11 +54,8 @@ svn-fe.1: svn-fe.txt
 		../contrib/svn-fe/$@
 	$(MV) ../../Documentation/svn-fe.1 .
 
-../../vcs-svn/lib.a: FORCE
-	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) vcs-svn/lib.a
-
-../../libgit.a: FORCE
-	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
+$(VCSSVN_LIB) $(GIT_LIB) $(XDIFF_LIB): ../../%.a: FORCE
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $*.a
 
 clean:
 	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
-- 
1.7.3.4

^ permalink raw reply related	[relevance 15%]

* [PATCH 1/8] svn-fe: Prepare for strbuf use
  @ 2010-11-20 19:22 15%     ` Jonathan Nieder
  0 siblings, 0 replies; 200+ results
From: Jonathan Nieder @ 2010-11-20 19:22 UTC (permalink / raw)
  To: git; +Cc: Ramkumar Ramachandra, Sverre Rabbelier, David Barr

Linking svn-fe strbuf.o will require sha1_name.o and wrapper.o, hence
sha1_file.o, hence libz, pthreads, and most of libgit.  Luckily there
is a separate patch series in flight that would trim down those
dependencies again.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 contrib/svn-fe/Makefile |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
index 360d8da..9732b03 100644
--- a/contrib/svn-fe/Makefile
+++ b/contrib/svn-fe/Makefile
@@ -8,11 +8,13 @@ CFLAGS = -g -O2 -Wall
 LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-EXTLIBS =
+PTHREAD_LIBS = -lpthread
+EXTLIBS = -lz $(PTHREAD_LIBS)
 
 GIT_LIB = ../../libgit.a
 VCSSVN_LIB = ../../vcs-svn/lib.a
-LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(EXTLIBS)
+XDIFF_LIB = ../../xdiff/lib.a
+LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(XDIFF_LIB) $(EXTLIBS)
 
 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
 QUIET_SUBDIR1 =
@@ -33,7 +35,7 @@ ifndef V
 endif
 endif
 
-svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(GIT_LIB)
+svn-fe$X: svn-fe.o $(VCSSVN_LIB) $(GIT_LIB) $(XDIFF_LIB)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ svn-fe.o \
 		$(ALL_LDFLAGS) $(LIBS)
 
@@ -51,11 +53,8 @@ svn-fe.1: svn-fe.txt
 		../contrib/svn-fe/$@
 	$(MV) ../../Documentation/svn-fe.1 .
 
-../../vcs-svn/lib.a: FORCE
-	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) vcs-svn/lib.a
-
-../../libgit.a: FORCE
-	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
+../../%.a: FORCE
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) $*.a
 
 clean:
 	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
-- 
1.7.2.3

^ permalink raw reply related	[relevance 15%]

* [PATCH 9/3] Move non-builtin git commands and script libraries to a subdirectory
  @ 2011-02-18  5:04 15%         ` Jonathan Nieder
  0 siblings, 0 replies; 200+ results
From: Jonathan Nieder @ 2011-02-18  5:04 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git, Junio C Hamano, Nicolas Pitre

Create a nonbuiltin/ directory for the standalone programs, scripts,
and script libraries that are installed in gitexecdir and implement
non-builtin git commands.

So now each file git-subcommand in /usr/libexec/git-core is a hard
link to git, a copy of scripts/unimplemented.sh, or builtin from a
file named nonbuiltin/subcommand.<something>, where <something> is c,
sh, or perl.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
The patch would probably be cleaner if

	BUILT_SCRIPT_SH := $(patsubst %.sh,%,$(SCRIPT_SH))

et al were factored out first.

 Makefile                                           |  137 ++++++++++----------
 [ ... and a bunch of renames ... ]
 44 files changed, 70 insertions(+), 67 deletions(-)

diff --git a/Makefile b/Makefile
index 1c10e29..6f8a11c 100644
--- a/Makefile
+++ b/Makefile
@@ -358,44 +358,44 @@ TEST_PROGRAMS_NEED_X =
 # interactive shell sessions without exporting it.
 unexport CDPATH
 
-SCRIPT_SH += git-am.sh
-SCRIPT_SH += git-bisect.sh
-SCRIPT_SH += git-difftool--helper.sh
-SCRIPT_SH += git-filter-branch.sh
-SCRIPT_SH += git-lost-found.sh
-SCRIPT_SH += git-merge-octopus.sh
-SCRIPT_SH += git-merge-one-file.sh
-SCRIPT_SH += git-merge-resolve.sh
-SCRIPT_SH += git-mergetool.sh
-SCRIPT_SH += git-pull.sh
-SCRIPT_SH += git-quiltimport.sh
-SCRIPT_SH += git-rebase--interactive.sh
-SCRIPT_SH += git-rebase.sh
-SCRIPT_SH += git-repack.sh
-SCRIPT_SH += git-request-pull.sh
-SCRIPT_SH += git-stash.sh
-SCRIPT_SH += git-submodule.sh
-SCRIPT_SH += git-web--browse.sh
+SCRIPT_SH += nonbuiltin/am.sh
+SCRIPT_SH += nonbuiltin/bisect.sh
+SCRIPT_SH += nonbuiltin/difftool--helper.sh
+SCRIPT_SH += nonbuiltin/filter-branch.sh
+SCRIPT_SH += nonbuiltin/lost-found.sh
+SCRIPT_SH += nonbuiltin/merge-octopus.sh
+SCRIPT_SH += nonbuiltin/merge-one-file.sh
+SCRIPT_SH += nonbuiltin/merge-resolve.sh
+SCRIPT_SH += nonbuiltin/mergetool.sh
+SCRIPT_SH += nonbuiltin/pull.sh
+SCRIPT_SH += nonbuiltin/quiltimport.sh
+SCRIPT_SH += nonbuiltin/rebase--interactive.sh
+SCRIPT_SH += nonbuiltin/rebase.sh
+SCRIPT_SH += nonbuiltin/repack.sh
+SCRIPT_SH += nonbuiltin/request-pull.sh
+SCRIPT_SH += nonbuiltin/stash.sh
+SCRIPT_SH += nonbuiltin/submodule.sh
+SCRIPT_SH += nonbuiltin/web--browse.sh
 
 SCRIPT_LIB += git-mergetool--lib
 SCRIPT_LIB += git-parse-remote
 SCRIPT_LIB += git-sh-setup
 
-SCRIPT_PERL += git-add--interactive.perl
-SCRIPT_PERL += git-difftool.perl
-SCRIPT_PERL += git-archimport.perl
-SCRIPT_PERL += git-cvsexportcommit.perl
-SCRIPT_PERL += git-cvsimport.perl
-SCRIPT_PERL += git-cvsserver.perl
-SCRIPT_PERL += git-relink.perl
-SCRIPT_PERL += git-send-email.perl
-SCRIPT_PERL += git-svn.perl
+SCRIPT_PERL += nonbuiltin/add--interactive.perl
+SCRIPT_PERL += nonbuiltin/difftool.perl
+SCRIPT_PERL += nonbuiltin/archimport.perl
+SCRIPT_PERL += nonbuiltin/cvsexportcommit.perl
+SCRIPT_PERL += nonbuiltin/cvsimport.perl
+SCRIPT_PERL += nonbuiltin/cvsserver.perl
+SCRIPT_PERL += nonbuiltin/relink.perl
+SCRIPT_PERL += nonbuiltin/send-email.perl
+SCRIPT_PERL += nonbuiltin/svn.perl
 
-SCRIPT_PYTHON += git-remote-testgit.py
+SCRIPT_PYTHON += nonbuiltin/remote-testgit.py
 
-SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
-	  $(patsubst %.perl,%,$(SCRIPT_PERL)) \
-	  $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
+SCRIPTS = $(patsubst nonbuiltin/%.sh,git-%,$(SCRIPT_SH)) \
+	  $(patsubst nonbuiltin/%.perl,git-%,$(SCRIPT_PERL)) \
+	  $(patsubst nonbuiltin/%.py,git-%,$(SCRIPT_PYTHON)) \
 	  git-instaweb
 
 ETAGS_TARGET = TAGS
@@ -406,15 +406,15 @@ EXTRA_PROGRAMS =
 # ... and all the rest that could be moved out of bindir to gitexecdir
 PROGRAMS += $(EXTRA_PROGRAMS)
 
-PROGRAM_OBJS += daemon.o
-PROGRAM_OBJS += fast-import.o
-PROGRAM_OBJS += imap-send.o
-PROGRAM_OBJS += shell.o
-PROGRAM_OBJS += show-index.o
-PROGRAM_OBJS += upload-pack.o
-PROGRAM_OBJS += http-backend.o
+PROGRAM_OBJS += nonbuiltin/daemon.o
+PROGRAM_OBJS += nonbuiltin/fast-import.o
+PROGRAM_OBJS += nonbuiltin/imap-send.o
+PROGRAM_OBJS += nonbuiltin/shell.o
+PROGRAM_OBJS += nonbuiltin/show-index.o
+PROGRAM_OBJS += nonbuiltin/upload-pack.o
+PROGRAM_OBJS += nonbuiltin/http-backend.o
 
-PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
+PROGRAMS += $(patsubst nonbuiltin/%.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_PROGRAMS_NEED_X += test-chmtime
 TEST_PROGRAMS_NEED_X += test-ctype
@@ -1267,12 +1267,12 @@ else
 	REMOTE_CURL_PRIMARY = git-remote-http$X
 	REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
 	REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
-	PROGRAM_OBJS += http-fetch.o
+	PROGRAM_OBJS += nonbuiltin/http-fetch.o
 	PROGRAMS += $(REMOTE_CURL_NAMES)
 	curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
 	ifeq "$(curl_check)" "070908"
 		ifndef NO_EXPAT
-			PROGRAM_OBJS += http-push.o
+			PROGRAM_OBJS += nonbuiltin/http-push.o
 		endif
 	endif
 	ifndef NO_EXPAT
@@ -1710,25 +1710,25 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
     -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
     -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
     -e $(BROKEN_PATH_FIX) \
-    $@.sh >$@+
+    $< >$@+
 endef
 
-$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
+$(patsubst nonbuiltin/%.sh,git-%,$(SCRIPT_SH)) : git-% : nonbuiltin/%.sh
 	$(QUIET_GEN)$(cmd_munge_script) && \
 	chmod +x $@+ && \
 	mv $@+ $@
 
-$(SCRIPT_LIB) : % : %.sh
+$(SCRIPT_LIB) : git-% : nonbuiltin/%.sh
 	$(QUIET_GEN)$(cmd_munge_script) && \
 	mv $@+ $@
 
 ifndef NO_PERL
-$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
+$(patsubst nonbuiltin/%.perl,git-%,$(SCRIPT_PERL)): perl/perl.mak
 
 perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL
 	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
 
-$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
+$(patsubst nonbuiltin/%.perl,git-%,$(SCRIPT_PERL)): git-% : nonbuiltin/%.perl
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
 	sed -e '1{' \
@@ -1739,7 +1739,7 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
 	    -e '	x' \
 	    -e '}' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-	    $@.perl >$@+ && \
+	    $< >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
 
@@ -1774,18 +1774,18 @@ gitweb/static/gitweb.min.css: gitweb/static/gitweb.css
 endif # CSSMIN
 
 
-git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/static/gitweb.js
+git-instaweb: nonbuiltin/instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/static/gitweb.js
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
 	    -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
 	    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
-	    $@.sh > $@+ && \
+	    $< >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
 else # NO_PERL
-$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : scripts/unimplemented.sh
+$(patsubst nonbuiltin/%.perl,git-%,$(SCRIPT_PERL)) git-instaweb: git-% : scripts/unimplemented.sh
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 	    -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
@@ -1795,8 +1795,8 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : scripts/unimplemented.sh
 endif # NO_PERL
 
 ifndef NO_PYTHON
-$(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS
-$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py
+$(patsubst nonbuiltin/%.py,git-%,$(SCRIPT_PYTHON)): GIT-CFLAGS
+$(patsubst nonbuiltin/%.py,git-%,$(SCRIPT_PYTHON)): git-% : nonbuiltin/%.py
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \
 		--no-print-directory prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' \
@@ -1804,11 +1804,11 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py
 	sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
 	    -e 's|\(os\.getenv("GITPYTHONLIB"\)[^)]*)|\1,"@@INSTLIBDIR@@")|' \
 	    -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
-	    $@.py >$@+ && \
+	    $< >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
 else # NO_PYTHON
-$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : scripts/unimplemented.sh
+$(patsubst nonbuiltin/%.py,git-%,$(SCRIPT_PYTHON)): git-% : scripts/unimplemented.sh
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 	    -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
@@ -1826,15 +1826,15 @@ configure: configure.ac
 
 # These can record GIT_VERSION
 git.o git.spec \
-	$(patsubst %.sh,%,$(SCRIPT_SH)) \
-	$(patsubst %.perl,%,$(SCRIPT_PERL)) \
+	$(patsubst nonbuiltin/%.sh,git-%,$(SCRIPT_SH)) \
+	$(patsubst nonbuiltin/%.perl,git-%,$(SCRIPT_PERL)) \
 	: GIT-VERSION-FILE
 
 TEST_OBJS := $(patsubst test-%$X,test-programs/test-%.o,$(TEST_PROGRAMS))
 GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
 	git.o
 ifndef NO_CURL
-	GIT_OBJS += http.o http-walker.o remote-curl.o
+	GIT_OBJS += http.o http-walker.o nonbuiltin/remote-curl.o
 endif
 XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
 	xdiff/xmerge.o xdiff/xpatience.o
@@ -1960,9 +1960,11 @@ builtin/log.o builtin/shortlog.o: include/shortlog.h
 builtin/prune.o builtin/reflog.o libgit/reachable.o: include/reachable.h
 builtin/commit.o builtin/revert.o libgit/wt-status.o: include/wt-status.h
 builtin/tar-tree.o libgit/archive-tar.o: include/tar.h
-libgit/connect.o libgit/transport.o http-backend.o: include/url.h
-http-fetch.o http-walker.o remote-curl.o libgit/transport.o libgit/walker.o: include/walker.h
-http.o http-walker.o http-push.o http-fetch.o remote-curl.o: include/http.h include/url.h
+libgit/connect.o libgit/transport.o nonbuiltin/http-backend.o: include/url.h
+nonbuiltin/http-fetch.o nonbuiltin/remote-curl.o http-walker.o: include/walker.h
+libgit/transport.o libgit/walker.o: include/walker.h
+nonbuiltin/http-push.o nonbuiltin/http-fetch.o: include/http.h include/url.h
+nonbuiltin/remote-curl.o http.o http-walker.o: include/http.h include/url.h
 
 libgit/xdiff-interface.o $(XDIFF_OBJS): \
 	xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
@@ -2005,17 +2007,17 @@ compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
 	-DNDEBUG -DOVERRIDE_STRDUP -DREPLACE_SYSTEM_ALLOCATOR
 endif
 
-git-%$X: %.o $(GITLIBS)
+git-%$X: nonbuiltin/%.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
 
-git-imap-send$X: imap-send.o $(GITLIBS)
+git-imap-send$X: nonbuiltin/imap-send.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
 
-git-http-fetch$X: libgit/revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
+git-http-fetch$X: libgit/revision.o http.o http-walker.o nonbuiltin/http-fetch.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL)
-git-http-push$X: libgit/revision.o http.o http-push.o $(GITLIBS)
+git-http-push$X: libgit/revision.o http.o nonbuiltin/http-push.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 
@@ -2025,7 +2027,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
 	ln -s $< $@ 2>/dev/null || \
 	cp $< $@
 
-$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)
+$(REMOTE_CURL_PRIMARY): nonbuiltin/remote-curl.o http.o http-walker.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 
@@ -2321,8 +2323,9 @@ distclean: clean
 	$(RM) configure
 
 clean:
-	$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
-		libgit/*.o builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
+	$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o
+	$(RM) libgit/*.o builtin/*.o nonbuiltin/*.o
+	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
 	$(RM) test-programs/*.o $(TEST_PROGRAMS)
 	$(RM) -r bin-wrappers
diff --git a/git-add--interactive.perl b/nonbuiltin/add--interactive.perl
similarity index 100%
rename from git-add--interactive.perl
rename to nonbuiltin/add--interactive.perl
diff --git a/git-am.sh b/nonbuiltin/am.sh
similarity index 100%
rename from git-am.sh
rename to nonbuiltin/am.sh
diff --git a/git-archimport.perl b/nonbuiltin/archimport.perl
similarity index 100%
rename from git-archimport.perl
rename to nonbuiltin/archimport.perl
diff --git a/git-bisect.sh b/nonbuiltin/bisect.sh
similarity index 100%
rename from git-bisect.sh
rename to nonbuiltin/bisect.sh
diff --git a/check-racy.c b/nonbuiltin/check-racy.c
similarity index 100%
rename from check-racy.c
rename to nonbuiltin/check-racy.c
diff --git a/git-cvsexportcommit.perl b/nonbuiltin/cvsexportcommit.perl
similarity index 100%
rename from git-cvsexportcommit.perl
rename to nonbuiltin/cvsexportcommit.perl
diff --git a/git-cvsimport.perl b/nonbuiltin/cvsimport.perl
similarity index 100%
rename from git-cvsimport.perl
rename to nonbuiltin/cvsimport.perl
diff --git a/git-cvsserver.perl b/nonbuiltin/cvsserver.perl
similarity index 100%
rename from git-cvsserver.perl
rename to nonbuiltin/cvsserver.perl
diff --git a/daemon.c b/nonbuiltin/daemon.c
similarity index 100%
rename from daemon.c
rename to nonbuiltin/daemon.c
diff --git a/git-difftool--helper.sh b/nonbuiltin/difftool--helper.sh
similarity index 100%
rename from git-difftool--helper.sh
rename to nonbuiltin/difftool--helper.sh
diff --git a/git-difftool.perl b/nonbuiltin/difftool.perl
similarity index 100%
rename from git-difftool.perl
rename to nonbuiltin/difftool.perl
diff --git a/fast-import.c b/nonbuiltin/fast-import.c
similarity index 100%
rename from fast-import.c
rename to nonbuiltin/fast-import.c
diff --git a/git-filter-branch.sh b/nonbuiltin/filter-branch.sh
similarity index 100%
rename from git-filter-branch.sh
rename to nonbuiltin/filter-branch.sh
diff --git a/http-backend.c b/nonbuiltin/http-backend.c
similarity index 100%
rename from http-backend.c
rename to nonbuiltin/http-backend.c
diff --git a/http-fetch.c b/nonbuiltin/http-fetch.c
similarity index 100%
rename from http-fetch.c
rename to nonbuiltin/http-fetch.c
diff --git a/http-push.c b/nonbuiltin/http-push.c
similarity index 100%
rename from http-push.c
rename to nonbuiltin/http-push.c
diff --git a/imap-send.c b/nonbuiltin/imap-send.c
similarity index 100%
rename from imap-send.c
rename to nonbuiltin/imap-send.c
diff --git a/git-instaweb.sh b/nonbuiltin/instaweb.sh
similarity index 100%
rename from git-instaweb.sh
rename to nonbuiltin/instaweb.sh
diff --git a/git-lost-found.sh b/nonbuiltin/lost-found.sh
similarity index 100%
rename from git-lost-found.sh
rename to nonbuiltin/lost-found.sh
diff --git a/git-merge-octopus.sh b/nonbuiltin/merge-octopus.sh
similarity index 100%
rename from git-merge-octopus.sh
rename to nonbuiltin/merge-octopus.sh
diff --git a/git-merge-one-file.sh b/nonbuiltin/merge-one-file.sh
similarity index 100%
rename from git-merge-one-file.sh
rename to nonbuiltin/merge-one-file.sh
diff --git a/git-merge-resolve.sh b/nonbuiltin/merge-resolve.sh
similarity index 100%
rename from git-merge-resolve.sh
rename to nonbuiltin/merge-resolve.sh
diff --git a/git-mergetool--lib.sh b/nonbuiltin/mergetool--lib.sh
similarity index 100%
rename from git-mergetool--lib.sh
rename to nonbuiltin/mergetool--lib.sh
diff --git a/git-mergetool.sh b/nonbuiltin/mergetool.sh
similarity index 100%
rename from git-mergetool.sh
rename to nonbuiltin/mergetool.sh
diff --git a/git-parse-remote.sh b/nonbuiltin/parse-remote.sh
similarity index 100%
rename from git-parse-remote.sh
rename to nonbuiltin/parse-remote.sh
diff --git a/git-pull.sh b/nonbuiltin/pull.sh
similarity index 100%
rename from git-pull.sh
rename to nonbuiltin/pull.sh
diff --git a/git-quiltimport.sh b/nonbuiltin/quiltimport.sh
similarity index 100%
rename from git-quiltimport.sh
rename to nonbuiltin/quiltimport.sh
diff --git a/git-rebase--interactive.sh b/nonbuiltin/rebase--interactive.sh
similarity index 100%
rename from git-rebase--interactive.sh
rename to nonbuiltin/rebase--interactive.sh
diff --git a/git-rebase.sh b/nonbuiltin/rebase.sh
similarity index 100%
rename from git-rebase.sh
rename to nonbuiltin/rebase.sh
diff --git a/git-relink.perl b/nonbuiltin/relink.perl
similarity index 100%
rename from git-relink.perl
rename to nonbuiltin/relink.perl
diff --git a/remote-curl.c b/nonbuiltin/remote-curl.c
similarity index 100%
rename from remote-curl.c
rename to nonbuiltin/remote-curl.c
diff --git a/git-remote-testgit.py b/nonbuiltin/remote-testgit.py
similarity index 100%
rename from git-remote-testgit.py
rename to nonbuiltin/remote-testgit.py
diff --git a/git-repack.sh b/nonbuiltin/repack.sh
similarity index 100%
rename from git-repack.sh
rename to nonbuiltin/repack.sh
diff --git a/git-request-pull.sh b/nonbuiltin/request-pull.sh
similarity index 100%
rename from git-request-pull.sh
rename to nonbuiltin/request-pull.sh
diff --git a/git-send-email.perl b/nonbuiltin/send-email.perl
similarity index 100%
rename from git-send-email.perl
rename to nonbuiltin/send-email.perl
diff --git a/git-sh-setup.sh b/nonbuiltin/sh-setup.sh
similarity index 100%
rename from git-sh-setup.sh
rename to nonbuiltin/sh-setup.sh
diff --git a/shell.c b/nonbuiltin/shell.c
similarity index 100%
rename from shell.c
rename to nonbuiltin/shell.c
diff --git a/show-index.c b/nonbuiltin/show-index.c
similarity index 100%
rename from show-index.c
rename to nonbuiltin/show-index.c
diff --git a/git-stash.sh b/nonbuiltin/stash.sh
similarity index 100%
rename from git-stash.sh
rename to nonbuiltin/stash.sh
diff --git a/git-submodule.sh b/nonbuiltin/submodule.sh
similarity index 100%
rename from git-submodule.sh
rename to nonbuiltin/submodule.sh
diff --git a/git-svn.perl b/nonbuiltin/svn.perl
similarity index 100%
rename from git-svn.perl
rename to nonbuiltin/svn.perl
diff --git a/upload-pack.c b/nonbuiltin/upload-pack.c
similarity index 100%
rename from upload-pack.c
rename to nonbuiltin/upload-pack.c
diff --git a/git-web--browse.sh b/nonbuiltin/web--browse.sh
similarity index 100%
rename from git-web--browse.sh
rename to nonbuiltin/web--browse.sh
-- 
1.7.4.1

^ permalink raw reply related	[relevance 15%]

* [PATCH/RFC] Build a shared / renamed / "stable" version of the library?
@ 2005-09-16 12:37 16% Matthias Urlichs
  2005-09-16 18:46  5% ` Junio C Hamano
  0 siblings, 1 reply; 200+ results
From: Matthias Urlichs @ 2005-09-16 12:37 UTC (permalink / raw)
  To: git

Build (and use) libgit.so instead of libgit.a.

--- 

I have written this nice Python extension that gives me fast access to
git objects. Python extensions are built as shared libraries. Linking
shared and non-shared objects into one library results in a couple of
linker warnings on i386; other architectures are far less forgiving.

So the best choice I seem to have is to build a shared libgit.so.

Unfortunately, libgit doesn't have nice symbol names. I dunno how you
all would feel about a big patch which renames absoutely every foo()
function in libgit to be git_foo() instead (or one that #ifdef's them)...
so I'm taking the easy way out, and use versioned symbols. That should
prevent symbol name conflicts with other libraries.

I've had to redefine usage(), error() and die() to git_*(), because
they're just too conflict-ish. "error" is even a weak symbol in libc. :-/

To summarize, the choices seem to be:
- don't do anything => no script language extensions, need to fork off
  a git program for absolutely everything. Bah.
- build libgit.a with -fpic'd objects => doesn't work on all
  architectures.
- build libgit.shared.a and use that for building script language
  extensions => works now, but may cause name conflicts down the road.
- build a "normal" libgit.so => ditto on the name conflicts.
- build a libgit.so with symbol versions => no name conflicts expected,
  but works only with the GNU linker.
- rename all library functions and globals => quite a bit of work,
  and more typing down the road.
- add "#define foo git_foo" to all library functions => ugly.

Opinions?

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,8 @@ ALL_CFLAGS = $(CFLAGS) $(PLATFORM_DEFINE
 
 prefix = $(HOME)
 bindir = $(prefix)/bin
+libdir = $(prefix)/lib
+incdir = $(prefix)/include
 template_dir = $(prefix)/share/git-core/templates/
 GIT_PYTHON_DIR = $(prefix)/share/git-core/python
 # DESTDIR=
@@ -142,7 +144,18 @@ LIB_OBJS = \
 	server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
 	tag.o tree.o usage.o $(DIFF_OBJS)
 
-LIBS = $(LIB_FILE)
+ifdef SHARED_LIBOBJ
+
+LIB_FILE=libgit.so
+GITLIB = -L. -lgit
+
+else
+
+LIB_FILE=libgit.a
+GITLIB = $(LIB_FILE)
+
+endif
+
 LIBS += -lz
 
 ifeq ($(shell uname -s),Darwin)
@@ -167,6 +180,7 @@ endif
 ifndef NO_OPENSSL
 	LIB_OBJS += epoch.o
 	OPENSSL_LIBSSL = -lssl
+	LIBS += -lssl
 else
 	DEFINES += '-DNO_OPENSSL'
 	MOZILLA_SHA1 = 1
@@ -242,7 +256,7 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)) : % 
 	$(CC) -o $*.o -c $(ALL_CFLAGS) $<
 
 git-%: %.o $(LIB_FILE)
-	$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
+	$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(GITLIB) $(LIBS)
 
 git-mailinfo : SIMPLE_LIB += $(LIB_4_ICONV)
 $(SIMPLE_PROGRAMS) : $(LIB_FILE)
@@ -267,9 +281,33 @@ $(LIB_OBJS): $(LIB_H)
 $(patsubst git-%,%.o,$(PROGRAMS)): $(LIB_H)
 $(DIFF_OBJS): diffcore.h
 
+# Use -fPIC for the library files so they may be linked into a shared
+# library if necessary
+#
+ifdef SHARED_LIBOBJ
+
+PIC=-fpic
+
+$(LIB_FILE): $(LIB_OBJS) libgit.vers
+	$(CC) -shared -Wl,-soname,$(SHARED_LIBOBJ) -Wl,--version-script=libgit.vers -o $@ $(LIB_OBJS) $(LIBS)
+	rm -f $(SHARED_LIBOBJ) && ln -s $(LIB_FILE) $(SHARED_LIBOBJ)
+
+else # "normal" library
+
+PIC=
+
 $(LIB_FILE): $(LIB_OBJS)
 	$(AR) rcs $@ $(LIB_OBJS)
 
+endif
+
+# Declare rules for building library files.
+define lib_rule
+$1.o: $1.c
+	$(CC) $(ALL_CFLAGS) $(PIC) -c -o $1.o $1.c
+endef
+$(foreach obj,$(basename $(LIB_OBJS)),$(eval $(call lib_rule, $(obj))))
+
 doc:
 	$(MAKE) -C Documentation all
 
@@ -300,6 +338,14 @@ install: $(PROGRAMS) $(SCRIPTS)
 	$(MAKE) -C templates install
 	$(INSTALL) -d -m755 $(DESTDIR)$(GIT_PYTHON_DIR)
 	$(INSTALL) $(PYMODULES) $(DESTDIR)$(GIT_PYTHON_DIR)
+ifdef SHARED_LIBOBJ
+	$(INSTALL) -m755 -d $(DESTDIR)$(libdir)
+	$(INSTALL) -m755 $(LIB_FILE) $(DESTDIR)$(libdir)/$(SHARED_LIBOBJ)
+	cd $(DESTDIR)$(libdir) && ln -sf $(SHARED_LIBOBJ) $(LIB_FILE)
+	$(INSTALL) -m755 -d $(DESTDIR)$(incdir)
+	$(INSTALL) -m755 -d $(DESTDIR)$(incdir)/git
+	$(INSTALL) -m644 $(LIB_H) $(DESTDIR)$(incdir)/git
+endif
 
 install-doc:
 	$(MAKE) -C Documentation install
@@ -333,7 +379,7 @@ deb: dist
 ### Cleaning rules
 
 clean:
-	rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROGRAMS) $(LIB_FILE)
+	rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROGRAMS) *.a *.so *.so.*
 	rm -f $(filter-out gitk,$(SCRIPTS))
 	rm -f git-core.spec
 	rm -rf $(GIT_TARNAME)
diff --git a/cache.h b/cache.h
--- a/cache.h
+++ b/cache.h
@@ -228,6 +228,9 @@ extern int get_sha1_hex(const char *hex,
 extern char *sha1_to_hex(const unsigned char *sha1);	/* static buffer result! */
 
 /* General helper functions */
+#define usage git_usage
+#define error git_error
+#define die git_die
 extern void usage(const char *err) NORETURN;
 extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2)));
 extern int error(const char *err, ...) __attribute__((format (printf, 1, 2)));
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+git-core (0.99.6-2) unstable; urgency=low
+
+  * Install a shared libgit.so
+  * Install development files (git-dev package)
+
+ -- Matthias Urlichs <smurf@debian.org>  Wed, 14 Sep 2005 09:04:57 +0200
+
 git-core (0.99.6-0) unstable; urgency=low
 
   * GIT 0.99.6
diff --git a/debian/control b/debian/control
--- a/debian/control
+++ b/debian/control
@@ -18,9 +18,22 @@ Description: The git content addressable
  enables human beings to work with the database in a manner to a degree
  similar to other SCM tools.
 
+Package: libgit1
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: The git content addressable filesystem, shared library
+ This package contains the shared library for git.
+
 Package: git-tk
 Architecture: all
 Depends: ${shlibs:Depends}, ${misc:Depends}, git-core, tk8.4
 Description: The git content addressable filesystem, GUI add-on
  This package contains 'gitk', the git revision tree visualizer.
 
+Package: git-dev
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, git-core, tk8.4
+Description: The git content addressable filesystem, development files
+ This package contains the files needed to build programs which access
+ the git library.
+
diff --git a/debian/git-core.files b/debian/git-core.files
--- a/debian/git-core.files
+++ b/debian/git-core.files
@@ -1 +1,3 @@
-/usr
+/usr/bin
+/usr/share
+/usr/lib/*.so.*
diff --git a/debian/git-dev.files b/debian/git-dev.files
new file mode 100644
--- /dev/null
+++ b/debian/git-dev.files
@@ -0,0 +1,2 @@
+/usr/include/git
+/usr/lib/*.so
diff --git a/debian/libgit1.files b/debian/libgit1.files
new file mode 100644
--- /dev/null
+++ b/debian/libgit1.files
@@ -0,0 +1 @@
+/usr/lib/libgit.so.1
diff --git a/debian/rules b/debian/rules
--- a/debian/rules
+++ b/debian/rules
@@ -25,6 +25,9 @@ else
 	export MOZILLA_SHA1=YesPlease
 endif
 
+# build libgit.a with shared objects
+export SHARED_LIBOBJ=libgit.so.1
+
 # We do have the requisite perl modules in the mainline, and
 # have no reason to shy away from this script.
 export WITH_SEND_EMAIL=YesPlease
@@ -60,11 +63,13 @@ install: build
 	dh_installdirs 
 
 	make DESTDIR=$(DESTDIR) prefix=$(PREFIX) mandir=$(MANDIR) \
-		install install-doc
+		install # install-doc
 
 	mkdir -p $(DOC_DESTDIR)
 	find $(DOC) '(' -name '*.txt' -o -name '*.html' ')' -exec install {} $(DOC_DESTDIR) ';'
 
+	dh_movefiles -p libgit1
+	dh_movefiles -p git-dev
 	dh_movefiles -p git-tk
 	dh_movefiles -p git-core
 	find debian/tmp -type d -o -print | sed -e 's/^/? /'
diff --git a/libgit.vers b/libgit.vers
new file mode 100644
--- /dev/null
+++ b/libgit.vers
@@ -0,0 +1,195 @@
+GIT_1 {
+	global:
+		add_cache_entry ;
+		add_packed_git ;
+		add_ref ;
+		alloc_filespec ;
+		base_name_compare ;
+		blob_type ;
+		cache_name_compare ;
+		cache_name_pos ;
+		ce_match_stat ;
+		ce_path_match ;
+		ce_same_name ;
+		checkout_entry ;
+		check_ref_format ;
+		check_sha1_signature ;
+		commit_index_file ;
+		commit_list_insert ;
+		commit_type ;
+		count_delta ;
+		count_parents ;
+		created_object ;
+		deref_tag ;
+		diff_addremove ;
+		diff_change ;
+		diffcore_break ;
+		diffcore_merge_broken ;
+		diffcore_order ;
+		diffcore_pathspec ;
+		diffcore_pickaxe ;
+		diffcore_rename ;
+		diffcore_std ;
+		diffcore_std_no_resolve ;
+		diff_delta ;
+		diff_flush ;
+		diff_free_filepair ;
+		diff_free_filespec ;
+		diff_helper_input ;
+		diff_populate_filespec ;
+		diff_q ;
+		diff_queue ;
+		diff_queue_is_empty ;
+		diff_scoreopt_parse ;
+		diff_setup ;
+		diff_unmerge ;
+		diff_unmodified_pair ;
+		fill_filespec ;
+		fill_stat_cache_info ;
+		find_pack_entry_one ;
+		find_rev_cache ;
+		find_sha1_pack ;
+		finish_connect ;
+		for_each_ref ;
+		free_commit_list ;
+		get_ack ;
+		get_commit_format ;
+		get_graft_file ;
+		get_ident ;
+		get_index_file ;
+		get_object_directory ;
+		get_pathspec ;
+		get_refs_directory ;
+		get_ref_sha1 ;
+		get_remote_heads ;
+		get_sha1 ;
+		get_sha1_hex ;
+		git_author_info ;
+		git_committer_info ;
+		git_connect ;
+		git_mkstemp ;
+		git_path ;
+		has_pack_file ;
+		has_pack_index ;
+		has_sha1_file ;
+		has_sha1_pack ;
+		head_ref ;
+		hold_index_file_for_update ;
+		index_fd ;
+		insert_by_date ;
+		install_packed_git ;
+		lock_ref_sha1 ;
+		lookup_blob ;
+		lookup_commit ;
+		lookup_commit_reference ;
+		lookup_commit_reference_gently ;
+		lookup_object ;
+		lookup_object_type ;
+		lookup_tag ;
+		lookup_tree ;
+		lookup_unknown_object ;
+		mark_reachable ;
+		match_refs ;
+		mkpath ;
+		nth_packed_object_sha1 ;
+		num_packed_objects ;
+		object_list_append ;
+		object_list_contains ;
+		object_list_insert ;
+		object_list_length ;
+		packed_object_info_detail ;
+		packet_flush ;
+		packet_read_line ;
+		packet_write ;
+		parse_blob ;
+		parse_blob_buffer ;
+		parse_commit ;
+		parse_commit_buffer ;
+		parse_date ;
+		parse_object ;
+		parse_pack_index ;
+		parse_pack_index_file ;
+		parse_sha1_header ;
+		parse_tag ;
+		parse_tag_buffer ;
+		parse_tree ;
+		parse_tree_buffer ;
+		parse_tree_indirect ;
+		patch_delta ;
+		path_match ;
+		pop_commit ;
+		pop_most_recent_commit ;
+		prefix_path ;
+		prepare_alt_odb ;
+		prepare_packed_git ;
+		pretty_print_commit ;
+		read_cache ;
+		read_line ;
+		read_object_with_reference ;
+		read_rev_cache ;
+		read_sha1_file ;
+		read_tree ;
+		record_rev_cache ;
+		remove_cache_entry_at ;
+		remove_file_from_cache ;
+		rollback_index_file ;
+		run_command ;
+		run_command_v ;
+		safe_create_leading_directories ;
+		safe_strncpy ;
+		setup_git_directory ;
+		setup_ident ;
+		sha1close ;
+		sha1create ;
+		sha1fd ;
+		sha1_file_name ;
+		SHA1_Final ;
+		SHA1_Init ;
+		sha1_object_info ;
+		sha1_pack_index_name ;
+		sha1_pack_name ;
+		sha1_to_hex ;
+		SHA1_Update ;
+		sha1write ;
+		sha1write_compressed ;
+		show_date ;
+		sort_by_date ;
+		sort_in_topological_order ;
+		sort_list_in_merge_order ;
+		sq_quote ;
+		strbuf_init ;
+		tag_type ;
+		tree_type ;
+		unpack_entry_gently ;
+		unpack_sha1_file ;
+		unpack_sha1_header ;
+		unuse_packed_git ;
+		update_server_info ;
+		use_packed_git ;
+		verify_pack ;
+		write_cache ;
+		write_ref_sha1 ;
+		write_ref_sha1_unlocked ;
+		write_rev_cache ;
+		write_sha1_file ;
+		write_sha1_file_prepare ;
+		write_sha1_from_fd ;
+		write_sha1_to_fd ;
+		active_alloc ;
+		active_cache ;
+		active_cache_changed ;
+		active_nr ;
+		nr_objs ;
+		objs ;
+		alloc_revs ;
+		nr_revs ;
+		rev_cache ;
+		alt_odb_list ;
+		packed_git ;
+		diff_queued_diff ;
+		git_die ;
+		git_usage ;
+		git_error ;
+	local:
+		*;
+};
diff --git a/t/Makefile b/t/Makefile
--- a/t/Makefile
+++ b/t/Makefile
@@ -8,7 +8,9 @@
 T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
 
 all:
-	@$(foreach t,$T,echo "*** $t ***"; sh $t $(GIT_TEST_OPTS) || exit; )
+	@$(foreach t,$T,echo "*** $t ***"; \
+	env LD_LIBRARY_PATH=$$(pwd)/..:$$LD_LIBRARY_PATH \
+	sh $t $(GIT_TEST_OPTS) || exit; )
 	@rm -fr trash
 
 clean:
-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
Don't send my boy to Harvard, the dying mother said. Don't send my boy to
Harvard, I'd rather see him dead.

^ permalink raw reply	[relevance 16%]

* [PATCH 3/3] Move header files into a include/ subdirectory
  2011-02-18  2:27  5%   ` [RFC/PATCH 0/3] Thinning the git toplevel directory Jonathan Nieder
  2011-02-18  2:31 28%     ` [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory Jonathan Nieder
@ 2011-02-18  2:37 18%     ` Jonathan Nieder
  2011-02-18  3:52  5%       ` Nguyen Thai Ngoc Duy
    2 siblings, 1 reply; 200+ results
From: Jonathan Nieder @ 2011-02-18  2:37 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git, Junio C Hamano, Nicolas Pitre

Move most of git's header files to an include/ subdirectory.
This leaves us with 71 fewer files in the toplevel directory,
making the high-level structure of the codebase a little easier
to see.

Three headers stay behind, at least for now: git-compat-util.h,
strbuf.h, and cache.h are referred to by some system-specific code
(in compat/) using paths starting with "..".  Making these three core
headers especially visible doesn't seem like a bad idea, anyway.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Makefile                                       |  146 ++++++++++++------------
 advice.h => include/advice.h                   |    0
 [ etc etc ]
 72 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/Makefile b/Makefile
index f458f65..1e96504 100644
--- a/Makefile
+++ b/Makefile
@@ -333,7 +333,7 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
 # Those must not be GNU-specific; they are shared with perl/ which may
 # be built by a different compiler. (Note that this is an artifact now
 # but it still might be nice to keep that distinction.)
-BASIC_CFLAGS = -I.
+BASIC_CFLAGS = -I. -Iinclude
 BASIC_LDFLAGS =
 
 # Guard against environment variables
@@ -491,15 +491,15 @@ LIB_FILE=libgit.a
 XDIFF_LIB=xdiff/lib.a
 VCSSVN_LIB=vcs-svn/lib.a
 
-LIB_H += advice.h
-LIB_H += archive.h
-LIB_H += attr.h
-LIB_H += blob.h
-LIB_H += builtin.h
+LIB_H += include/advice.h
+LIB_H += include/archive.h
+LIB_H += include/attr.h
+LIB_H += include/blob.h
+LIB_H += include/builtin.h
 LIB_H += cache.h
-LIB_H += cache-tree.h
-LIB_H += color.h
-LIB_H += commit.h
+LIB_H += include/cache-tree.h
+LIB_H += include/color.h
+LIB_H += include/commit.h
 LIB_H += compat/bswap.h
 LIB_H += compat/cygwin.h
 LIB_H += compat/mingw.h
@@ -507,58 +507,58 @@ LIB_H += compat/win32/pthread.h
 LIB_H += compat/win32/syslog.h
 LIB_H += compat/win32/sys/poll.h
 LIB_H += compat/win32/dirent.h
-LIB_H += csum-file.h
-LIB_H += decorate.h
-LIB_H += delta.h
-LIB_H += diffcore.h
-LIB_H += diff.h
-LIB_H += dir.h
-LIB_H += exec_cmd.h
-LIB_H += fsck.h
+LIB_H += include/csum-file.h
+LIB_H += include/decorate.h
+LIB_H += include/delta.h
+LIB_H += include/diffcore.h
+LIB_H += include/diff.h
+LIB_H += include/dir.h
+LIB_H += include/exec_cmd.h
+LIB_H += include/fsck.h
 LIB_H += git-compat-util.h
-LIB_H += graph.h
-LIB_H += grep.h
-LIB_H += hash.h
-LIB_H += help.h
-LIB_H += levenshtein.h
-LIB_H += list-objects.h
-LIB_H += ll-merge.h
-LIB_H += log-tree.h
-LIB_H += mailmap.h
-LIB_H += merge-recursive.h
-LIB_H += notes.h
-LIB_H += notes-cache.h
-LIB_H += notes-merge.h
-LIB_H += object.h
-LIB_H += pack.h
-LIB_H += pack-refs.h
-LIB_H += pack-revindex.h
-LIB_H += parse-options.h
-LIB_H += patch-ids.h
-LIB_H += pkt-line.h
-LIB_H += progress.h
-LIB_H += quote.h
-LIB_H += reflog-walk.h
-LIB_H += refs.h
-LIB_H += remote.h
-LIB_H += rerere.h
-LIB_H += resolve-undo.h
-LIB_H += revision.h
-LIB_H += run-command.h
-LIB_H += sha1-lookup.h
-LIB_H += sideband.h
-LIB_H += sigchain.h
+LIB_H += include/graph.h
+LIB_H += include/grep.h
+LIB_H += include/hash.h
+LIB_H += include/help.h
+LIB_H += include/levenshtein.h
+LIB_H += include/list-objects.h
+LIB_H += include/ll-merge.h
+LIB_H += include/log-tree.h
+LIB_H += include/mailmap.h
+LIB_H += include/merge-recursive.h
+LIB_H += include/notes.h
+LIB_H += include/notes-cache.h
+LIB_H += include/notes-merge.h
+LIB_H += include/object.h
+LIB_H += include/pack.h
+LIB_H += include/pack-refs.h
+LIB_H += include/pack-revindex.h
+LIB_H += include/parse-options.h
+LIB_H += include/patch-ids.h
+LIB_H += include/pkt-line.h
+LIB_H += include/progress.h
+LIB_H += include/quote.h
+LIB_H += include/reflog-walk.h
+LIB_H += include/refs.h
+LIB_H += include/remote.h
+LIB_H += include/rerere.h
+LIB_H += include/resolve-undo.h
+LIB_H += include/revision.h
+LIB_H += include/run-command.h
+LIB_H += include/sha1-lookup.h
+LIB_H += include/sideband.h
+LIB_H += include/sigchain.h
 LIB_H += strbuf.h
-LIB_H += string-list.h
-LIB_H += submodule.h
-LIB_H += tag.h
-LIB_H += transport.h
-LIB_H += tree.h
-LIB_H += tree-walk.h
-LIB_H += unpack-trees.h
-LIB_H += userdiff.h
-LIB_H += utf8.h
-LIB_H += xdiff-interface.h
+LIB_H += include/string-list.h
+LIB_H += include/submodule.h
+LIB_H += include/tag.h
+LIB_H += include/transport.h
+LIB_H += include/tree.h
+LIB_H += include/tree-walk.h
+LIB_H += include/unpack-trees.h
+LIB_H += include/userdiff.h
+LIB_H += include/utf8.h
+LIB_H += include/xdiff-interface.h
 LIB_H += xdiff/xdiff.h
 
 LIB_OBJS += libgit/abspath.o
@@ -1949,20 +1949,20 @@ else
 # gcc detects!
 
 $(GIT_OBJS): $(LIB_H)
-builtin/branch.o builtin/checkout.o builtin/clone.o builtin/reset.o: branch.h
-libgit/branch.o libgit/transport.o: branch.h
-builtin/bundle.o libgit/bundle.o libgit/transport.o: bundle.h
-builtin/bisect--helper.o builtin/rev-list.o libgit/bisect.o: bisect.h
-builtin/clone.o builtin/fetch-pack.o libgit/transport.o: fetch-pack.h
-builtin/grep.o builtin/pack-objects.o libgit/transport-helper.o: thread-utils.h
-builtin/send-pack.o libgit/transport.o: send-pack.h
-builtin/log.o builtin/shortlog.o: shortlog.h
-builtin/prune.o builtin/reflog.o libgit/reachable.o: reachable.h
-builtin/commit.o builtin/revert.o libgit/wt-status.o: wt-status.h
-builtin/tar-tree.o libgit/archive-tar.o: tar.h
-libgit/connect.o libgit/transport.o http-backend.o: url.h
-http-fetch.o http-walker.o remote-curl.o libgit/transport.o libgit/walker.o: walker.h
-http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h url.h
+builtin/branch.o builtin/checkout.o builtin/clone.o builtin/reset.o: include/branch.h
+libgit/branch.o libgit/transport.o: include/branch.h
+builtin/bundle.o libgit/bundle.o libgit/transport.o: include/bundle.h
+builtin/bisect--helper.o builtin/rev-list.o libgit/bisect.o: include/bisect.h
+builtin/clone.o builtin/fetch-pack.o libgit/transport.o: include/fetch-pack.h
+builtin/grep.o builtin/pack-objects.o libgit/transport-helper.o: include/thread-utils.h
+builtin/send-pack.o libgit/transport.o: include/send-pack.h
+builtin/log.o builtin/shortlog.o: include/shortlog.h
+builtin/prune.o builtin/reflog.o libgit/reachable.o: include/reachable.h
+builtin/commit.o builtin/revert.o libgit/wt-status.o: include/wt-status.h
+builtin/tar-tree.o libgit/archive-tar.o: include/tar.h
+libgit/connect.o libgit/transport.o http-backend.o: include/url.h
+http-fetch.o http-walker.o remote-curl.o libgit/transport.o libgit/walker.o: include/walker.h
+http.o http-walker.o http-push.o http-fetch.o remote-curl.o: include/http.h include/url.h
 
 libgit/xdiff-interface.o $(XDIFF_OBJS): \
 	xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
diff --git a/advice.h b/include/advice.h
similarity index 100%
rename from advice.h
rename to include/advice.h
diff --git a/archive.h b/include/archive.h
similarity index 100%
rename from archive.h
rename to include/archive.h
diff --git a/attr.h b/include/attr.h
similarity index 100%
rename from attr.h
rename to include/attr.h
diff --git a/bisect.h b/include/bisect.h
similarity index 100%
rename from bisect.h
rename to include/bisect.h
diff --git a/blob.h b/include/blob.h
similarity index 100%
rename from blob.h
rename to include/blob.h
diff --git a/branch.h b/include/branch.h
similarity index 100%
rename from branch.h
rename to include/branch.h
diff --git a/builtin.h b/include/builtin.h
similarity index 100%
rename from builtin.h
rename to include/builtin.h
diff --git a/bundle.h b/include/bundle.h
similarity index 100%
rename from bundle.h
rename to include/bundle.h
diff --git a/cache-tree.h b/include/cache-tree.h
similarity index 100%
rename from cache-tree.h
rename to include/cache-tree.h
diff --git a/color.h b/include/color.h
similarity index 100%
rename from color.h
rename to include/color.h
diff --git a/commit.h b/include/commit.h
similarity index 100%
rename from commit.h
rename to include/commit.h
diff --git a/csum-file.h b/include/csum-file.h
similarity index 100%
rename from csum-file.h
rename to include/csum-file.h
diff --git a/decorate.h b/include/decorate.h
similarity index 100%
rename from decorate.h
rename to include/decorate.h
diff --git a/delta.h b/include/delta.h
similarity index 100%
rename from delta.h
rename to include/delta.h
diff --git a/diff.h b/include/diff.h
similarity index 100%
rename from diff.h
rename to include/diff.h
diff --git a/diffcore.h b/include/diffcore.h
similarity index 100%
rename from diffcore.h
rename to include/diffcore.h
diff --git a/dir.h b/include/dir.h
similarity index 100%
rename from dir.h
rename to include/dir.h
diff --git a/exec_cmd.h b/include/exec_cmd.h
similarity index 100%
rename from exec_cmd.h
rename to include/exec_cmd.h
diff --git a/fetch-pack.h b/include/fetch-pack.h
similarity index 100%
rename from fetch-pack.h
rename to include/fetch-pack.h
diff --git a/fsck.h b/include/fsck.h
similarity index 100%
rename from fsck.h
rename to include/fsck.h
diff --git a/graph.h b/include/graph.h
similarity index 100%
rename from graph.h
rename to include/graph.h
diff --git a/grep.h b/include/grep.h
similarity index 100%
rename from grep.h
rename to include/grep.h
diff --git a/hash.h b/include/hash.h
similarity index 100%
rename from hash.h
rename to include/hash.h
diff --git a/help.h b/include/help.h
similarity index 100%
rename from help.h
rename to include/help.h
diff --git a/http.h b/include/http.h
similarity index 100%
rename from http.h
rename to include/http.h
diff --git a/levenshtein.h b/include/levenshtein.h
similarity index 100%
rename from levenshtein.h
rename to include/levenshtein.h
diff --git a/list-objects.h b/include/list-objects.h
similarity index 100%
rename from list-objects.h
rename to include/list-objects.h
diff --git a/ll-merge.h b/include/ll-merge.h
similarity index 100%
rename from ll-merge.h
rename to include/ll-merge.h
diff --git a/log-tree.h b/include/log-tree.h
similarity index 100%
rename from log-tree.h
rename to include/log-tree.h
diff --git a/mailmap.h b/include/mailmap.h
similarity index 100%
rename from mailmap.h
rename to include/mailmap.h
diff --git a/merge-recursive.h b/include/merge-recursive.h
similarity index 100%
rename from merge-recursive.h
rename to include/merge-recursive.h
diff --git a/notes-cache.h b/include/notes-cache.h
similarity index 100%
rename from notes-cache.h
rename to include/notes-cache.h
diff --git a/notes-merge.h b/include/notes-merge.h
similarity index 100%
rename from notes-merge.h
rename to include/notes-merge.h
diff --git a/notes.h b/include/notes.h
similarity index 100%
rename from notes.h
rename to include/notes.h
diff --git a/object.h b/include/object.h
similarity index 100%
rename from object.h
rename to include/object.h
diff --git a/pack-refs.h b/include/pack-refs.h
similarity index 100%
rename from pack-refs.h
rename to include/pack-refs.h
diff --git a/pack-revindex.h b/include/pack-revindex.h
similarity index 100%
rename from pack-revindex.h
rename to include/pack-revindex.h
diff --git a/pack.h b/include/pack.h
similarity index 100%
rename from pack.h
rename to include/pack.h
diff --git a/parse-options.h b/include/parse-options.h
similarity index 100%
rename from parse-options.h
rename to include/parse-options.h
diff --git a/patch-ids.h b/include/patch-ids.h
similarity index 100%
rename from patch-ids.h
rename to include/patch-ids.h
diff --git a/pkt-line.h b/include/pkt-line.h
similarity index 100%
rename from pkt-line.h
rename to include/pkt-line.h
diff --git a/progress.h b/include/progress.h
similarity index 100%
rename from progress.h
rename to include/progress.h
diff --git a/quote.h b/include/quote.h
similarity index 100%
rename from quote.h
rename to include/quote.h
diff --git a/reachable.h b/include/reachable.h
similarity index 100%
rename from reachable.h
rename to include/reachable.h
diff --git a/reflog-walk.h b/include/reflog-walk.h
similarity index 100%
rename from reflog-walk.h
rename to include/reflog-walk.h
diff --git a/refs.h b/include/refs.h
similarity index 100%
rename from refs.h
rename to include/refs.h
diff --git a/remote.h b/include/remote.h
similarity index 100%
rename from remote.h
rename to include/remote.h
diff --git a/rerere.h b/include/rerere.h
similarity index 100%
rename from rerere.h
rename to include/rerere.h
diff --git a/resolve-undo.h b/include/resolve-undo.h
similarity index 100%
rename from resolve-undo.h
rename to include/resolve-undo.h
diff --git a/revision.h b/include/revision.h
similarity index 100%
rename from revision.h
rename to include/revision.h
diff --git a/run-command.h b/include/run-command.h
similarity index 100%
rename from run-command.h
rename to include/run-command.h
diff --git a/send-pack.h b/include/send-pack.h
similarity index 100%
rename from send-pack.h
rename to include/send-pack.h
diff --git a/sha1-lookup.h b/include/sha1-lookup.h
similarity index 100%
rename from sha1-lookup.h
rename to include/sha1-lookup.h
diff --git a/shortlog.h b/include/shortlog.h
similarity index 100%
rename from shortlog.h
rename to include/shortlog.h
diff --git a/sideband.h b/include/sideband.h
similarity index 100%
rename from sideband.h
rename to include/sideband.h
diff --git a/sigchain.h b/include/sigchain.h
similarity index 100%
rename from sigchain.h
rename to include/sigchain.h
diff --git a/string-list.h b/include/string-list.h
similarity index 100%
rename from string-list.h
rename to include/string-list.h
diff --git a/submodule.h b/include/submodule.h
similarity index 100%
rename from submodule.h
rename to include/submodule.h
diff --git a/tag.h b/include/tag.h
similarity index 100%
rename from tag.h
rename to include/tag.h
diff --git a/tar.h b/include/tar.h
similarity index 100%
rename from tar.h
rename to include/tar.h
diff --git a/thread-utils.h b/include/thread-utils.h
similarity index 100%
rename from thread-utils.h
rename to include/thread-utils.h
diff --git a/transport.h b/include/transport.h
similarity index 100%
rename from transport.h
rename to include/transport.h
diff --git a/tree-walk.h b/include/tree-walk.h
similarity index 100%
rename from tree-walk.h
rename to include/tree-walk.h
diff --git a/tree.h b/include/tree.h
similarity index 100%
rename from tree.h
rename to include/tree.h
diff --git a/unpack-trees.h b/include/unpack-trees.h
similarity index 100%
rename from unpack-trees.h
rename to include/unpack-trees.h
diff --git a/url.h b/include/url.h
similarity index 100%
rename from url.h
rename to include/url.h
diff --git a/userdiff.h b/include/userdiff.h
similarity index 100%
rename from userdiff.h
rename to include/userdiff.h
diff --git a/utf8.h b/include/utf8.h
similarity index 100%
rename from utf8.h
rename to include/utf8.h
diff --git a/walker.h b/include/walker.h
similarity index 100%
rename from walker.h
rename to include/walker.h
diff --git a/wt-status.h b/include/wt-status.h
similarity index 100%
rename from wt-status.h
rename to include/wt-status.h
diff --git a/xdiff-interface.h b/include/xdiff-interface.h
similarity index 100%
rename from xdiff-interface.h
rename to include/xdiff-interface.h
-- 
1.7.4.1

^ permalink raw reply related	[relevance 18%]

* [PATCH] lib: add new libgit-builtin
@ 2023-05-12 22:52 18% Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2023-05-12 22:52 UTC (permalink / raw)
  To: git; +Cc: Felipe Contreras, Emily Shaffer

Since its creation in 0a02ce72d9 (Clean up the Makefile a bit.,
2005-04-18), libgit.a has been used as dumping ground for everything all
git commands use.

When the code was split between `*.c` and `builtin/*.c` it was never
clarified what belongs in what category.

The code in `*.c` can be shared by all builtins, but so can the code in
`builtin/*.c`.

There's no practical difference.

In order to attempt to start decoupling libgit.a from the `git` binary,
let's create a new libgit-builtin.a library meant only for the code in
`builtin/*.c`.

Ideally eventually libgit.a would not contain code that is specific to
`git`, only code that is generic and could be used by projects outside
git.git.

This is an essential step that has to be done if there's any hope of
ever having a public libgit.so library.

The choice of notes-utils.c is mostly arbitrary, but its functions had
been discussed before as a roadblock for a proper libgit. In particular
something like `init_copy_notes_for_rewrite("am")` does not seem like
something anyone outside `git` would want to call.

Cc: Emily Shaffer <nasamuffin@google.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---

After re-reading a previous thread about the lbification of git [1], I
realized `init_copy_notes_for_rewrite()` and others which now belong in
notes-utils.c are good candidates to start splitting away from what
eventually should be a public libgit.so library.

[1] https://lore.kernel.org/git/1370712574-27688-1-git-send-email-felipe.contreras@gmail.com/

 Makefile | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index e440728c24..84cbb35828 100644
--- a/Makefile
+++ b/Makefile
@@ -668,6 +668,7 @@ FUZZ_OBJS =
 FUZZ_PROGRAMS =
 GIT_OBJS =
 LIB_OBJS =
+BUILTIN_LIB_OBJS =
 SCALAR_OBJS =
 OBJECTS =
 OTHER_PROGRAMS =
@@ -916,6 +917,7 @@ export PYTHON_PATH
 TEST_SHELL_PATH = $(SHELL_PATH)
 
 LIB_FILE = libgit.a
+BUILTIN_LIB_FILE = libgit-builtin.a
 XDIFF_LIB = xdiff/lib.a
 REFTABLE_LIB = reftable/libreftable.a
 REFTABLE_TEST_LIB = reftable/libreftable_test.a
@@ -1071,7 +1073,6 @@ LIB_OBJS += negotiator/noop.o
 LIB_OBJS += negotiator/skipping.o
 LIB_OBJS += notes-cache.o
 LIB_OBJS += notes-merge.o
-LIB_OBJS += notes-utils.o
 LIB_OBJS += notes.o
 LIB_OBJS += object-file.o
 LIB_OBJS += object-name.o
@@ -1194,6 +1195,8 @@ LIB_OBJS += ws.o
 LIB_OBJS += wt-status.o
 LIB_OBJS += xdiff-interface.o
 
+BUILTIN_LIB_OBJS += notes-utils.o
+
 BUILTIN_OBJS += builtin/add.o
 BUILTIN_OBJS += builtin/am.o
 BUILTIN_OBJS += builtin/annotate.o
@@ -1332,7 +1335,7 @@ THIRD_PARTY_SOURCES += sha1collisiondetection/%
 THIRD_PARTY_SOURCES += sha1dc/%
 
 # xdiff and reftable libs may in turn depend on what is in libgit.a
-GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE)
+GITLIBS = common-main.o $(LIB_FILE) $(BUILTIN_LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE)
 EXTLIBS =
 
 GIT_USER_AGENT = git/$(GIT_VERSION)
@@ -2655,6 +2658,7 @@ TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST
 test-objs: $(TEST_OBJS)
 
 GIT_OBJS += $(LIB_OBJS)
+GIT_OBJS += $(BUILTIN_LIB_OBJS)
 GIT_OBJS += $(BUILTIN_OBJS)
 GIT_OBJS += common-main.o
 GIT_OBJS += git.o
@@ -2809,6 +2813,9 @@ scalar$X: scalar.o GIT-LDFLAGS $(GITLIBS)
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
+$(BUILTIN_LIB_FILE): $(BUILTIN_LIB_OBJS)
+	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
+
 $(XDIFF_LIB): $(XDIFF_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
 
@@ -3651,7 +3658,7 @@ clean: profile-clean coverage-clean cocciclean
 	$(RM) po/git.pot po/git-core.pot
 	$(RM) git.res
 	$(RM) $(OBJECTS)
-	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
+	$(RM) $(LIB_FILE) $(BUILTIN_LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS)
 	$(RM) $(TEST_PROGRAMS)
 	$(RM) $(FUZZ_PROGRAMS)
-- 
2.40.0+fc1


^ permalink raw reply related	[relevance 18%]

* [PATCH] Add USE_SHARED_LIBGIT flag to build and use libgit.so rather than libgit.a
@ 2007-07-01  8:28 21% Josh Triplett
  0 siblings, 0 replies; 200+ results
From: Josh Triplett @ 2007-07-01  8:28 UTC (permalink / raw)
  To: git

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

Git builds a static libgit.a, and many commands which link to libgit.a,
resulting in many duplicate copies of the code in libgit.a.  Add a
USE_SHARED_LIBGIT flag to the Makefile (off by default), which builds and uses
a shared library libgit.so instead.

The existing objects in libgit.a reference the symbols git_version_string and
git_usage_string, defined in git.c, but libgit does not include git.o, making
the library not self-contained, and leading to linking errors when trying to
use a shared library.  Move those two symbols to help.c, where the references
from libgit occur.

This change does not install header files, versioned libraries, or anything
else that would support actually using libgit.so from anything other than the
installed git binaries.  The built libgit.so exists solely for the benefit of
the installed git binaries that link to it.

Motivated by trying to install Git on a machine for which this makes the
difference between remaining under quota and not.

Signed-off-by: Josh Triplett <josh@freedesktop.org>
---
 Makefile |   31 ++++++++++++++++++++++++++-----
 git.c    |    5 -----
 help.c   |    5 +++++
 3 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index a98e27a..db35b3b 100644
--- a/Makefile
+++ b/Makefile
@@ -124,6 +124,8 @@ all::
 # If not set it defaults to the bare 'wish'. If it is set to the empty
 # string then NO_TCLTK will be forced (this is used by configure script).
 #
+# Define USE_SHARED_LIBGIT to create and use a shared library libgit.so rather
+# than a static library libgit.a.
 
 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
 	@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -146,6 +148,7 @@ STRIP ?= strip
 prefix = $(HOME)
 bindir = $(prefix)/bin
 gitexecdir = $(bindir)
+libdir = $(prefix)/lib
 sharedir = $(prefix)/share
 template_dir = $(sharedir)/git-core/templates
 ifeq ($(prefix),/usr)
@@ -290,7 +293,13 @@ endif
 
 export PERL_PATH
 
+ifdef USE_SHARED_LIBGIT
+LIB_FILE=libgit.so
+LIBGIT=-L. -lgit
+else
 LIB_FILE=libgit.a
+LIBGIT=$(LIB_FILE)
+endif
 XDIFF_LIB=xdiff/lib.a
 
 LIB_H = \
@@ -704,6 +713,7 @@ ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
 bindir_SQ = $(subst ','\'',$(bindir))
 gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
+libdir_SQ = $(subst ','\'',$(libdir))
 template_dir_SQ = $(subst ','\'',$(template_dir))
 prefix_SQ = $(subst ','\'',$(prefix))
 
@@ -712,7 +722,7 @@ PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
 PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
 TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
 
-LIBS = $(GITLIBS) $(EXTLIBS)
+LIBS = $(LIBGIT) $(XDIFF_LIB) $(EXTLIBS)
 
 BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
 	-DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"' $(COMPAT_CFLAGS)
@@ -721,6 +731,10 @@ LIB_OBJS += $(COMPAT_OBJS)
 ALL_CFLAGS += $(BASIC_CFLAGS)
 ALL_LDFLAGS += $(BASIC_LDFLAGS)
 
+ifdef USE_SHARED_LIBGIT
+ALL_CFLAGS += -fpic
+endif
+
 export TAR INSTALL DESTDIR SHELL_PATH
 
 
@@ -747,16 +761,15 @@ gitk-wish: gitk GIT-GUI-VARS
 	chmod +x $@+ && \
 	mv -f $@+ $@
 
-git.o: git.c common-cmds.h GIT-CFLAGS
-	$(QUIET_CC)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
-		$(ALL_CFLAGS) -c $(filter %.c,$^)
+git.o: common-cmds.h
 
 git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
 	$(QUIET_LINK)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
 		$(ALL_CFLAGS) -o $@ $(filter %.c,$^) git.o \
 		$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
 
-help.o: common-cmds.h
+help.o: help.c common-cmds.h GIT-CFLAGS
+	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DGIT_VERSION='"$(GIT_VERSION)"' $<
 
 git-merge-subtree$X: git-merge-recursive$X
 	$(QUIET_BUILT_IN)rm -f $@ && ln git-merge-recursive$X $@
@@ -908,7 +921,11 @@ $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
 $(DIFF_OBJS): diffcore.h
 
 $(LIB_FILE): $(LIB_OBJS)
+ifdef USE_SHARED_LIBGIT
+	$(QUIET_LINK)$(CC) -shared -o $@ $(LIB_OBJS)
+else
 	$(QUIET_AR)rm -f $@ && $(AR) rcs $@ $(LIB_OBJS)
+endif
 
 XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
 	xdiff/xmerge.o
@@ -996,6 +1013,10 @@ install: all
 	$(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
 	$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
 	$(INSTALL) git$X '$(DESTDIR_SQ)$(bindir_SQ)'
+ifdef USE_SHARED_LIBGIT
+	$(INSTALL) -d -m755 $(DESTDIR_SQ)$(libdir_SQ)
+	$(INSTALL) $(LIB_FILE) $(DESTDIR_SQ)$(libdir_SQ)
+endif
 	$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
 	$(MAKE) -C perl prefix='$(prefix_SQ)' install
 ifndef NO_TCLTK
diff --git a/git.c b/git.c
index 29b55a1..1e24903 100644
--- a/git.c
+++ b/git.c
@@ -3,9 +3,6 @@
 #include "cache.h"
 #include "quote.h"
 
-const char git_usage_string[] =
-	"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate] [--bare] [--git-dir=GIT_DIR] [--help] COMMAND [ARGS]";
-
 static void prepend_to_path(const char *dir, int len)
 {
 	const char *old_path = getenv("PATH");
@@ -206,8 +203,6 @@ static int handle_alias(int *argcp, const char ***argv)
 	return ret;
 }
 
-const char git_version_string[] = GIT_VERSION;
-
 #define RUN_SETUP	(1<<0)
 #define USE_PAGER	(1<<1)
 /*
diff --git a/help.c b/help.c
index 1cd33ec..3f3ceeb 100644
--- a/help.c
+++ b/help.c
@@ -9,6 +9,11 @@
 #include "common-cmds.h"
 #include <sys/ioctl.h>
 
+const char git_usage_string[] =
+	"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate] [--bare] [--git-dir=GIT_DIR] [--help] COMMAND [ARGS]";
+
+const char git_version_string[] = GIT_VERSION;
+
 /* most GUI terminals set COLUMNS (although some don't export it) */
 static int term_columns(void)
 {
-- 
1.5.2.2



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply related	[relevance 21%]

* Re: [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory
  2011-02-18  3:47 12%       ` Nguyen Thai Ngoc Duy
@ 2011-02-18  4:14 27%         ` Jonathan Nieder
  2011-02-18  4:18 11%           ` Jeff King
  0 siblings, 1 reply; 200+ results
From: Jonathan Nieder @ 2011-02-18  4:14 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git, Junio C Hamano, Nicolas Pitre

Nguyen Thai Ngoc Duy wrote:
> 2011/2/18 Jonathan Nieder <jrnieder@gmail.com>:

>> Move sources for libgit.a to a libgit/ subdirectory.  This way, a
>> person wanting to tackle the reusable part of git will know where to
>> look, and those looking to work on individual commands know to look
>> elsewhere.
>
> You missed a few (on purpose?): block-sha1, ppc and compat.

Yes, on purpose.  They're separately reusable.

> libgit.a is produced at toplevel so I need a few more keystrokes to
> reach files inside libgit. Maybe move libgit.a to libgit too?

Mm, good idea.

> With die() all over the place in libgit.a, I doubt it would become an
> independent project. Although this certainly makes it easier to
> reimplement libgit as a thin wrapper around libgit2.

I think it's more realistic to replace functions in libgit one by one
with reentrant versions.

Jonathan

-- 8< --
Subject: Rename libgit.a to libgit/lib.a

This makes the libgit files easier to reach through tab completion.

cgit uses "make -C git libgit.a" in its build process.  Make sure
that continues to work by installing a symlink libgit.a -> libgit/lib.a
on request.

Requested-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Makefile                |    5 ++++-
 contrib/svn-fe/Makefile |    6 +++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index b812c1e..3d701d2 100644
--- a/Makefile
+++ b/Makefile
@@ -487,7 +487,7 @@ endif
 export PERL_PATH
 export PYTHON_PATH
 
-LIB_FILE=libgit.a
+LIB_FILE=libgit/lib.a
 XDIFF_LIB=xdiff/lib.a
 VCSSVN_LIB=vcs-svn/lib.a
 
@@ -2029,6 +2029,9 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
 
+libgit.a: $(LIB_FILE)
+	ln -sf $(LIB_FILE) $@
+
 $(XDIFF_LIB): $(XDIFF_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
 
diff --git a/contrib/svn-fe/Makefile b/contrib/svn-fe/Makefile
index 360d8da..9dcad63 100644
--- a/contrib/svn-fe/Makefile
+++ b/contrib/svn-fe/Makefile
@@ -10,7 +10,7 @@ ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 EXTLIBS =
 
-GIT_LIB = ../../libgit.a
+GIT_LIB = ../../libgit/lib.a
 VCSSVN_LIB = ../../vcs-svn/lib.a
 LIBS = $(VCSSVN_LIB) $(GIT_LIB) $(EXTLIBS)
 
@@ -54,8 +54,8 @@ svn-fe.1: svn-fe.txt
 ../../vcs-svn/lib.a: FORCE
 	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) vcs-svn/lib.a
 
-../../libgit.a: FORCE
-	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit.a
+../../libgit/lib.a: FORCE
+	$(QUIET_SUBDIR0)../.. $(QUIET_SUBDIR1) libgit/lib.a
 
 clean:
 	$(RM) svn-fe$X svn-fe.o svn-fe.html svn-fe.xml svn-fe.1
-- 
1.7.4.1

^ permalink raw reply related	[relevance 27%]

* [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory
  2011-02-18  2:27  5%   ` [RFC/PATCH 0/3] Thinning the git toplevel directory Jonathan Nieder
@ 2011-02-18  2:31 28%     ` Jonathan Nieder
  2011-02-18  3:47 12%       ` Nguyen Thai Ngoc Duy
  2011-02-18  4:31 11%       ` Nguyen Thai Ngoc Duy
  2011-02-18  2:37 18%     ` [PATCH 3/3] Move header files into a include/ subdirectory Jonathan Nieder
    2 siblings, 2 replies; 200+ results
From: Jonathan Nieder @ 2011-02-18  2:31 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git, Junio C Hamano, Nicolas Pitre

Move sources for libgit.a to a libgit/ subdirectory.  This way, a
person wanting to tackle the reusable part of git will know where to
look, and those looking to work on individual commands know to look
elsewhere.

Perhaps some day the libgit/ subdirectory can be managed as an
independent subproject (for example if it gets merged with libgit2).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Makefile                                        |  281 ++++++++++++-----------
 abspath.c => libgit/abspath.c                   |    0
 [ etc etc etc ]
 zlib.c => libgit/zlib.c                         |    0
 117 files changed, 142 insertions(+), 139 deletions(-)
 rename abspath.c => libgit/abspath.c (100%)
 [ etc ]
 rename zlib.c => libgit/zlib.c (100%)

diff --git a/Makefile b/Makefile
index ade7923..b812c1e 100644
--- a/Makefile
+++ b/Makefile
@@ -561,121 +561,121 @@ LIB_H += utf8.h
 LIB_H += xdiff-interface.h
 LIB_H += xdiff/xdiff.h
 
-LIB_OBJS += abspath.o
-LIB_OBJS += advice.o
-LIB_OBJS += alias.o
-LIB_OBJS += alloc.o
-LIB_OBJS += archive.o
-LIB_OBJS += archive-tar.o
-LIB_OBJS += archive-zip.o
-LIB_OBJS += attr.o
-LIB_OBJS += base85.o
-LIB_OBJS += bisect.o
-LIB_OBJS += blob.o
-LIB_OBJS += branch.o
-LIB_OBJS += bundle.o
-LIB_OBJS += cache-tree.o
-LIB_OBJS += color.o
-LIB_OBJS += combine-diff.o
-LIB_OBJS += commit.o
-LIB_OBJS += config.o
-LIB_OBJS += connect.o
-LIB_OBJS += convert.o
-LIB_OBJS += copy.o
-LIB_OBJS += csum-file.o
-LIB_OBJS += ctype.o
-LIB_OBJS += date.o
-LIB_OBJS += decorate.o
-LIB_OBJS += diffcore-break.o
-LIB_OBJS += diffcore-delta.o
-LIB_OBJS += diffcore-order.o
-LIB_OBJS += diffcore-pickaxe.o
-LIB_OBJS += diffcore-rename.o
-LIB_OBJS += diff-delta.o
-LIB_OBJS += diff-lib.o
-LIB_OBJS += diff-no-index.o
-LIB_OBJS += diff.o
-LIB_OBJS += dir.o
-LIB_OBJS += editor.o
-LIB_OBJS += entry.o
-LIB_OBJS += environment.o
-LIB_OBJS += exec_cmd.o
-LIB_OBJS += fsck.o
-LIB_OBJS += graph.o
-LIB_OBJS += grep.o
-LIB_OBJS += hash.o
-LIB_OBJS += help.o
-LIB_OBJS += hex.o
-LIB_OBJS += ident.o
-LIB_OBJS += levenshtein.o
-LIB_OBJS += list-objects.o
-LIB_OBJS += ll-merge.o
-LIB_OBJS += lockfile.o
-LIB_OBJS += log-tree.o
-LIB_OBJS += mailmap.o
-LIB_OBJS += match-trees.o
-LIB_OBJS += merge-file.o
-LIB_OBJS += merge-recursive.o
-LIB_OBJS += name-hash.o
-LIB_OBJS += notes.o
-LIB_OBJS += notes-cache.o
-LIB_OBJS += notes-merge.o
-LIB_OBJS += object.o
-LIB_OBJS += pack-check.o
-LIB_OBJS += pack-refs.o
-LIB_OBJS += pack-revindex.o
-LIB_OBJS += pack-write.o
-LIB_OBJS += pager.o
-LIB_OBJS += parse-options.o
-LIB_OBJS += patch-delta.o
-LIB_OBJS += patch-ids.o
-LIB_OBJS += path.o
-LIB_OBJS += pkt-line.o
-LIB_OBJS += preload-index.o
-LIB_OBJS += pretty.o
-LIB_OBJS += progress.o
-LIB_OBJS += quote.o
-LIB_OBJS += reachable.o
-LIB_OBJS += read-cache.o
-LIB_OBJS += reflog-walk.o
-LIB_OBJS += refs.o
-LIB_OBJS += remote.o
-LIB_OBJS += replace_object.o
-LIB_OBJS += rerere.o
-LIB_OBJS += resolve-undo.o
-LIB_OBJS += revision.o
-LIB_OBJS += run-command.o
-LIB_OBJS += server-info.o
-LIB_OBJS += setup.o
-LIB_OBJS += sha1-lookup.o
-LIB_OBJS += sha1_file.o
-LIB_OBJS += sha1_name.o
-LIB_OBJS += shallow.o
-LIB_OBJS += sideband.o
-LIB_OBJS += sigchain.o
-LIB_OBJS += strbuf.o
-LIB_OBJS += string-list.o
-LIB_OBJS += submodule.o
-LIB_OBJS += symlinks.o
-LIB_OBJS += tag.o
-LIB_OBJS += trace.o
-LIB_OBJS += transport.o
-LIB_OBJS += transport-helper.o
-LIB_OBJS += tree-diff.o
-LIB_OBJS += tree.o
-LIB_OBJS += tree-walk.o
-LIB_OBJS += unpack-trees.o
-LIB_OBJS += url.o
-LIB_OBJS += usage.o
-LIB_OBJS += userdiff.o
-LIB_OBJS += utf8.o
-LIB_OBJS += walker.o
-LIB_OBJS += wrapper.o
-LIB_OBJS += write_or_die.o
-LIB_OBJS += ws.o
-LIB_OBJS += wt-status.o
-LIB_OBJS += xdiff-interface.o
-LIB_OBJS += zlib.o
+LIB_OBJS += libgit/abspath.o
+LIB_OBJS += libgit/advice.o
+LIB_OBJS += libgit/alias.o
+LIB_OBJS += libgit/alloc.o
+LIB_OBJS += libgit/archive.o
+LIB_OBJS += libgit/archive-tar.o
+LIB_OBJS += libgit/archive-zip.o
+LIB_OBJS += libgit/attr.o
+LIB_OBJS += libgit/base85.o
+LIB_OBJS += libgit/bisect.o
+LIB_OBJS += libgit/blob.o
+LIB_OBJS += libgit/branch.o
+LIB_OBJS += libgit/bundle.o
+LIB_OBJS += libgit/cache-tree.o
+LIB_OBJS += libgit/color.o
+LIB_OBJS += libgit/combine-diff.o
+LIB_OBJS += libgit/commit.o
+LIB_OBJS += libgit/config.o
+LIB_OBJS += libgit/connect.o
+LIB_OBJS += libgit/convert.o
+LIB_OBJS += libgit/copy.o
+LIB_OBJS += libgit/csum-file.o
+LIB_OBJS += libgit/ctype.o
+LIB_OBJS += libgit/date.o
+LIB_OBJS += libgit/decorate.o
+LIB_OBJS += libgit/diffcore-break.o
+LIB_OBJS += libgit/diffcore-delta.o
+LIB_OBJS += libgit/diffcore-order.o
+LIB_OBJS += libgit/diffcore-pickaxe.o
+LIB_OBJS += libgit/diffcore-rename.o
+LIB_OBJS += libgit/diff-delta.o
+LIB_OBJS += libgit/diff-lib.o
+LIB_OBJS += libgit/diff-no-index.o
+LIB_OBJS += libgit/diff.o
+LIB_OBJS += libgit/dir.o
+LIB_OBJS += libgit/editor.o
+LIB_OBJS += libgit/entry.o
+LIB_OBJS += libgit/environment.o
+LIB_OBJS += libgit/exec_cmd.o
+LIB_OBJS += libgit/fsck.o
+LIB_OBJS += libgit/graph.o
+LIB_OBJS += libgit/grep.o
+LIB_OBJS += libgit/hash.o
+LIB_OBJS += libgit/help.o
+LIB_OBJS += libgit/hex.o
+LIB_OBJS += libgit/ident.o
+LIB_OBJS += libgit/levenshtein.o
+LIB_OBJS += libgit/list-objects.o
+LIB_OBJS += libgit/ll-merge.o
+LIB_OBJS += libgit/lockfile.o
+LIB_OBJS += libgit/log-tree.o
+LIB_OBJS += libgit/mailmap.o
+LIB_OBJS += libgit/match-trees.o
+LIB_OBJS += libgit/merge-file.o
+LIB_OBJS += libgit/merge-recursive.o
+LIB_OBJS += libgit/name-hash.o
+LIB_OBJS += libgit/notes.o
+LIB_OBJS += libgit/notes-cache.o
+LIB_OBJS += libgit/notes-merge.o
+LIB_OBJS += libgit/object.o
+LIB_OBJS += libgit/pack-check.o
+LIB_OBJS += libgit/pack-refs.o
+LIB_OBJS += libgit/pack-revindex.o
+LIB_OBJS += libgit/pack-write.o
+LIB_OBJS += libgit/pager.o
+LIB_OBJS += libgit/parse-options.o
+LIB_OBJS += libgit/patch-delta.o
+LIB_OBJS += libgit/patch-ids.o
+LIB_OBJS += libgit/path.o
+LIB_OBJS += libgit/pkt-line.o
+LIB_OBJS += libgit/preload-index.o
+LIB_OBJS += libgit/pretty.o
+LIB_OBJS += libgit/progress.o
+LIB_OBJS += libgit/quote.o
+LIB_OBJS += libgit/reachable.o
+LIB_OBJS += libgit/read-cache.o
+LIB_OBJS += libgit/reflog-walk.o
+LIB_OBJS += libgit/refs.o
+LIB_OBJS += libgit/remote.o
+LIB_OBJS += libgit/replace_object.o
+LIB_OBJS += libgit/rerere.o
+LIB_OBJS += libgit/resolve-undo.o
+LIB_OBJS += libgit/revision.o
+LIB_OBJS += libgit/run-command.o
+LIB_OBJS += libgit/server-info.o
+LIB_OBJS += libgit/setup.o
+LIB_OBJS += libgit/sha1-lookup.o
+LIB_OBJS += libgit/sha1_file.o
+LIB_OBJS += libgit/sha1_name.o
+LIB_OBJS += libgit/shallow.o
+LIB_OBJS += libgit/sideband.o
+LIB_OBJS += libgit/sigchain.o
+LIB_OBJS += libgit/strbuf.o
+LIB_OBJS += libgit/string-list.o
+LIB_OBJS += libgit/submodule.o
+LIB_OBJS += libgit/symlinks.o
+LIB_OBJS += libgit/tag.o
+LIB_OBJS += libgit/trace.o
+LIB_OBJS += libgit/transport.o
+LIB_OBJS += libgit/transport-helper.o
+LIB_OBJS += libgit/tree-diff.o
+LIB_OBJS += libgit/tree.o
+LIB_OBJS += libgit/tree-walk.o
+LIB_OBJS += libgit/unpack-trees.o
+LIB_OBJS += libgit/url.o
+LIB_OBJS += libgit/usage.o
+LIB_OBJS += libgit/userdiff.o
+LIB_OBJS += libgit/utf8.o
+LIB_OBJS += libgit/walker.o
+LIB_OBJS += libgit/wrapper.o
+LIB_OBJS += libgit/write_or_die.o
+LIB_OBJS += libgit/ws.o
+LIB_OBJS += libgit/wt-status.o
+LIB_OBJS += libgit/xdiff-interface.o
+LIB_OBJS += libgit/zlib.o
 
 BUILTIN_OBJS += builtin/add.o
 BUILTIN_OBJS += builtin/annotate.o
@@ -1524,7 +1524,7 @@ ifdef NO_PTHREADS
 else
 	BASIC_CFLAGS += $(PTHREAD_CFLAGS)
 	EXTLIBS += $(PTHREAD_LIBS)
-	LIB_OBJS += thread-utils.o
+	LIB_OBJS += libgit/thread-utils.o
 endif
 
 ifdef HAVE_PATHS_H
@@ -1683,7 +1683,7 @@ git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
 		$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
 
-help.o: common-cmds.h
+libgit/help.o: common-cmds.h
 
 builtin/help.o: common-cmds.h
 builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
@@ -1946,21 +1946,22 @@ else
 # gcc detects!
 
 $(GIT_OBJS): $(LIB_H)
-builtin/branch.o builtin/checkout.o builtin/clone.o builtin/reset.o branch.o transport.o: branch.h
-builtin/bundle.o bundle.o transport.o: bundle.h
-builtin/bisect--helper.o builtin/rev-list.o bisect.o: bisect.h
-builtin/clone.o builtin/fetch-pack.o transport.o: fetch-pack.h
-builtin/grep.o builtin/pack-objects.o transport-helper.o: thread-utils.h
-builtin/send-pack.o transport.o: send-pack.h
+builtin/branch.o builtin/checkout.o builtin/clone.o builtin/reset.o: branch.h
+libgit/branch.o libgit/transport.o: branch.h
+builtin/bundle.o libgit/bundle.o libgit/transport.o: bundle.h
+builtin/bisect--helper.o builtin/rev-list.o libgit/bisect.o: bisect.h
+builtin/clone.o builtin/fetch-pack.o libgit/transport.o: fetch-pack.h
+builtin/grep.o builtin/pack-objects.o libgit/transport-helper.o: thread-utils.h
+builtin/send-pack.o libgit/transport.o: send-pack.h
 builtin/log.o builtin/shortlog.o: shortlog.h
-builtin/prune.o builtin/reflog.o reachable.o: reachable.h
-builtin/commit.o builtin/revert.o wt-status.o: wt-status.h
-builtin/tar-tree.o archive-tar.o: tar.h
-connect.o transport.o http-backend.o: url.h
-http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
+builtin/prune.o builtin/reflog.o libgit/reachable.o: reachable.h
+builtin/commit.o builtin/revert.o libgit/wt-status.o: wt-status.h
+builtin/tar-tree.o libgit/archive-tar.o: tar.h
+libgit/connect.o libgit/transport.o http-backend.o: url.h
+http-fetch.o http-walker.o remote-curl.o libgit/transport.o libgit/walker.o: walker.h
 http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h url.h
 
-xdiff-interface.o $(XDIFF_OBJS): \
+libgit/xdiff-interface.o $(XDIFF_OBJS): \
 	xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
 	xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
 
@@ -1972,7 +1973,7 @@ $(VCSSVN_OBJS) $(VCSSVN_TEST_OBJS): $(LIB_H) \
 test-svn-fe.o: vcs-svn/svndump.h
 endif
 
-exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
+libgit/exec_cmd.s libgit/exec_cmd.o: EXTRA_CPPFLAGS = \
 	'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
 	'-DBINDIR="$(bindir_relative_SQ)"' \
 	'-DPREFIX="$(prefix_SQ)"'
@@ -1980,9 +1981,11 @@ exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
 builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
 	-DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
 
-config.s config.o: EXTRA_CPPFLAGS = -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
+libgit/config.s libgit/config.o: EXTRA_CPPFLAGS = \
+	-DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
 
-attr.s attr.o: EXTRA_CPPFLAGS = -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
+libgit/attr.s libgit/attr.o: EXTRA_CPPFLAGS = \
+	-DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
 
 http.s http.o: EXTRA_CPPFLAGS = -DGIT_HTTP_USER_AGENT='"git/$(GIT_VERSION)"'
 
@@ -2006,10 +2009,10 @@ git-imap-send$X: imap-send.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
 
-git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
+git-http-fetch$X: libgit/revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL)
-git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
+git-http-push$X: libgit/revision.o http.o http-push.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 
@@ -2123,15 +2126,15 @@ export NO_SVN_TESTS
 test: all
 	$(MAKE) -C t/ all
 
-test-ctype$X: ctype.o
+test-ctype$X: libgit/ctype.o
 
-test-date$X: date.o ctype.o
+test-date$X: libgit/date.o libgit/ctype.o
 
-test-delta$X: diff-delta.o patch-delta.o
+test-delta$X: libgit/diff-delta.o libgit/patch-delta.o
 
 test-line-buffer$X: vcs-svn/lib.a
 
-test-parse-options$X: parse-options.o
+test-parse-options$X: libgit/parse-options.o
 
 test-string-pool$X: vcs-svn/lib.a
 
@@ -2316,7 +2319,7 @@ distclean: clean
 
 clean:
 	$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
-		builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
+		libgit/*.o builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
 	$(RM) $(TEST_PROGRAMS)
 	$(RM) -r bin-wrappers
diff --git a/abspath.c b/libgit/abspath.c
similarity index 100%
rename from abspath.c
rename to libgit/abspath.c
diff --git a/advice.c b/libgit/advice.c
similarity index 100%
rename from advice.c
rename to libgit/advice.c
diff --git a/alias.c b/libgit/alias.c
similarity index 100%
rename from alias.c
rename to libgit/alias.c
diff --git a/alloc.c b/libgit/alloc.c
similarity index 100%
rename from alloc.c
rename to libgit/alloc.c
diff --git a/archive-tar.c b/libgit/archive-tar.c
similarity index 100%
rename from archive-tar.c
rename to libgit/archive-tar.c
diff --git a/archive-zip.c b/libgit/archive-zip.c
similarity index 100%
rename from archive-zip.c
rename to libgit/archive-zip.c
diff --git a/archive.c b/libgit/archive.c
similarity index 100%
rename from archive.c
rename to libgit/archive.c
diff --git a/attr.c b/libgit/attr.c
similarity index 100%
rename from attr.c
rename to libgit/attr.c
diff --git a/base85.c b/libgit/base85.c
similarity index 100%
rename from base85.c
rename to libgit/base85.c
diff --git a/bisect.c b/libgit/bisect.c
similarity index 100%
rename from bisect.c
rename to libgit/bisect.c
diff --git a/blob.c b/libgit/blob.c
similarity index 100%
rename from blob.c
rename to libgit/blob.c
diff --git a/branch.c b/libgit/branch.c
similarity index 100%
rename from branch.c
rename to libgit/branch.c
diff --git a/bundle.c b/libgit/bundle.c
similarity index 100%
rename from bundle.c
rename to libgit/bundle.c
diff --git a/cache-tree.c b/libgit/cache-tree.c
similarity index 100%
rename from cache-tree.c
rename to libgit/cache-tree.c
diff --git a/color.c b/libgit/color.c
similarity index 100%
rename from color.c
rename to libgit/color.c
diff --git a/combine-diff.c b/libgit/combine-diff.c
similarity index 100%
rename from combine-diff.c
rename to libgit/combine-diff.c
diff --git a/commit.c b/libgit/commit.c
similarity index 100%
rename from commit.c
rename to libgit/commit.c
diff --git a/config.c b/libgit/config.c
similarity index 100%
rename from config.c
rename to libgit/config.c
diff --git a/connect.c b/libgit/connect.c
similarity index 100%
rename from connect.c
rename to libgit/connect.c
diff --git a/convert.c b/libgit/convert.c
similarity index 100%
rename from convert.c
rename to libgit/convert.c
diff --git a/copy.c b/libgit/copy.c
similarity index 100%
rename from copy.c
rename to libgit/copy.c
diff --git a/csum-file.c b/libgit/csum-file.c
similarity index 100%
rename from csum-file.c
rename to libgit/csum-file.c
diff --git a/ctype.c b/libgit/ctype.c
similarity index 100%
rename from ctype.c
rename to libgit/ctype.c
diff --git a/date.c b/libgit/date.c
similarity index 100%
rename from date.c
rename to libgit/date.c
diff --git a/decorate.c b/libgit/decorate.c
similarity index 100%
rename from decorate.c
rename to libgit/decorate.c
diff --git a/diff-delta.c b/libgit/diff-delta.c
similarity index 100%
rename from diff-delta.c
rename to libgit/diff-delta.c
diff --git a/diff-lib.c b/libgit/diff-lib.c
similarity index 100%
rename from diff-lib.c
rename to libgit/diff-lib.c
diff --git a/diff-no-index.c b/libgit/diff-no-index.c
similarity index 100%
rename from diff-no-index.c
rename to libgit/diff-no-index.c
diff --git a/diff.c b/libgit/diff.c
similarity index 100%
rename from diff.c
rename to libgit/diff.c
diff --git a/diffcore-break.c b/libgit/diffcore-break.c
similarity index 100%
rename from diffcore-break.c
rename to libgit/diffcore-break.c
diff --git a/diffcore-delta.c b/libgit/diffcore-delta.c
similarity index 100%
rename from diffcore-delta.c
rename to libgit/diffcore-delta.c
diff --git a/diffcore-order.c b/libgit/diffcore-order.c
similarity index 100%
rename from diffcore-order.c
rename to libgit/diffcore-order.c
diff --git a/diffcore-pickaxe.c b/libgit/diffcore-pickaxe.c
similarity index 100%
rename from diffcore-pickaxe.c
rename to libgit/diffcore-pickaxe.c
diff --git a/diffcore-rename.c b/libgit/diffcore-rename.c
similarity index 100%
rename from diffcore-rename.c
rename to libgit/diffcore-rename.c
diff --git a/dir.c b/libgit/dir.c
similarity index 100%
rename from dir.c
rename to libgit/dir.c
diff --git a/editor.c b/libgit/editor.c
similarity index 100%
rename from editor.c
rename to libgit/editor.c
diff --git a/entry.c b/libgit/entry.c
similarity index 100%
rename from entry.c
rename to libgit/entry.c
diff --git a/environment.c b/libgit/environment.c
similarity index 100%
rename from environment.c
rename to libgit/environment.c
diff --git a/exec_cmd.c b/libgit/exec_cmd.c
similarity index 100%
rename from exec_cmd.c
rename to libgit/exec_cmd.c
diff --git a/fsck.c b/libgit/fsck.c
similarity index 100%
rename from fsck.c
rename to libgit/fsck.c
diff --git a/graph.c b/libgit/graph.c
similarity index 100%
rename from graph.c
rename to libgit/graph.c
diff --git a/grep.c b/libgit/grep.c
similarity index 100%
rename from grep.c
rename to libgit/grep.c
diff --git a/hash.c b/libgit/hash.c
similarity index 100%
rename from hash.c
rename to libgit/hash.c
diff --git a/help.c b/libgit/help.c
similarity index 100%
rename from help.c
rename to libgit/help.c
diff --git a/hex.c b/libgit/hex.c
similarity index 100%
rename from hex.c
rename to libgit/hex.c
diff --git a/ident.c b/libgit/ident.c
similarity index 100%
rename from ident.c
rename to libgit/ident.c
diff --git a/levenshtein.c b/libgit/levenshtein.c
similarity index 100%
rename from levenshtein.c
rename to libgit/levenshtein.c
diff --git a/list-objects.c b/libgit/list-objects.c
similarity index 100%
rename from list-objects.c
rename to libgit/list-objects.c
diff --git a/ll-merge.c b/libgit/ll-merge.c
similarity index 100%
rename from ll-merge.c
rename to libgit/ll-merge.c
diff --git a/lockfile.c b/libgit/lockfile.c
similarity index 100%
rename from lockfile.c
rename to libgit/lockfile.c
diff --git a/log-tree.c b/libgit/log-tree.c
similarity index 100%
rename from log-tree.c
rename to libgit/log-tree.c
diff --git a/mailmap.c b/libgit/mailmap.c
similarity index 100%
rename from mailmap.c
rename to libgit/mailmap.c
diff --git a/match-trees.c b/libgit/match-trees.c
similarity index 100%
rename from match-trees.c
rename to libgit/match-trees.c
diff --git a/merge-file.c b/libgit/merge-file.c
similarity index 100%
rename from merge-file.c
rename to libgit/merge-file.c
diff --git a/merge-recursive.c b/libgit/merge-recursive.c
similarity index 100%
rename from merge-recursive.c
rename to libgit/merge-recursive.c
diff --git a/name-hash.c b/libgit/name-hash.c
similarity index 100%
rename from name-hash.c
rename to libgit/name-hash.c
diff --git a/notes-cache.c b/libgit/notes-cache.c
similarity index 100%
rename from notes-cache.c
rename to libgit/notes-cache.c
diff --git a/notes-merge.c b/libgit/notes-merge.c
similarity index 100%
rename from notes-merge.c
rename to libgit/notes-merge.c
diff --git a/notes.c b/libgit/notes.c
similarity index 100%
rename from notes.c
rename to libgit/notes.c
diff --git a/object.c b/libgit/object.c
similarity index 100%
rename from object.c
rename to libgit/object.c
diff --git a/pack-check.c b/libgit/pack-check.c
similarity index 100%
rename from pack-check.c
rename to libgit/pack-check.c
diff --git a/pack-refs.c b/libgit/pack-refs.c
similarity index 100%
rename from pack-refs.c
rename to libgit/pack-refs.c
diff --git a/pack-revindex.c b/libgit/pack-revindex.c
similarity index 100%
rename from pack-revindex.c
rename to libgit/pack-revindex.c
diff --git a/pack-write.c b/libgit/pack-write.c
similarity index 100%
rename from pack-write.c
rename to libgit/pack-write.c
diff --git a/pager.c b/libgit/pager.c
similarity index 100%
rename from pager.c
rename to libgit/pager.c
diff --git a/parse-options.c b/libgit/parse-options.c
similarity index 100%
rename from parse-options.c
rename to libgit/parse-options.c
diff --git a/patch-delta.c b/libgit/patch-delta.c
similarity index 100%
rename from patch-delta.c
rename to libgit/patch-delta.c
diff --git a/patch-ids.c b/libgit/patch-ids.c
similarity index 100%
rename from patch-ids.c
rename to libgit/patch-ids.c
diff --git a/path.c b/libgit/path.c
similarity index 100%
rename from path.c
rename to libgit/path.c
diff --git a/pkt-line.c b/libgit/pkt-line.c
similarity index 100%
rename from pkt-line.c
rename to libgit/pkt-line.c
diff --git a/preload-index.c b/libgit/preload-index.c
similarity index 100%
rename from preload-index.c
rename to libgit/preload-index.c
diff --git a/pretty.c b/libgit/pretty.c
similarity index 100%
rename from pretty.c
rename to libgit/pretty.c
diff --git a/progress.c b/libgit/progress.c
similarity index 100%
rename from progress.c
rename to libgit/progress.c
diff --git a/quote.c b/libgit/quote.c
similarity index 100%
rename from quote.c
rename to libgit/quote.c
diff --git a/reachable.c b/libgit/reachable.c
similarity index 100%
rename from reachable.c
rename to libgit/reachable.c
diff --git a/read-cache.c b/libgit/read-cache.c
similarity index 100%
rename from read-cache.c
rename to libgit/read-cache.c
diff --git a/reflog-walk.c b/libgit/reflog-walk.c
similarity index 100%
rename from reflog-walk.c
rename to libgit/reflog-walk.c
diff --git a/refs.c b/libgit/refs.c
similarity index 100%
rename from refs.c
rename to libgit/refs.c
diff --git a/remote.c b/libgit/remote.c
similarity index 100%
rename from remote.c
rename to libgit/remote.c
diff --git a/replace_object.c b/libgit/replace_object.c
similarity index 100%
rename from replace_object.c
rename to libgit/replace_object.c
diff --git a/rerere.c b/libgit/rerere.c
similarity index 100%
rename from rerere.c
rename to libgit/rerere.c
diff --git a/resolve-undo.c b/libgit/resolve-undo.c
similarity index 100%
rename from resolve-undo.c
rename to libgit/resolve-undo.c
diff --git a/revision.c b/libgit/revision.c
similarity index 100%
rename from revision.c
rename to libgit/revision.c
diff --git a/run-command.c b/libgit/run-command.c
similarity index 100%
rename from run-command.c
rename to libgit/run-command.c
diff --git a/server-info.c b/libgit/server-info.c
similarity index 100%
rename from server-info.c
rename to libgit/server-info.c
diff --git a/setup.c b/libgit/setup.c
similarity index 100%
rename from setup.c
rename to libgit/setup.c
diff --git a/sha1-lookup.c b/libgit/sha1-lookup.c
similarity index 100%
rename from sha1-lookup.c
rename to libgit/sha1-lookup.c
diff --git a/sha1_file.c b/libgit/sha1_file.c
similarity index 100%
rename from sha1_file.c
rename to libgit/sha1_file.c
diff --git a/sha1_name.c b/libgit/sha1_name.c
similarity index 100%
rename from sha1_name.c
rename to libgit/sha1_name.c
diff --git a/shallow.c b/libgit/shallow.c
similarity index 100%
rename from shallow.c
rename to libgit/shallow.c
diff --git a/sideband.c b/libgit/sideband.c
similarity index 100%
rename from sideband.c
rename to libgit/sideband.c
diff --git a/sigchain.c b/libgit/sigchain.c
similarity index 100%
rename from sigchain.c
rename to libgit/sigchain.c
diff --git a/strbuf.c b/libgit/strbuf.c
similarity index 100%
rename from strbuf.c
rename to libgit/strbuf.c
diff --git a/string-list.c b/libgit/string-list.c
similarity index 100%
rename from string-list.c
rename to libgit/string-list.c
diff --git a/submodule.c b/libgit/submodule.c
similarity index 100%
rename from submodule.c
rename to libgit/submodule.c
diff --git a/symlinks.c b/libgit/symlinks.c
similarity index 100%
rename from symlinks.c
rename to libgit/symlinks.c
diff --git a/tag.c b/libgit/tag.c
similarity index 100%
rename from tag.c
rename to libgit/tag.c
diff --git a/thread-utils.c b/libgit/thread-utils.c
similarity index 100%
rename from thread-utils.c
rename to libgit/thread-utils.c
diff --git a/trace.c b/libgit/trace.c
similarity index 100%
rename from trace.c
rename to libgit/trace.c
diff --git a/transport-helper.c b/libgit/transport-helper.c
similarity index 100%
rename from transport-helper.c
rename to libgit/transport-helper.c
diff --git a/transport.c b/libgit/transport.c
similarity index 100%
rename from transport.c
rename to libgit/transport.c
diff --git a/tree-diff.c b/libgit/tree-diff.c
similarity index 100%
rename from tree-diff.c
rename to libgit/tree-diff.c
diff --git a/tree-walk.c b/libgit/tree-walk.c
similarity index 100%
rename from tree-walk.c
rename to libgit/tree-walk.c
diff --git a/tree.c b/libgit/tree.c
similarity index 100%
rename from tree.c
rename to libgit/tree.c
diff --git a/unpack-trees.c b/libgit/unpack-trees.c
similarity index 100%
rename from unpack-trees.c
rename to libgit/unpack-trees.c
diff --git a/url.c b/libgit/url.c
similarity index 100%
rename from url.c
rename to libgit/url.c
diff --git a/usage.c b/libgit/usage.c
similarity index 100%
rename from usage.c
rename to libgit/usage.c
diff --git a/userdiff.c b/libgit/userdiff.c
similarity index 100%
rename from userdiff.c
rename to libgit/userdiff.c
diff --git a/utf8.c b/libgit/utf8.c
similarity index 100%
rename from utf8.c
rename to libgit/utf8.c
diff --git a/walker.c b/libgit/walker.c
similarity index 100%
rename from walker.c
rename to libgit/walker.c
diff --git a/wrapper.c b/libgit/wrapper.c
similarity index 100%
rename from wrapper.c
rename to libgit/wrapper.c
diff --git a/write_or_die.c b/libgit/write_or_die.c
similarity index 100%
rename from write_or_die.c
rename to libgit/write_or_die.c
diff --git a/ws.c b/libgit/ws.c
similarity index 100%
rename from ws.c
rename to libgit/ws.c
diff --git a/wt-status.c b/libgit/wt-status.c
similarity index 100%
rename from wt-status.c
rename to libgit/wt-status.c
diff --git a/xdiff-interface.c b/libgit/xdiff-interface.c
similarity index 100%
rename from xdiff-interface.c
rename to libgit/xdiff-interface.c
diff --git a/zlib.c b/libgit/zlib.c
similarity index 100%
rename from zlib.c
rename to libgit/zlib.c
-- 
1.7.4.1

^ permalink raw reply related	[relevance 28%]

Results 1-200 of ~2000   | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2007-07-01  8:28 21% [PATCH] Add USE_SHARED_LIBGIT flag to build and use libgit.so rather than libgit.a Josh Triplett
2023-05-12 22:52 18% [PATCH] lib: add new libgit-builtin Felipe Contreras
2005-09-16 12:37 16% [PATCH/RFC] Build a shared / renamed / "stable" version of the library? Matthias Urlichs
2005-09-16 18:46  5% ` Junio C Hamano
2024-02-27 14:44 15% [PATCH] cmake: adapt to the Git Standard Library Johannes Schindelin via GitGitGadget
2016-06-14  8:34 12% [TIG PATCH] test: make diff/log work with git 2.9 Michael J Gruber
2009-08-10 13:56 11% Using VC build git Frank Li
2005-04-17  3:12 10% [PATCH] libgit Mike Taht
2005-04-17  3:46  9% ` Randy.Dunlap
2014-08-26 12:44 10% [PATCH] contrib/svn-fe: fix Makefile Maxim Bublis
2017-05-24  5:15 10% [PATCH 00/29] Add blame to libgit Jeff Smith
     [not found]     <499B3F65.8010109@synapse.com>
     [not found]     ` <20090218091617.7805.qmail@2684cdd72f0ee9.315fe32.mid.smarden.org>
     [not found]       ` <499C40EA.6050108@synapse.com>
     [not found]         ` <20090219092446.23272.qmail@3b5a9fa637f270.315fe32.mid.smarden.org>
2010-03-07 10:27 10%       ` status of libgit.a Paul Menzel
2010-03-07 13:26 10%         ` Dmitry Potapov
2010-03-07 16:36 10%         ` Johannes Schindelin
2010-03-07 12:18  8%         ` Miklos Vajna
2007-07-23 12:35  9% [ANNOUNCE]: PyGit and libgit-thin Luiz Fernando N. Capitulino
2019-06-11 19:52  9% Reducing git size by building libgit.so Elmar Pruesse
2019-06-11 23:48  9% ` brian m. carlson
2019-06-12  9:29  8%   ` Duy Nguyen
2019-06-12 13:57       ` Paul Smith
2019-06-13  7:51  8%     ` Johannes Schindelin
2017-05-05  5:27  9% [RFC PATCH 00/10] Add blame to libgit Jeff Smith
2017-05-14  3:14 10% ` [RFC PATCH v2 00/22] " Jeff Smith
2014-08-28 17:00  9% [PATCH v2] contrib/svn-fe: fix Makefile Maxim Bublis
     [not found]     <b086760e0907111409w602f4338u868729dcfa188908@mail.gmail.com>
2009-07-11 21:17  8% ` libgit api & external integration devzero2000
2009-07-16 10:03  8%   ` Jeff King
2008-01-14 16:36  8% [PATCH] Move sha1_file_to_archive into libgit Lars Hjemli
2008-07-31  9:53  8% linking libgit.a in C++ projects cte
2008-07-31 10:57  8% ` Dmitry Potapov
2008-07-31 11:10  9%   ` cte
2008-07-31 11:16  8%     ` Pedro Melo
2008-07-31 11:20  8%       ` cte
2008-07-31 11:20  8%       ` Petr Baudis
2008-07-31 11:14       ` Petr Baudis
2008-07-31 12:34  8%     ` Dmitry Potapov
2008-07-31 13:04     ` Boaz Harrosh
2008-07-31 18:37       ` Alex Riesen
2008-07-31 18:55         ` Avery Pennarun
2008-08-03 20:12  8%       ` Alex Riesen
2012-12-09 10:36  7% [PATCH] Makefile: whitespace style fixes in macro definitions Stefano Lattarini
2006-09-23 18:20  7% [PATCH] Git.pm: Kill Git.xs for now Petr Baudis
2006-06-24  2:34  7% [PATCH 01/12] Introduce Git.pm (v4) Petr Baudis
2006-06-24  2:34     ` [PATCH 07/12] Git.pm: Better error handling Petr Baudis
2006-06-24  8:37  5%   ` Junio C Hamano
2006-06-22 22:02  7% [PATCH] Introduce Git.pm (v3) Petr Baudis
2006-06-22 23:18     ` Junio C Hamano
2006-06-22 23:50  6%   ` Petr Baudis
2006-06-23 12:39  5%     ` Petr Baudis
2006-06-23  0:22  5%     ` Junio C Hamano
2006-06-23  1:12           ` Petr Baudis
2006-06-23  8:57             ` Junio C Hamano
2006-06-23 12:04               ` Eric W. Biederman
2019-03-20 10:19  7% How to properly find git config in a libgit.a-using executable? Mike Hommey
2019-03-22  7:33  8% ` Jeff King
2019-03-22 13:39       ` Johannes Schindelin
2019-03-22 14:19  8%     ` Mike Hommey
2019-03-25 14:37  8%       ` Johannes Schindelin
2009-08-15 16:21  7% Using VC build git (new patch) Frank Li
2009-08-17 13:13  7% Using VC build git (split patch) Frank Li
2005-05-08 19:35  6% Make errors John Kacur
2006-02-02 18:41  6% problem compiling tonights Git dave morgan
2023-12-17 22:54  6% Unable to install git-2.43.0 from source on macOS Big Sur 11.7.10 Jonathan Abrams
2007-05-12 21:35  5% [PATCH] Make git compile with SUNs forte12 compiler Thomas Glanzmann
2007-05-13  9:47     ` Matthieu CASTET
2007-05-13 10:30       ` Thomas Glanzmann
2007-05-13 12:52  5%     ` matthieu castet
2005-10-18 14:28  5% [PATCH] Ignore more generated files Johannes Schindelin
2005-07-12 18:33  5% Compilation troubles Dan Kohn
2009-01-15 15:00  5% [PATCH 1/2] Move run_hook() from builtin-commit.c into run-command.c (libgit) Stephan Beyer
2012-10-23  2:24  5% [PATCH] Move try_merge_command and checkout_fast_forward to libgit.a Nguyễn Thái Ngọc Duy
2012-10-25  9:45     ` Jeff King
2012-10-25 12:50  8%   ` Nguyen Thai Ngoc Duy
2012-10-26 12:02  8%     ` Jeff King
2012-10-26 15:53 10%       ` [PATCH 0/7] Move code from builtin " Nguyễn Thái Ngọc Duy
2012-10-26 15:53  8%         ` [PATCH 3/7] Move print_commit_list " Nguyễn Thái Ngọc Duy
2012-10-26 15:53  8%         ` [PATCH 2/7] Move estimate_bisect_steps " Nguyễn Thái Ngọc Duy
2012-10-26 15:53  7%         ` [PATCH 4/7] Move setup_diff_pager " Nguyễn Thái Ngọc Duy
2012-10-26 15:53  5%         ` [PATCH 1/7] Move try_merge_command and checkout_fast_forward " Nguyễn Thái Ngọc Duy
2015-06-09 14:07  5% How to compile without iconv? Sascha Ziemann
2005-07-16 20:45  5% Darcs-Git: upgrading to Git 0.99 Juliusz Chroboczek
2005-07-17 10:40  5% ` [darcs-devel] " David Roundy
2007-09-05 23:22  5% [PATCH 3/3] Makefile: Add cache-tree.h to the public headers list Dmitry V. Levin
2006-03-18 14:53  5% [PATCH] Basic Zsh completion support Fredrik Kuivinen
2008-06-14  7:28  5% [StGIT PATCH] Implement a new patch identification scheme and id command Catalin Marinas
2006-03-05 12:25  5% [PATCH] gitignore: Ignore some more boring things Mark Wooding
2015-01-22 19:43  5% Git compile warnings (under mac/clang) Michael Blume
2017-09-25 10:10  5% [RFC PATCH 0/8] sequencer: dont't fork git commit Phillip Wood
2007-02-14 14:57     [PATCH] add install-lib target to install libgit.a library plus headers Gerrit Pape
2007-02-14 18:24  9% ` Junio C Hamano
2007-02-14 15:51  8% ` Johannes Schindelin
2006-12-01  7:06     Resolving conflicts Wink Saville
2006-12-01  7:39     ` Linus Torvalds
2006-12-01  7:52       ` Wink Saville
2006-12-02  4:30         ` Linus Torvalds
2006-12-02  7:55           ` Junio C Hamano
2006-12-02 10:49             ` using xdl_merge(), was " Johannes Schindelin
2006-12-05 17:58               ` Ramsay Jones
2006-12-05 18:28                 ` Linus Torvalds
2006-12-05 18:53                   ` Johannes Schindelin
2006-12-05 19:50  5%                 ` Junio C Hamano
2020-09-16 19:10     [PATCH 00/13] reftable library Han-Wen Nienhuys via GitGitGadget
2020-09-16 19:10  9% ` [PATCH 03/13] vcxproj: adjust for the reftable changes Johannes Schindelin via GitGitGadget
2020-10-01 16:10     ` [PATCH v2 00/13] reftable library Han-Wen Nienhuys via GitGitGadget
2020-10-01 16:10  9%   ` [PATCH v2 03/13] vcxproj: adjust for the reftable changes Johannes Schindelin via GitGitGadget
2008-05-24  0:01     [WIP PATCH 0/5] Build in merge Miklos Vajna
2008-05-24  0:01     ` [PATCH 1/5] Move reset_index_file() to a new reset.c Miklos Vajna
2008-05-24  0:01  7%   ` [PATCH 2/5] Move split_cmdline() to libgit Miklos Vajna
2006-06-25  1:54     [PATCH 1/7] Git.pm: Introduce ident() and ident_person() methods Petr Baudis
2006-06-25  1:54 11% ` [PATCH 5/7] Make it possible to set up libgit directly (instead of from the environment) Petr Baudis
2007-11-24  8:14     QGit: Shrink used memory with custom git log format Marco Costalba
2007-11-27  1:52     ` Shawn O. Pearce
2007-11-27 10:48       ` Johannes Schindelin
2007-11-27 12:36  5%     ` Marco Costalba
2014-12-05 20:53     Announcing a new (prototype) git-remote-hg tool Mike Hommey
2014-12-05 22:13  5% ` Jonathan Nieder
2005-04-19  3:51     "True" git merge in git-pasky Petr Baudis
2005-04-19  5:43  5% ` bert hubert
2020-05-04 13:31     [PATCH 0/6] Minimal patch series to fix the CI runs of hn/reftable Johannes Schindelin via GitGitGadget
2020-05-04 13:31  9% ` [PATCH 6/6] vcxproj: adjust for the reftable changes Johannes Schindelin via GitGitGadget
2012-08-17 20:25     [PATCH/RFC v4 01/16] GSOC remote-svn Florian Achleitner
2012-08-17 20:25     ` [PATCH/RFC v4 01/16] Implement a remote helper for svn in C Florian Achleitner
2012-08-17 20:25  5%   ` [PATCH/RFC v4 02/16] Integrate remote-svn into svn-fe/Makefile Florian Achleitner
2021-08-30 14:57     [PATCH 00/19] Adds reftable library code from https://github.com/hanwen/reftable Han-Wen Nienhuys via GitGitGadget
2021-08-30 14:57  7% ` [PATCH 04/19] reftable: utility functions Han-Wen Nienhuys via GitGitGadget
2021-09-09 18:47     ` [PATCH v2 00/19] Adds reftable library code from https://github.com/hanwen/reftable Han-Wen Nienhuys via GitGitGadget
2021-09-09 18:47  7%   ` [PATCH v2 04/19] reftable: utility functions Han-Wen Nienhuys via GitGitGadget
2021-09-28 15:09       ` [PATCH v3 00/19] Adds reftable library code from https://github.com/hanwen/reftable Han-Wen Nienhuys via GitGitGadget
2021-09-28 15:10  7%     ` [PATCH v3 04/19] reftable: utility functions Han-Wen Nienhuys via GitGitGadget
2021-10-07 20:24         ` [PATCH v4 00/19] Adds reftable library code from https://github.com/hanwen/reftable Han-Wen Nienhuys via GitGitGadget
2021-10-07 20:25  7%       ` [PATCH v4 04/19] reftable: utility functions Han-Wen Nienhuys via GitGitGadget
2008-03-19  4:08     [SoC RFC] libsvn-fs-git: A git backend for the subversion filesystem Bryan Donlan
2008-03-22  5:02     ` Bryan Donlan
2008-03-22 11:35  9%   ` thread-safe libgit.a as a GSoC project, was " Johannes Schindelin
2009-08-17 16:04     [PATCH 06/11] Add miss git-compat-util.h at regex.c and fnmatch.c Add git-compat-util.h to enable build at MSVC environment Frank Li
2009-08-17 16:04     ` [PATCH 07/11] Add O_BINARY flag to open flag at mingw.c Frank Li
2009-08-17 16:04       ` [PATCH 08/11] Place __stdcall to correct position Frank Li
2009-08-17 16:05         ` [PATCH 09/11] Add MSVC porting header files Frank Li
2009-08-17 16:05 11%       ` [PATCH 10/11] Add MSVC Project file Frank Li
2020-04-24  4:01     [PATCH 0/8] CMake build system for git Sibi Siddharthan via GitGitGadget
2020-04-24  4:01  5% ` [PATCH 6/8] cmake: support for building git on windows with mingw Sibi Siddharthan via GitGitGadget
2020-05-12 16:50     ` [PATCH v2 00/11] CMake build system for git Sibi Siddharthan via GitGitGadget
2020-05-12 16:50  5%   ` [PATCH v2 06/11] cmake: support for building git on windows with mingw Sibi Siddharthan via GitGitGadget
2020-05-29 13:40       ` [PATCH v3 0/8] CMake build system for git Sibi Siddharthan via GitGitGadget
2020-05-29 13:40  5%     ` [PATCH v3 6/8] cmake: support for building git on windows with mingw Sibi Siddharthan via GitGitGadget
2020-06-12 18:29         ` [PATCH v4 0/8] CMake build system for git Sibi Siddharthan via GitGitGadget
2020-06-12 18:29  5%       ` [PATCH v4 6/8] cmake: support for building git on windows with mingw Sibi Siddharthan via GitGitGadget
2020-06-26 16:11           ` [PATCH v5 0/8] CMake build system for git Sibi Siddharthan via GitGitGadget
2020-06-26 16:11  5%         ` [PATCH v5 6/8] cmake: support for building git on windows with mingw Sibi Siddharthan via GitGitGadget
2008-08-23 19:41     [PATCH] Makefile: improve customization for supporting HP-UX Miklos Vajna
2008-08-23 20:09     ` Robert Schiele
2008-08-23 20:26  5%   ` Miklos Vajna
2008-03-04  5:11     GSoC 2008 - Mentors Wanted! Shawn O. Pearce
2008-03-04 20:47     ` Carlos Rica
2008-03-05  5:36       ` Shawn O. Pearce
2008-03-05  7:58         ` Imran M Yousuf
2008-03-05  8:15  5%       ` Shawn O. Pearce
2019-09-25  8:35     [PATCH 0/2] Git's rename detection requires a stable sort Johannes Schindelin via GitGitGadget
2019-09-25  8:36  6% ` [PATCH 1/2] Move git_sort(), a stable sort, into into libgit.a Johannes Schindelin via GitGitGadget
2019-09-30 17:21     ` [PATCH v2 0/2] Git's rename detection requires a stable sort Johannes Schindelin via GitGitGadget
2019-09-30 17:21  6%   ` [PATCH v2 1/2] Move git_sort(), a stable sort, into into libgit.a Johannes Schindelin via GitGitGadget
2016-08-15  7:52     [PATCH 1/1] do not add common-main to lib Christian Hesse
2016-08-15 12:20  5% ` Johannes Schindelin
2016-08-15 12:02  5% ` Jeff King
2021-06-29  8:44     [PATCH v2] Makefile: add and use the ".DELETE_ON_ERROR" flag Ævar Arnfjörð Bjarmason
2021-08-18 21:36  5% ` [PATCH] Makefile: remove archives before manipulating them with 'ar' SZEDER Gábor
2008-07-18  0:58     [PATCH] shrink git-shell by avoiding redundant dependencies Shawn O. Pearce
2008-07-18  1:04  9% ` [PATCH] Link git-shell only to a subset of libgit.a Stephan Beyer
2023-09-29 21:20     [PATCH v4 0/4] Preliminary patches before git-std-lib Jonathan Tan
2024-02-22 17:50  9% ` [PATCH v5 2/3] git-std-lib: introduce Git Standard Library Calvin Wan
2024-02-29 11:16       ` Phillip Wood
2024-02-29 17:23  5%     ` Junio C Hamano
2024-02-29 18:27           ` Linus Arver
2024-02-29 18:54  5%         ` Junio C Hamano
2013-06-07 22:16     [PATCH 0/2] Move sequencer Felipe Contreras
2013-06-07 22:16     ` [PATCH 2/2] Move sequencer to builtin Felipe Contreras
2013-06-08  2:35       ` Duy Nguyen
2013-06-08 10:14  5%     ` Felipe Contreras
2013-06-08 11:42           ` Duy Nguyen
2013-06-08 12:25  5%         ` Felipe Contreras
2013-06-08 12:34               ` Duy Nguyen
2013-06-08 12:55                 ` Ramkumar Ramachandra
2013-06-08 13:15                   ` Duy Nguyen
2013-06-08 13:34                     ` Ramkumar Ramachandra
2013-06-08 14:10  5%                   ` Duy Nguyen
2013-06-08 14:20                         ` Felipe Contreras
2013-06-09  4:34                           ` Jeff King
2013-06-09  9:58  5%                         ` Ramkumar Ramachandra
2006-06-24  0:18     x86 asm SHA1 (draft) Junio C Hamano
2006-06-24  1:22     ` linux
2006-06-24  7:03       ` Junio C Hamano
2006-06-24 10:03         ` PPC SHA-1 Updates in "pu" Junio C Hamano
2006-06-24 18:55           ` Linus Torvalds
2006-06-24 20:21             ` Junio C Hamano
2006-06-24 20:42               ` Linus Torvalds
2006-06-24 23:59  5%             ` Junio C Hamano
2005-04-16 13:22     using git directory cache code in darcs? David Roundy
2005-04-16 22:43     ` Linus Torvalds
2005-04-17 12:17       ` David Roundy
2005-04-17 16:24         ` Linus Torvalds
2005-04-18  2:56  5%       ` Paul Jackson
2005-04-18  3:06             ` Linus Torvalds
2005-04-18  4:36  5%           ` Paul Jackson
2019-10-18 19:43     [PATCH 2/2] Make "git branch -d" prune missing worktrees automatically Peter Jones
2019-10-18 19:45     ` [PATCH v2 1/4] libgit: Add a read-only helper to test the worktree lock Peter Jones
2019-10-21  1:36  6%   ` Junio C Hamano
2021-08-30 21:34     [PATCH 00/15] [RFC] Upstreaming the Scalar command Johannes Schindelin via GitGitGadget
2021-08-30 21:34  5% ` [PATCH 01/15] scalar: create a rudimentary executable Johannes Schindelin via GitGitGadget
2021-09-03 17:54     ` [PATCH v2 00/15] [RFC] Upstreaming the Scalar command Johannes Schindelin via GitGitGadget
2021-09-03 17:54  5%   ` [PATCH v2 01/15] scalar: create a rudimentary executable Johannes Schindelin via GitGitGadget
2021-09-08 19:24       ` [PATCH v3 00/15] [RFC] Upstreaming the Scalar command Johannes Schindelin via GitGitGadget
2021-09-08 19:24  5%     ` [PATCH v3 01/15] scalar: create a rudimentary executable Johannes Schindelin via GitGitGadget
2021-09-14 14:39         ` [PATCH v4 00/15] Upstreaming the Scalar command Johannes Schindelin via GitGitGadget
2021-09-14 14:39  5%       ` [PATCH v4 01/15] scalar: create a rudimentary executable Johannes Schindelin via GitGitGadget
2021-10-07 10:58           ` [PATCH v5 00/15] Upstreaming the Scalar command Johannes Schindelin via GitGitGadget
2021-10-07 10:58  5%         ` [PATCH v5 01/15] scalar: create a rudimentary executable Johannes Schindelin via GitGitGadget
2021-10-27  8:27             ` [PATCH v6 00/15] Upstreaming the Scalar command Johannes Schindelin via GitGitGadget
2021-10-27  8:27  5%           ` [PATCH v6 01/15] scalar: create a rudimentary executable Johannes Schindelin via GitGitGadget
2021-11-17 14:19               ` [PATCH v7 00/17] Upstreaming the Scalar command Johannes Schindelin via GitGitGadget
2021-11-17 14:19  5%             ` [PATCH v7 02/17] scalar: create a rudimentary executable Johannes Schindelin via GitGitGadget
2021-11-19 23:03                 ` [PATCH v8 00/17] Upstreaming the Scalar command Johannes Schindelin via GitGitGadget
2021-11-19 23:03  5%               ` [PATCH v8 02/17] scalar: create a rudimentary executable Johannes Schindelin via GitGitGadget
2021-11-30 11:54                   ` [PATCH v9 00/17] Upstreaming the Scalar command Johannes Schindelin via GitGitGadget
2021-11-30 11:54  5%                 ` [PATCH v9 02/17] scalar: create a rudimentary executable Johannes Schindelin via GitGitGadget
2021-12-03 13:34                     ` [PATCH v10 00/15] Upstreaming the Scalar command Johannes Schindelin via GitGitGadget
2021-12-03 13:34  5%                   ` [PATCH v10 02/15] scalar: create a rudimentary executable Johannes Schindelin via GitGitGadget
2023-05-04 23:10     [PATCH] diff: fix behaviour of the "-s" option Junio C Hamano
2023-05-05 16:59     ` [PATCH v2] diff: fix interaction between the "-s" option and other options Junio C Hamano
2023-05-09  0:38       ` Felipe Contreras
2023-05-09  1:22         ` Junio C Hamano
2023-05-09  3:50           ` Felipe Contreras
2023-05-10  4:26             ` Junio C Hamano
2023-05-10 23:16               ` Felipe Contreras
2023-05-10 23:41                 ` Felipe Contreras
2023-05-11  1:25                   ` Jeff King
2023-05-13  3:07  5%                 ` Felipe Contreras
2020-04-27 20:13     [PATCH v10 00/12] Reftable support git-core Han-Wen Nienhuys via GitGitGadget
2020-05-04 19:03     ` [PATCH v11 " Han-Wen Nienhuys via GitGitGadget
2020-05-04 19:03  9%   ` [PATCH v11 10/12] vcxproj: adjust for the reftable changes Johannes Schindelin via GitGitGadget
2020-05-07  9:59       ` [PATCH v12 00/12] Reftable support git-core Han-Wen Nienhuys via GitGitGadget
2020-05-07  9:59  9%     ` [PATCH v12 10/12] vcxproj: adjust for the reftable changes Johannes Schindelin via GitGitGadget
2020-05-11 19:46         ` [PATCH v13 00/13] Reftable support git-core Han-Wen Nienhuys via GitGitGadget
2020-05-11 19:46  9%       ` [PATCH v13 12/13] vcxproj: adjust for the reftable changes Johannes Schindelin via GitGitGadget
2020-05-18 20:31           ` [PATCH v14 0/9] Reftable support git-core Han-Wen Nienhuys via GitGitGadget
2020-05-18 20:31  9%         ` [PATCH v14 8/9] vcxproj: adjust for the reftable changes Johannes Schindelin via GitGitGadget
2020-05-28 19:46             ` [PATCH v15 00/13] Reftable support git-core Han-Wen Nienhuys via GitGitGadget
2020-05-28 19:46  9%           ` [PATCH v15 12/13] vcxproj: adjust for the reftable changes Johannes Schindelin via GitGitGadget
2020-06-05 18:03               ` [PATCH v16 00/14] Reftable support git-core Han-Wen Nienhuys via GitGitGadget
2020-06-05 18:03  9%             ` [PATCH v16 13/14] vcxproj: adjust for the reftable changes Johannes Schindelin via GitGitGadget
2020-06-16 19:20                 ` [PATCH v17 00/17] Reftable support git-core Han-Wen Nienhuys via GitGitGadget
2020-06-16 19:20  9%               ` [PATCH v17 15/17] vcxproj: adjust for the reftable changes Johannes Schindelin via GitGitGadget
2020-06-22 21:55                   ` [PATCH v18 00/19] Reftable support git-core Han-Wen Nienhuys via GitGitGadget
2020-06-22 21:55  9%                 ` [PATCH v18 16/19] vcxproj: adjust for the reftable changes Johannes Schindelin via GitGitGadget
2020-06-29 18:56                     ` [PATCH v19 00/20] Reftable support git-core Han-Wen Nienhuys via GitGitGadget
2020-06-29 18:56  9%                   ` [PATCH v19 17/20] vcxproj: adjust for the reftable changes Johannes Schindelin via GitGitGadget
2020-07-31 15:26                       ` [PATCH v20 00/21] Reftable support git-core Han-Wen Nienhuys via GitGitGadget
2020-07-31 15:27  9%                     ` [PATCH v20 18/21] vcxproj: adjust for the reftable changes Johannes Schindelin via GitGitGadget
2011-02-09 22:15     [PATCH/RFC] Move test-*.c to test/ subdirectory Junio C Hamano
2011-02-10  2:14     ` [PATCH] Move test-* to t/helper/ subdirectory Nguyễn Thái Ngọc Duy
2011-02-18  2:27  5%   ` [RFC/PATCH 0/3] Thinning the git toplevel directory Jonathan Nieder
2011-02-18  2:31 28%     ` [PATCH 1/3] Move libgit.a sources into a libgit/ subdirectory Jonathan Nieder
2011-02-18  3:47 12%       ` Nguyen Thai Ngoc Duy
2011-02-18  4:14 27%         ` Jonathan Nieder
2011-02-18  4:18 11%           ` Jeff King
2011-02-18  5:58 12%             ` Jonathan Nieder
2011-02-18  4:31 11%       ` Nguyen Thai Ngoc Duy
2011-02-18  2:37 18%     ` [PATCH 3/3] Move header files into a include/ subdirectory Jonathan Nieder
2011-02-18  3:52  5%       ` Nguyen Thai Ngoc Duy
2011-02-18  3:56         ` [RFC/PATCH 0/3] Thinning the git toplevel directory Nguyen Thai Ngoc Duy
2011-02-18  9:25           ` Jonathan Nieder
2011-02-18 11:08             ` Jeff King
2011-02-18 12:33  6%           ` Jonathan Nieder
2011-02-18  4:51           ` [RFC/PATCH 7 - 9/3] " Jonathan Nieder
2011-02-18  5:04 15%         ` [PATCH 9/3] Move non-builtin git commands and script libraries to a subdirectory Jonathan Nieder
2023-05-02  4:11     [RFC PATCH 0/3] test: new testing framework for libification Felipe Contreras
2023-05-02  4:11  8% ` [RFC PATCH 2/3] test: add basic unit testing framework Felipe Contreras
2023-05-02  4:11  6% ` [RFC PATCH 1/3] test: add simple shared library Felipe Contreras
2008-06-15 14:02     [PATCH 0/4] Teach "git clone" to pack refs Johan Herland
2008-06-15 14:05     ` [PATCH 2/4] Move pack_refs() and friends into libgit Johan Herland
2008-06-15 17:52       ` Jeff King
2008-06-15 21:27  5%     ` [PATCH 2/4 v2] " Johan Herland
2023-09-08 17:41     [PATCH v3 0/6] Introduce Git Standard Library Calvin Wan
2023-09-08 17:44  5% ` [PATCH v3 5/6] git-std-lib: introduce git standard library Calvin Wan
2011-06-20  0:50     [PATCH/RFC] Move contents of libgit.a to lib subdirectory Peter Foley
2011-06-20  1:06     ` Shawn Pearce
2011-06-20  1:21  8%   ` Peter Foley
2023-08-10 16:33     [RFC PATCH v2 0/7] Introduce Git Standard Library Calvin Wan
2023-08-10 16:36  5% ` [RFC PATCH v2 6/7] git-std-lib: introduce git standard library Calvin Wan
2009-10-11 12:26     Installing full fledged git on solaris? Dilip M
2009-10-11 12:57  5% ` Dilip M
2009-08-19 15:52     [PATCH 01/12] Avoid declaration after instruction Frank Li
2009-08-19 15:52     ` [PATCH 02/12] Define SNPRINTF_SIZE_CORR=1 for Microsoft Visual C++ Frank Li
2009-08-19 15:52       ` [PATCH 03/12] Using macro WIN32 replace __MINGW32_ at Windows special handler The code which is conditional on MinGW32 is actually conditional on Windows. Use WIN32 macro will share both MINGW32 and MSVC environment Frank Li
2009-08-19 15:52         ` [PATCH 04/12] mingw.c: Use the O_BINARY flag to open files Frank Li
2009-08-19 15:52           ` [PATCH 05/12] Place __stdcall between return value and function name Frank Li
2009-08-19 15:52             ` [PATCH 06/12] Add _MSC_VER in porting head file git-compat-util.h Frank Li
2009-08-19 15:52               ` [PATCH 07/12] Add Unix header files to build git at MSVC Frank Li
2009-08-19 15:52                 ` [PATCH 08/12] Add MSVC porting files Frank Li
2009-08-19 15:52                   ` [PATCH 09/12] Don't include windows.h at winansi.c at MSVC build Frank Li
2009-08-19 15:52                     ` [PATCH 10/12] Fix errcode have defined as int at MSVC Frank Li
2009-08-19 15:52 11%                   ` [PATCH 11/12] Add MSVC Project file Frank Li
2014-05-13 21:29     [PATCH] contrib: remote-helpers: add move warnings (v2.0) Felipe Contreras
2014-05-13 22:02  5% ` Junio C Hamano
2011-07-03 17:57     [PATCH 0/8] vcs-svn, svn-fe: add a couple of options Dmitry Ivankov
2011-07-03 17:57 15% ` [PATCH 3/8] svn-fe: add EXTLIBS needed for parse-options Dmitry Ivankov
2008-06-19 21:41     [StGIT PATCH 0/4] Proposed patches Catalin Marinas
2008-06-19 21:42  5% ` [StGIT PATCH 2/4] Implement a new patch identification scheme and id command Catalin Marinas
2005-04-26  3:24     [ANNOUNCE] Cogito-0.8 (former git-pasky, big changes!) Petr Baudis
2005-04-26  4:58  5% ` Jeff Garzik
2008-07-13 11:40     [PATCH 0/4] Proposed patches Catalin Marinas
2008-07-13 11:40  5% ` [PATCH 2/4] Implement a new patch identification scheme and id command Catalin Marinas
2011-07-13 12:21     [PATCH v2 00/11] vcs-svn,svn-fe add a couple of options Dmitry Ivankov
2011-07-13 12:21 15% ` [PATCH v2 03/11] svn-fe: add EXTLIBS needed for parse-options Dmitry Ivankov
2019-08-03 23:52     [PATCH 0/6] Port git to Plan 9 KADOTA, Kyohei via GitGitGadget
2019-08-03 23:52  7% ` [PATCH 6/6] Add mkfile to build git and subcommands for " lufia via GitGitGadget
2020-11-28  6:44     [PATCH 0/6] Minimal patches to let reftable pass the CI builds Johannes Schindelin via GitGitGadget
2020-11-28  6:44 10% ` [PATCH 2/6] fixup! reftable: utility functions Johannes Schindelin via GitGitGadget
2007-11-27 15:02     [PATCH RFC] Move all dashed form git commands to libexecdir Nguyễn Thái Ngọc Duy
2007-11-27 16:04     ` [PATCH] " Nguyễn Thái Ngoc Duy
2007-11-27 16:18       ` Johannes Schindelin
2007-11-28  0:07         ` Jan Hudec
2007-11-28  1:13           ` Junio C Hamano
2007-11-28  8:36             ` Nguyen Thai Ngoc Duy
2007-11-28 23:14               ` Junio C Hamano
2007-11-29  3:17                 ` Nguyen Thai Ngoc Duy
2007-11-29 14:09                   ` Nicolas Pitre
2007-11-29 22:36                     ` Junio C Hamano
2007-11-30 11:28                       ` Eyvind Bernhardsen
2007-11-30 12:08                         ` [PATCH] transport.c: call dash-less form of receive-pack and upload-pack on remote Johannes Schindelin
2007-12-01  2:36                           ` Junio C Hamano
2007-12-01 10:17                             ` Johannes Schindelin
2007-12-01 19:30                               ` Junio C Hamano
2007-12-01 23:03                                 ` Johannes Schindelin
2007-12-01 23:15                                   ` Johannes Schindelin
2007-12-02  2:52                                     ` [PATCH 0/3] Call builtin functions directly, was " Johannes Schindelin
2007-12-02  2:54  7%                                   ` [PATCH 2/3] Include the objects needed for the builtin functions into libgit.a Johannes Schindelin
2022-01-19  9:45     [PATCH v2] cache.h: auto-detect if zlib has uncompress2() Ævar Arnfjörð Bjarmason
2022-01-20  1:16     ` [PATCH v3] " Ævar Arnfjörð Bjarmason
2022-01-21 23:23       ` Junio C Hamano
2022-01-23  0:19         ` Beat Bolli
2022-01-23 19:18           ` Junio C Hamano
2022-01-24  2:54             ` [PATCH v4] compat: " Junio C Hamano
2022-01-24 18:27  7%           ` [PATCH v5] " Junio C Hamano
2019-07-18 13:19     [PATCH 00/24] Reinstate support for Visual Studio Johannes Schindelin via GitGitGadget
2019-07-18 13:19  8% ` [PATCH 17/24] contrib/buildsystems: add a backend for modern Visual Studio versions Johannes Schindelin via GitGitGadget
2019-07-29 20:08     ` [PATCH v2 00/23] Reinstate support for Visual Studio Johannes Schindelin via GitGitGadget
2019-07-29 20:08  8%   ` [PATCH v2 17/23] contrib/buildsystems: add a backend for modern Visual Studio versions Johannes Schindelin via GitGitGadget
2012-02-10 13:00     [PATCH 3/4] diff --stat: use the real terminal width Nguyen Thai Ngoc Duy
2012-02-10 16:39     ` [PATCH 0/3 v2] " Zbigniew Jędrzejewski-Szmek
2012-02-10 16:39  5%   ` [PATCH 1/3] Move git_version_string to help.c before diff changes Zbigniew Jędrzejewski-Szmek
2010-11-18  5:00     [PATCH 0/2] svn-fe: recognize v3 dumps Jonathan Nieder
2010-11-20  0:45     ` [RFC/PATCH 0/15] svn-fe: support for property deltas (but not text deltas yet) Jonathan Nieder
2010-11-20 19:21       ` [WIP/PATCH 0/8] svn-fe: support for text deltas Jonathan Nieder
2010-11-20 19:22 15%     ` [PATCH 1/8] svn-fe: Prepare for strbuf use Jonathan Nieder
2023-05-17 23:56     [PATCH RFC v2 0/4] Add an external testing library for unit tests steadmon
2023-05-17 23:56     ` [PATCH RFC v2 1/4] common-main: split common_exit() into a new file steadmon
2023-05-18 17:17       ` Junio C Hamano
2023-07-14 23:38         ` Splitting common-main (Was: Re: [PATCH RFC v2 1/4] common-main: split common_exit() into a new file) Josh Steadmon
2023-07-15  0:34  5%       ` Splitting common-main Junio C Hamano
2009-08-21 13:30     [RFC/PATCH 00/14] Build git with MSVC Marius Storm-Olsen
2009-08-21 13:30     ` [PATCH 01/14] Fix non-constant array creation Marius Storm-Olsen
2009-08-21 13:30       ` [PATCH 02/14] Avoid declaration after statement Marius Storm-Olsen
2009-08-21 13:30         ` [PATCH 03/14] Define SNPRINTF_SIZE_CORR=1 for Microsoft Visual C++ Marius Storm-Olsen
2009-08-21 13:30           ` [PATCH 04/14] Add define guards to compat/win32.h Marius Storm-Olsen
2009-08-21 13:30             ` [PATCH 05/14] Change regerror() declaration from K&R style to ANSI C (C89) Marius Storm-Olsen
2009-08-21 13:30               ` [PATCH 06/14] mingw.c: Use the O_BINARY flag to open files Marius Storm-Olsen
2009-08-21 13:30                 ` [PATCH 07/14] Fix __stdcall/WINAPI placement and function prototype Marius Storm-Olsen
2009-08-21 13:30                   ` [PATCH 08/14] Test for WIN32 instead of __MINGW32_ Marius Storm-Olsen
2009-08-21 13:30                     ` [PATCH 09/14] Avoid including windows.h in winansi.c for MSVC build Marius Storm-Olsen
2009-08-21 13:30                       ` [PATCH 10/14] Add empty header files for MSVC port Marius Storm-Olsen
2009-08-21 13:30                         ` [PATCH 11/14] Add MinGW header files to build git with MSVC Marius Storm-Olsen
2009-08-21 13:30                           ` [PATCH 12/14] Add platform files for MSVC porting Marius Storm-Olsen
2009-08-21 13:30 11%                         ` [PATCH 13/14] Add MSVC project files Marius Storm-Olsen
2023-06-27 19:52     [RFC PATCH 0/8] Introduce Git Standard Library Calvin Wan
2023-06-27 19:52  6% ` [RFC PATCH 7/8] git-std-lib: introduce git standard library Calvin Wan
2010-06-24 10:50     [PATCH/RFC v2 0/9] Subversion dump parsing library Jonathan Nieder
2010-06-24 11:07  5% ` [PATCH 9/9] Add a sample user for the svndump library Jonathan Nieder
2011-08-16  9:54     [PATCH v3 00/10] vcs-svn,svn-fe add a couple of options Dmitry Ivankov
2011-08-16  9:54 14% ` [PATCH v3 02/10] svn-fe: add EXTLIBS needed for parse-options Dmitry Ivankov
2009-11-27  8:04     [PATCH] Makefile: determine the list of header files using a glob Johannes Sixt
2009-11-27  9:36  5% ` Johannes Schindelin
2013-06-06 14:54     [Administrivia] On ruby and contrib/ Greg Troxel
2013-06-06 16:22     ` Johannes Schindelin
2013-06-08  2:17       ` Duy Nguyen
2013-06-08 10:02         ` Felipe Contreras
2013-06-08 11:28           ` Duy Nguyen
2013-06-08 11:56             ` Felipe Contreras
2013-06-08 12:07               ` Duy Nguyen
2013-06-08 13:20                 ` Felipe Contreras
2013-06-08 17:15                   ` Jeff King
2013-06-08 17:40                     ` Felipe Contreras
2013-06-09  0:10                       ` Jeff King
2013-06-09  1:17  5%                     ` Felipe Contreras
2013-06-09  2:23                           ` Jeff King
2013-06-09  2:41  5%                         ` Felipe Contreras
2013-06-08 17:29     [PATCH] build: get rid of the notion of a git library Felipe Contreras
2013-06-08 18:02     ` Ramkumar Ramachandra
2013-06-08 18:22  5%   ` Felipe Contreras
2013-06-09 14:56         ` Ramkumar Ramachandra
2013-06-09 15:12           ` John Keeping
2013-06-09 15:40             ` Felipe Contreras
2013-06-09 17:30               ` Vincent van Ravesteijn
2013-06-10 21:45  5%             ` Jeff King
2013-06-10 21:52                   ` Felipe Contreras
2013-06-10 22:06  5%                 ` Jeff King
2013-06-10 22:22  5%                   ` Felipe Contreras
2013-06-09 16:02               ` John Keeping
2013-06-09 16:22                 ` Felipe Contreras
2013-06-09 16:42                   ` John Keeping
2013-06-09 17:03                     ` Ramkumar Ramachandra
2013-06-09 17:13                       ` Felipe Contreras
2013-06-09 17:32  5%                     ` John Keeping
2012-08-14 19:13     [PATCH/RFC v3 00/16] GSOC remote-svn Florian Achleitner
2012-08-14 19:13     ` [PATCH/RFC v3 01/16] Implement a remote helper for svn in C Florian Achleitner
2012-08-14 19:13  6%   ` [PATCH/RFC v3 02/16] Integrate remote-svn into svn-fe/Makefile Florian Achleitner
2010-07-15 16:25     [PATCH] Get rr/svn-fe-contrib merged Ramkumar Ramachandra
2010-07-15 16:25  5% ` [PATCH] Add a sample user for the svndump library Ramkumar Ramachandra
2007-03-16  4:24     Libification project (SoC) Luiz Fernando N. Capitulino
2007-03-16  4:59     ` Shawn O. Pearce
2007-03-16  5:30       ` Junio C Hamano
2007-03-16  6:00         ` Shawn O. Pearce
2007-03-16  6:54           ` Junio C Hamano
2007-03-16 11:54             ` Johannes Schindelin
2007-03-16 13:09               ` Rocco Rutte
2007-03-16 15:12                 ` Johannes Schindelin
2007-03-18 14:08  5%               ` Petr Baudis
2007-03-18 23:48                     ` Johannes Schindelin
2007-03-19  1:21                       ` Petr Baudis
2007-03-19  1:43  5%                     ` Johannes Schindelin
2007-03-16 18:20  5%               ` Marco Costalba
2007-03-16 18:38                     ` Marco Costalba
2007-03-16 19:09  5%                   ` Andy Parkins
2007-03-16 18:59                       ` Nicolas Pitre
2007-03-16 21:07  5%                     ` Marco Costalba
2007-03-16 23:24  5%                       ` Johannes Schindelin
2007-03-17  7:04  5%                         ` Marco Costalba
2018-10-15  2:18     [PATCH v2 00/13] Base SHA-256 implementation brian m. carlson
2018-10-15  2:18     ` [PATCH v2 02/13] sha1-file: provide functions to look up hash algorithms brian m. carlson
2018-10-17 13:32  5%   ` SZEDER Gábor
2018-08-17 19:03     [RFC/PATCH] drop vcs-svn experiment Jeff King
2018-08-18  5:26     ` Jonathan Nieder
2018-08-18 15:03  5%   ` Jeff King
2013-06-09 16:40     [PATCH v4 00/45] Massive improvents to rebase and cherry-pick Felipe Contreras
2013-06-09 16:40     ` [PATCH v4 06/45] Move sequencer to builtin Felipe Contreras
2013-06-09 17:02       ` Antoine Pelisse
2013-06-09 17:06  5%     ` Felipe Contreras
2020-06-12 18:29     [PATCH v4 1/8] Introduce CMake support for configuring Git Sibi Siddharthan via GitGitGadget
2020-06-15 14:00  8% ` Øystein Walle
2021-10-19  6:48     What's cooking in git.git (Oct 2021, #05; Mon, 18) Junio C Hamano
2021-10-19 12:45  5% ` js/scalar, was " Johannes Schindelin
2012-07-26  7:32     [RFC 00/16] GSOC remote-svn, rewritten patch series Florian Achleitner
2012-07-26  7:32     ` [RFC 01/16] Implement a remote helper for svn in C Florian Achleitner
2012-07-26  7:32  6%   ` [RFC 02/16] Integrate remote-svn into svn-fe/Makefile Florian Achleitner
2012-07-30 14:31     ` [RFC v2 00/16] GSOC remote-svn, rewritten patch series Florian Achleitner
2012-07-30 14:31       ` [RFC v2 01/16] Implement a remote helper for svn in C Florian Achleitner
2012-07-30 14:31  6%     ` [RFC v2 02/16] Integrate remote-svn into svn-fe/Makefile Florian Achleitner
2019-10-10 18:36     [PATCH 0/3] sequencer: start running post-commit hook again Phillip Wood via GitGitGadget
2019-10-15 10:25     ` [PATCH v2 0/6] " Phillip Wood via GitGitGadget
2019-10-15 10:25  8%   ` [PATCH v2 5/6] move run_commit_hook() to libgit and use it there Phillip Wood via GitGitGadget
2006-07-03 20:44     [PATCH 0/6] The residual Git.pm patches Petr Baudis
2006-07-03 20:48 11% ` [PATCH 4/6] Make it possible to set up libgit directly (instead of from the environment) Petr Baudis

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).