Merge branch 'master' into next

* master: (32 commits)
  t/t3415: use && where applicable.
  SubmittingPatches: Document some extra tags used in commit messages
  diffcore-pickaxe.c: a void function shouldn't try to return something
  Make test script t9157 executable
  Martin Langhoff has a new e-mail address
  Documentation/git-clone: describe --mirror more verbosely
  do not depend on signed integer overflow
  work around buggy S_ISxxx(m) implementations
  xdiff: cast arguments for ctype functions to unsigned char
  init: plug tiny one-time memory leak
  diffcore-pickaxe.c: remove unnecessary curly braces
  t3020 (ls-files-error-unmatch): remove stray '1' from end of file
  setup: make sure git dir path is in a permanent buffer
  environment.c: remove unused variable
  Add MinGW-specific execv() override.
  Fix Windows-specific macro redefinition warning.
  Fix 'clone' failure at DOS root directory.
  mingw: do not crash on open(NULL, ...)
  git-am: fix detection of absolute paths for windows
  Side-step MSYS-specific path "corruption" leading to t5560 failure.
  ...
This commit is contained in:
Junio C Hamano
2010-10-06 13:50:20 -07:00
36 changed files with 285 additions and 97 deletions

View File

@@ -36,7 +36,7 @@ Lars Doelle <lars.doelle@on-line ! de>
Lars Doelle <lars.doelle@on-line.de>
Li Hong <leehong@pku.edu.cn>
Lukas Sandström <lukass@etek.chalmers.se>
Martin Langhoff <martin@catalyst.net.nz>
Martin Langhoff <martin@laptop.org>
Michael Coleman <tutufan@gmail.com>
Michael J Gruber <git@drmicha.warpmail.net> <michaeljgruber+gmane@fastmail.fm>
Michael W. Olson <mwolson@gnu.org>

View File

@@ -264,12 +264,21 @@ the change to its true author (see (2) above).
Also notice that a real name is used in the Signed-off-by: line. Please
don't hide your real name.
Some people also put extra tags at the end.
If you like, you can put extra tags at the end:
"Acked-by:" says that the patch was reviewed by the person who
is more familiar with the issues and the area the patch attempts
to modify. "Tested-by:" says the patch was tested by the person
and found to have the desired effect.
1. "Reported-by:" is used to to credit someone who found the bug that
the patch attempts to fix.
2. "Acked-by:" says that the person who is more familiar with the area
the patch attempts to modify liked the patch.
3. "Reviewed-by:", unlike the other tags, can only be offered by the
reviewer and means that she is completely satisfied that the patch
is ready for application. It is usually offered only after a
detailed review.
4. "Tested-by:" is used to indicate that the person applied the patch
and found it to have the desired effect.
You can also create your own tag or use one that's in common usage
such as "Thanks-to:", "Based-on-patch-by:", or "Mentored-by:".
------------------------------------------------
An ideal patch flow

View File

@@ -109,7 +109,7 @@ OPTIONS
Author
------
Written by Martin Langhoff <martin@catalyst.net.nz>.
Written by Martin Langhoff <martin@laptop.org>.
Documentation
--------------

View File

@@ -128,7 +128,12 @@ objects from the source repository into a pack in the cloned repository.
configuration variables are created.
--mirror::
Set up a mirror of the remote repository. This implies `--bare`.
Set up a mirror of the source repository. This implies `--bare`.
Compared to `--bare`, `--mirror` not only maps local branches of the
source to local branches of the target, it maps all refs (including
remote branches, notes etc.) and sets up a refspec configuration such
that all these refs are overwritten by a `git remote update` in the
target repository.
--origin <name>::
-o <name>::

View File

@@ -114,11 +114,11 @@ $ git cherry cvshead myhead | sed -n 's/^+ //p' | xargs -l1 git cvsexportcommit
Author
------
Written by Martin Langhoff <martin@catalyst.net.nz> and others.
Written by Martin Langhoff <martin@laptop.org> and others.
Documentation
--------------
Documentation by Martin Langhoff <martin@catalyst.net.nz> and others.
Documentation by Martin Langhoff <martin@laptop.org> and others.
GIT
---

