Merge branch 'js/modfix' into next

* js/modfix:
  adjust_shared_perm: chmod() only when needed.
  Remove unsupported C99 style struct initializers in git-archive.
  Remove SIMPLE_PROGRAMS and make git-daemon a normal program.
  Use ULONG_MAX rather than implicit cast of -1.
  git-svn: don't die on rebuild when --upgrade is specified
  git-svn: avoid printing filenames of files we're not tracking
  Added bash completion support for git-reset.
  Added completion support for git-branch.exe.
This commit is contained in:
Junio C Hamano
2006-11-04 23:57:54 -08:00
7 changed files with 31 additions and 33 deletions

View File

@@ -187,15 +187,12 @@ SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
$(patsubst %.py,%,$(SCRIPT_PYTHON)) \
git-cherry-pick git-status git-instaweb
# The ones that do not have to link with lcrypto, lz nor xdiff.
SIMPLE_PROGRAMS = \
git-daemon$X
# ... and all the rest that could be moved out of bindir to gitexecdir
PROGRAMS = \
git-convert-objects$X git-fetch-pack$X git-fsck-objects$X \
git-hash-object$X git-index-pack$X git-local-fetch$X \
git-merge-base$X \
git-daemon$X \
git-merge-index$X git-mktag$X git-mktree$X git-patch-id$X \
git-peek-remote$X git-receive-pack$X \
git-send-pack$X git-shell$X \
@@ -217,7 +214,7 @@ BUILT_INS = \
$(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
# what 'all' will build and 'install' will install, in gitexecdir
ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS) \
ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) \
git-merge-recur$X
# Backward compatibility -- to be removed after 1.0
@@ -487,11 +484,9 @@ ifdef NEEDS_LIBICONV
endif
ifdef NEEDS_SOCKET
EXTLIBS += -lsocket
SIMPLE_LIB += -lsocket
endif
ifdef NEEDS_NSL
EXTLIBS += -lnsl
SIMPLE_LIB += -lnsl
endif
ifdef NO_D_TYPE_IN_DIRENT
BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
@@ -738,11 +733,6 @@ endif
git-%$X: %.o $(GITLIBS)
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
$(SIMPLE_PROGRAMS) : $(LIB_FILE)
$(SIMPLE_PROGRAMS) : git-%$X : %.o
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
$(LIB_FILE) $(SIMPLE_LIB)
ssh-pull.o: ssh-fetch.c
ssh-push.o: ssh-upload.c
git-local-fetch$X: fetch.o

View File

@@ -25,8 +25,6 @@ struct archiver {
parse_extra_args_fn_t parse_extra;
};
extern struct archiver archivers[];
extern int parse_archive_args(int argc,
const char **argv,
struct archiver *ar);

View File

@@ -43,7 +43,7 @@ static int apply_verbosely;
static int no_add;
static int show_index_info;
static int line_termination = '\n';
static unsigned long p_context = -1;
static unsigned long p_context = ULONG_MAX;
static const char apply_usage[] =
"git-apply [--stat] [--numstat] [--summary] [--check] [--index] [--cached] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [--reverse] [--reject] [--verbose] [-z] [-pNUM] [-CNUM] [--whitespace=<nowarn|warn|error|error-all|strip>] <patch>...";

View File

