* Using VC build git (new patch)
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 +-
| 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;
}
--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
* Re: [PATCH] git-instaweb: fix mod_perl detection for apache2
From: Mark A Rada @ 2009-08-15 16:09 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Junio C Hamano, Mark A Rada, git
In-Reply-To: <m3iqgwoxq7.fsf@localhost.localdomain>
Does this means it may be taken off the menu in the not too distant
future or
deprecated?
--
Mark A Rada (ferrous26)
marada@uwaterloo.ca
On 10-Aug-09, at 4:55 AM, Jakub Narebski wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Mark A Rada <marada@uwaterloo.ca> writes:
>>
>>> The script was looking for something that matched the '^our $gitbin'
>>> regex, which no longer exists in gitweb.cgi.
>>>
>>> Now it looks for 'MOD_PERL', which should be on the line that checks
>>> to see if the script is running in a mod_perl environment.
>>
>> Thanks. That sounds like an ancient bug that in turn perhaps
>> suggests
>> nobody uses instaweb. Will apply to 'maint'..
>
> Hmmm... taking a peek at current "Git User's Survey 2009" results
> http://www.survs.com/shareResults?survey=2PIMZGU0&rndm=678J66QRA2
>
> 11. What Git interfaces, implementations, frontends and tools do you
> use?
>
> git-instaweb 3% 77 / 2712
>
> 16. How often do you use the following forms of git commands or extra
> git tools?
>
> git instaweb
> never: 1983 - 79%
> rarely: 208 - 8%
> sometimes: 50 - 2%
> often: 9 - 0%
>
> Total respondents 2506
>
> --
> Jakub Narebski
> Poland
> ShadeHawk on #git
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] add -p: do not attempt to coalesce mode changes
From: Thomas Rast @ 2009-08-15 14:35 UTC (permalink / raw)
To: Jeff King; +Cc: gitster, Kirill Smelkov, git
In-Reply-To: <20090815141710.GA15978@sigill.intra.peff.net>
Jeff King wrote:
>
> > --- a/git-add--interactive.perl
> > +++ b/git-add--interactive.perl
> > @@ -841,6 +841,10 @@
> > my ($last_o_ctx, $last_was_dirty);
> >
> > for (grep { $_->{USE} } @in) {
> > + if ($_->{TYPE} ne 'hunk') {
> > + push @out, $_;
> > + next;
> > + }
> > my $text = $_->{TEXT};
> > my ($o_ofs) = parse_hunk_header($text->[0]);
> > if (defined $last_o_ctx &&
>
> Hmm. I am not too familiar with the coalesce_overlapping_hunks code, but
> it looks like we peek at $out[-1] based on $last_o_ctx, assuming that
> $last_o_ctx comes from the last hunk pushed (either because we just
> pushed it, or we merged into it). So a non-hunk in the middle of some
> coalescing hunks is going to violate that assumption.
>
> As it is now, I think we always put the 'mode' hunk at the very
> beginning, so that shouldn't happen (and IIRC, that order is preserved
> throughout). So maybe it is not worth worrying about. But an alternate
> patch is below.
Hmm. I briefly considered worrying about futureproofing, but then
decided it wasn't worth it since we also rely on
coalesce_overlapping_hunks only being run over the hunks of a single
file. But since you already went to the lengths of doing it, feel
free to take the explanation in my commit message and add my Acked-by
:-)
--
Thomas Rast
trast@{inf,student}.ethz.ch
^ permalink raw reply
* Integration of git release workflow with automake "make dist"
From: Roger Leigh @ 2009-08-15 14:21 UTC (permalink / raw)
To: git
[-- Attachment #1.1: Type: text/plain, Size: 1951 bytes --]
[I'm not subscribed to the list, so I'd appreciate a CC on reply, thanks!]
Hi folks,
After initially bringing up the idea behind this initial implementation
on the automake mailing list, I want to get some criticism and comments
from automake users who use git (or git experts in general in case my
use of the git plumbing is not correct!).
The initial discussion is here:
http://thread.gmane.org/gmane.comp.sysutils.automake.general/10936
And the current implementation is attached.
Automake has a "dist" target to generate a "release" in the form of a
compressed tarfile or zip file. This file contains files not normally
kept under version control in the developer's repo (generated autotools
scripts, other generated files such as changelogs etc.) as well as
possibly excluding other bits in the repo not needed by end users.
However, this isn't kept under version control, and it would be
helpful it it was.
The above thread contains most of the rationale behind doing this, so
I won't repeat it all here.
The attached make fragment implements a "dist-git" target. Instead
of releasing by creating a tarball, it injects the same tree onto a
specified git branch and (optionally) signs both the release and
distribution branches. Branch and tag names and messages are
configurable. Note this is just an initial proof of concept;
anything can be changed!
I'd like to make this as generally usable for as many people as
possible, so it would be great to hear how you are managing releases
with automake and git, and if this would be useful for you, and if
there's anything that could be added or changed to better accommodate
you.
Many thanks,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
[-- Attachment #1.2: automake-dist-git.mk --]
[-- Type: text/plain, Size: 2872 bytes --]
ENABLE_DIST_GIT=false
GIT_RELEASE_BRANCH=HEAD
GIT_RELEASE_TAG=true
GIT_RELEASE_TAG_SIGN=true
GIT_RELEASE_TAG_NAME=release/$(PACKAGE)-$(VERSION)
GIT_RELEASE_TAG_MESSAGE="Release of $(PACKAGE)-$(VERSION)"
GIT_DIST_BRANCH=distribution
GIT_DIST_COMMIT_MESSAGE="Distribution of $(PACKAGE) version $(VERSION)"
GIT_DIST_TAG=true
GIT_DIST_TAG_SIGN=true
GIT_DIST_TAG_NAME=distribution/$(PACKAGE)-$(VERSION)
GIT_DIST_TAG_MESSAGE="Distribution of $(PACKAGE)-$(VERSION)"
dist-git: distdir
if [ "$(ENABLE_DIST_GIT)" != "true" ]; then \
echo "$@: ENABLE_DIST_GIT not true; not distributing"; \
exit 0; \
fi; \
cd "$(abs_top_srcdir)"; \
if [ ! -d .git ]; then \
echo "$@: Not a git repository" 1>&2; \
exit 1; \
fi; \
if [ "$(GIT_RELEASE_TAG)" = "true" ]; then \
if git show-ref --tags -q $(GIT_RELEASE_TAG_NAME); then \
echo "git release tag $(GIT_RELEASE_TAG_NAME) already exists; not distributing" 1>&2; \
exit 1; \
fi; \
fi; \
if [ "$(GIT_DIST_TAG)" = "true" ]; then \
if git show-ref --tags -q $(GIT_DIST_TAG_NAME); then \
echo "git distribution tag $(GIT_DIST_TAG_NAME) already exists; not distributing" 1>&2; \
exit 1; \
fi; \
fi; \
echo "$@: distributing $(PACKAGE)-$(VERSION) on git branch $(GIT_DIST_BRANCH)"; \
DISTDIR_INDEX="$(abs_top_builddir)/$(distdir).git.idx"; \
DISTDIR_TREE="$(abs_top_builddir)/$(distdir)"; \
rm -f "$$DISTDIR_INDEX"; \
GIT_INDEX_FILE="$$DISTDIR_INDEX" GIT_WORK_TREE="$$DISTDIR_TREE" git add -A || exit 1; \
GIT_INDEX_FILE="$$DISTDIR_INDEX" TREE="$$(git write-tree)"; \
rm -f "$$DISTDIR_INDEX"; \
[ -n "$$TREE" ] || exit 1; \
RELEASE_HEAD="$$(git show-ref -s $(GIT_RELEASE_BRANCH))"; \
COMMIT_OPTS="-p $$RELEASE_HEAD"; \
DIST_PARENT="$$(git show-ref --heads -s refs/heads/$(GIT_DIST_BRANCH))"; \
if [ -n "$$DIST_PARENT" ]; then \
COMMIT_OPTS="$$COMMIT_OPTS -p $$DIST_PARENT"; \
fi; \
COMMIT="$$(echo $(GIT_DIST_COMMIT_MESSAGE) | git commit-tree "$$TREE" $$COMMIT_OPTS)"; \
[ -n "$$COMMIT" ] || exit 1; \
git update-ref "refs/heads/$(GIT_DIST_BRANCH)" "$$COMMIT" "$$DIST_PARENT" || exit 1;\
echo "$@: tree=$$TREE"; \
echo "$@: commit=$$COMMIT"; \
if [ "$(GIT_RELEASE_TAG)" = "true" ]; then \
RELEASE_TAG_OPTS=""; \
if [ "$(GIT_RELEASE_TAG_SIGN)" = "true" ]; then \
RELEASE_TAG_OPTS="$$TAG_OPTS -s"; \
fi; \
git tag -m $(GIT_RELEASE_TAG_MESSAGE) $$RELEASE_TAG_OPTS "$(GIT_RELEASE_TAG_NAME)" "$$COMMIT" || exit 1; \
echo "$@: release tagged as $(GIT_RELEASE_TAG_NAME)"; \
fi; \
if [ "$(GIT_DIST_TAG)" = "true" ]; then \
DIST_TAG_OPTS=""; \
if [ "$(GIT_DIST_TAG_SIGN)" = "true" ]; then \
DIST_TAG_OPTS="$$TAG_OPTS -s"; \
fi; \
git tag -m $(GIT_DIST_TAG_MESSAGE) $$DIST_TAG_OPTS "$(GIT_DIST_TAG_NAME)" "$$COMMIT" || exit 1; \
echo "$@: distribution tagged as $(GIT_DIST_TAG_NAME)"; \
fi;
$(am__remove_distdir)
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [PATCH] git-log: allow --decorate[=short|full]
From: Lars Hjemli @ 2009-08-15 14:23 UTC (permalink / raw)
To: Jeff King; +Cc: Junio C Hamano, Git Mailing List
In-Reply-To: <20090815122812.GB30630@coredump.intra.peff.net>
Commit de435ac0 changed the behavior of --decorate from printing the
full ref (e.g., "refs/heads/master") to a shorter, more human-readable
version (e.g., just "master"). While this is nice for human readers,
external tools using the output from "git log" may prefer the full
version.
This patch introduces an extension to --decorate to allow the caller to
specify either the short or the full versions.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
Thanks for the review. I've adapted the patch to your comments, and
modified the documentation of '--decorate' to be more specific.
Documentation/git-log.txt | 8 ++++++--
builtin-log.c | 13 +++++++++++--
log-tree.c | 7 ++++---
log-tree.h | 2 +-
pretty.c | 2 +-
revision.c | 2 +-
revision.h | 5 ++++-
t/t4013-diff-various.sh | 1 +
...corate_--all => diff.log_--decorate=full_--all} | 8 ++++----
9 files changed, 33 insertions(+), 15 deletions(-)
copy t/t4013/{diff.log_--decorate_--all =>
diff.log_--decorate=full_--all} (72%)
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 34cf4e5..3d79de1 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -37,8 +37,12 @@ include::diff-options.txt[]
and <until>, see "SPECIFYING REVISIONS" section in
linkgit:git-rev-parse[1].
---decorate::
- Print out the ref names of any commits that are shown.
+--decorate[=short|full]::
+ Print out the ref names of any commits that are shown. If 'short' is
+ specified, the ref name prefixes 'refs/heads/', 'refs/tags/' and
+ 'refs/remotes/' will not be printed. If 'full' is specified, the
+ full ref name (including prefix) will be printed. The default option
+ is 'short'.
--source::
Print out the ref name given on the command line by which each
diff --git a/builtin-log.c b/builtin-log.c
index 3817bf1..1ed4c76 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -61,8 +61,15 @@ static void cmd_log_init(int argc, const char
**argv, const char *prefix,
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
if (!strcmp(arg, "--decorate")) {
- load_ref_decorations();
- rev->show_decorations = 1;
+ rev->show_decorations = DECORATE_SHORT_REFS;
+ } else if (!prefixcmp(arg, "--decorate=")) {
+ const char *v = skip_prefix(arg, "--decorate=");
+ if (!strcmp(v, "full"))
+ rev->show_decorations = DECORATE_FULL_REFS;
+ else if (!strcmp(v, "short"))
+ rev->show_decorations = DECORATE_SHORT_REFS;
+ else
+ die("invalid --decorate option: %s", arg);
} else if (!strcmp(arg, "--source")) {
rev->show_source = 1;
} else if (!strcmp(arg, "-h")) {
@@ -70,6 +77,8 @@ static void cmd_log_init(int argc, const char
**argv, const char *prefix,
} else
die("unrecognized argument: %s", arg);
}
+ if (rev->show_decorations)
+ load_ref_decorations(rev->show_decorations);
}
/*
diff --git a/log-tree.c b/log-tree.c
index 6f73c17..70223eb 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -25,7 +25,8 @@ static int add_ref_decoration(const char *refname,
const unsigned char *sha1, in
struct object *obj = parse_object(sha1);
if (!obj)
return 0;
- refname = prettify_refname(refname);
+ if (!cb_data || *(int *)cb_data & DECORATE_SHORT_REFS)
+ refname = prettify_refname(refname);
add_name_decoration("", refname, obj);
while (obj->type == OBJ_TAG) {
obj = ((struct tag *)obj)->tagged;
@@ -36,12 +37,12 @@ static int add_ref_decoration(const char *refname,
const unsigned char *sha1, in
return 0;
}
-void load_ref_decorations(void)
+void load_ref_decorations(int flags)
{
static int loaded;
if (!loaded) {
loaded = 1;
- for_each_ref(add_ref_decoration, NULL);
+ for_each_ref(add_ref_decoration, &flags);
}
}
diff --git a/log-tree.h b/log-tree.h
index 20b5caf..3f7b400 100644
--- a/log-tree.h
+++ b/log-tree.h
@@ -17,7 +17,7 @@ void log_write_email_headers(struct rev_info *opt,
struct commit *commit,
const char **subject_p,
const char **extra_headers_p,
int *need_8bit_cte_p);
-void load_ref_decorations(void);
+void load_ref_decorations(int flags);
#define FORMAT_PATCH_NAME_MAX 64
void get_patch_filename(struct commit *commit, int nr, const char *suffix,
diff --git a/pretty.c b/pretty.c
index e5328da..daa721b 100644
--- a/pretty.c
+++ b/pretty.c
@@ -571,7 +571,7 @@ static void format_decoration(struct strbuf *sb,
const struct commit *commit)
struct name_decoration *d;
const char *prefix = " (";
- load_ref_decorations();
+ load_ref_decorations(DECORATE_SHORT_REFS);
d = lookup_decoration(&name_decoration, &commit->object);
while (d) {
strbuf_addstr(sb, prefix);
diff --git a/revision.c b/revision.c
index 9f5dac5..ce24ad9 100644
--- a/revision.c
+++ b/revision.c
@@ -1052,7 +1052,7 @@ static int handle_revision_opt(struct rev_info
*revs, int argc, const char **arg
revs->simplify_by_decoration = 1;
revs->limited = 1;
revs->prune = 1;
- load_ref_decorations();
+ load_ref_decorations(DECORATE_SHORT_REFS);
} else if (!strcmp(arg, "--date-order")) {
revs->lifo = 0;
revs->topo_order = 1;
diff --git a/revision.h b/revision.h
index fb74492..9a644ee 100644
--- a/revision.h
+++ b/revision.h
@@ -15,6 +15,9 @@
#define SYMMETRIC_LEFT (1u<<8)
#define ALL_REV_FLAGS ((1u<<9)-1)
+#define DECORATE_SHORT_REFS 1
+#define DECORATE_FULL_REFS 2
+
struct rev_info;
struct log_info;
@@ -56,7 +59,6 @@ struct rev_info {
rewrite_parents:1,
print_parents:1,
show_source:1,
- show_decorations:1,
reverse:1,
reverse_output_stage:1,
cherry_pick:1,
@@ -96,6 +98,7 @@ struct rev_info {
const char *subject_prefix;
int no_inline;
int show_log_size;
+ int show_decorations;
/* Filter by commit log message */
struct grep_opt grep_filter;
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 8b33321..8e3694e 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -207,6 +207,7 @@ log --root --cc --patch-with-stat --summary master
log -SF master
log -SF -p master
log --decorate --all
+log --decorate=full --all
rev-list --parents HEAD
rev-list --children HEAD
diff --git a/t/t4013/diff.log_--decorate_--all
b/t/t4013/diff.log_--decorate=full_--all
similarity index 72%
copy from t/t4013/diff.log_--decorate_--all
copy to t/t4013/diff.log_--decorate=full_--all
index 954210e..903d9d9 100644
--- a/t/t4013/diff.log_--decorate_--all
+++ b/t/t4013/diff.log_--decorate=full_--all
@@ -1,12 +1,12 @@
-$ git log --decorate --all
-commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (master)
+$ git log --decorate=full --all
+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (refs/heads/master)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000
Merge branch 'side'
-commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a (side)
+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a (refs/heads/side)
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000
@@ -26,7 +26,7 @@ Date: Mon Jun 26 00:01:00 2006 +0000
This is the second commit.
-commit 444ac553ac7612cc88969031b02b3767fb8a353a (initial)
+commit 444ac553ac7612cc88969031b02b3767fb8a353a (refs/heads/initial)
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000
--
1.6.4.135.g4e5b
^ permalink raw reply related
* Re: [PATCH] add -p: do not attempt to coalesce mode changes
From: Jeff King @ 2009-08-15 14:17 UTC (permalink / raw)
To: Thomas Rast; +Cc: gitster, Kirill Smelkov, git
In-Reply-To: <770693df8f416615f57423141fb59f3d6eccc915.1250344341.git.trast@student.ethz.ch>
On Sat, Aug 15, 2009 at 03:56:39PM +0200, Thomas Rast wrote:
> In 0392513 (add-interactive: refactor mode hunk handling, 2009-04-16),
> we merged the interaction loops for mode changes and hunk staging.
> This was fine at the time, because 0beee4c (git-add--interactive:
> remove hunk coalescing, 2008-07-02) removed hunk coalescing.
>
> However, in 7a26e65 (Revert "git-add--interactive: remove hunk
> coalescing", 2009-05-16), we resurrected it. Since then, the code
> would attempt in vain to merge mode changes with diff hunks,
> corrupting both in the process.
Thanks for the writeup; I bisected the problem to 7a26e65, as well, but
hadn't yet figured out what was going on. :)
> --- a/git-add--interactive.perl
> +++ b/git-add--interactive.perl
> @@ -841,6 +841,10 @@
> my ($last_o_ctx, $last_was_dirty);
>
> for (grep { $_->{USE} } @in) {
> + if ($_->{TYPE} ne 'hunk') {
> + push @out, $_;
> + next;
> + }
> my $text = $_->{TEXT};
> my ($o_ofs) = parse_hunk_header($text->[0]);
> if (defined $last_o_ctx &&
Hmm. I am not too familiar with the coalesce_overlapping_hunks code, but
it looks like we peek at $out[-1] based on $last_o_ctx, assuming that
$last_o_ctx comes from the last hunk pushed (either because we just
pushed it, or we merged into it). So a non-hunk in the middle of some
coalescing hunks is going to violate that assumption.
As it is now, I think we always put the 'mode' hunk at the very
beginning, so that shouldn't happen (and IIRC, that order is preserved
throughout). So maybe it is not worth worrying about. But an alternate
patch is below.
---
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index a06172c..c859bb4 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -838,21 +838,26 @@ sub coalesce_overlapping_hunks {
my (@in) = @_;
my @out = ();
- my ($last_o_ctx, $last_was_dirty);
+ my ($last_o_ctx, $last_was_dirty, $last_hunk);
for (grep { $_->{USE} } @in) {
+ if ($_->{TYPE} ne 'hunk') {
+ push @out, $_;
+ next;
+ }
my $text = $_->{TEXT};
my ($o_ofs) = parse_hunk_header($text->[0]);
if (defined $last_o_ctx &&
$o_ofs <= $last_o_ctx &&
!$_->{DIRTY} &&
!$last_was_dirty) {
- merge_hunk($out[-1], $_);
+ merge_hunk($last_hunk, $_);
}
else {
push @out, $_;
+ $last_hunk = $_;
}
- $last_o_ctx = find_last_o_ctx($out[-1]);
+ $last_o_ctx = find_last_o_ctx($last_hunk);
$last_was_dirty = $_->{DIRTY};
}
return @out;
^ permalink raw reply related
* Re: msysGit and SCons: broken?
From: Dirk Süsserott @ 2009-08-15 14:04 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Dirk Süsserott, Git Mailing List
In-Reply-To: <alpine.DEB.1.00.0908132353380.8306@pacific.mpi-cbg.de>
Am 13.08.2009 23:54 schrieb Johannes Schindelin:
> Hi,
>
> On Thu, 13 Aug 2009, Dirk Süsserott wrote:
>
...
>> If someone had the same or a similar problem: I tracked it down and
>> found a solution. The problem was that I tried to run a Windows program
>> from git-bash. The Windows program then faces the bash's $PATH with a
>> different separator (':' vs. ';') and a different root directory ('/c/'
>> vs. 'C:/').
>
> I cannot believe that. I actually run a Windows program very often, from
> Git Bash, and PATH is correctly converted all the time.
>
> Ciao,
> Dscho
Hmm, I wrote a simple "hello $PATH" and it actually DID print the path
in Windows' flavour when started from Git Bash, like you said. Dunno why
ActivePython ceased to do so as well... Probably I confused my machine
by extending PATH in Windows and .bashrc with different PATHs in
different order. Or ActivePython is somehow "zickig" (what's that in
english? :-)). However, now it works for me and as SCons is the only
tool that failed, I see no further need for investigation.
Btw., I started scons from Git Bash with
cmd //c C:/Python24/Scripts/scons.bat "$@"
Maybe that's a problem, but I don't care any longer.
Dirk
^ permalink raw reply
* [PATCH] add -p: do not attempt to coalesce mode changes
From: Thomas Rast @ 2009-08-15 13:56 UTC (permalink / raw)
To: gitster, Kirill Smelkov; +Cc: Jeff King, git
In-Reply-To: <1250339209-27962-1-git-send-email-kirr@mns.spb.ru>
In 0392513 (add-interactive: refactor mode hunk handling, 2009-04-16),
we merged the interaction loops for mode changes and hunk staging.
This was fine at the time, because 0beee4c (git-add--interactive:
remove hunk coalescing, 2008-07-02) removed hunk coalescing.
However, in 7a26e65 (Revert "git-add--interactive: remove hunk
coalescing", 2009-05-16), we resurrected it. Since then, the code
would attempt in vain to merge mode changes with diff hunks,
corrupting both in the process.
We add a check to the coalescing loop to ensure it only looks at diff
hunks, thus skipping mode changes.
Noticed-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
git-add--interactive.perl | 4 ++++
t/t3701-add-interactive.sh | 2 +-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index df9f231..06f7060 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -841,6 +841,10 @@
my ($last_o_ctx, $last_was_dirty);
for (grep { $_->{USE} } @in) {
+ if ($_->{TYPE} ne 'hunk') {
+ push @out, $_;
+ next;
+ }
my $text = $_->{TEXT};
my ($o_ofs) = parse_hunk_header($text->[0]);
if (defined $last_o_ctx &&
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index d5e9351..62fd65e 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -164,7 +164,7 @@ test_expect_success FILEMODE 'stage mode but not hunk' '
'
-test_expect_failure FILEMODE 'stage mode and hunk' '
+test_expect_success FILEMODE 'stage mode and hunk' '
git reset --hard &&
echo content >>file &&
chmod +x file &&
--
1.6.4.288.gc754a.dirty
^ permalink raw reply related
* [BUG, PATCH] git add -p: demonstrate failure when staging both mode and hunk
From: Kirill Smelkov @ 2009-08-15 12:26 UTC (permalink / raw)
To: gitster; +Cc: git, Kirill Smelkov, Jeff King, Thomas Rast
When trying to stage changes to file which has also pending `chmod +x`,
`git add -p` produces lots of 'Use of uninitialized value ...' warnings
and fails to do the job:
$ echo content >> file
$ chmod +x file
$ git add -p
diff --git a/file b/file
index e69de29..d95f3ad
--- a/file
+++ b/file
old mode 100644
new mode 100755
Stage mode change [y,n,q,a,d,/,j,J,g,?]? y
@@ -0,0 +1 @@
+content
Stage this hunk [y,n,q,a,d,/,K,g,e,?]? y
Use of uninitialized value $o_ofs in addition (+) at /home/kirr/local/git/libexec/git-core/git-add--interactive line 776.
Use of uninitialized value $ofs in numeric le (<=) at /home/kirr/local/git/libexec/git-core/git-add--interactive line 806.
Use of uninitialized value $o0_ofs in concatenation (.) or string at /home/kirr/local/git/libexec/git-core/git-add--interactive line 830.
Use of uninitialized value $n0_ofs in concatenation (.) or string at /home/kirr/local/git/libexec/git-core/git-add--interactive line 830.
Use of uninitialized value $o_ofs in addition (+) at /home/kirr/local/git/libexec/git-core/git-add--interactive line 776.
fatal: corrupt patch at line 5
diff --git a/file b/file
index e69de29..d95f3ad
--- a/file
+++ b/file
@@ -,0 + @@
+content
Cc: Jeff King <peff@peff.net>
Cc: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
---
t/t3701-add-interactive.sh | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index fd2a55a..d5e9351 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -163,6 +163,17 @@ test_expect_success FILEMODE 'stage mode but not hunk' '
git diff file | grep "+content"
'
+
+test_expect_failure FILEMODE 'stage mode and hunk' '
+ git reset --hard &&
+ echo content >>file &&
+ chmod +x file &&
+ printf "y\\ny\\n" | git add -p &&
+ git diff --cached file | grep "new mode" &&
+ git diff --cached file | grep "+content" &&
+ test -z "$(git diff file)"
+'
+
# end of tests disabled when filemode is not usable
test_expect_success 'setup again' '
--
1.6.4.134.gb2139
^ permalink raw reply related
* Re: [PATCH] git-log: allow --decorate[=short|full]
From: Jeff King @ 2009-08-15 12:28 UTC (permalink / raw)
To: Lars Hjemli; +Cc: Junio C Hamano, Git Mailing List
In-Reply-To: <8c5c35580908150250y62b1042cmf6071016bac98a48@mail.gmail.com>
On Sat, Aug 15, 2009 at 11:50:25AM +0200, Lars Hjemli wrote:
> This extension to --decorate makes it possible to generate decorations
> similar to pre-1.6.4 git, which is nice when the output from git-log
> is used by external tools.
This commit message really lacks context. When I read it, I thought to
myself "what happened to decorations in 1.6.4?" It really needs to say:
- exactly what changed
- why did it change
- why the change has drawbacks
After reading the patch and digging through the history, I think you
want something more like:
-- >8 --
Commit de435ac0 changed the behavior of --decorate from printing the
full ref (e.g., "refs/heads/master") to a shorter, more human-readable
version (e.g., just "master"). While this is nice for human readers,
external tools using the output from "git log" may prefer the full
version.
This patch introduces an extension to --decorate to allow the caller to
specify either the short or the full versions.
-- 8< --
As for the patch, it mostly looks good, but a few comments:
> + } else if (!strncmp(arg, "--decorate=", 11)) {
> + if (!strcmp(arg + 11, "full"))
> + rev->show_decorations = DECORATE_FULL_REFS;
> + else if (!strcmp(arg + 11, "short"))
> + rev->show_decorations = DECORATE_SHORT_REFS;
> + else
> + die("invalid --decorate option: %s", arg + 11);
To avoid the magic 11's, we have a few helpers:
if (!prefixcmp(arg, "--decorate=")) {
const char *v = skip_prefix(arg, "--decorate=");
...
though arguably that is just as bad because you have to repeat the
"--decorate=".
> --- a/revision.h
> +++ b/revision.h
> @@ -15,6 +15,10 @@
> #define SYMMETRIC_LEFT (1u<<8)
> #define ALL_REV_FLAGS ((1u<<9)-1)
>
> +
> +#define DECORATE_SHORT_REFS 1
> +#define DECORATE_FULL_REFS 2
> +
Style nit: extra blank line?
> @@ -56,7 +60,7 @@ struct rev_info {
> rewrite_parents:1,
> print_parents:1,
> show_source:1,
> - show_decorations:1,
> + show_decorations:2,
> reverse:1,
> reverse_output_stage:1,
> cherry_pick:1,
Should we perhaps just turn show_decorations into its own variable? It
just seems like a trap for future maintainers to want to add more
DECORATE_* flags but not realize they have to keep bumping up the size
of the bitfield.
And rev_info is not a struct that we are particularly trying to optimize
the memory on.
> diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
> index 8b33321..8e3694e 100755
> --- a/t/t4013-diff-various.sh
> +++ b/t/t4013-diff-various.sh
> @@ -207,6 +207,7 @@ log --root --cc --patch-with-stat --summary master
> log -SF master
> log -SF -p master
> log --decorate --all
> +log --decorate=full --all
Yay, tests.
-Peff
^ permalink raw reply
* [PATCH v5.1 4/6] Implement 'git reset --patch'
From: Thomas Rast @ 2009-08-15 11:48 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Sverre Rabbelier, Nanako Shiraishi,
Nicolas Sebrecht, Pierre Habouzit
In-Reply-To: <f3b8fdbcf451fe28786ed221d02717e28423e6dd.1250164190.git.trast@student.ethz.ch>
This introduces a --patch mode for git-reset. The basic case is
git reset --patch -- [files...]
which acts as the opposite of 'git add --patch -- [files...]': it
offers hunks for *un*staging. Advanced usage is
git reset --patch <revision> -- [files...]
which offers hunks from the diff between the index and <revision> for
forward application to the index. (That is, the basic case is just
<revision> = HEAD.)
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Jeff noticed the prompt and patch direction weren't matching:
http://article.gmane.org/gmane.comp.version-control.git/125981
This flips the direction of the patch in the 'git reset -p other'
case, as I really wanted it that way around.
Documentation/git-reset.txt | 15 ++++++++-
builtin-reset.c | 19 ++++++++++++
git-add--interactive.perl | 57 +++++++++++++++++++++++++++++++++--
t/t7105-reset-patch.sh | 69 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 154 insertions(+), 6 deletions(-)
create mode 100755 t/t7105-reset-patch.sh
diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
index abb25d1..469cf6d 100644
--- a/Documentation/git-reset.txt
+++ b/Documentation/git-reset.txt
@@ -10,6 +10,7 @@ SYNOPSIS
[verse]
'git reset' [--mixed | --soft | --hard | --merge] [-q] [<commit>]
'git reset' [-q] [<commit>] [--] <paths>...
+'git reset' --patch [<commit>] [--] [<paths>...]
DESCRIPTION
-----------
@@ -23,8 +24,9 @@ the undo in the history.
If you want to undo a commit other than the latest on a branch,
linkgit:git-revert[1] is your friend.
-The second form with 'paths' is used to revert selected paths in
-the index from a given commit, without moving HEAD.
+The second and third forms with 'paths' and/or --patch are used to
+revert selected paths in the index from a given commit, without moving
+HEAD.
OPTIONS
@@ -50,6 +52,15 @@ OPTIONS
and updates the files that are different between the named commit
and the current commit in the working tree.
+-p::
+--patch::
+ Interactively select hunks in the difference between the index
+ and <commit> (defaults to HEAD). The chosen hunks are applied
+ in reverse to the index.
++
+This means that `git reset -p` is the opposite of `git add -p` (see
+linkgit:git-add[1]).
+
-q::
Be quiet, only report errors.
diff --git a/builtin-reset.c b/builtin-reset.c
index 5fa1789..246a127 100644
--- a/builtin-reset.c
+++ b/builtin-reset.c
@@ -142,6 +142,17 @@ static void update_index_from_diff(struct diff_queue_struct *q,
}
}
+static int interactive_reset(const char *revision, const char **argv,
+ const char *prefix)
+{
+ const char **pathspec = NULL;
+
+ if (*argv)
+ pathspec = get_pathspec(prefix, argv);
+
+ return run_add_interactive(revision, "--patch=reset", pathspec);
+}
+
static int read_from_tree(const char *prefix, const char **argv,
unsigned char *tree_sha1, int refresh_flags)
{
@@ -183,6 +194,7 @@ static void prepend_reflog_action(const char *action, char *buf, size_t size)
int cmd_reset(int argc, const char **argv, const char *prefix)
{
int i = 0, reset_type = NONE, update_ref_status = 0, quiet = 0;
+ int patch_mode = 0;
const char *rev = "HEAD";
unsigned char sha1[20], *orig = NULL, sha1_orig[20],
*old_orig = NULL, sha1_old_orig[20];
@@ -198,6 +210,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
"reset HEAD, index and working tree", MERGE),
OPT_BOOLEAN('q', NULL, &quiet,
"disable showing new HEAD in hard reset and progress message"),
+ OPT_BOOLEAN('p', "patch", &patch_mode, "select hunks interactively"),
OPT_END()
};
@@ -251,6 +264,12 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
die("Could not parse object '%s'.", rev);
hashcpy(sha1, commit->object.sha1);
+ if (patch_mode) {
+ if (reset_type != NONE)
+ die("--patch is incompatible with --{hard,mixed,soft}");
+ return interactive_reset(rev, argv + i, prefix);
+ }
+
/* git reset tree [--] paths... can be used to
* load chosen paths from the tree into the index without
* affecting the working tree nor HEAD. */
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 3606103..d14f48c 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -72,6 +72,7 @@
# command line options
my $patch_mode;
+my $patch_mode_revision;
sub apply_patch;
@@ -85,6 +86,24 @@
PARTICIPLE => 'staging',
FILTER => 'file-only',
},
+ 'reset_head' => {
+ DIFF => 'diff-index -p --cached',
+ APPLY => sub { apply_patch 'apply -R --cached', @_; },
+ APPLY_CHECK => 'apply -R --cached',
+ VERB => 'Unstage',
+ TARGET => '',
+ PARTICIPLE => 'unstaging',
+ FILTER => 'index-only',
+ },
+ 'reset_nothead' => {
+ DIFF => 'diff-index -R -p --cached',
+ APPLY => sub { apply_patch 'apply --cached', @_; },
+ APPLY_CHECK => 'apply --cached',
+ VERB => 'Apply',
+ TARGET => ' to index',
+ PARTICIPLE => 'applying',
+ FILTER => 'index-only',
+ },
);
my %patch_mode_flavour = %{$patch_modes{stage}};
@@ -206,7 +225,14 @@
return if (!@tracked);
}
- my $reference = is_initial_commit() ? get_empty_tree() : 'HEAD';
+ my $reference;
+ if (defined $patch_mode_revision and $patch_mode_revision ne 'HEAD') {
+ $reference = $patch_mode_revision;
+ } elsif (is_initial_commit()) {
+ $reference = get_empty_tree();
+ } else {
+ $reference = 'HEAD';
+ }
for (run_cmd_pipe(qw(git diff-index --cached
--numstat --summary), $reference,
'--', @tracked)) {
@@ -640,6 +666,9 @@
sub parse_diff {
my ($path) = @_;
my @diff_cmd = split(" ", $patch_mode_flavour{DIFF});
+ if (defined $patch_mode_revision) {
+ push @diff_cmd, $patch_mode_revision;
+ }
my @diff = run_cmd_pipe("git", @diff_cmd, "--", $path);
my @colored = ();
if ($diff_use_color) {
@@ -1391,11 +1420,31 @@
sub process_args {
return unless @ARGV;
my $arg = shift @ARGV;
- if ($arg eq "--patch") {
- $patch_mode = 1;
- $arg = shift @ARGV or die "missing --";
+ if ($arg =~ /--patch(?:=(.*))?/) {
+ if (defined $1) {
+ if ($1 eq 'reset') {
+ $patch_mode = 'reset_head';
+ $patch_mode_revision = 'HEAD';
+ $arg = shift @ARGV or die "missing --";
+ if ($arg ne '--') {
+ $patch_mode_revision = $arg;
+ $patch_mode = ($arg eq 'HEAD' ?
+ 'reset_head' : 'reset_nothead');
+ $arg = shift @ARGV or die "missing --";
+ }
+ } elsif ($1 eq 'stage') {
+ $patch_mode = 'stage';
+ $arg = shift @ARGV or die "missing --";
+ } else {
+ die "unknown --patch mode: $1";
+ }
+ } else {
+ $patch_mode = 'stage';
+ $arg = shift @ARGV or die "missing --";
+ }
die "invalid argument $arg, expecting --"
unless $arg eq "--";
+ %patch_mode_flavour = %{$patch_modes{$patch_mode}};
}
elsif ($arg ne "--") {
die "invalid argument $arg, expecting --";
diff --git a/t/t7105-reset-patch.sh b/t/t7105-reset-patch.sh
new file mode 100755
index 0000000..c1f4fc3
--- /dev/null
+++ b/t/t7105-reset-patch.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+test_description='git reset --patch'
+. ./lib-patch-mode.sh
+
+test_expect_success 'setup' '
+ mkdir dir &&
+ echo parent > dir/foo &&
+ echo dummy > bar &&
+ git add dir &&
+ git commit -m initial &&
+ test_tick &&
+ test_commit second dir/foo head &&
+ set_and_save_state bar bar_work bar_index &&
+ save_head
+'
+
+# note: bar sorts before foo, so the first 'n' is always to skip 'bar'
+
+test_expect_success 'saying "n" does nothing' '
+ set_and_save_state dir/foo work work
+ (echo n; echo n) | git reset -p &&
+ verify_saved_state dir/foo &&
+ verify_saved_state bar
+'
+
+test_expect_success 'git reset -p' '
+ (echo n; echo y) | git reset -p &&
+ verify_state dir/foo work head &&
+ verify_saved_state bar
+'
+
+test_expect_success 'git reset -p HEAD^' '
+ (echo n; echo y) | git reset -p HEAD^ &&
+ verify_state dir/foo work parent &&
+ verify_saved_state bar
+'
+
+# The idea in the rest is that bar sorts first, so we always say 'y'
+# first and if the path limiter fails it'll apply to bar instead of
+# dir/foo. There's always an extra 'n' to reject edits to dir/foo in
+# the failure case (and thus get out of the loop).
+
+test_expect_success 'git reset -p dir' '
+ set_state dir/foo work work
+ (echo y; echo n) | git reset -p dir &&
+ verify_state dir/foo work head &&
+ verify_saved_state bar
+'
+
+test_expect_success 'git reset -p -- foo (inside dir)' '
+ set_state dir/foo work work
+ (echo y; echo n) | (cd dir && git reset -p -- foo) &&
+ verify_state dir/foo work head &&
+ verify_saved_state bar
+'
+
+test_expect_success 'git reset -p HEAD^ -- dir' '
+ (echo y; echo n) | git reset -p HEAD^ -- dir &&
+ verify_state dir/foo work parent &&
+ verify_saved_state bar
+'
+
+test_expect_success 'none of this moved HEAD' '
+ verify_saved_head
+'
+
+
+test_done
--
1.6.4.287.g3e02d
^ permalink raw reply related
* [PATCH v5.1 5/6] Implement 'git checkout --patch'
From: Thomas Rast @ 2009-08-15 11:48 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Sverre Rabbelier, Nanako Shiraishi,
Nicolas Sebrecht, Pierre Habouzit
In-Reply-To: <b75f4adebf7f417b8c46746202933e8f7ff80331.1250164190.git.trast@student.ethz.ch>
This introduces a --patch mode for git-checkout. In the index usage
git checkout --patch -- [files...]
it lets the user discard edits from the <files> at the granularity of
hunks (by selecting hunks from 'git diff' and then reverse applying
them to the worktree).
We also accept a revision argument. In the case
git checkout --patch HEAD -- [files...]
we offer hunks from the difference between HEAD and the worktree, and
reverse applies them to both index and worktree, allowing you to
discard staged changes completely. In the non-HEAD usage
git checkout --patch <revision> -- [files...]
it offers hunks from the difference between the worktree and
<revision>. The chosen hunks are then applied to both index and
worktree.
The application to worktree and index is done "atomically" in the
sense that we first check if the patch applies to the index (it should
always apply to the worktree). If it does not, we give the user a
choice to either abort or apply to the worktree anyway.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
I found another mismatch of the -R flags during double checking, as
follows:
diff --git c/git-add--interactive.perl i/git-add--interactive.perl
index 2363a77..21746d5 100755
--- c/git-add--interactive.perl
+++ i/git-add--interactive.perl
@@ -117,7 +117,7 @@
'checkout_head' => {
DIFF => 'diff-index -p',
APPLY => sub { apply_patch_for_checkout_commit '-R', @_ },
- APPLY_CHECK => 'apply',
+ APPLY_CHECK => 'apply -R',
VERB => 'Discard',
TARGET => ' from index and worktree',
PARTICIPLE => 'discarding',
Documentation/git-checkout.txt | 13 +++++-
builtin-checkout.c | 19 +++++++
git-add--interactive.perl | 61 +++++++++++++++++++++++
t/t2015-checkout-patch.sh | 107 ++++++++++++++++++++++++++++++++++++++++
4 files changed, 199 insertions(+), 1 deletions(-)
create mode 100755 t/t2015-checkout-patch.sh
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index ad4b31e..26a5447 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -11,6 +11,7 @@ SYNOPSIS
'git checkout' [-q] [-f] [-m] [<branch>]
'git checkout' [-q] [-f] [-m] [-b <new_branch>] [<start_point>]
'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
+'git checkout' --patch [<tree-ish>] [--] [<paths>...]
DESCRIPTION
-----------
@@ -25,7 +26,7 @@ use the --track or --no-track options, which will be passed to `git
branch`. As a convenience, --track without `-b` implies branch
creation; see the description of --track below.
-When <paths> are given, this command does *not* switch
+When <paths> or --patch are given, this command does *not* switch
branches. It updates the named paths in the working tree from
the index file, or from a named <tree-ish> (most often a commit). In
this case, the `-b` and `--track` options are meaningless and giving
@@ -113,6 +114,16 @@ the conflicted merge in the specified paths.
"merge" (default) and "diff3" (in addition to what is shown by
"merge" style, shows the original contents).
+-p::
+--patch::
+ Interactively select hunks in the difference between the
+ <tree-ish> (or the index, if unspecified) and the working
+ tree. The chosen hunks are then applied in reverse to the
+ working tree (and if a <tree-ish> was specified, the index).
++
+This means that you can use `git checkout -p` to selectively discard
+edits from your current working tree.
+
<branch>::
Branch to checkout; if it refers to a branch (i.e., a name that,
when prepended with "refs/heads/", is a valid ref), then that
diff --git a/builtin-checkout.c b/builtin-checkout.c
index 8a9a474..8b942ba 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -572,6 +572,13 @@ static int git_checkout_config(const char *var, const char *value, void *cb)
return git_xmerge_config(var, value, cb);
}
+static int interactive_checkout(const char *revision, const char **pathspec,
+ struct checkout_opts *opts)
+{
+ return run_add_interactive(revision, "--patch=checkout", pathspec);
+}
+
+
int cmd_checkout(int argc, const char **argv, const char *prefix)
{
struct checkout_opts opts;
@@ -580,6 +587,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
struct branch_info new;
struct tree *source_tree = NULL;
char *conflict_style = NULL;
+ int patch_mode = 0;
struct option options[] = {
OPT__QUIET(&opts.quiet),
OPT_STRING('b', NULL, &opts.new_branch, "new branch", "branch"),
@@ -594,6 +602,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
OPT_BOOLEAN('m', "merge", &opts.merge, "merge"),
OPT_STRING(0, "conflict", &conflict_style, "style",
"conflict style (merge or diff3)"),
+ OPT_BOOLEAN('p', "patch", &patch_mode, "select hunks interactively"),
OPT_END(),
};
int has_dash_dash;
@@ -608,6 +617,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, options, checkout_usage,
PARSE_OPT_KEEP_DASHDASH);
+ if (patch_mode && (opts.track > 0 || opts.new_branch
+ || opts.new_branch_log || opts.merge || opts.force))
+ die ("--patch is incompatible with all other options");
+
/* --track without -b should DWIM */
if (0 < opts.track && !opts.new_branch) {
const char *argv0 = argv[0];
@@ -714,6 +727,9 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
if (!pathspec)
die("invalid path specification");
+ if (patch_mode)
+ return interactive_checkout(new.name, pathspec, &opts);
+
/* Checkout paths */
if (opts.new_branch) {
if (argc == 1) {
@@ -729,6 +745,9 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
return checkout_paths(source_tree, pathspec, &opts);
}
+ if (patch_mode)
+ return interactive_checkout(new.name, NULL, &opts);
+
if (opts.new_branch) {
struct strbuf buf = STRBUF_INIT;
if (strbuf_check_branch_ref(&buf, opts.new_branch))
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index d14f48c..21746d5 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -75,6 +75,7 @@
my $patch_mode_revision;
sub apply_patch;
+sub apply_patch_for_checkout_commit;
my %patch_modes = (
'stage' => {
@@ -104,6 +105,33 @@
PARTICIPLE => 'applying',
FILTER => 'index-only',
},
+ 'checkout_index' => {
+ DIFF => 'diff-files -p',
+ APPLY => sub { apply_patch 'apply -R', @_; },
+ APPLY_CHECK => 'apply -R',
+ VERB => 'Discard',
+ TARGET => ' from worktree',
+ PARTICIPLE => 'discarding',
+ FILTER => 'file-only',
+ },
+ 'checkout_head' => {
+ DIFF => 'diff-index -p',
+ APPLY => sub { apply_patch_for_checkout_commit '-R', @_ },
+ APPLY_CHECK => 'apply -R',
+ VERB => 'Discard',
+ TARGET => ' from index and worktree',
+ PARTICIPLE => 'discarding',
+ FILTER => undef,
+ },
+ 'checkout_nothead' => {
+ DIFF => 'diff-index -R -p',
+ APPLY => sub { apply_patch_for_checkout_commit '', @_ },
+ APPLY_CHECK => 'apply',
+ VERB => 'Apply',
+ TARGET => ' to index and worktree',
+ PARTICIPLE => 'applying',
+ FILTER => undef,
+ },
);
my %patch_mode_flavour = %{$patch_modes{stage}};
@@ -1069,6 +1097,29 @@
return $ret;
}
+sub apply_patch_for_checkout_commit {
+ my $reverse = shift;
+ my $applies_index = run_git_apply 'apply '.$reverse.' --cached --recount --check', @_;
+ my $applies_worktree = run_git_apply 'apply '.$reverse.' --recount --check', @_;
+
+ if ($applies_worktree && $applies_index) {
+ run_git_apply 'apply '.$reverse.' --cached --recount', @_;
+ run_git_apply 'apply '.$reverse.' --recount', @_;
+ return 1;
+ } elsif (!$applies_index) {
+ print colored $error_color, "The selected hunks do not apply to the index!\n";
+ if (prompt_yesno "Apply them to the worktree anyway? ") {
+ return run_git_apply 'apply '.$reverse.' --recount', @_;
+ } else {
+ print colored $error_color, "Nothing was applied.\n";
+ return 0;
+ }
+ } else {
+ print STDERR @_;
+ return 0;
+ }
+}
+
sub patch_update_cmd {
my @all_mods = list_modified($patch_mode_flavour{FILTER});
my @mods = grep { !($_->{BINARY}) } @all_mods;
@@ -1432,6 +1483,16 @@
'reset_head' : 'reset_nothead');
$arg = shift @ARGV or die "missing --";
}
+ } elsif ($1 eq 'checkout') {
+ $arg = shift @ARGV or die "missing --";
+ if ($arg eq '--') {
+ $patch_mode = 'checkout_index';
+ } else {
+ $patch_mode_revision = $arg;
+ $patch_mode = ($arg eq 'HEAD' ?
+ 'checkout_head' : 'checkout_nothead');
+ $arg = shift @ARGV or die "missing --";
+ }
} elsif ($1 eq 'stage') {
$patch_mode = 'stage';
$arg = shift @ARGV or die "missing --";
diff --git a/t/t2015-checkout-patch.sh b/t/t2015-checkout-patch.sh
new file mode 100755
index 0000000..4d1c2e9
--- /dev/null
+++ b/t/t2015-checkout-patch.sh
@@ -0,0 +1,107 @@
+#!/bin/sh
+
+test_description='git checkout --patch'
+
+. ./lib-patch-mode.sh
+
+test_expect_success 'setup' '
+ mkdir dir &&
+ echo parent > dir/foo &&
+ echo dummy > bar &&
+ git add bar dir/foo &&
+ git commit -m initial &&
+ test_tick &&
+ test_commit second dir/foo head &&
+ set_and_save_state bar bar_work bar_index &&
+ save_head
+'
+
+# note: bar sorts before dir/foo, so the first 'n' is always to skip 'bar'
+
+test_expect_success 'saying "n" does nothing' '
+ set_and_save_state dir/foo work head &&
+ (echo n; echo n) | git checkout -p &&
+ verify_saved_state bar &&
+ verify_saved_state dir/foo
+'
+
+test_expect_success 'git checkout -p' '
+ (echo n; echo y) | git checkout -p &&
+ verify_saved_state bar &&
+ verify_state dir/foo head head
+'
+
+test_expect_success 'git checkout -p with staged changes' '
+ set_state dir/foo work index
+ (echo n; echo y) | git checkout -p &&
+ verify_saved_state bar &&
+ verify_state dir/foo index index
+'
+
+test_expect_success 'git checkout -p HEAD with NO staged changes: abort' '
+ set_and_save_state dir/foo work head &&
+ (echo n; echo y; echo n) | git checkout -p HEAD &&
+ verify_saved_state bar &&
+ verify_saved_state dir/foo
+'
+
+test_expect_success 'git checkout -p HEAD with NO staged changes: apply' '
+ (echo n; echo y; echo y) | git checkout -p HEAD &&
+ verify_saved_state bar &&
+ verify_state dir/foo head head
+'
+
+test_expect_success 'git checkout -p HEAD with change already staged' '
+ set_state dir/foo index index
+ # the third n is to get out in case it mistakenly does not apply
+ (echo n; echo y; echo n) | git checkout -p HEAD &&
+ verify_saved_state bar &&
+ verify_state dir/foo head head
+'
+
+test_expect_success 'git checkout -p HEAD^' '
+ # the third n is to get out in case it mistakenly does not apply
+ (echo n; echo y; echo n) | git checkout -p HEAD^ &&
+ verify_saved_state bar &&
+ verify_state dir/foo parent parent
+'
+
+# The idea in the rest is that bar sorts first, so we always say 'y'
+# first and if the path limiter fails it'll apply to bar instead of
+# dir/foo. There's always an extra 'n' to reject edits to dir/foo in
+# the failure case (and thus get out of the loop).
+
+test_expect_success 'path limiting works: dir' '
+ set_state dir/foo work head &&
+ (echo y; echo n) | git checkout -p dir &&
+ verify_saved_state bar &&
+ verify_state dir/foo head head
+'
+
+test_expect_success 'path limiting works: -- dir' '
+ set_state dir/foo work head &&
+ (echo y; echo n) | git checkout -p -- dir &&
+ verify_saved_state bar &&
+ verify_state dir/foo head head
+'
+
+test_expect_success 'path limiting works: HEAD^ -- dir' '
+ # the third n is to get out in case it mistakenly does not apply
+ (echo y; echo n; echo n) | git checkout -p HEAD^ -- dir &&
+ verify_saved_state bar &&
+ verify_state dir/foo parent parent
+'
+
+test_expect_success 'path limiting works: foo inside dir' '
+ set_state dir/foo work head &&
+ # the third n is to get out in case it mistakenly does not apply
+ (echo y; echo n; echo n) | (cd dir && git checkout -p foo) &&
+ verify_saved_state bar &&
+ verify_state dir/foo head head
+'
+
+test_expect_success 'none of this moved HEAD' '
+ verify_saved_head
+'
+
+test_done
--
1.6.4.287.g3e02d
^ permalink raw reply related
* Re: [PATCH] git submodule summary: add --files option
From: Jens Lehmann @ 2009-08-15 11:40 UTC (permalink / raw)
To: Lars Hjemli; +Cc: Junio C Hamano, git
In-Reply-To: <8c5c35580908150140q1d209664ic5e3816609365e24@mail.gmail.com>
Lars Hjemli schrieb:
> On Fri, Aug 14, 2009 at 21:52, Junio C Hamano<gitster@pobox.com> wrote:
>> Jens Lehmann <Jens.Lehmann@web.de> writes:
>>
>>> git submodule summary is providing similar functionality for submodules as
>>> git diff-index does for a git project (including the meaning of --cached).
>>> But the analogon to git diff-files is missing, so add a --files option to
>>> summarize the differences between the index of the super project and the
>>> last commit checked out in the working tree of the submodule.
>>>
>>> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
>> Makes sense to me. Comments?
>
> Acked-by: Lars Hjemli <hjemli@gmail.com> with a tiny fixup:
>
> --- a/Documentation/git-submodule.txt
> +++ b/Documentation/git-submodule.txt
> @@ -129,7 +129,7 @@ summary::
> in the submodule between the given super project commit and the
> index or working tree (switched by --cached) are shown. If the option
> --files is given, show the series of commits in the submodule between
> - the index of super project the and the working tree of the submodule
> + the index of the super project and the working tree of the submodule
> (this option doesn't allow to use the --cached option or to provide an
> explicit commit).
Yup, sentence this makes much more sense now ... :-)
Shall i send an updated patch?
Jens
^ permalink raw reply
* Re: [PATCH] git-log: allow --decorate[=short|full]
From: Lars Hjemli @ 2009-08-15 10:26 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <8c5c35580908150250y62b1042cmf6071016bac98a48@mail.gmail.com>
On Sat, Aug 15, 2009 at 11:50, Lars Hjemli<hjemli@gmail.com> wrote:
> This extension to --decorate makes it possible to generate decorations
> similar to pre-1.6.4 git, which is nice when the output from git-log
> is used by external tools.
BTW: the patch was made on top of current master (b2139dbd) - if
accepted, it might be considered for maint.
--
larsh
^ permalink raw reply
* Re: [PATCH v5 0/6] {checkout,reset,stash} --patch
From: Thomas Rast @ 2009-08-15 10:14 UTC (permalink / raw)
To: Junio C Hamano
Cc: Jeff King, git, Sverre Rabbelier, Nanako Shiraishi,
Nicolas Sebrecht, Pierre Habouzit
In-Reply-To: <7v4os9v7al.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> >> reset -p [HEAD] Reset this hunk? (**)
> >> reset -p other Apply this hunk to index? (**)
> >
> > This doesn't make sense to me.
>
> Not to me, either.
>
> Let's say you have modified $path and ran "git add $path" earlier.
>
> "reset -p -- $path" and "reset -p HEAD -- $path" both show what your index
> has relative to the commit you are resetting your index to and offer to
> "Unstage" [*1*]. This is consistent and feels natural.
>
> "reset -p HEAD^ -- $path" however shows the same forward diff (i.e. how
> your index is different compared to the commit HEAD^ you are resetting
> to), but offers to "Apply".
[...]
> Perhaps you meant to show a reverse diff and use the word
> "Apply".
Indeed.
> However, that would break down rather badly when HEAD did not change $path
> since HEAD^. Logically what the "reset -p" would do to $path is the same,
> but the patch shown and the operation offered to the user are opposite.
>
> You could compare HEAD and the commit you are resetting the index to and
> see if the path in question is different between the two commits, and
> switch the direction---if there is no change, you show forward diff and
> offer to "Remove this change out of the index", if there is a change, you
> show reverse diff and offer to "Apply this change to the index". But if
> the difference between HEAD and the commit you are resetting to does not
> overlap with the change you staged to the index earlier from your work
> tree, it is unclear such heuristics would yield a natural feel.
>
> So I actually think you may be better off if you consistently showed a
> forward diff (i.e. what patch would have been applied to the commit in
> question to bring the index into its current shape), and always offer
> "Remove this change out of the index?"
HEAD^ is not special. What do we do if the user resets to something
that is logically further progressed in time, perhaps another branch?
I just have a much better mental model of it as "apply <something> to
index" than if it said: here's some diff between whatever commit you
gave me, and your index; but I'm going to apply it reverse!
(v4 actually did it this way and I found it a bit confusing...)
> The same comment applies to "checkout -p HEAD" vs "checkout -p HEAD^".
> I think the latter shouldn't show a reverse diff and offer "Apply?";
> instead both should consitently show a forward diff (i.e. what patch would
> have been applied to the commit to bring your work tree into its current
> shape), and offer "Remove this change out of the index and the work tree?".
Again (and unlike in the reset case, I can actually see myself doing
this at times) the user could pass in a commit that is logically
newer than HEAD.
> *1* I actually have a slight problem with the use of word "Unstage" in
> this context; "to stage", at least to me, means "adding _from the work
> tree_ to the index", not just "modifying the index" from a random source.
> The command is resetting the index in this case from a tree-ish and there
> is no work tree involved, and the word "stage/unstage" feels out of place.
It's not using "unstage" any more if the commit is not HEAD. If it
is, then we're doing the opposite of 'add -p', so doesn't the term
apply then?
--
Thomas Rast
trast@{inf,student}.ethz.ch
^ permalink raw reply
* [PATCH 5/6] git stat -s: short status output
From: Junio C Hamano @ 2009-08-15 10:06 UTC (permalink / raw)
To: git; +Cc: Jeff King
In-Reply-To: <1250330803-22171-5-git-send-email-gitster@pobox.com>
Give -s(hort) option to "git stat" that shows the status of paths in a
more concise way.
XY PATH1 -> PATH2
format to be more machine readable than output from "git status", which is
about previewing of "git commit" with the same arguments.
PATH1 is the path in the HEAD, and " -> PATH2" part is shown only when
PATH1 corresponds to a different path in the index/worktree.
For unmerged entries, X shows the status of stage #2 (i.e. ours) and Y
shows the status of stage #3 (i.e. theirs). For entries that do not have
conflicts, X shows the status of the index, and Y shows the status of the
work tree. For untracked paths, XY are "??".
X Y Meaning
-------------------------------------------------
[MD] not updated
M [ MD] updated in index
A [ MD] added to index
D [ MD] deleted from index
R [ MD] renamed in index
C [ MD] copied in index
[MARC] index and work tree matches
[ MARC] M work tree changed since index
[ MARC] D deleted in work tree
D D unmerged, both deleted
A U unmerged, added by us
U D unmerged, deleted by them
U A unmerged, added by them
D U unmerged, deleted by us
A A unmerged, both added
U U unmerged, both modified
? ? untracked
When given -z option, the records are terminated by NUL characters for
better machine readability. Because the traditional long format is
designed for human consumption, NUL termination does not make sense.
For this reason, -z option implies -s (short output).
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Unlike what was in 'pu', -z now implies -s. I do not think the machine
readble -s format should use color, but I _could_ be talked into
coloring the output when -z is not used.
builtin-commit.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 103 insertions(+), 5 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 64ae45f..6d9bd84 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -898,11 +898,86 @@ static int git_status_config(const char *k, const char *v, void *cb)
return git_diff_ui_config(k, v, NULL);
}
+#define quote_path quote_path_relative
+
+static void short_unmerged(int null_termination, struct string_list_item *it,
+ struct wt_status *s)
+{
+ struct wt_status_change_data *d = it->util;
+ const char *how = "??";
+
+ switch (d->stagemask) {
+ case 1: how = "DD"; break; /* both deleted */
+ case 2: how = "AU"; break; /* added by us */
+ case 3: how = "UD"; break; /* deleted by them */
+ case 4: how = "UA"; break; /* added by them */
+ case 5: how = "DU"; break; /* deleted by us */
+ case 6: how = "AA"; break; /* both added */
+ case 7: how = "UU"; break; /* both modified */
+ }
+ printf("%s ", how);
+ if (null_termination) {
+ fprintf(stdout, "%s%c", it->string, 0);
+ } else {
+ struct strbuf onebuf = STRBUF_INIT;
+ const char *one;
+ one = quote_path(it->string, -1, &onebuf, s->prefix);
+ printf("%s\n", one);
+ strbuf_release(&onebuf);
+ }
+}
+
+static void short_status(int null_termination, struct string_list_item *it,
+ struct wt_status *s)
+{
+ struct wt_status_change_data *d = it->util;
+
+ printf("%c%c ",
+ !d->index_status ? ' ' : d->index_status,
+ !d->worktree_status ? ' ' : d->worktree_status);
+ if (null_termination) {
+ fprintf(stdout, "%s%c", it->string, 0);
+ if (d->head_path)
+ fprintf(stdout, "%s%c", d->head_path, 0);
+ } else {
+ struct strbuf onebuf = STRBUF_INIT;
+ const char *one;
+ if (d->head_path) {
+ one = quote_path(d->head_path, -1, &onebuf, s->prefix);
+ printf("%s -> ", one);
+ strbuf_release(&onebuf);
+ }
+ one = quote_path(it->string, -1, &onebuf, s->prefix);
+ printf("%s\n", one);
+ strbuf_release(&onebuf);
+ }
+}
+
+static void short_untracked(int null_termination, struct string_list_item *it,
+ struct wt_status *s)
+{
+ if (null_termination) {
+ fprintf(stdout, "?? %s%c", it->string, 0);
+ } else {
+ struct strbuf onebuf = STRBUF_INIT;
+ const char *one;
+ one = quote_path(it->string, -1, &onebuf, s->prefix);
+ printf("?? %s\n", one);
+ strbuf_release(&onebuf);
+ }
+}
+
int cmd_stat(int argc, const char **argv, const char *prefix)
{
struct wt_status s;
+ static int null_termination, shortstatus;
+ int i;
unsigned char sha1[20];
static struct option builtin_stat_options[] = {
+ OPT_BOOLEAN('s', "short", &shortstatus,
+ "show status concicely"),
+ OPT_BOOLEAN('z', "null", &null_termination,
+ "terminate entries with NUL"),
{ OPTION_STRING, 'u', "untracked-files", &untracked_files_arg,
"mode",
"show untracked files, optional modes: all, normal, no. (Default: all)",
@@ -910,6 +985,9 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
OPT_END(),
};
+ if (null_termination)
+ shortstatus = 1;
+
wt_status_prepare(&s);
git_config(git_status_config, &s);
argc = parse_options(argc, argv, prefix,
@@ -925,11 +1003,31 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
wt_status_collect(&s);
- if (s.use_color == -1)
- s.use_color = git_use_color_default;
- if (diff_use_color_default == -1)
- diff_use_color_default = git_use_color_default;
- wt_status_print_body(&s);
+ if (shortstatus) {
+ for (i = 0; i < s.change.nr; i++) {
+ struct wt_status_change_data *d;
+ struct string_list_item *it;
+
+ it = &(s.change.items[i]);
+ d = it->util;
+ if (d->stagemask)
+ short_unmerged(null_termination, it, &s);
+ else
+ short_status(null_termination, it, &s);
+ }
+ for (i = 0; i < s.untracked.nr; i++) {
+ struct string_list_item *it;
+
+ it = &(s.untracked.items[i]);
+ short_untracked(null_termination, it, &s);
+ }
+ } else {
+ if (s.use_color == -1)
+ s.use_color = git_use_color_default;
+ if (diff_use_color_default == -1)
+ diff_use_color_default = git_use_color_default;
+ wt_status_print_body(&s);
+ }
return 0;
}
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 6/6] git status: not "commit --dry-run" anymore
From: Junio C Hamano @ 2009-08-15 10:06 UTC (permalink / raw)
To: git; +Cc: Jeff King
In-Reply-To: <1250330803-22171-6-git-send-email-gitster@pobox.com>
This removes tentative "git stat" and make it take over "git status".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Documentation/git-status.txt | 79 ++++++++++++++++++++++++++++++++++++-----
builtin-commit.c | 29 ++-------------
builtin.h | 1 -
git.c | 1 -
4 files changed, 73 insertions(+), 37 deletions(-)
diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index 84f60f3..b5939d6 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -8,7 +8,7 @@ git-status - Show the working tree status
SYNOPSIS
--------
-'git status' <options>...
+'git status' [<options>...] [--] [<pathspec>...]
DESCRIPTION
-----------
@@ -20,25 +20,85 @@ are what you _would_ commit by running `git commit`; the second and
third are what you _could_ commit by running 'git-add' before running
`git commit`.
-The command takes the same set of options as 'git-commit'; it
-shows what would be committed if the same options are given to
-'git-commit'.
-
-If there is no path that is different between the index file and
-the current HEAD commit (i.e., there is nothing to commit by running
-`git commit`), the command exits with non-zero status.
+OPTIONS
+-------
+
+-s::
+--short::
+ Give the output in the short-format.
+
+-u[<mode>]::
+--untracked-files[=<mode>]::
+ Show untracked files (Default: 'all').
++
+The mode parameter is optional, and is used to specify
+the handling of untracked files. The possible options are:
++
+--
+ - 'no' - Show no untracked files
+ - 'normal' - Shows untracked files and directories
+ - 'all' - Also shows individual files in untracked directories.
+--
++
+See linkgit:git-config[1] for configuration variable
+used to change the default for when the option is not
+specified.
+
+-z::
+ Terminate entries with NUL, instead of LF. This implies `-s`
+ (short status) output format.
OUTPUT
------
The output from this command is designed to be used as a commit
template comment, and all the output lines are prefixed with '#'.
+The default, long format, is designed to be human readable,
+verbose and descriptive. They are subject to change in any time.
The paths mentioned in the output, unlike many other git commands, are
made relative to the current directory if you are working in a
subdirectory (this is on purpose, to help cutting and pasting). See
the status.relativePaths config option below.
+In short-format, the status of each path is shown as
+
+ XY PATH1 -> PATH2
+
+where `PATH1` is the path in the `HEAD`, and ` -> PATH2` part is
+shown only when `PATH1` corresponds to a different path in the
+index/worktree (i.e. renamed).
+
+For unmerged entries, `X` shows the status of stage #2 (i.e. ours) and `Y`
+shows the status of stage #3 (i.e. theirs).
+
+For entries that do not have conflicts, `X` shows the status of the index,
+and `Y` shows the status of the work tree. For untracked paths, `XY` are
+`??`.
+
+ X Y Meaning
+ -------------------------------------------------
+ [MD] not updated
+ M [ MD] updated in index
+ A [ MD] added to index
+ D [ MD] deleted from index
+ R [ MD] renamed in index
+ C [ MD] copied in index
+ [MARC] index and work tree matches
+ [ MARC] M work tree changed since index
+ [ MARC] D deleted in work tree
+ -------------------------------------------------
+ D D unmerged, both deleted
+ A U unmerged, added by us
+ U D unmerged, deleted by them
+ U A unmerged, added by them
+ D U unmerged, deleted by us
+ A A unmerged, both added
+ U U unmerged, both modified
+ -------------------------------------------------
+ ? ? untracked
+ -------------------------------------------------
+
CONFIGURATION
-------------
@@ -63,8 +123,7 @@ linkgit:gitignore[5]
Author
------
-Written by Linus Torvalds <torvalds@osdl.org> and
-Junio C Hamano <gitster@pobox.com>.
+Written by Junio C Hamano <gitster@pobox.com>.
Documentation
--------------
diff --git a/builtin-commit.c b/builtin-commit.c
index 6d9bd84..efbcd16 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -36,11 +36,6 @@ static const char * const builtin_status_usage[] = {
NULL
};
-static const char * const builtin_stat_usage[] = {
- "git stat [options]",
- NULL
-};
-
static unsigned char head_sha1[20], merge_head_sha1[20];
static char *use_message_buffer;
static const char commit_editmsg[] = "COMMIT_EDITMSG";
@@ -967,13 +962,13 @@ static void short_untracked(int null_termination, struct string_list_item *it,
}
}
-int cmd_stat(int argc, const char **argv, const char *prefix)
+int cmd_status(int argc, const char **argv, const char *prefix)
{
struct wt_status s;
static int null_termination, shortstatus;
int i;
unsigned char sha1[20];
- static struct option builtin_stat_options[] = {
+ static struct option builtin_status_options[] = {
OPT_BOOLEAN('s', "short", &shortstatus,
"show status concicely"),
OPT_BOOLEAN('z', "null", &null_termination,
@@ -991,8 +986,8 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
wt_status_prepare(&s);
git_config(git_status_config, &s);
argc = parse_options(argc, argv, prefix,
- builtin_stat_options,
- builtin_stat_usage, 0);
+ builtin_status_options,
+ builtin_status_usage, 0);
handle_untracked_files_arg(&s);
if (*argv)
@@ -1031,22 +1026,6 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
return 0;
}
-int cmd_status(int argc, const char **argv, const char *prefix)
-{
- struct wt_status s;
-
- wt_status_prepare(&s);
- git_config(git_status_config, &s);
- if (s.use_color == -1)
- s.use_color = git_use_color_default;
- if (diff_use_color_default == -1)
- diff_use_color_default = git_use_color_default;
-
- argc = parse_and_validate_options(argc, argv, builtin_status_usage,
- prefix, &s);
- return dry_run_commit(argc, argv, prefix, &s);
-}
-
static void print_summary(const char *prefix, const unsigned char *sha1)
{
struct rev_info rev;
diff --git a/builtin.h b/builtin.h
index eeaf0b6..20427d2 100644
--- a/builtin.h
+++ b/builtin.h
@@ -95,7 +95,6 @@ extern int cmd_send_pack(int argc, const char **argv, const char *prefix);
extern int cmd_shortlog(int argc, const char **argv, const char *prefix);
extern int cmd_show(int argc, const char **argv, const char *prefix);
extern int cmd_show_branch(int argc, const char **argv, const char *prefix);
-extern int cmd_stat(int argc, const char **argv, const char *prefix);
extern int cmd_status(int argc, const char **argv, const char *prefix);
extern int cmd_stripspace(int argc, const char **argv, const char *prefix);
extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index de7fcf6..807d875 100644
--- a/git.c
+++ b/git.c
@@ -350,7 +350,6 @@ static void handle_internal_command(int argc, const char **argv)
{ "shortlog", cmd_shortlog, USE_PAGER },
{ "show-branch", cmd_show_branch, RUN_SETUP },
{ "show", cmd_show, RUN_SETUP | USE_PAGER },
- { "stat", cmd_stat, RUN_SETUP | NEED_WORK_TREE },
{ "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
{ "stripspace", cmd_stripspace },
{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 4/6] git stat: pathspec limits, unlike traditional "git status"
From: Junio C Hamano @ 2009-08-15 10:06 UTC (permalink / raw)
To: git; +Cc: Jeff King
In-Reply-To: <1250330803-22171-4-git-send-email-gitster@pobox.com>
The "git stat" command is not "preview of commit with the same arguments";
the path parameters are not paths to be added to the pristine index (aka
"--only" option), but are taken as pathspecs to limit the output.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Unchanged since what has been queued in 'pu'. This should probably be
squashed to the previous one in the final form after review.
builtin-commit.c | 3 +++
wt-status.c | 6 ++++++
wt-status.h | 1 +
3 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 0ef7c8f..64ae45f 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -917,6 +917,9 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
builtin_stat_usage, 0);
handle_untracked_files_arg(&s);
+ if (*argv)
+ s.pathspec = get_pathspec(prefix, argv);
+
read_cache();
refresh_cache(REFRESH_QUIET|REFRESH_UNMERGED);
s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
diff --git a/wt-status.c b/wt-status.c
index c887a90..11db07e 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -269,6 +269,7 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)
rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = wt_status_collect_changed_cb;
rev.diffopt.format_callback_data = s;
+ rev.prune_data = s->pathspec;
run_diff_files(&rev, 0);
}
@@ -285,6 +286,7 @@ static void wt_status_collect_changes_index(struct wt_status *s)
rev.diffopt.detect_rename = 1;
rev.diffopt.rename_limit = 200;
rev.diffopt.break_opt = 0;
+ rev.prune_data = s->pathspec;
run_diff_index(&rev, 1);
}
@@ -297,6 +299,8 @@ static void wt_status_collect_changes_initial(struct wt_status *s)
struct wt_status_change_data *d;
struct cache_entry *ce = active_cache[i];
+ if (!ce_path_match(ce, s->pathspec))
+ continue;
it = string_list_insert(ce->name, &s->change);
d = it->util;
if (!d) {
@@ -330,6 +334,8 @@ static void wt_status_collect_untracked(struct wt_status *s)
struct dir_entry *ent = dir.entries[i];
if (!cache_name_is_other(ent->name, ent->len))
continue;
+ if (!match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))
+ continue;
s->workdir_untracked = 1;
string_list_insert(ent->name, &s->untracked);
}
diff --git a/wt-status.h b/wt-status.h
index ab52ce1..4bc1a59 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -31,6 +31,7 @@ struct wt_status {
int is_initial;
char *branch;
const char *reference;
+ const char **pathspec;
int verbose;
int amend;
int nowarn;
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 3/6] git stat: the beginning
From: Junio C Hamano @ 2009-08-15 10:06 UTC (permalink / raw)
To: git; +Cc: Jeff King
In-Reply-To: <1250330803-22171-3-git-send-email-gitster@pobox.com>
Tentatively add "git stat" as a new command. This does not munge the
index with paths parameters before showing the status like "git status"
does. In later rounds, we will take path parameters as pathspec to limit
the output.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* The change since the version cooking in 'pu' is that the long format
honors the color (both "status" colors and "diff" colors).
Makefile | 1 +
builtin-commit.c | 64 +++++++++++++++++++++++++++++++++++++++++++++--------
builtin.h | 1 +
git.c | 1 +
wt-status.c | 23 +++++++++++-------
wt-status.h | 1 +
6 files changed, 72 insertions(+), 19 deletions(-)
diff --git a/Makefile b/Makefile
index daf4296..39dd334 100644
--- a/Makefile
+++ b/Makefile
@@ -378,6 +378,7 @@ BUILT_INS += git-init$X
BUILT_INS += git-merge-subtree$X
BUILT_INS += git-peek-remote$X
BUILT_INS += git-repo-config$X
+BUILT_INS += git-stat$X
BUILT_INS += git-show$X
BUILT_INS += git-stage$X
BUILT_INS += git-status$X
diff --git a/builtin-commit.c b/builtin-commit.c
index 200ffda..0ef7c8f 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -24,6 +24,7 @@
#include "string-list.h"
#include "rerere.h"
#include "unpack-trees.h"
+#include "quote.h"
static const char * const builtin_commit_usage[] = {
"git commit [options] [--] <filepattern>...",
@@ -35,6 +36,11 @@ static const char * const builtin_status_usage[] = {
NULL
};
+static const char * const builtin_stat_usage[] = {
+ "git stat [options]",
+ NULL
+};
+
static unsigned char head_sha1[20], merge_head_sha1[20];
static char *use_message_buffer;
static const char commit_editmsg[] = "COMMIT_EDITMSG";
@@ -691,6 +697,21 @@ static const char *find_author_by_nickname(const char *name)
die("No existing author found with '%s'", name);
}
+
+static void handle_untracked_files_arg(struct wt_status *s)
+{
+ if (!untracked_files_arg)
+ ; /* default already initialized */
+ else if (!strcmp(untracked_files_arg, "no"))
+ s->show_untracked_files = SHOW_NO_UNTRACKED_FILES;
+ else if (!strcmp(untracked_files_arg, "normal"))
+ s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
+ else if (!strcmp(untracked_files_arg, "all"))
+ s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
+ else
+ die("Invalid untracked files mode '%s'", untracked_files_arg);
+}
+
static int parse_and_validate_options(int argc, const char *argv[],
const char * const usage[],
const char *prefix,
@@ -794,16 +815,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
else
die("Invalid cleanup mode %s", cleanup_arg);
- if (!untracked_files_arg)
- ; /* default already initialized */
- else if (!strcmp(untracked_files_arg, "no"))
- s->show_untracked_files = SHOW_NO_UNTRACKED_FILES;
- else if (!strcmp(untracked_files_arg, "normal"))
- s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
- else if (!strcmp(untracked_files_arg, "all"))
- s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
- else
- die("Invalid untracked files mode '%s'", untracked_files_arg);
+ handle_untracked_files_arg(s);
if (all && argc > 0)
die("Paths with -a does not make sense.");
@@ -886,6 +898,38 @@ static int git_status_config(const char *k, const char *v, void *cb)
return git_diff_ui_config(k, v, NULL);
}
+int cmd_stat(int argc, const char **argv, const char *prefix)
+{
+ struct wt_status s;
+ unsigned char sha1[20];
+ static struct option builtin_stat_options[] = {
+ { OPTION_STRING, 'u', "untracked-files", &untracked_files_arg,
+ "mode",
+ "show untracked files, optional modes: all, normal, no. (Default: all)",
+ PARSE_OPT_OPTARG, NULL, (intptr_t)"all" },
+ OPT_END(),
+ };
+
+ wt_status_prepare(&s);
+ git_config(git_status_config, &s);
+ argc = parse_options(argc, argv, prefix,
+ builtin_stat_options,
+ builtin_stat_usage, 0);
+ handle_untracked_files_arg(&s);
+
+ read_cache();
+ refresh_cache(REFRESH_QUIET|REFRESH_UNMERGED);
+ s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
+ wt_status_collect(&s);
+
+ if (s.use_color == -1)
+ s.use_color = git_use_color_default;
+ if (diff_use_color_default == -1)
+ diff_use_color_default = git_use_color_default;
+ wt_status_print_body(&s);
+ return 0;
+}
+
int cmd_status(int argc, const char **argv, const char *prefix)
{
struct wt_status s;
diff --git a/builtin.h b/builtin.h
index 20427d2..eeaf0b6 100644
--- a/builtin.h
+++ b/builtin.h
@@ -95,6 +95,7 @@ extern int cmd_send_pack(int argc, const char **argv, const char *prefix);
extern int cmd_shortlog(int argc, const char **argv, const char *prefix);
extern int cmd_show(int argc, const char **argv, const char *prefix);
extern int cmd_show_branch(int argc, const char **argv, const char *prefix);
+extern int cmd_stat(int argc, const char **argv, const char *prefix);
extern int cmd_status(int argc, const char **argv, const char *prefix);
extern int cmd_stripspace(int argc, const char **argv, const char *prefix);
extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index 807d875..de7fcf6 100644
--- a/git.c
+++ b/git.c
@@ -350,6 +350,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "shortlog", cmd_shortlog, USE_PAGER },
{ "show-branch", cmd_show_branch, RUN_SETUP },
{ "show", cmd_show, RUN_SETUP | USE_PAGER },
+ { "stat", cmd_stat, RUN_SETUP | NEED_WORK_TREE },
{ "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
{ "stripspace", cmd_stripspace },
{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
diff --git a/wt-status.c b/wt-status.c
index 63598ce..c887a90 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -531,6 +531,19 @@ static void wt_status_print_tracking(struct wt_status *s)
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
}
+void wt_status_print_body(struct wt_status *s)
+{
+ wt_status_print_unmerged(s);
+ wt_status_print_updated(s);
+ wt_status_print_changed(s);
+ if (s->submodule_summary)
+ wt_status_print_submodule_summary(s);
+ if (s->show_untracked_files)
+ wt_status_print_untracked(s);
+ else if (s->commitable)
+ fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
+}
+
void wt_status_print(struct wt_status *s)
{
unsigned char sha1[20];
@@ -561,15 +574,7 @@ void wt_status_print(struct wt_status *s)
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
}
- wt_status_print_unmerged(s);
- wt_status_print_updated(s);
- wt_status_print_changed(s);
- if (s->submodule_summary)
- wt_status_print_submodule_summary(s);
- if (s->show_untracked_files)
- wt_status_print_untracked(s);
- else if (s->commitable)
- fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
+ wt_status_print_body(s);
if (s->verbose)
wt_status_print_verbose(s);
diff --git a/wt-status.h b/wt-status.h
index a0e7517..ab52ce1 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -54,5 +54,6 @@ struct wt_status {
void wt_status_prepare(struct wt_status *s);
void wt_status_print(struct wt_status *s);
void wt_status_collect(struct wt_status *s);
+void wt_status_print_body(struct wt_status *s);
#endif /* STATUS_H */
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 1/6] Documentation/git-commit.txt: describe --dry-run
From: Junio C Hamano @ 2009-08-15 10:06 UTC (permalink / raw)
To: git; +Cc: Jeff King
In-Reply-To: <1250330803-22171-1-git-send-email-gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* The --dry-run option is already in 'next', but haven't been described.
Documentation/git-commit.txt | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index d01ff5a..64f94cf 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -9,7 +9,7 @@ SYNOPSIS
--------
[verse]
'git commit' [-a | --interactive] [-s] [-v] [-u<mode>] [--amend] [--dry-run]
- [(-c | -C) <commit>] [-F <file> | -m <msg>]
+ [(-c | -C) <commit>] [-F <file> | -m <msg>] [--dry-run]
[--allow-empty] [--no-verify] [-e] [--author=<author>]
[--cleanup=<mode>] [--] [[-i | -o ]<file>...]
@@ -42,10 +42,9 @@ The content to be added can be specified in several ways:
by one which files should be part of the commit, before finalizing the
operation. Currently, this is done by invoking 'git-add --interactive'.
-The 'git-status' command can be used to obtain a
+The `--dry-run` option can be used to obtain a
summary of what is included by any of the above for the next
-commit by giving the same set of parameters you would give to
-this command.
+commit by giving the same set of parameters (options and paths).
If you make a commit and then find a mistake immediately after
that, you can recover from it with 'git-reset'.
@@ -70,6 +69,12 @@ OPTIONS
Like '-C', but with '-c' the editor is invoked, so that
the user can further edit the commit message.
+--dry-run::
+ Do not actually make a commit, but show the list of paths
+ with updates in the index, paths with changes in the work tree,
+ and paths that are untracked, similar to the one that is given
+ in the commit log editor.
+
-F <file>::
--file=<file>::
Take the commit message from the given file. Use '-' to
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 2/6] git commit --dry-run -v: show diff in color when asked
From: Junio C Hamano @ 2009-08-15 10:06 UTC (permalink / raw)
To: git; +Cc: Jeff King
In-Reply-To: <1250330803-22171-2-git-send-email-gitster@pobox.com>
The earlier implementation of --dry-run didn't duplicate the use of color
"git status -v" set up for diff output.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Fixes what is already queued in 'next'.
builtin-commit.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 1c200eb..200ffda 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -979,9 +979,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
argc = parse_and_validate_options(argc, argv, builtin_commit_usage,
prefix, &s);
- if (dry_run)
+ if (dry_run) {
+ if (diff_use_color_default == -1)
+ diff_use_color_default = git_use_color_default;
return dry_run_commit(argc, argv, prefix, &s);
-
+ }
index_file = prepare_index(argc, argv, prefix, 0);
/* Set up everything for writing the commit object. This includes
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 0/6] "git commit --dry-run" updates
From: Junio C Hamano @ 2009-08-15 10:06 UTC (permalink / raw)
To: git; +Cc: Jeff King
The first patch describes --dry-run option, and stops mentioning the
equivalence to "git status" in the documentation for "git commit".
The second one fixes "git commit --dry-run -v", which did not show the
diff text in color when asked with the configuration.
The third and the fourth ones tentatively introduce "git stat". The
former is an incomplete implementation that ignores the pathspec, and the
latter adds pathspec limiting to it. In the final form before it goes to
'next', these two should probably be squashed.
The fifth one introduces "git stat -s" (short output format) that is
designed to be machine readable, especially with -z (NUL termination).
The sixth one renames "git stat" to take over the traditional "git status"
and obviously is a 1.7.0 material.
The tests still have breakages that future updates to the sixth patch need
to fix. t4030 still assumes "git status" is "git commit --dry-run" and
expects it to take "-v" to produce diffs, for example.
^ permalink raw reply
* Re: [PATCH v5 0/6] {checkout,reset,stash} --patch
From: Thomas Rast @ 2009-08-15 10:04 UTC (permalink / raw)
To: Jeff King
Cc: Junio C Hamano, git, Sverre Rabbelier, Nanako Shiraishi,
Nicolas Sebrecht, Pierre Habouzit
In-Reply-To: <20090815065125.GA23068@coredump.intra.peff.net>
Jeff King wrote:
> > reset -p other Apply this hunk to index? (**)
>
> This doesn't make sense to me. For example:
[...]
> The hunk is _already_ in the index. You are really asking to remove it
> from the index. So shouldn't it say something like "Unstage this hunk"
> or "Remove this hunk from the index"?
>
> Or did you intend to reverse the diff, as with "checkout -p" below?
Yes, sorry :-( I apparently managed to forget the reversing here and
never noticed. I'll make a fixed patch 4/6 today.
> > checkout -p HEAD Discard this hunk from index and worktree? (**)
>
> Good. I like how it clarifies what is being touched.
>
> > checkout -p other Apply this hunk to index and worktree? (**)
>
> I really expected this to just be the same as the "HEAD" case. That is,
> with "git checkout -p HEAD", you are saying "I'm not interested in these
> bits, discard to return back to HEAD". So if I do "git checkout -p
> HEAD^", that is conceptually the same thing, except going back further
> in time.
>
> But I guess you are thinking of it as "pull these changes out of
> 'other'", in which case showing the reverse diff makes sense.
>
> I think this may be a situation where the user has one of two mental
> models in issuing the command, and we don't necessarily know which. So I
> guess what you have is fine, but I wanted to register my surprise.
Well, as I said earlier in the thread I'd hate to reverse the
direction of plain "{reset,checkout,stash} -p" because I want them to
show hunks that match visually.
But then my mental model of "checkout other -- file" is already of the
sort "fetch me the contents of 'file' from 'other'", and I think I use
it about as frequently in a forward as in a backward application. And
I just felt it would be easier to mentally go over the consequences if
it shoed the diff the other way.
(I'm sufficiently confused about which way is back that I think I'll
just stop saying "backward"...)
> > stash -p Stash this hunk?
>
> Getting greedy, is there a reason not to have "stash apply -p" as well?
Should be doable, I'll look at it.
--
Thomas Rast
trast@{inf,student}.ethz.ch
^ permalink raw reply
* [PATCH] git-log: allow --decorate[=short|full]
From: Lars Hjemli @ 2009-08-15 9:50 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
This extension to --decorate makes it possible to generate decorations
similar to pre-1.6.4 git, which is nice when the output from git-log
is used by external tools.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
Documentation/git-log.txt | 6 ++++--
builtin-log.c | 12 ++++++++++--
log-tree.c | 7 ++++---
log-tree.h | 2 +-
pretty.c | 2 +-
revision.c | 2 +-
revision.h | 6 +++++-
t/t4013-diff-various.sh | 1 +
...corate_--all => diff.log_--decorate=full_--all} | 8 ++++----
9 files changed, 31 insertions(+), 15 deletions(-)
copy t/t4013/{diff.log_--decorate_--all =>
diff.log_--decorate=full_--all} (72%)
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index 34cf4e5..451839c 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -37,8 +37,10 @@ include::diff-options.txt[]
and <until>, see "SPECIFYING REVISIONS" section in
linkgit:git-rev-parse[1].
---decorate::
- Print out the ref names of any commits that are shown.
+--decorate[=short|full]::
+ Print out the ref names of any commits that are shown. If 'short' is
+ specified, the ref names will be shortened, and if 'full' is specified,
+ the ref names will not be shortened. The default option is 'short'.
--source::
Print out the ref name given on the command line by which each
diff --git a/builtin-log.c b/builtin-log.c
index 3817bf1..cb886d8 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -61,8 +61,14 @@ static void cmd_log_init(int argc, const char
**argv, const char *prefix,
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
if (!strcmp(arg, "--decorate")) {
- load_ref_decorations();
- rev->show_decorations = 1;
+ rev->show_decorations = DECORATE_SHORT_REFS;
+ } else if (!strncmp(arg, "--decorate=", 11)) {
+ if (!strcmp(arg + 11, "full"))
+ rev->show_decorations = DECORATE_FULL_REFS;
+ else if (!strcmp(arg + 11, "short"))
+ rev->show_decorations = DECORATE_SHORT_REFS;
+ else
+ die("invalid --decorate option: %s", arg + 11);
} else if (!strcmp(arg, "--source")) {
rev->show_source = 1;
} else if (!strcmp(arg, "-h")) {
@@ -70,6 +76,8 @@ static void cmd_log_init(int argc, const char
**argv, const char *prefix,
} else
die("unrecognized argument: %s", arg);
}
+ if (rev->show_decorations)
+ load_ref_decorations(rev->show_decorations);
}
/*
diff --git a/log-tree.c b/log-tree.c
index 6f73c17..70223eb 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -25,7 +25,8 @@ static int add_ref_decoration(const char *refname,
const unsigned char *sha1, in
struct object *obj = parse_object(sha1);
if (!obj)
return 0;
- refname = prettify_refname(refname);
+ if (!cb_data || *(int *)cb_data & DECORATE_SHORT_REFS)
+ refname = prettify_refname(refname);
add_name_decoration("", refname, obj);
while (obj->type == OBJ_TAG) {
obj = ((struct tag *)obj)->tagged;
@@ -36,12 +37,12 @@ static int add_ref_decoration(const char *refname,
const unsigned char *sha1, in
return 0;
}
-void load_ref_decorations(void)
+void load_ref_decorations(int flags)
{
static int loaded;
if (!loaded) {
loaded = 1;
- for_each_ref(add_ref_decoration, NULL);
+ for_each_ref(add_ref_decoration, &flags);
}
}
diff --git a/log-tree.h b/log-tree.h
index 20b5caf..3f7b400 100644
--- a/log-tree.h
+++ b/log-tree.h
@@ -17,7 +17,7 @@ void log_write_email_headers(struct rev_info *opt,
struct commit *commit,
const char **subject_p,
const char **extra_headers_p,
int *need_8bit_cte_p);
-void load_ref_decorations(void);
+void load_ref_decorations(int flags);
#define FORMAT_PATCH_NAME_MAX 64
void get_patch_filename(struct commit *commit, int nr, const char *suffix,
diff --git a/pretty.c b/pretty.c
index e5328da..daa721b 100644
--- a/pretty.c
+++ b/pretty.c
@@ -571,7 +571,7 @@ static void format_decoration(struct strbuf *sb,
const struct commit *commit)
struct name_decoration *d;
const char *prefix = " (";
- load_ref_decorations();
+ load_ref_decorations(DECORATE_SHORT_REFS);
d = lookup_decoration(&name_decoration, &commit->object);
while (d) {
strbuf_addstr(sb, prefix);
diff --git a/revision.c b/revision.c
index 9f5dac5..ce24ad9 100644
--- a/revision.c
+++ b/revision.c
@@ -1052,7 +1052,7 @@ static int handle_revision_opt(struct rev_info
*revs, int argc, const char **arg
revs->simplify_by_decoration = 1;
revs->limited = 1;
revs->prune = 1;
- load_ref_decorations();
+ load_ref_decorations(DECORATE_SHORT_REFS);
} else if (!strcmp(arg, "--date-order")) {
revs->lifo = 0;
revs->topo_order = 1;
diff --git a/revision.h b/revision.h
index fb74492..16e65f6 100644
--- a/revision.h
+++ b/revision.h
@@ -15,6 +15,10 @@
#define SYMMETRIC_LEFT (1u<<8)
#define ALL_REV_FLAGS ((1u<<9)-1)
+
+#define DECORATE_SHORT_REFS 1
+#define DECORATE_FULL_REFS 2
+
struct rev_info;
struct log_info;
@@ -56,7 +60,7 @@ struct rev_info {
rewrite_parents:1,
print_parents:1,
show_source:1,
- show_decorations:1,
+ show_decorations:2,
reverse:1,
reverse_output_stage:1,
cherry_pick:1,
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 8b33321..8e3694e 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -207,6 +207,7 @@ log --root --cc --patch-with-stat --summary master
log -SF master
log -SF -p master
log --decorate --all
+log --decorate=full --all
rev-list --parents HEAD
rev-list --children HEAD
diff --git a/t/t4013/diff.log_--decorate_--all
b/t/t4013/diff.log_--decorate=full_--all
similarity index 72%
copy from t/t4013/diff.log_--decorate_--all
copy to t/t4013/diff.log_--decorate=full_--all
index 954210e..903d9d9 100644
--- a/t/t4013/diff.log_--decorate_--all
+++ b/t/t4013/diff.log_--decorate=full_--all
@@ -1,12 +1,12 @@
-$ git log --decorate --all
-commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (master)
+$ git log --decorate=full --all
+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (refs/heads/master)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000
Merge branch 'side'
-commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a (side)
+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a (refs/heads/side)
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000
@@ -26,7 +26,7 @@ Date: Mon Jun 26 00:01:00 2006 +0000
This is the second commit.
-commit 444ac553ac7612cc88969031b02b3767fb8a353a (initial)
+commit 444ac553ac7612cc88969031b02b3767fb8a353a (refs/heads/initial)
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000
--
1.6.4.135.g4e5b
^ permalink raw reply related
* Re: jc/shortstatus
From: Jeff King @ 2009-08-15 8:45 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7v8whltrqj.fsf@alter.siamese.dyndns.org>
On Sat, Aug 15, 2009 at 01:18:28AM -0700, Junio C Hamano wrote:
> It is handy to have both available while asking others help debugging the
> version in 'pu', and that is the only reason for the separate command. It
> could have been named 'git frotz' for all I care ;-)
>
> I do not intend to make it another "git merge-recur"; I would actually
> want to have it replace "status" before the series goes to 'next'.
Ah, OK. I thought we were going to live through 1.6.5 with the dual
commands. But if it is going to be "status", I don't care at all what it
is called in the interim. :)
> - What should its exit code be? Should it be consistent with the
> traditional "git status" at least when no paths are given, signallying
> failure when nothing is staged for committing, so that ancient out of
> tree scripts people may have written would not break too badly when we
> make the switch?
If I were designing it from scratch, I would say the exit code should be
the opposite. That is, it is really about doing several diffs, and if
there are no changes, then we should, like diff, exit zero.
If you want to know whether there is something to commit, you wouldn't
to use this tool. If you just want to know if there is something in the
index to commit, you would use diff-index. If you want to see if
some set of commit parameters would make a commit, you would use "commit
--dry-run".
So really there is only the historical argument. I am inclined not to
worry about it. We are already breaking compatibility in other ways
(like how command line parameters are treated), so you are really only
helping people whose scripts use a subset of the current "git status"
functionality. And since this is the time for breaking, I think it's
best to make all of the changes we want, and not have another
half-breakage later.
> - What should its default mode of output be? Do people prefer "svn st"
> style short-format output, or should we stay verbose and explanatory?
Personally I prefer the long format, but maybe just because I'm used to
it. I suspect others want the short format. This really should be a
porcelain command[1], so I don't see a problem with a
status.outputformat config option.
[1] One can, after all, call diff-index, diff-files, and "ls-files -o"
to get the same information from plumbing. If we really want to provide
plumbing that pulls them all together (e.g., because it is more
efficient or more convenient to do it all in one command), then I think
we should provide "git status --porcelain".
> - Is it handling corner cases correctly? e.g. Does it operate correctly
> when run from a subdirectory? How should it handle submodules? Before
> the initial commit? Use of colors?
I'll try out a few things, but I think largely we will need to put it in
"next" to shake out any bugs.
-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