View File

@@ -399,13 +399,13 @@ This program is copyright The Open University UK - 2006.
Authors:
- Martyn Smith <martyn@catalyst.net.nz>
- Martin Langhoff <martin@catalyst.net.nz>
- Martin Langhoff <martin@laptop.org>
with ideas and patches from participants of the git-list <git@vger.kernel.org>.
Documentation
--------------
Documentation by Martyn Smith <martyn@catalyst.net.nz>, Martin Langhoff <martin@catalyst.net.nz>, and Matthias Urlichs <smurf@smurf.noris.de>.
Documentation by Martyn Smith <martyn@catalyst.net.nz>, Martin Langhoff <martin@laptop.org>, and Matthias Urlichs <smurf@smurf.noris.de>.
GIT
---

View File

@@ -56,6 +56,8 @@ COMMANDS
as well, they take precedence.
--no-metadata;;
Set the 'noMetadata' option in the [svn-remote] config.
This option is not recommended, please read the 'svn.noMetadata'
section of this manpage before using this option.
--use-svm-props;;
Set the 'useSvmProps' option in the [svn-remote] config.
--use-svnsync-props;;
@@ -597,13 +599,22 @@ svn.noMetadata::
svn-remote.<name>.noMetadata::
This gets rid of the 'git-svn-id:' lines at the end of every commit.
+
If you lose your .git/svn/git-svn/.rev_db file, 'git svn' will not
be able to rebuild it and you won't be able to fetch again,
either. This is fine for one-shot imports.
This option can only be used for one-shot imports as 'git svn'
will not be able to fetch again without metadata. Additionally,
if you lose your .git/svn/**/.rev_map.* files, 'git svn' will not
be able to rebuild them.
+
The 'git svn log' command will not work on repositories using
this, either. Using this conflicts with the 'useSvmProps'
option for (hopefully) obvious reasons.
+
This option is NOT recommended as it makes it difficult to track down
old references to SVN revision numbers in existing documentation, bug
reports and archives. If you plan to eventually migrate from SVN to git
and are certain about dropping SVN history, consider
linkgit:git-filter-branch[1] instead. filter-branch also allows
reformating of metadata for ease-of-reading and rewriting authorship
info for non-"svn.authorsFile" users.
svn.useSvmProps::
svn-remote.<name>.useSvmProps::

View File

@@ -108,10 +108,14 @@ const char *make_nonrelative_path(const char *path)
if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)
die("Too long path: %.*s", 60, path);
} else {
size_t len;
const char *fmt;
const char *cwd = get_pwd_cwd();
if (!cwd)
die_errno("Cannot determine the current working directory");
if (snprintf(buf, PATH_MAX, "%s/%s", cwd, path) >= PATH_MAX)
len = strlen(cwd);
fmt = (len > 0 && is_dir_sep(cwd[len-1])) ? "%s%s" : "%s/%s";
if (snprintf(buf, PATH_MAX, fmt, cwd, path) >= PATH_MAX)
die("Too long path: %.*s", 60, path);
}
return buf;

View File

@@ -161,7 +161,7 @@ static void use(int bytes)
input_offset += bytes;
/* make sure off_t is sufficiently large not to wrap */
if (consumed_bytes > consumed_bytes + bytes)
if (signed_add_overflows(consumed_bytes, bytes))
die("pack too large for current definition of off_t");
consumed_bytes += bytes;
}

View File

