* [PATCH 12/12] Add gitignore and ReadMe file for MSVC Build
From: Frank Li @ 2009-08-19 15:57 UTC (permalink / raw)
To: git, msysgit; +Cc: Frank Li
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..f4e5efa
--- /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 --init
+
+3. Open gitbuild\gitbuild.sln with VS2008. Then press F7.
\ No newline at end of file
--
1.6.4.msysgit.0
^ permalink raw reply related
* [PATCH 11/12] Add MSVC Project file
From: Frank Li @ 2009-08-19 15:52 UTC (permalink / raw)
To: git, msysgit; +Cc: Frank Li
In-Reply-To: <1250697167-5536-10-git-send-email-lznuaa@gmail.com>
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
* [PATCH 10/12] Fix errcode have defined as int at MSVC
From: Frank Li @ 2009-08-19 15:52 UTC (permalink / raw)
To: git, msysgit; +Cc: Frank Li
In-Reply-To: <1250697167-5536-9-git-send-email-lznuaa@gmail.com>
MSVC type define errcode as int.
regex.c use old style C function declare.
Change it C99 style
Signed-off-by: Frank Li <lznuaa@gmail.com>
---
compat/regex/regex.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/compat/regex/regex.c b/compat/regex/regex.c
index 5ea0075..f94bed5 100644
--- a/compat/regex/regex.c
+++ b/compat/regex/regex.c
@@ -4852,11 +4852,8 @@ 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
^ permalink raw reply related
* [PATCH 09/12] Don't include windows.h at winansi.c at MSVC build
From: Frank Li @ 2009-08-19 15:52 UTC (permalink / raw)
To: git, msysgit; +Cc: Frank Li
In-Reply-To: <1250697167-5536-8-git-send-email-lznuaa@gmail.com>
msvc.h include winsock2.h, which conflict windows.h.
msvc.h define minimized required windows version
Signed-off-by: Frank Li <lznuaa@gmail.com>
---
compat/winansi.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/compat/winansi.c b/compat/winansi.c
index 9217c24..15053d0 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -1,8 +1,9 @@
/*
* Copyright 2008 Peter Harris <git@peter.is-a-geek.org>
*/
-
+#ifndef _MSC_VER
#include <windows.h>
+#endif
#include "../git-compat-util.h"
/*
--
1.6.4.msysgit.0
^ permalink raw reply related
* [PATCH 08/12] Add MSVC porting files.
From: Frank Li @ 2009-08-19 15:52 UTC (permalink / raw)
To: git, msysgit; +Cc: Frank Li
In-Reply-To: <1250697167-5536-7-git-send-email-lznuaa@gmail.com>
Add msvc.c and msvc.h to build git under MSVC
Signed-off-by: Frank Li <lznuaa@gmail.com>
---
compat/msvc.c | 33 ++++++++++++++++++++++
compat/msvc.h | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 119 insertions(+), 0 deletions(-)
create mode 100644 compat/msvc.c
create mode 100644 compat/msvc.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..76cc6e5
--- /dev/null
+++ b/compat/msvc.h
@@ -0,0 +1,86 @@
+#ifndef __MSVC__HEAD
+#define __MSVC__HEAD
+
+/*Define minimize windows version*/
+#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 NO_ST_BLOCKS_IN_STRUCT_STAT
+#define NO_NSEC
+#define NO_REGEX
+#define NO_SYS_SELECT_H
+#define NO_PTHEADS
+#define NO_ICONV
+#define NO_PTHREADS
+#define NO_CURL
+#define NO_STRTOUMAX
+#define NO_STRLCPY
+#define NO_UNSETENV
+#define NO_SETENV
+
+#define USE_WIN32_MMAP
+#define USE_NED_ALLOCATOR
+#define HAVE_STRING_H 1
+#define STDC_HEADERS
+#define SNPRINTF_RETURNS_BOGUS
+#define RUNTIME_PREFIX
+#define REGEX_MALLOC
+
+/*Git runtime infomation*/
+#define ETC_GITCONFIG "%HOME%"
+#define SHA1_HEADER "mozilla-sha1\\sha1.h"
+#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"
+
+/*porting function*/
+#define strdup _strdup
+#define read _read
+#define close _close
+#define dup _dup
+#define dup2 _dup2
+#define strncasecmp _strnicmp
+#define strtoull _strtoui64
+#define inline __inline
+#define __inline__ __inline
+#define __attribute__(x)
+#define va_copy(dst, src) ((dst) = (src))
+
+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(x,y)
+#define stat _stat64
+#endif
\ No newline at end of file
--
1.6.4.msysgit.0
^ permalink raw reply related
* [PATCH 07/12] Add Unix header files to build git at MSVC.
From: Frank Li @ 2009-08-19 15:52 UTC (permalink / raw)
To: git, msysgit; +Cc: Frank Li
In-Reply-To: <1250697167-5536-6-git-send-email-lznuaa@gmail.com>
Add head files direct.h, unistd.h and time.h to build git
Under MSVC.
These file coming from mingw header file.
Signed-off-by: Frank Li <lznuaa@gmail.com>
---
compat/vcbuild/include/dirent.h | 127 +++++++++++++++++++++++++++++++++++++++
compat/vcbuild/include/unistd.h | 92 ++++++++++++++++++++++++++++
compat/vcbuild/sys/time.h | 21 +++++++
3 files changed, 240 insertions(+), 0 deletions(-)
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/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
--
1.6.4.msysgit.0
^ permalink raw reply related
* [PATCH 06/12] Add _MSC_VER in porting head file git-compat-util.h
From: Frank Li @ 2009-08-19 15:52 UTC (permalink / raw)
To: git, msysgit; +Cc: Frank Li
In-Reply-To: <1250697167-5536-5-git-send-email-lznuaa@gmail.com>
Add Microsoft C++ compiler predefine _MSC_VER at
git-compat-util.h to include msvc.h at MSVC environment
Signed-off-by: Frank Li <lznuaa@gmail.com>
---
git-compat-util.h | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
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
^ permalink raw reply related
* [PATCH 05/12] Place __stdcall between return value and function name
From: Frank Li @ 2009-08-19 15:52 UTC (permalink / raw)
To: git, msysgit; +Cc: Frank Li
In-Reply-To: <1250697167-5536-4-git-send-email-lznuaa@gmail.com>
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 | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index d5fa0ed..c938f0a 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 d0833f8..62bea19 100644
--- a/run-command.c
+++ b/run-command.c
@@ -295,7 +295,7 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const
}
#ifdef WIN32
-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);
--
1.6.4.msysgit.0
^ permalink raw reply related
* [PATCH 04/12] mingw.c: Use the O_BINARY flag to open files
From: Frank Li @ 2009-08-19 15:52 UTC (permalink / raw)
To: git, msysgit; +Cc: Frank Li
In-Reply-To: <1250697167-5536-3-git-send-email-lznuaa@gmail.com>
On Windows, non-text files must be opened using the O_BINARY flag.
MinGW does this for us automatically, but Microsoft Visual C++
does not.
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
^ permalink raw reply related
* [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.
From: Frank Li @ 2009-08-19 15:52 UTC (permalink / raw)
To: git, msysgit; +Cc: Frank Li
In-Reply-To: <1250697167-5536-2-git-send-email-lznuaa@gmail.com>
Signed-off-by: Frank Li <lznuaa@gmail.com>
---
help.c | 2 +-
| 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..9dae4e7 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__
+#ifdef WIN32
{ /* cannot trust the executable bit, peek into the file instead */
char buf[3] = { 0 };
int n;
--git a/pager.c b/pager.c
index 4921843..37d1948 100644
--- a/pager.c
+++ b/pager.c
@@ -9,7 +9,7 @@
static int spawned_pager;
-#ifndef __MINGW32__
+#ifndef WIN32
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__
+#ifndef WIN32
pager_process.preexec_cb = pager_preexec;
#endif
if (start_command(&pager_process))
diff --git a/run-command.c b/run-command.c
index d1df7ab..d0833f8 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__
+#ifndef WIN32
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__
+#ifdef WIN32
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__
+#ifndef WIN32
/* 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__
+#ifndef WIN32
int ret = 0;
if (wait_or_whine(async->pid))
diff --git a/run-command.h b/run-command.h
index e345502..09a4cb2 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__
+#ifndef WIN32
pid_t pid;
#else
HANDLE tid;
diff --git a/setup.c b/setup.c
index e3781b6..029371e 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__
+#ifndef WIN32
if (!pfx || !*pfx || is_absolute_path(arg))
return arg;
memcpy(path, pfx, pfx_len);
--
1.6.4.msysgit.0
^ permalink raw reply related
* [PATCH 02/12] Define SNPRINTF_SIZE_CORR=1 for Microsoft Visual C++
From: Frank Li @ 2009-08-19 15:52 UTC (permalink / raw)
To: git, msysgit; +Cc: Frank Li
In-Reply-To: <1250697167-5536-1-git-send-email-lznuaa@gmail.com>
The Microsoft C runtime's vsnprintf function does not add NUL at
the end of the buffer.
Further, Microsoft deprecated vsnprintf in favor of _vsnprintf, so
add a #define to that end.
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
^ permalink raw reply related
* [PATCH 01/12] Avoid declaration after instruction
From: Frank Li @ 2009-08-19 15:52 UTC (permalink / raw)
To: git, msysgit; +Cc: Frank Li
Microsoft Visual C++ does not understand this C99 style
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
^ permalink raw reply related
* Re: [msysGit] Re: [PATCH 02/11] Fix declare variable at mid of function
From: Johannes Sixt @ 2009-08-19 15:21 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Frank Li, Marius Storm-Olsen, Reece Dunn, git, msysgit
In-Reply-To: <alpine.DEB.1.00.0908191514020.5594@intel-tinevez-2-302>
Johannes Schindelin schrieb:
> On Wed, 19 Aug 2009, Johannes Sixt wrote:
>> Johannes Schindelin schrieb:
>>> On Wed, 19 Aug 2009, Frank Li wrote:
>>>> I have push my change to tgit
>>>> git://repo.or.cz/tgit.git
>>>> branch vcpatch2
>>>>
>>>> How do I know if patch has been applied main line?
>>> I applied them to 4msysgit.git's devel. Note that I had a strange
>>> merge conflict in pager.c: you replaced and #ifndef __MINGW32__ with
>>> an #ifndef WIN32, but I don't have that #ifndef at all.
>> 4msysgit has my "Windows: Better support PAGER settings with spaces in
>> the path", which removes the #ifndefs, Frank's version doesn't have it.
>> Therefore, you should not rebase Frank's patches on top of 4msysgit's
>> master or devel before they are merged into git.git.
>
> Well, I wanted to give them a little bit more visibility by putting them
> into 4msysgit.git, as I think the best way to get Microsoft Visual C++
> support into git.git _is_ via 4msysgit.git.
Even more so should you keep the original patches (in this case at least),
not rebased ones. It is unlikely that "Windows: Better support PAGER..."
will be in git.git _before_ Frank's MINGW32->WIN32 conversion patch.
-- Hannes
^ permalink raw reply
* Re: Continue git clone after interruption
From: Jakub Narebski @ 2009-08-19 15:19 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Tomasz Kontusz, git
In-Reply-To: <alpine.LFD.2.00.0908181711350.6044@xanadu.home>
On Tue, 18 Aug 2009, Nicolas Pitre wrote:
> On Tue, 18 Aug 2009, Jakub Narebski wrote:
>
>> You can probably get number and size taken by delta and non-delta (base)
>> objects in the packfile somehow. Neither "git verify-pack -v <packfile>"
>> nor contrib/stats/packinfo.pl did help me arrive at this data.
>
> Documentation for verify-pack says:
>
> |When specifying the -v option the format used is:
> |
> | SHA1 type size size-in-pack-file offset-in-packfile
> |
> |for objects that are not deltified in the pack, and
> |
> | SHA1 type size size-in-packfile offset-in-packfile depth base-SHA1
> |
> |for objects that are deltified.
>
> So a simple script should be able to give you the answer.
Thanks.
There are 114937 objects in this packfile, including 56249 objects
used as base (can be deltified or not). git-verify-pack -v shows
that all objects have total size-in-packfile of 33 MB (which agrees
with packfile size of 33 MB), with 17 MB size-in-packfile taken by
deltaified objects, and 16 MB taken by base objects.
git verify-pack -v |
grep -v "^chain" |
grep -v "objects/pack/pack-" > verify-pack.out
sum=0; bsum=0; dsum=0;
while read sha1 type size packsize off depth base; do
echo "$sha1" >> verify-pack.sha1.out
sum=$(( $sum + $packsize ))
if [ -n "$base" ]; then
echo "$sha1" >> verify-pack.delta.out
dsum=$(( $dsum + $packsize ))
else
echo "$sha1" >> verify-pack.base.out
bsum=$(( $bsum + $packsize ))
fi
done < verify-pack.out
echo "sum=$sum; bsum=$bsum; dsum=$dsum"
>>>> (BTW what happens if this pack is larger than file size limit for
>>>> given filesystem?).
[...]
>> If I remember correctly FAT28^W FAT32 has maximum file size of 2 GB.
>> FAT is often used on SSD, on USB drive. Although if you have 2 GB
>> packfile, you are doing something wrong, or UGFWIINI (Using Git For
>> What It Is Not Intended).
>
> Hopefully you're not performing a 'git clone' off of a FAT filesystem.
> For physical transport you may repack with the appropriate switches.
Not off a FAT filesystem, but into a FAT filesystem.
[...]
>>> I think it is better to "prime" the repository with the content of the
>>> top commit in the most straight forward manner using git-archive which
>>> has the potential to be fully restartable at any point with little
>>> complexity on the server side.
>>
>> But didn't it make fully restartable 2.5 MB part out of 37 MB packfile?
>
> The front of the pack is the critical point. If you get enough to
> create the top commit then further transfers can be done incrementally
> with only the deltas between each commits.
How? You have some objects that can be used as base; how to tell
git-daemon that we have them (but not theirs prerequisites), and how
to generate incrementals?
>> A question about pack protocol negotiation. If clients presents some
>> objects as "have", server can and does assume that client has all
>> prerequisites for such objects, e.g. for tree objects that it has
>> all objects for files and directories inside tree; for commit it means
>> all ancestors and all objects in snapshot (have top tree, and its
>> prerequisites). Do I understand this correctly?
>
> That works only for commits.
Hmmmm... how do you intent for "prefetch top objects restartable-y first"
to work, then?
>> BTW. because of compression it might be more difficult to resume
>> archive creation in the middle, I think...
>
> Why so? the tar+gzip format is streamable.
gzip format uses sliding window in compression. "cat a b | gzip"
is different from "cat <(gzip a) <(gzip b)".
But that doesn't matter. If we are interrupted in the middle, we can
uncompress what we have to check how far did we get, and tell server
to send the rest; this way server wouldn't have to even generate
(but not send) what we get as partial transfer.
P.S. What do you think about 'bundle' capability extension mentioned
in a side sub-thread?
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: [RFC] Enable compilation by Makefile for the MSVC toolchain
From: Erik Faye-Lund @ 2009-08-19 14:51 UTC (permalink / raw)
To: Marius Storm-Olsen
Cc: Johannes Schindelin, Marius Storm-Olsen, Johan 't Hart,
Junio C Hamano, msysgit, git, lznuaa, bonzini
In-Reply-To: <4A8BFD75.8000706@storm-olsen.com>
On Wed, Aug 19, 2009 at 3:26 PM, Marius
Storm-Olsen<marius@storm-olsen.com> wrote:
> They would still require the rest of the msysgit environment to be able to
> use the result. Not until we have zero scripts left as git commands can we
> ditch the msysgit environment. So yes, even for msvc-built git is msysgit
> required. Its just not build with MinGW.
...perhaps support for msvc for a subset of git-core (without all
shell scripts, that is) is just the incentive some windows-developers
need to start developing c-versions of the lacking functionality? A
pure C git-core would IMO be the ideal case. Utilities could still be
scripted on top of this through bindings given that the developer have
perl installed, no?
--
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656
^ permalink raw reply
* Re: Simple commit mechanism for non-technical users
From: D Sundstrom @ 2009-08-19 14:40 UTC (permalink / raw)
To: git
In-Reply-To: <20090819102036.GC28920@sigill.intra.peff.net>
Thanks to all that responded.
It might help to frame things from Aunt Tillie's point of view.
Her workflow consists of editing office documents (word, powerblower, etc)
in collaboration with her peers. They email these back and forth and
come up with whatever ad-hoc "version control" they think of at the
moment, such as file names, dates, verbal communication, etc.
I'm technical product manager and I need to coordinate reviews of
these documents as well as my release process. I also face audits
and accreditation from my customers.
We previously chose and implemented GIT for our scm system based
on a number of considerations. Primarily we have distributed teams and
also there is a review and sign-off process before code is "blessed" into
our official repository. For this, GIT fits well.
I'm going to put all the project artifacts into this repository, including
the aforementioned office documents. They just get versioned as binary
blobs, which is fine for this application. I just need to know which one
is current and maintain prior versions.
Aunt Tillie may someday appreciate our scm enough to install a client
on her machine and learn how to use it. But that is a big jump from
the simple workflow she has today. My thought is that I might get her
to upload this document to a SMB/CIFS or webdav file share, or use
a simple webapp, but that is about it for now.
My thought is to just have a process that watches for these files and
commits them as they arrive. I wouldn't do any filename magic, I would
just train Aunt Tillie to use the same name every time. If two people
step on each other's work, they tend learn from the experience and
coordinate amongst themselves the next time. There are only a
few people touching any given document.
A wiki doesn't seem appropriate because we are dealing with office
documents rather than "wiki-like" content. This is more of a
document management system, albeit a very simple one.
The Aunt Tillies are all on windows (XP or later). The development
team is all over the map, windows, osx, linux.
-David
On Wed, Aug 19, 2009 at 5:20 AM, Jeff King<peff@peff.net> wrote:
> On Wed, Aug 19, 2009 at 09:49:50AM +0200, Johannes Schindelin wrote:
>
>> Then you have a bunch of people who do not want to care about learning
>> proper version control.
>>
>> This is what I would do: write a very simple .cgi (I'd use Perl for that),
>> which has a file upload button, takes the name as commit message (or maybe
>> adds a field where you can type in a commit message, but that might be
>> asking your bunch of Aunt Tillies too much), strips the "v3"-like suffixes
>> ($name =~ s/[-_ ]*v\d+(\.[A-Za-z0-9]{1,5})$/$1/;), set author and
>> committer information according to IP (and refuse if the IP is not in the
>> internal mapping) and commit.
>>
>> The whole script would probably not be larger than 50 lines, and require
>> Git to be installed on the server.
>>
>> The bigger problem is that your Aunt Tillies most likely would not love
>> gitweb, so you need a fancier interface.
>
> Actually, I think there is a technical problem here. You get Aunt
> Tillie's v3, but you don't necessarily know what it is based on. So if
> some other Aunt Tillie has submitted a v3 in the meantime, what do you
> do with her file? Commit on top? Try to guess where her v2 was, branch
> from there, and merge?
>
> If you commit on top, then you are potentially erasing the other
> person's work. If you do a merge, you are likely to get conflicts
> (especially because Aunt Tillie likes to use horrible binary formats)
> that _somebody_ will have to resolve.
>
> I guess you can throw each Tillie on their own branch and then let
> somebody clueful do the merging, but then you do not really have people
> working together.
>
> I think this is a fundamental issue. Most version control systems (and
> especially distributed ones) are about doing concurrent work and
> merging, and merging requires a bit of a clue. The Aunt Tillies of the
> world really need a locking system to manage concurrency.
>
> -Peff
>
^ permalink raw reply
* Re: [msysGit] Re: [RFC] Enable compilation by Makefile for the MSVC toolchain
From: Marius Storm-Olsen @ 2009-08-19 13:26 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Marius Storm-Olsen, Erik Faye-Lund, Johan 't Hart,
Junio C Hamano, msysgit, git, lznuaa, bonzini
In-Reply-To: <alpine.DEB.1.00.0908191455140.5594@intel-tinevez-2-302>
[-- Attachment #1: Type: text/plain, Size: 839 bytes --]
Johannes Schindelin said the following on 19.08.2009 14:56:
> On Wed, 19 Aug 2009, Marius Storm-Olsen wrote:
>> Ok, but you would still have to rely on GNU Make in this setup,
>> and it would have to generate the common_cmds.h before you can
>> even compile with the MSVC IDE.
>
> But then I could bundle it up and give it to a Visual Studio user
> and they do not need msysGit.
>
> But maybe we should require them to have msysGit? After all, if
> the package is too small, no Windows developer will take it
> seriously, right? ;-)
They would still require the rest of the msysgit environment to be
able to use the result. Not until we have zero scripts left as git
commands can we ditch the msysgit environment. So yes, even for
msvc-built git is msysgit required. Its just not build with MinGW.
--
.marius
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 187 bytes --]
^ permalink raw reply
* Re: New to Git / Questions about single user / multiple projects
From: Jakub Narebski @ 2009-08-19 13:20 UTC (permalink / raw)
To: Jeff King; +Cc: Rob (gmail), git
In-Reply-To: <20090819124820.GC20381@coredump.intra.peff.net>
On Wed, 19 August 2009, Jeff King <peff@peff.net> wrote:
> On Wed, Aug 19, 2009 at 02:18:07PM +0200, Jakub Narebski wrote:
>
> > More complicated solution, used by gitweb, requires Perl, not checked
> > that it works correctly, doesn't work with ancient repositories with
> > symlink HEAD.
> >
> > $ perl -e '
> > use File::Find qw(find);
> > my @list = ();
> > find({follow_fast => 1, follow_skip => 2, dangling_symlinks => 0,
> > wanted => sub {
> > return if (m!^[/.]$!);
> > return unless (-d $_);
> > push @list, $_ if -e "$_/HEAD"
> > }});
> > print join("\n", @list)."\n";
> > '
>
> That doesn't seem very accurate. It will find 'HEAD' in "logs/" of
> repositories with reflogs enabled, and "refs/remotes/*/" of cloned
> repositories, giving you a lot of false positives.
To be more exact it is simplified solution used by git; in this case
_oversimplified_, as gitweb doesn't have problems with 'HEAD' in
remote-tracking branches.
On the other hand gitweb currently does not detect submodules or
submodule-like repositories, i.e. repositories inside working directory
of other repository. So this could be improved...
>
> If you want accuracy, you can ask git rev-parse to verify whether a
> directory is a git repo; it actually uses a few different heuristics to
> check. For example:
>
> find . -type d |
> while read dir; do
> if GIT_DIR=$dir git rev-parse --git-dir >/dev/null 2>&1; then
Or "git --git-dir=$dir rev-parse 2> /dev/null"
> echo $dir
> fi
> done
>
> but it is a bit slower, as you invoke rev-parse for every directory, and
> it actually does some verification of the contents of HEAD (so it is
> probably a bad idea for something like gitweb, which cares about
> performance).
>
> If you want to do a cheap and fast check, searching for 'HEAD', 'refs',
> and 'objects' in the same directory is a reasonable heuristic.
If one follow preferred git conventions for naming non-bare repositories,
and one doesn't have anything funny,
$ find . -name "*.git" -type d
should be sufficient.
--
Jakub Narebski
Poland
^ permalink raw reply
* [PATCH JGIT] Ensure created test repositories use canonical paths
From: Jonas Fonseca @ 2009-08-19 13:18 UTC (permalink / raw)
To: Robin Rosenberg, Shawn O. Pearce; +Cc: git
Fixes breakage in the RepositoryCacheTest when running tests using:
mvn -f ./jgit-maven/jgit/pom.xml test
which in turn will lead to test repositories using paths, such as:
/path/to/jgit/./jgit-maven/jgit/trash/trash1250647279819.186/.git
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
.../org/spearce/jgit/lib/RepositoryTestCase.java | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java
index b1adde9..d1aef78 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java
@@ -217,7 +217,7 @@ public void setUp() throws Exception {
final String name = getClass().getName() + "." + getName();
recursiveDelete(trashParent, true, name, false); // Cleanup old failed stuff
trash = new File(trashParent,"trash"+System.currentTimeMillis()+"."+(testcount++));
- trash_git = new File(trash, ".git");
+ trash_git = new File(trash, ".git").getCanonicalFile();
if (shutdownhook == null) {
shutdownhook = new Thread() {
@Override
@@ -307,7 +307,7 @@ protected Repository createNewEmptyRepo() throws IOException {
protected Repository createNewEmptyRepo(boolean bare) throws IOException {
final File newTestRepo = new File(trashParent, "new"
+ System.currentTimeMillis() + "." + (testcount++)
- + (bare ? "" : "/") + ".git");
+ + (bare ? "" : "/") + ".git").getCanonicalFile();
assertFalse(newTestRepo.exists());
final Repository newRepo = new Repository(newTestRepo);
newRepo.create();
--
1.6.4.rc3.195.g2b05f
^ permalink raw reply related
* Re: [PATCH 02/11] Fix declare variable at mid of function
From: Johannes Schindelin @ 2009-08-19 13:15 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Frank Li, Marius Storm-Olsen, Reece Dunn, git, msysgit
In-Reply-To: <4A8BDA2A.9030105@viscovery.net>
Hi,
On Wed, 19 Aug 2009, Johannes Sixt wrote:
> Johannes Schindelin schrieb:
> > On Wed, 19 Aug 2009, Frank Li wrote:
> >> I have push my change to tgit
> >> git://repo.or.cz/tgit.git
> >> branch vcpatch2
> >>
> >> How do I know if patch has been applied main line?
> >
> > I applied them to 4msysgit.git's devel. Note that I had a strange
> > merge conflict in pager.c: you replaced and #ifndef __MINGW32__ with
> > an #ifndef WIN32, but I don't have that #ifndef at all.
>
> 4msysgit has my "Windows: Better support PAGER settings with spaces in
> the path", which removes the #ifndefs, Frank's version doesn't have it.
> Therefore, you should not rebase Frank's patches on top of 4msysgit's
> master or devel before they are merged into git.git.
Well, I wanted to give them a little bit more visibility by putting them
into 4msysgit.git, as I think the best way to get Microsoft Visual C++
support into git.git _is_ via 4msysgit.git.
Ciao,
Dscho
^ permalink raw reply
* Re: [RFC] Enable compilation by Makefile for the MSVC toolchain
From: Joshua Jensen @ 2009-08-19 13:04 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Erik Faye-Lund, Marius Storm-Olsen, Johan 't Hart,
Junio C Hamano, msysgit, git, lznuaa, bonzini
In-Reply-To: <alpine.DEB.1.00.0908190910270.5594@intel-tinevez-2-302>
----- Original Message -----
From: Johannes Schindelin
Date: 8/19/2009 1:16 AM
> Using a Makefile from within Visual Studio is just not the intended way to
> do things, so you will hit the limitations sooner or later.
>
I use Visual Studio makefile projects daily and have for years. In my
case, an additional script takes the Jam build scripts and creates the
.vcproj files with the proper file lists and project source folders.
These Makefile .vcproj files have full support for Intellisense,
debugging, and nearly everything else. The only thing a Makefile
project doesn't seem to expose is single file compilation.
Josh
^ permalink raw reply
* Re: [msysGit] Re: [RFC] Enable compilation by Makefile for the MSVC toolchain
From: Johannes Schindelin @ 2009-08-19 12:56 UTC (permalink / raw)
To: Marius Storm-Olsen
Cc: Marius Storm-Olsen, Erik Faye-Lund, Johan 't Hart,
Junio C Hamano, msysgit, git, lznuaa, bonzini
In-Reply-To: <4A8BDAF6.5060805@gmail.com>
Hi,
On Wed, 19 Aug 2009, Marius Storm-Olsen wrote:
> Johannes Schindelin said the following on 19.08.2009 10:29:
> > Hi,
> >
> > On Wed, 19 Aug 2009, Marius Storm-Olsen wrote:
> >
> > > The full IDE support is secondary, first because you *can* use the
> > > IDE already, and second because it'll be harder to whip something up
> > > which guarantees that the vcproj support stays in-sync at all times
> > > and won't lag behind.
> >
> > I think the point of Frank's patches is to make Visual Studio users
> > comfortable with Git. You cannot ask those to use a build process or
> > an IDE they are not used to.
> >
> > > Of course, if someone has a huge itch to restructure the current
> > > Makefile; factoring out the files into a file which can simply be
> > > included in the current Makefile, and easily parsed by a script, or
> > > included by CMake, then that can be done in parallel and possible
> > > added to git mainline before the MSVC support patches from Frank.
> >
> > I still think it would be possible to use a combination of a Makefile
> > rule and GNU make features to spit out a list of targets and their
> > dependet .h and .c files.
>
> Ok, but you would still have to rely on GNU Make in this setup, and it
> would have to generate the common_cmds.h before you can even compile
> with the MSVC IDE.
But then I could bundle it up and give it to a Visual Studio user and they
do not need msysGit.
But maybe we should require them to have msysGit? After all, if the
package is too small, no Windows developer will take it seriously, right?
;-)
Ciao,
Dscho
^ permalink raw reply
* [PATCH JGIT] Make Repository.stripWorkDir more robust
From: Jonas Fonseca @ 2009-08-19 12:50 UTC (permalink / raw)
To: Robin Rosenberg, Shawn O. Pearce; +Cc: awhawks, git
In-Reply-To: <200908122147.52530.robin.rosenberg.lists@dewire.com>
Repository.stripWorkDir was assuming too much about its File arguments,
namely that the given file was always a decendant of the workdir.
Futhermore, it did not "normalize" paths of relative files, but simpy
relied on the path returned by File.getPath().
The new behavior is to fall-back to using File.getAbsolutePath() if the
path returned by File.getPath() cannot be normalized. Test the new
behavior against mix of relative and absolute paths given as arguments.
Fixes problem with string out of bound exception when the path of the
given file is shorter than the workdir, usually meaning it is not a
decendant of the workdir.
Reported-by: Adam W. Hawks <awhawks@writeme.com>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
On Wed, Aug 12, 2009 at 15:47, Robin Rosenberg<robin.rosenberg.lists@dewire.com> wrote:
> Why not convert both paths? A trickier issue is that getAbsolutePath is very slow when
> the path is not absolute. I don't think we will always need to normalize in order to
> fix this. A few unit tests to show the cases solved would help.
Something like this? I am myself interested in fixing the string out of bound
exception, which makes this method unusable for me.
.../tst/org/spearce/jgit/lib/T0003_Basic.java | 25 ++++++++++++++++
.../src/org/spearce/jgit/lib/Repository.java | 31 ++++++++++++++-----
2 files changed, 48 insertions(+), 8 deletions(-)
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0003_Basic.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0003_Basic.java
index 3660b45..c2b1b91 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0003_Basic.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0003_Basic.java
@@ -545,6 +545,31 @@ public void test029_mapObject() throws IOException {
assertEquals(Commit.class, db.mapObject(ObjectId.fromString("540a36d136cf413e4b064c2b0e0a4db60f77feab"), null).getClass());
assertEquals(Tree.class, db.mapObject(ObjectId.fromString("aabf2ffaec9b497f0950352b3e582d73035c2035"), null).getClass());
assertEquals(Tag.class, db.mapObject(ObjectId.fromString("17768080a2318cd89bba4c8b87834401e2095703"), null).getClass());
+ }
+
+ public void test30_stripWorkDir() {
+ File relCwd = new File(".");
+ File absCwd = relCwd.getAbsoluteFile();
+ File absBase = new File(new File(absCwd, "repo"), "workdir");
+ File relBase = new File(new File(relCwd, "repo"), "workdir");
+ assertEquals(absBase.getAbsolutePath(), relBase.getAbsolutePath());
+
+ File relBaseFile = new File(new File(relBase, "other"), "module.c");
+ File absBaseFile = new File(new File(absBase, "other"), "module.c");
+ assertEquals("other/module.c", Repository.stripWorkDir(relBase, relBaseFile));
+ assertEquals("other/module.c", Repository.stripWorkDir(relBase, absBaseFile));
+ assertEquals("other/module.c", Repository.stripWorkDir(absBase, relBaseFile));
+ assertEquals("other/module.c", Repository.stripWorkDir(absBase, absBaseFile));
+
+ File relNonFile = new File(new File(relCwd, "not-repo"), ".gitignore");
+ File absNonFile = new File(new File(absCwd, "not-repo"), ".gitignore");
+ assertEquals("", Repository.stripWorkDir(relBase, relNonFile));
+ assertEquals("", Repository.stripWorkDir(absBase, absNonFile));
+
+ assertEquals("", Repository.stripWorkDir(db.getWorkDir(), db.getWorkDir()));
+
+ File file = new File(new File(db.getWorkDir(), "subdir"), "File.java");
+ assertEquals("subdir/File.java", Repository.stripWorkDir(db.getWorkDir(), file));
}
}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
index d6be9bf..46b7804 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -729,7 +729,7 @@ else if (item.equals("")) {
}
}
if (time != null)
- throw new RevisionSyntaxException("reflogs not yet supported by revision parser yet", revstr);
+ throw new RevisionSyntaxException("reflogs not yet supported by revision parser", revstr);
i = m - 1;
break;
default:
@@ -1029,15 +1029,30 @@ public static boolean isValidRefName(final String refName) {
}
/**
- * Strip work dir and return normalized repository path
+ * Strip work dir and return normalized repository path.
*
- * @param wd Work dir
- * @param f File whose path shall be stripped of its workdir
- * @return normalized repository relative path
+ * @param workDir Work dir
+ * @param file File whose path shall be stripped of its workdir
+ * @return normalized repository relative path or the empty
+ * string if the file is not relative to the work directory.
*/
- public static String stripWorkDir(File wd, File f) {
- String relName = f.getPath().substring(wd.getPath().length() + 1);
- relName = relName.replace(File.separatorChar, '/');
+ public static String stripWorkDir(File workDir, File file) {
+ final String filePath = file.getPath();
+ final String workDirPath = workDir.getPath();
+
+ if (filePath.length() <= workDirPath.length() ||
+ filePath.charAt(workDirPath.length()) != File.separatorChar ||
+ !filePath.startsWith(workDirPath)) {
+ File absWd = workDir.isAbsolute() ? workDir : workDir.getAbsoluteFile();
+ File absFile = file.isAbsolute() ? file : file.getAbsoluteFile();
+ if (absWd == workDir && absFile == file)
+ return "";
+ return stripWorkDir(absWd, absFile);
+ }
+
+ String relName = filePath.substring(workDirPath.length() + 1);
+ if (File.separatorChar != '/')
+ relName = relName.replace(File.separatorChar, '/');
return relName;
}
--
1.6.4.rc3.195.g2b05f
^ permalink raw reply related
* Re: New to Git / Questions about single user / multiple projects
From: Jeff King @ 2009-08-19 12:49 UTC (permalink / raw)
To: Rob (gmail); +Cc: Jakub Narebski, git
In-Reply-To: <a2db4dd50908190528o7f16b65are1acc89c900f7014@mail.gmail.com>
On Wed, Aug 19, 2009 at 08:28:04AM -0400, Rob (gmail) wrote:
> That seems like the best solution.
> How do I delete my initial repository that I created and obviously
> messed up ?
If you have nothing of value in the whole directory, just "rm -rf repo".
If you want to keep the working tree but delete all of the git bits,
just "rm -rf .git".
-Peff
^ permalink raw reply
* Re: New to Git / Questions about single user / multiple projects
From: Jeff King @ 2009-08-19 12:48 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Rob (gmail), git
In-Reply-To: <200908191418.08838.jnareb@gmail.com>
On Wed, Aug 19, 2009 at 02:18:07PM +0200, Jakub Narebski wrote:
> More complicated solution, used by gitweb, requires Perl, not checked
> that it works correctly, doesn't work with ancient repositories with
> symlink HEAD.
>
> $ perl -e '
> use File::Find qw(find);
> my @list = ();
> find({follow_fast => 1, follow_skip => 2, dangling_symlinks => 0,
> wanted => sub {
> return if (m!^[/.]$!);
> return unless (-d $_);
> push @list, $_ if -e "$_/HEAD"
> }});
> print join("\n", @list)."\n";
> '
That doesn't seem very accurate. It will find 'HEAD' in "logs/" of
repositories with reflogs enabled, and "refs/remotes/*/" of cloned
repositories, giving you a lot of false positives.
If you want accuracy, you can ask git rev-parse to verify whether a
directory is a git repo; it actually uses a few different heuristics to
check. For example:
find . -type d |
while read dir; do
if GIT_DIR=$dir git rev-parse --git-dir >/dev/null 2>&1; then
echo $dir
fi
done
but it is a bit slower, as you invoke rev-parse for every directory, and
it actually does some verification of the contents of HEAD (so it is
probably a bad idea for something like gitweb, which cares about
performance).
If you want to do a cheap and fast check, searching for 'HEAD', 'refs',
and 'objects' in the same directory is a reasonable heuristic.
-Peff
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox