Merge 'fixes' branch
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
commit
a61399b5fb
4
.gitignore
vendored
4
.gitignore
vendored
@ -96,3 +96,7 @@ git-verify-pack
|
|||||||
git-verify-tag
|
git-verify-tag
|
||||||
git-whatchanged
|
git-whatchanged
|
||||||
git-write-tree
|
git-write-tree
|
||||||
|
#*.tar.gz
|
||||||
|
#*.dsc
|
||||||
|
#*.deb
|
||||||
|
#git-core.spec
|
||||||
|
@ -9,12 +9,15 @@ git-diff-tree - Compares the content and mode of blobs found via two tree object
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
'git-diff-tree' [--stdin] [-m] [-s] [-v] [--pretty] [-t] [<common diff options>] <tree-ish> <tree-ish> [<path>...]
|
'git-diff-tree' [--stdin] [-m] [-s] [-v] [--pretty] [-t] [<common diff options>] <tree-ish> [<tree-ish>] [<path>...]
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
Compares the content and mode of the blobs found via two tree objects.
|
Compares the content and mode of the blobs found via two tree objects.
|
||||||
|
|
||||||
|
If there is only one <tree-ish> given, the commit is compared with its parents
|
||||||
|
(see --stdin below).
|
||||||
|
|
||||||
Note that "git-diff-tree" can use the tree encapsulated in a commit object.
|
Note that "git-diff-tree" can use the tree encapsulated in a commit object.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
|
@ -2,31 +2,12 @@
|
|||||||
#
|
#
|
||||||
# For more information about this module, see PEP 324.
|
# For more information about this module, see PEP 324.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2003-2004 by Peter Astrand <astrand@lysator.liu.se>
|
# This module should remain compatible with Python 2.2, see PEP 291.
|
||||||
#
|
#
|
||||||
# By obtaining, using, and/or copying this software and/or its
|
# Copyright (c) 2003-2005 by Peter Astrand <astrand@lysator.liu.se>
|
||||||
# associated documentation, you agree that you have read, understood,
|
|
||||||
# and will comply with the following terms and conditions:
|
|
||||||
#
|
|
||||||
# Permission to use, copy, modify, and distribute this software and
|
|
||||||
# its associated documentation for any purpose and without fee is
|
|
||||||
# hereby granted, provided that the above copyright notice appears in
|
|
||||||
# all copies, and that both that copyright notice and this permission
|
|
||||||
# notice appear in supporting documentation, and that the name of the
|
|
||||||
# author not be used in advertising or publicity pertaining to
|
|
||||||
# distribution of the software without specific, written prior
|
|
||||||
# permission.
|
|
||||||
#
|
|
||||||
# THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
|
|
||||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
||||||
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
||||||
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
|
||||||
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
|
||||||
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
#
|
|
||||||
# Use of this file within git is permitted under GPLv2.
|
|
||||||
#
|
#
|
||||||
|
# Licensed to PSF under a Contributor Agreement.
|
||||||
|
# See http://www.python.org/2.4/license for licensing details.
|
||||||
|
|
||||||
r"""subprocess - Subprocesses with accessible I/O streams
|
r"""subprocess - Subprocesses with accessible I/O streams
|
||||||
|
|
||||||
|
2
fetch.c
2
fetch.c
@ -48,6 +48,7 @@ static int process_tree(struct tree *tree)
|
|||||||
struct tree_entry_list *next = entry->next;
|
struct tree_entry_list *next = entry->next;
|
||||||
if (process(entry->item.any))
|
if (process(entry->item.any))
|
||||||
return -1;
|
return -1;
|
||||||
|
free(entry->name);
|
||||||
free(entry);
|
free(entry);
|
||||||
entry = next;
|
entry = next;
|
||||||
}
|
}
|
||||||
@ -206,6 +207,7 @@ int pull(char *target)
|
|||||||
int fd = -1;
|
int fd = -1;
|
||||||
|
|
||||||
save_commit_buffer = 0;
|
save_commit_buffer = 0;
|
||||||
|
track_object_refs = 0;
|
||||||
if (write_ref && current_ref) {
|
if (write_ref && current_ref) {
|
||||||
fd = lock_ref_sha1(write_ref, current_ref);
|
fd = lock_ref_sha1(write_ref, current_ref);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
|
14
git-diff.sh
14
git-diff.sh
@ -9,9 +9,21 @@ files=$(git-rev-parse --no-revs --no-flags --sq "$@")
|
|||||||
|
|
||||||
: ${flags:="'-M' '-p'"}
|
: ${flags:="'-M' '-p'"}
|
||||||
|
|
||||||
|
# I often say 'git diff --cached -p' and get scolded by git-diff-files, but
|
||||||
|
# obviously I mean 'git diff --cached -p HEAD' in that case.
|
||||||
|
case "$rev" in
|
||||||
|
'')
|
||||||
|
case " $flags " in
|
||||||
|
*" '--cached' "*)
|
||||||
|
rev='HEAD '
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
esac
|
||||||
|
|
||||||
case "$rev" in
|
case "$rev" in
|
||||||
?*' '?*' '?*)
|
?*' '?*' '?*)
|
||||||
die "I don't understand"
|
echo >&2 "I don't understand"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
?*' '^?*)
|
?*' '^?*)
|
||||||
begin=$(expr "$rev" : '.*^.\([0-9a-f]*\).*') &&
|
begin=$(expr "$rev" : '.*^.\([0-9a-f]*\).*') &&
|
||||||
|
@ -38,6 +38,8 @@ static int setup_indices(void)
|
|||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
sprintf(filename, "%s/objects/pack/", path);
|
sprintf(filename, "%s/objects/pack/", path);
|
||||||
dir = opendir(filename);
|
dir = opendir(filename);
|
||||||
|
if (!dir)
|
||||||
|
return -1;
|
||||||
while ((de = readdir(dir)) != NULL) {
|
while ((de = readdir(dir)) != NULL) {
|
||||||
int namelen = strlen(de->d_name);
|
int namelen = strlen(de->d_name);
|
||||||
if (namelen != 50 ||
|
if (namelen != 50 ||
|
||||||
@ -46,10 +48,12 @@ static int setup_indices(void)
|
|||||||
get_sha1_hex(de->d_name + 5, sha1);
|
get_sha1_hex(de->d_name + 5, sha1);
|
||||||
setup_index(sha1);
|
setup_index(sha1);
|
||||||
}
|
}
|
||||||
|
closedir(dir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int copy_file(const char *source, const char *dest, const char *hex)
|
static int copy_file(const char *source, const char *dest, const char *hex,
|
||||||
|
int warn_if_not_exists)
|
||||||
{
|
{
|
||||||
if (use_link) {
|
if (use_link) {
|
||||||
if (!link(source, dest)) {
|
if (!link(source, dest)) {
|
||||||
@ -58,13 +62,24 @@ static int copy_file(const char *source, const char *dest, const char *hex)
|
|||||||
}
|
}
|
||||||
/* If we got ENOENT there is no point continuing. */
|
/* If we got ENOENT there is no point continuing. */
|
||||||
if (errno == ENOENT) {
|
if (errno == ENOENT) {
|
||||||
fprintf(stderr, "does not exist %s\n", source);
|
if (warn_if_not_exists)
|
||||||
|
fprintf(stderr, "does not exist %s\n", source);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (use_symlink && !symlink(source, dest)) {
|
if (use_symlink) {
|
||||||
pull_say("symlink %s\n", hex);
|
struct stat st;
|
||||||
return 0;
|
if (stat(source, &st)) {
|
||||||
|
if (!warn_if_not_exists && errno == ENOENT)
|
||||||
|
return -1;
|
||||||
|
fprintf(stderr, "cannot stat %s: %s\n", source,
|
||||||
|
strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!symlink(source, dest)) {
|
||||||
|
pull_say("symlink %s\n", hex);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (use_filecopy) {
|
if (use_filecopy) {
|
||||||
int ifd, ofd, status;
|
int ifd, ofd, status;
|
||||||
@ -72,7 +87,11 @@ static int copy_file(const char *source, const char *dest, const char *hex)
|
|||||||
void *map;
|
void *map;
|
||||||
ifd = open(source, O_RDONLY);
|
ifd = open(source, O_RDONLY);
|
||||||
if (ifd < 0 || fstat(ifd, &st) < 0) {
|
if (ifd < 0 || fstat(ifd, &st) < 0) {
|
||||||
close(ifd);
|
int err = errno;
|
||||||
|
if (ifd >= 0)
|
||||||
|
close(ifd);
|
||||||
|
if (!warn_if_not_exists && err == ENOENT)
|
||||||
|
return -1;
|
||||||
fprintf(stderr, "cannot open %s\n", source);
|
fprintf(stderr, "cannot open %s\n", source);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -86,7 +105,8 @@ static int copy_file(const char *source, const char *dest, const char *hex)
|
|||||||
status = ((ofd < 0) ||
|
status = ((ofd < 0) ||
|
||||||
(write(ofd, map, st.st_size) != st.st_size));
|
(write(ofd, map, st.st_size) != st.st_size));
|
||||||
munmap(map, st.st_size);
|
munmap(map, st.st_size);
|
||||||
close(ofd);
|
if (ofd >= 0)
|
||||||
|
close(ofd);
|
||||||
if (status)
|
if (status)
|
||||||
fprintf(stderr, "cannot write %s\n", dest);
|
fprintf(stderr, "cannot write %s\n", dest);
|
||||||
else
|
else
|
||||||
@ -116,11 +136,11 @@ static int fetch_pack(const unsigned char *sha1)
|
|||||||
sprintf(filename, "%s/objects/pack/pack-%s.pack",
|
sprintf(filename, "%s/objects/pack/pack-%s.pack",
|
||||||
path, sha1_to_hex(target->sha1));
|
path, sha1_to_hex(target->sha1));
|
||||||
copy_file(filename, sha1_pack_name(target->sha1),
|
copy_file(filename, sha1_pack_name(target->sha1),
|
||||||
sha1_to_hex(target->sha1));
|
sha1_to_hex(target->sha1), 1);
|
||||||
sprintf(filename, "%s/objects/pack/pack-%s.idx",
|
sprintf(filename, "%s/objects/pack/pack-%s.idx",
|
||||||
path, sha1_to_hex(target->sha1));
|
path, sha1_to_hex(target->sha1));
|
||||||
copy_file(filename, sha1_pack_index_name(target->sha1),
|
copy_file(filename, sha1_pack_index_name(target->sha1),
|
||||||
sha1_to_hex(target->sha1));
|
sha1_to_hex(target->sha1), 1);
|
||||||
install_packed_git(target);
|
install_packed_git(target);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -141,7 +161,7 @@ static int fetch_file(const unsigned char *sha1)
|
|||||||
filename[object_name_start+1] = hex[1];
|
filename[object_name_start+1] = hex[1];
|
||||||
filename[object_name_start+2] = '/';
|
filename[object_name_start+2] = '/';
|
||||||
strcpy(filename + object_name_start + 3, hex + 2);
|
strcpy(filename + object_name_start + 3, hex + 2);
|
||||||
return copy_file(filename, dest_filename, hex);
|
return copy_file(filename, dest_filename, hex, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fetch(unsigned char *sha1)
|
int fetch(unsigned char *sha1)
|
||||||
|
10
rsh.c
10
rsh.c
@ -53,6 +53,7 @@ static int add_to_string(char **ptrp, int *sizep, const char *str, int quote)
|
|||||||
char *p = *ptrp;
|
char *p = *ptrp;
|
||||||
int size = *sizep;
|
int size = *sizep;
|
||||||
int oc;
|
int oc;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
if ( quote ) {
|
if ( quote ) {
|
||||||
oc = shell_quote(p, size, str);
|
oc = shell_quote(p, size, str);
|
||||||
@ -62,15 +63,14 @@ static int add_to_string(char **ptrp, int *sizep, const char *str, int quote)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( oc >= size ) {
|
if ( oc >= size ) {
|
||||||
p[size-1] = '\0';
|
err = 1;
|
||||||
*ptrp += size-1;
|
oc = size-1;
|
||||||
*sizep = 1;
|
|
||||||
return 1; /* Overflow, string unusable */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*ptrp += oc;
|
*ptrp += oc;
|
||||||
|
**ptrp = '\0';
|
||||||
*sizep -= oc;
|
*sizep -= oc;
|
||||||
return 0;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int setup_connection(int *fd_in, int *fd_out, const char *remote_prog,
|
int setup_connection(int *fd_in, int *fd_out, const char *remote_prog,
|
||||||
|
Loading…
Reference in New Issue
Block a user