@@ -294,11 +294,26 @@ static int create_default_files(const char *template_path)
return reinit;
}
static void create_object_directory(void)
{
const char *object_directory = get_object_directory();
int len = strlen(object_directory);
char *path = xmalloc(len + 40);
memcpy(path, object_directory, len);
safe_create_dir(object_directory, 1);
strcpy(path+len, "/pack");
safe_create_dir(path, 1);
strcpy(path+len, "/info");
safe_create_dir(path, 1);
free(path);
}
int init_db(const char *template_dir, unsigned int flags)
{
const char *sha1_dir;
char *path;
int len, reinit;
int reinit;
safe_create_dir(get_git_dir(), 0);
@@ -313,16 +328,7 @@ int init_db(const char *template_dir, unsigned int flags)
reinit = create_default_files(template_dir);
sha1_dir = get_object_directory();
len = strlen(sha1_dir);
path = xmalloc(len + 40);
memcpy(path, sha1_dir, len);
safe_create_dir(sha1_dir, 1);
strcpy(path+len, "/pack");
safe_create_dir(path, 1);
strcpy(path+len, "/info");
safe_create_dir(path, 1);
create_object_directory();
if (shared_repository) {
char buf[10];

View File

@@ -431,7 +431,7 @@ static int write_one(struct sha1file *f,
written_list[nr_written++] = &e->idx;
/* make sure off_t is sufficiently large not to wrap */
if (*offset > *offset + size)
if (signed_add_overflows(*offset, size))
die("pack too large for current definition of off_t");
*offset += size;
return 1;

View File

@@ -83,7 +83,7 @@ static void use(int bytes)
offset += bytes;
/* make sure off_t is sufficiently large not to wrap */
if (consumed_bytes > consumed_bytes + bytes)
if (signed_add_overflows(consumed_bytes, bytes))
die("pack too large for current definition of off_t");
consumed_bytes += bytes;
}

13
cache.h
View File

@@ -277,9 +277,16 @@ static inline int ce_to_dtype(const struct cache_entry *ce)
else
return DT_UNKNOWN;
}
#define canon_mode(mode) \
(S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \
S_ISLNK(mode) ? S_IFLNK : S_ISDIR(mode) ? S_IFDIR : S_IFGITLINK)
static inline unsigned int canon_mode(unsigned int mode)
{
if (S_ISREG(mode))
return S_IFREG | ce_permissions(mode);
if (S_ISLNK(mode))
return S_IFLNK;
if (S_ISDIR(mode))
return S_IFDIR;
return S_IFGITLINK;
}
#define flexible_size(STRUCT,len) ((offsetof(struct STRUCT,name) + (len) + 8) & ~7)
#define cache_entry_size(len) flexible_size(cache_entry,len)

View File

@@ -127,7 +127,7 @@ int mingw_open (const char *filename, int oflags, ...)
mode = va_arg(args, int);
va_end(args);
if (!strcmp(filename, "/dev/null"))
if (filename && !strcmp(filename, "/dev/null"))
filename = "nul";
fd = open(filename, oflags, mode);
@@ -160,7 +160,7 @@ ssize_t mingw_write(int fd, const void *buf, size_t count)
#undef fopen
FILE *mingw_fopen (const char *filename, const char *otype)
{
if (!strcmp(filename, "/dev/null"))
if (filename && !strcmp(filename, "/dev/null"))
filename = "nul";
return fopen(filename, otype);
}
@@ -192,8 +192,11 @@ static inline time_t filetime_to_time_t(const FILETIME *ft)
/* We keep the do_lstat code in a separate function to avoid recursion.
* When a path ends with a slash, the stat will fail with ENOENT. In
* this case, we strip the trailing slashes and stat again.
*
* If follow is true then act like stat() and report on the link
* target. Otherwise report on the link itself.
*/
static int do_lstat(const char *file_name, struct stat *buf)
static int do_lstat(int follow, const char *file_name, struct stat *buf)
{
WIN32_FILE_ATTRIBUTE_DATA fdata;
@@ -209,6 +212,25 @@ static int do_lstat(const char *file_name, struct stat *buf)
buf->st_atime = filetime_to_time_t(&(fdata.ftLastAccessTime));
buf->st_mtime = filetime_to_time_t(&(fdata.ftLastWriteTime));
buf->st_ctime = filetime_to_time_t(&(fdata.ftCreationTime));
if (fdata.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
WIN32_FIND_DATAA findbuf;
HANDLE handle = FindFirstFileA(file_name, &findbuf);
if (handle != INVALID_HANDLE_VALUE) {
if ((findbuf.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) &&
(findbuf.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) {
if (follow) {
char buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
buf->st_size = readlink(file_name, buffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE);
} else {
buf->st_mode = S_IFLNK;
}
buf->st_mode |= S_IREAD;
if (!(findbuf.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
buf->st_mode |= S_IWRITE;
}
FindClose(handle);
}
}
return 0;
}
return -1;
@@ -220,12 +242,12 @@ static int do_lstat(const char *file_name, struct stat *buf)
* complete. Note that Git stat()s are redirected to mingw_lstat()
* too, since Windows doesn't really handle symlinks that well.
*/
int mingw_lstat(const char *file_name, struct stat *buf)
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
{
int namelen;
static char alt_name[PATH_MAX];
if (!do_lstat(file_name, buf))
if (!do_lstat(follow, file_name, buf))
return 0;
/* if file_name ended in a '/', Windows returned ENOENT;
@@ -244,7 +266,16 @@ int mingw_lstat(const char *file_name, struct stat *buf)
memcpy(alt_name, file_name, namelen);
alt_name[namelen] = 0;
return do_lstat(alt_name, buf);
return do_lstat(follow, alt_name, buf);
}
int mingw_lstat(const char *file_name, struct stat *buf)
{
return do_stat_internal(0, file_name, buf);
}
int mingw_stat(const char *file_name, struct stat *buf)
{
return do_stat_internal(1, file_name, buf);
}
#undef fstat
@@ -873,6 +904,11 @@ void mingw_execvp(const char *cmd, char *const *argv)
free_path_split(path);
}
void mingw_execv(const char *cmd, char *const *argv)
{
mingw_execve(cmd, argv, environ);
}
static char **copy_environ(void)
{
char **env;
@@ -1386,6 +1422,7 @@ void mingw_open_html(const char *unixpath)
const char *, const char *, const char *, INT);
T ShellExecute;
HMODULE shell32;
int r;
shell32 = LoadLibrary("shell32.dll");
if (!shell32)
@@ -1395,9 +1432,12 @@ void mingw_open_html(const char *unixpath)
die("cannot run browser");
printf("Launching default browser to display HTML ...\n");
ShellExecute(NULL, "open", htmlpath, NULL, "\\", 0);
r = (int)ShellExecute(NULL, "open", htmlpath, NULL, "\\", SW_SHOWNORMAL);
FreeLibrary(shell32);
/* see the MSDN documentation referring to the result codes here */
if (r <= 32) {
die("failed to launch browser for %.*s", MAX_PATH, unixpath);
}
}
int link(const char *oldpath, const char *newpath)

View File

@@ -6,17 +6,30 @@
*/
typedef int pid_t;
typedef int uid_t;
#define hstrerror strerror
#define S_IFLNK 0120000 /* Symbolic link */
#define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK)
#define S_ISSOCK(x) 0
#ifndef _STAT_H_
#define S_IRUSR 0
#define S_IWUSR 0
#define S_IXUSR 0
#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
#endif
#define S_IRGRP 0
#define S_IWGRP 0
#define S_IXGRP 0
#define S_ISGID 0
#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
#define S_IROTH 0
#define S_IWOTH 0
#define S_IXOTH 0
#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
#define S_ISUID 0
#define S_ISGID 0
#define S_ISVTX 0
#define WIFEXITED(x) 1
#define WIFSIGNALED(x) 0
@@ -65,6 +78,12 @@ struct itimerval {
};
#define ITIMER_REAL 0
/*
* sanitize preprocessor namespace polluted by Windows headers defining
* macros which collide with git local versions
*/
#undef HELP_COMMAND /* from winuser.h */
/*
* trivial stubs
*/
@@ -75,17 +94,17 @@ static inline int symlink(const char *oldpath, const char *newpath)
{ errno = ENOSYS; return -1; }
static inline int fchmod(int fildes, mode_t mode)
{ errno = ENOSYS; return -1; }
static inline int fork(void)
static inline pid_t fork(void)
{ errno = ENOSYS; return -1; }
static inline unsigned int alarm(unsigned int seconds)
{ return 0; }
static inline int fsync(int fd)
{ return _commit(fd); }
static inline int getppid(void)
static inline pid_t getppid(void)
{ return 1; }
static inline void sync(void)
{}
static inline int getuid()
static inline uid_t getuid(void)
{ return 1; }
static inline struct passwd *getpwnam(const char *name)
{ return NULL; }
@@ -117,7 +136,7 @@ static inline int mingw_unlink(const char *pathname)
}
#define unlink mingw_unlink
static inline int waitpid(pid_t pid, int *status, unsigned options)
static inline pid_t waitpid(pid_t pid, int *status, unsigned options)
{
if (options == 0)
return _cwait(status, pid, 0);
@@ -158,7 +177,7 @@ int poll(struct pollfd *ufds, unsigned int nfds, int timeout);
struct tm *gmtime_r(const time_t *timep, struct tm *result);
struct tm *localtime_r(const time_t *timep, struct tm *result);
int getpagesize(void); /* defined in MinGW's libgcc.a */
struct passwd *getpwuid(int uid);
struct passwd *getpwuid(uid_t uid);
int setitimer(int type, struct itimerval *in, struct itimerval *out);
int sigaction(int sig, struct sigaction *in, struct sigaction *out);
int link(const char *oldpath, const char *newpath);
@@ -222,10 +241,11 @@ int mingw_getpagesize(void);
#ifndef ALREADY_DECLARED_STAT_FUNCS
#define stat _stati64
int mingw_lstat(const char *file_name, struct stat *buf);
int mingw_stat(const char *file_name, struct stat *buf);
int mingw_fstat(int fd, struct stat *buf);
#define fstat mingw_fstat
#define lstat mingw_lstat
#define _stati64(x,y) mingw_lstat(x,y)
#define _stati64(x,y) mingw_stat(x,y)
#endif
int mingw_utime(const char *file_name, const struct utimbuf *times);
@@ -236,6 +256,8 @@ pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **env,
int fhin, int fhout, int fherr);
void mingw_execvp(const char *cmd, char *const *argv);
#define execvp mingw_execvp
void mingw_execv(const char *cmd, char *const *argv);
#define execv mingw_execv
static inline unsigned int git_ntohl(unsigned int x)
{ return (unsigned int)ntohl(x); }

View File

@@ -269,9 +269,8 @@ static void diffcore_pickaxe_count(struct diff_options *o)
diff_free_filepair(p);
}
if (opts & DIFF_PICKAXE_REGEX) {
if (opts & DIFF_PICKAXE_REGEX)
regfree(&regex);
}
free(q->queue);
*q = outq;
@@ -282,7 +281,7 @@ void diffcore_pickaxe(struct diff_options *o)
{
/* Might want to warn when both S and G are on; I don't care... */
if (o->pickaxe_opts & DIFF_PICKAXE_KIND_G)
return diffcore_pickaxe_grep(o);
diffcore_pickaxe_grep(o);
else
return diffcore_pickaxe_count(o);
diffcore_pickaxe_count(o);
}

View File

@@ -64,7 +64,7 @@ char *git_work_tree_cfg;
static char *work_tree;
static const char *git_dir;
static char *git_object_dir, *git_index_file, *git_refs_dir, *git_graft_file;
static char *git_object_dir, *git_index_file, *git_graft_file;
/*
* Repository-local GIT_* environment variables
@@ -87,8 +87,10 @@ const char * const local_repo_env[LOCAL_REPO_ENV_SIZE + 1] = {
static void setup_git_env(void)
{
git_dir = getenv(GIT_DIR_ENVIRONMENT);
if (!git_dir)
if (!git_dir) {
git_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);
git_dir = git_dir ? xstrdup(git_dir) : NULL;
}
if (!git_dir)
git_dir = DEFAULT_GIT_DIR_ENVIRONMENT;
git_object_dir = getenv(DB_ENVIRONMENT);
@@ -96,8 +98,6 @@ static void setup_git_env(void)
git_object_dir = xmalloc(strlen(git_dir) + 9);
sprintf(git_object_dir, "%s/objects", git_dir);
}
git_refs_dir = xmalloc(strlen(git_dir) + 6);
sprintf(git_refs_dir, "%s/refs", git_dir);
git_index_file = getenv(INDEX_ENVIRONMENT);
if (!git_index_file) {
git_index_file = xmalloc(strlen(git_dir) + 7);

View File

@@ -444,12 +444,12 @@ else
set x
first=
}
case "$arg" in
/*)
set "$@" "$arg" ;;
*)
set "$@" "$prefix$arg" ;;
esac
if is_absolute_path "$arg"
then
set "$@" "$arg"
else
set "$@" "$prefix$arg"
fi
done
shift
fi

View File

@@ -28,6 +28,18 @@
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#define bitsizeof(x) (CHAR_BIT * sizeof(x))
#define maximum_signed_value_of_type(a) \
(INTMAX_MAX >> (bitsizeof(intmax_t) - bitsizeof(a)))
/*
* Signed integer overflow is undefined in C, so here's a helper macro
* to detect if the sum of two integers will overflow.
*
* Requires: a >= 0, typeof(a) equals typeof(b)
*/
#define signed_add_overflows(a, b) \
((b) > maximum_signed_value_of_type(a) - (a))
#ifdef __GNUC__
#define TYPEOF(x) (__typeof__(x))
#else

View File

@@ -8,7 +8,7 @@
#### Copyright The Open University UK - 2006.
####
#### Authors: Martyn Smith <martyn@catalyst.net.nz>
#### Martin Langhoff <martin@catalyst.net.nz>
#### Martin Langhoff <martin@laptop.org>
####
####
#### Released under the GNU Public License, version 2.
@@ -2681,7 +2681,7 @@ package GITCVS::log;
#### Copyright The Open University UK - 2006.
####
#### Authors: Martyn Smith <martyn@catalyst.net.nz>
#### Martin Langhoff <martin@catalyst.net.nz>
#### Martin Langhoff <martin@laptop.org>
####
####
@@ -2848,7 +2848,7 @@ package GITCVS::updater;
#### Copyright The Open University UK - 2006.
####
#### Authors: Martyn Smith <martyn@catalyst.net.nz>
#### Martin Langhoff <martin@catalyst.net.nz>
#### Martin Langhoff <martin@laptop.org>
####
####

View File

@@ -61,6 +61,11 @@ do
esac
eval pretty_name=\${GITHEAD_$SHA1:-$SHA1}
if test "$SHA1" = "$pretty_name"
then
SHA1_UP="$(echo "$SHA1" | tr a-z A-Z)"
eval pretty_name=\${GITHEAD_$SHA1_UP:-$pretty_name}
fi
common=$(git merge-base --all $SHA1 $MRC) ||
die "Unable to find common commit with $pretty_name"

View File

@@ -206,5 +206,20 @@ case $(uname -s) in
find () {
/usr/bin/find "$@"
}
is_absolute_path () {
case "$1" in
[/\\]* | [A-Za-z]:*)
return 0 ;;
esac
return 1
}
;;
*)
is_absolute_path () {
case "$1" in
/*)
return 0 ;;
esac
return 1
}
esac

View File

@@ -1514,7 +1514,8 @@ sub cmt_sha2rev_batch {
sub working_head_info {
my ($head, $refs) = @_;
my @args = ('log', '--no-color', '--first-parent', '--pretty=medium');
my @args = qw/log --no-color --no-decorate --first-parent
--pretty=medium/;
my ($fh, $ctx) = command_output_pipe(@args, $head);
my $hash;
my %max;
@@ -3119,9 +3120,10 @@ sub _rev_list {
sub check_cherry_pick {
my $base = shift;
my $tip = shift;
my $parents = shift;
my @ranges = @_;
my %commits = map { $_ => 1 }
_rev_list("--no-merges", $tip, "--not", $base);
_rev_list("--no-merges", $tip, "--not", $base, @$parents);
for my $range ( @ranges ) {
delete @commits{_rev_list($range)};
}
@@ -3297,6 +3299,7 @@ sub find_extra_svn_parents {
# double check that there are no missing non-merge commits
my (@incomplete) = check_cherry_pick(
$merge_base, $merge_tip,
$parents,
@$ranges,
);

0
gitweb/README Executable file → Normal file
View File

View File

@@ -701,13 +701,13 @@ cat >expect <<\EOF
trailingtilde = foo~
EOF
test_expect_success 'set --path' '
test_expect_success NOT_MINGW 'set --path' '
git config --path path.home "~/" &&
git config --path path.normal "/dev/null" &&
git config --path path.trailingtilde "foo~" &&
test_cmp expect .git/config'
if test "${HOME+set}"
if test_have_prereq NOT_MINGW && test "${HOME+set}"
then
test_set_prereq HOMEVAR
fi
@@ -730,7 +730,7 @@ cat >expect <<\EOF
foo~
EOF
test_expect_success 'get --path copes with unset $HOME' '
test_expect_success NOT_MINGW 'get --path copes with unset $HOME' '
(
unset HOME;
test_must_fail git config --get --path path.home \

View File

@@ -26,4 +26,3 @@ test_expect_success \
'git ls-files --error-unmatch foo bar'
test_done
1

View File

@@ -26,7 +26,7 @@ test_auto_fixup() {
echo 1 >file1 &&
git add -u &&
test_tick &&
git commit -m "fixup! first"
git commit -m "fixup! first" &&
git tag $1 &&
test_tick &&
@@ -55,7 +55,7 @@ test_auto_squash() {
echo 1 >file1 &&
git add -u &&
test_tick &&
git commit -m "squash! first"
git commit -m "squash! first" &&
git tag $1 &&
test_tick &&
@@ -84,7 +84,7 @@ test_expect_success 'misspelled auto squash' '
echo 1 >file1 &&
git add -u &&
test_tick &&
git commit -m "squash! forst"
git commit -m "squash! forst" &&
git tag final-missquash &&
test_tick &&
git rebase --autosquash -i HEAD^^^ &&

View File

@@ -94,7 +94,7 @@ test_expect_success 'git archive with --output' \
'git archive --output=b4.tar HEAD &&
test_cmp b.tar b4.tar'
test_expect_success 'git archive --remote' \
test_expect_success NOT_MINGW 'git archive --remote' \
'git archive --remote=. HEAD >b5.tar &&
test_cmp b.tar b5.tar'

View File

@@ -4,14 +4,9 @@ test_description='test automatic tag following'
. ./test-lib.sh
case $(uname -s) in
*MINGW*)
if !test_have_prereq NOT_MINGW; then
say "GIT_DEBUG_SEND_PACK not supported - skipping tests"
;;
*)
test_set_prereq NOT_MINGW
;;
esac
fi
# End state of the repository:
#

View File

@@ -5,11 +5,12 @@ test_description='test git-http-backend-noserver'
HTTPD_DOCUMENT_ROOT_PATH="$TRASH_DIRECTORY"
test_have_prereq MINGW && export GREP_OPTIONS=-U
run_backend() {
echo "$2" |
QUERY_STRING="${1#*\?}" \
GIT_PROJECT_ROOT="$HTTPD_DOCUMENT_ROOT_PATH" \
PATH_INFO="${1%%\?*}" \
PATH_TRANSLATED="$HTTPD_DOCUMENT_ROOT_PATH/${1%%\?*}" \
git http-backend >act.out 2>act.err
}

View File

@@ -14,6 +14,8 @@ test_description='CRLF merge conflict across text=auto change
. ./test-lib.sh
test_have_prereq MINGW && SED_OPTIONS=-b
test_expect_success setup '
git config core.autocrlf false &&
@@ -60,7 +62,7 @@ test_expect_success setup '
test_expect_success 'set up fuzz_conflict() helper' '
fuzz_conflict() {
sed -e "s/^\([<>=]......\) .*/\1/" "$@"
sed $SED_OPTIONS -e "s/^\([<>=]......\) .*/\1/" "$@"
}
'