@@ -15,16 +15,14 @@
static const char archive_usage[] = \
"git-archive --format=<fmt> [--prefix=<prefix>/] [--verbose] [<extra>] <tree-ish> [path...]";
struct archiver archivers[] = {
{
.name = "tar",
.write_archive = write_tar_archive,
},
{
.name = "zip",
.write_archive = write_zip_archive,
.parse_extra = parse_extra_zip_args,
},
static struct archiver_desc
{
const char *name;
write_archive_fn_t write_archive;
parse_extra_args_fn_t parse_extra;
} archivers[] = {
{ "tar", write_tar_archive, NULL },
{ "zip", write_zip_archive, parse_extra_zip_args },
};
static int run_remote_archiver(const char *remote, int argc,
@@ -88,7 +86,10 @@ static int init_archiver(const char *name, struct archiver *ar)
for (i = 0; i < ARRAY_SIZE(archivers); i++) {
if (!strcmp(name, archivers[i].name)) {
memcpy(ar, &archivers[i], sizeof(struct archiver));
memset(ar, 0, sizeof(*ar));
ar->name = archivers[i].name;
ar->write_archive = archivers[i].write_archive;
ar->parse_extra = archivers[i].parse_extra;
rv = 0;
break;
}

View File

@@ -271,6 +271,13 @@ _git_push ()
esac
}
_git_reset ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
local opt="--mixed --hard --soft"
COMPREPLY=($(compgen -W "$opt $(__git_refs .)" -- "$cur"))
}
_git_show ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -304,6 +311,7 @@ _git ()
ls-tree) _git_ls_tree ;;
pull) _git_pull ;;
push) _git_push ;;
reset) _git_reset ;;
show) _git_show ;;
show-branch) _git_log ;;
whatchanged) _git_log ;;
@@ -332,6 +340,7 @@ complete -o default -o nospace -F _git_ls_tree git-ls-tree
complete -o default -F _git_merge_base git-merge-base
complete -o default -o nospace -F _git_pull git-pull
complete -o default -o nospace -F _git_push git-push
complete -o default -F _git_reset git-reset
complete -o default -F _git_show git-show
complete -o default -o nospace -F _git_log git-whatchanged
@@ -339,6 +348,7 @@ complete -o default -o nospace -F _git_log git-whatchanged
# when the user has tab-completed the executable name and consequently
# included the '.exe' suffix.
#
complete -o default -F _git_branch git-branch.exe
complete -o default -o nospace -F _git_cat_file git-cat-file.exe
complete -o default -o nospace -F _git_diff git-diff.exe
complete -o default -o nospace -F _git_diff_tree git-diff-tree.exe

View File

@@ -2662,11 +2662,12 @@ sub libsvn_connect {
}
sub libsvn_get_file {
my ($gui, $f, $rev) = @_;
my ($gui, $f, $rev, $chg) = @_;
my $p = $f;
if (length $SVN_PATH > 0) {
return unless ($p =~ s#^\Q$SVN_PATH\E/##);
}
print "\t$chg\t$f\n" unless $_q;
my ($hash, $pid, $in, $out);
my $pool = SVN::Pool->new;
@@ -2769,8 +2770,7 @@ sub libsvn_fetch {
$pool->clear;
}
foreach (@amr) {
print "\t$_->[0]\t$_->[1]\n" unless $_q;
libsvn_get_file($gui, $_->[1], $rev)
libsvn_get_file($gui, $_->[1], $rev, $_->[0]);
}
close $gui or croak $?;
return libsvn_log_entry($rev, $author, $date, $msg, [$last_commit]);
@@ -2848,8 +2848,7 @@ sub libsvn_traverse {
if (defined $files) {
push @$files, $file;
} else {
print "\tA\t$file\n" unless $_q;
libsvn_get_file($gui, $file, $rev);
libsvn_get_file($gui, $file, $rev, 'A');
}
}
}
@@ -3140,7 +3139,7 @@ sub copy_remote_ref {
my $ref = "refs/remotes/$GIT_SVN";
if (safe_qx('git-ls-remote', $origin, $ref)) {
sys(qw/git fetch/, $origin, "$ref:$ref");
} else {
} elsif ($_cp_remote && !$_upgrade) {
die "Unable to find remote reference: ",
"refs/remotes/$GIT_SVN on $origin\n";
}

2
path.c
View File

@@ -279,7 +279,7 @@ int adjust_shared_perm(const char *path)
: 0));
if (S_ISDIR(mode))
mode |= S_ISGID;
if (chmod(path, mode) < 0)
if ((mode & st.st_mode) != mode && chmod(path, mode) < 0)
return -2;
return 0;
}