50
t/t9157-git-svn-fetch-merge.sh Executable file
View File

@@ -0,0 +1,50 @@
#!/bin/sh
#
# Copyright (c) 2010 Steven Walter
#
test_description='git svn merge detection'
. ./lib-git-svn.sh
test_expect_success 'initialize source svn repo' '
svn_cmd mkdir -m x "$svnrepo"/trunk &&
svn_cmd mkdir -m x "$svnrepo"/branches &&
svn_cmd co "$svnrepo"/trunk "$SVN_TREE" &&
(
cd "$SVN_TREE" &&
touch foo &&
svn add foo &&
svn commit -m "initial commit" &&
svn cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch1 &&
touch bar &&
svn add bar &&
svn commit -m x &&
svn cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch2 &&
svn switch "$svnrepo"/branches/branch1 &&
touch baz &&
svn add baz &&
svn commit -m x &&
svn switch "$svnrepo"/trunk &&
svn merge "$svnrepo"/branches/branch1 &&
svn commit -m "merge" &&
svn switch "$svnrepo"/branches/branch1 &&
svn commit -m x &&
svn switch "$svnrepo"/branches/branch2 &&
svn merge "$svnrepo"/branches/branch1 &&
svn commit -m "merge branch1" &&
svn switch "$svnrepo"/trunk &&
svn merge "$svnrepo"/branches/branch2 &&
svn resolved baz &&
svn commit -m "merge branch2"
) &&
rm -rf "$SVN_TREE"
'
test_expect_success 'clone svn repo' '
git svn init -s "$svnrepo" &&
git svn fetch
'
test_expect_success 'verify merge commit' 'git rev-parse HEAD^2'
test_done

View File

@@ -970,11 +970,13 @@ case $(uname -s) in
# no POSIX permissions
# backslashes in pathspec are converted to '/'
# exec does not inherit the PID
test_set_prereq MINGW
;;
*)
test_set_prereq POSIXPERM
test_set_prereq BSLASHPSPEC
test_set_prereq EXECKEEPSPID
test_set_prereq NOT_MINGW
;;
esac

View File

@@ -30,6 +30,7 @@
#define XDL_MAX(a, b) ((a) > (b) ? (a): (b))
#define XDL_ABS(v) ((v) >= 0 ? (v): -(v))
#define XDL_ISDIGIT(c) ((c) >= '0' && (c) <= '9')
#define XDL_ISSPACE(c) (isspace((unsigned char)(c)))
#define XDL_ADDBITS(v,b) ((v) + ((v) >> (b)))
#define XDL_MASKBITS(b) ((1UL << (b)) - 1)
#define XDL_HASHLONG(v,b) (XDL_ADDBITS((unsigned long)(v), b) & XDL_MASKBITS(b))

View File

@@ -336,7 +336,7 @@ static int xdl_refine_conflicts(xdfenv_t *xe1, xdfenv_t *xe2, xdmerge_t *m,
static int line_contains_alnum(const char *ptr, long size)
{
while (size--)
if (isalnum(*(ptr++)))
if (isalnum((unsigned char)*(ptr++)))
return 1;
return 0;
}

View File

@@ -211,18 +211,18 @@ int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
if (l1[i1++] != l2[i2++])
return 0;
skip_ws:
while (i1 < s1 && isspace(l1[i1]))
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
while (i2 < s2 && isspace(l2[i2]))
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
}
} else if (flags & XDF_IGNORE_WHITESPACE_CHANGE) {
while (i1 < s1 && i2 < s2) {
if (isspace(l1[i1]) && isspace(l2[i2])) {
if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) {
/* Skip matching spaces and try again */
while (i1 < s1 && isspace(l1[i1]))
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
while (i2 < s2 && isspace(l2[i2]))
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
continue;
}
@@ -241,13 +241,13 @@ int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
* while there still are characters remaining on both lines.
*/
if (i1 < s1) {
while (i1 < s1 && isspace(l1[i1]))
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
if (s1 != i1)
return 0;
}
if (i2 < s2) {
while (i2 < s2 && isspace(l2[i2]))
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
return (s2 == i2);
}
@@ -260,10 +260,10 @@ static unsigned long xdl_hash_record_with_whitespace(char const **data,
char const *ptr = *data;
for (; ptr < top && *ptr != '\n'; ptr++) {
if (isspace(*ptr)) {
if (XDL_ISSPACE(*ptr)) {
const char *ptr2 = ptr;
int at_eol;
while (ptr + 1 < top && isspace(ptr[1])
while (ptr + 1 < top && XDL_ISSPACE(ptr[1])
&& ptr[1] != '\n')
ptr++;
at_eol = (top <= ptr + 1 || ptr[1] == '\n');