зеркало из https://github.com/microsoft/git.git
Merge branch 'maint'
* maint: git-svn: change dashed git-commit-tree to git commit-tree Documentation: clarify information about 'ident' attribute bash completion: add doubledash to "git show" Use test-chmtime -v instead of perl in t5000 to get mtime of a file Add --verbose|-v to test-chmtime asciidoc: add minor workaround to add an empty line after code blocks Plug a memleak in builtin-revert Add file delete/create info when we overflow rename_limit Install git-cvsserver in $(bindir) Install git-shell in bindir, too
This commit is contained in:
Коммит
933bb3ae5e
|
@ -40,6 +40,26 @@ endif::doctype-manpage[]
|
|||
</literallayout>
|
||||
{title#}</example>
|
||||
endif::docbook-xsl-172[]
|
||||
|
||||
ifdef::docbook-xsl-172[]
|
||||
ifdef::doctype-manpage[]
|
||||
# The following two small workarounds insert a simple paragraph after screen
|
||||
[listingblock]
|
||||
<example><title>{title}</title>
|
||||
<screen>
|
||||
|
|
||||
</screen><simpara></simpara>
|
||||
{title#}</example>
|
||||
|
||||
[verseblock]
|
||||
<formalpara{id? id="{id}"}><title>{title}</title><para>
|
||||
{title%}<literallayout{id? id="{id}"}>
|
||||
{title#}<literallayout>
|
||||
|
|
||||
</literallayout><simpara></simpara>
|
||||
{title#}</para></formalpara>
|
||||
endif::doctype-manpage[]
|
||||
endif::docbook-xsl-172[]
|
||||
endif::backend-docbook[]
|
||||
|
||||
ifdef::doctype-manpage[]
|
||||
|
|
|
@ -163,8 +163,8 @@ few exceptions. Even though...
|
|||
`ident`
|
||||
^^^^^^^
|
||||
|
||||
When the attribute `ident` is set to a path, git replaces
|
||||
`$Id$` in the blob object with `$Id:`, followed by
|
||||
When the attribute `ident` is set for a path, git replaces
|
||||
`$Id$` in the blob object with `$Id:`, followed by the
|
||||
40-character hexadecimal blob object name, followed by a dollar
|
||||
sign `$` upon checkout. Any byte sequence that begins with
|
||||
`$Id:` and ends with `$` in the worktree file is replaced
|
||||
|
|
|
@ -251,7 +251,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
|
|||
int i, index_fd, clean;
|
||||
char *oneline, *reencoded_message = NULL;
|
||||
const char *message, *encoding;
|
||||
const char *defmsg = xstrdup(git_path("MERGE_MSG"));
|
||||
char *defmsg = xstrdup(git_path("MERGE_MSG"));
|
||||
struct merge_options o;
|
||||
struct tree *result, *next_tree, *base_tree, *head_tree;
|
||||
static struct lock_file index_lock;
|
||||
|
@ -432,6 +432,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
|
|||
return execv_git_cmd(args);
|
||||
}
|
||||
free(reencoded_message);
|
||||
free(defmsg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1398,6 +1398,8 @@ _git_shortlog ()
|
|||
|
||||
_git_show ()
|
||||
{
|
||||
__git_has_doubledash && return
|
||||
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
case "$cur" in
|
||||
--pretty=*)
|
||||
|
|
|
@ -493,7 +493,7 @@ void diffcore_rename(struct diff_options *options)
|
|||
if ((num_create > rename_limit && num_src > rename_limit) ||
|
||||
(num_create * num_src > rename_limit * rename_limit)) {
|
||||
if (options->warn_on_too_large_rename)
|
||||
warning("too many files, skipping inexact rename detection");
|
||||
warning("too many files (created: %d deleted: %d), skipping inexact rename detection", num_create, num_src);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
|
@ -2267,7 +2267,7 @@ sub do_git_commit {
|
|||
}
|
||||
die "Tree is not a valid sha1: $tree\n" if $tree !~ /^$::sha1$/o;
|
||||
|
||||
my @exec = ('git-commit-tree', $tree);
|
||||
my @exec = ('git', 'commit-tree', $tree);
|
||||
foreach ($self->get_commit_parents($log_entry)) {
|
||||
push @exec, '-p', $_;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ test_expect_success \
|
|||
'validate file modification time' \
|
||||
'mkdir extract &&
|
||||
"$TAR" xf b.tar -C extract a/a &&
|
||||
perl -e '\''print((stat("extract/a/a"))[9], "\n")'\'' >b.mtime &&
|
||||
test-chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&
|
||||
echo "1117231200" >expected.mtime &&
|
||||
diff expected.mtime b.mtime'
|
||||
|
||||
|
|
|
@ -1,39 +1,83 @@
|
|||
/*
|
||||
* This program can either change modification time of the given
|
||||
* file(s) or just print it. The program does not change atime nor
|
||||
* ctime (their values are explicitely preserved).
|
||||
*
|
||||
* The mtime can be changed to an absolute value:
|
||||
*
|
||||
* test-chmtime =<seconds> file...
|
||||
*
|
||||
* Relative to the current time as returned by time(3):
|
||||
*
|
||||
* test-chmtime =+<seconds> (or =-<seconds>) file...
|
||||
*
|
||||
* Or relative to the current mtime of the file:
|
||||
*
|
||||
* test-chmtime <seconds> file...
|
||||
* test-chmtime +<seconds> (or -<seconds>) file...
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* To just print the mtime use --verbose and set the file mtime offset to 0:
|
||||
*
|
||||
* test-chmtime -v +0 file
|
||||
*
|
||||
* To set the mtime to current time:
|
||||
*
|
||||
* test-chmtime =+0 file
|
||||
*
|
||||
*/
|
||||
#include "git-compat-util.h"
|
||||
#include <utime.h>
|
||||
|
||||
static const char usage_str[] = "(+|=|=+|=-|-)<seconds> <file>...";
|
||||
static const char usage_str[] = "-v|--verbose (+|=|=+|=-|-)<seconds> <file>...";
|
||||
|
||||
static int timespec_arg(const char *arg, long int *set_time, int *set_eq)
|
||||
{
|
||||
char *test;
|
||||
const char *timespec = arg;
|
||||
*set_eq = (*timespec == '=') ? 1 : 0;
|
||||
if (*set_eq) {
|
||||
timespec++;
|
||||
if (*timespec == '+') {
|
||||
*set_eq = 2; /* relative "in the future" */
|
||||
timespec++;
|
||||
}
|
||||
}
|
||||
*set_time = strtol(timespec, &test, 10);
|
||||
if (*test) {
|
||||
fprintf(stderr, "Not a base-10 integer: %s\n", arg + 1);
|
||||
return 0;
|
||||
}
|
||||
if ((*set_eq && *set_time < 0) || *set_eq == 2) {
|
||||
time_t now = time(NULL);
|
||||
*set_time += now;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
int i;
|
||||
int set_eq;
|
||||
long int set_time;
|
||||
char *test;
|
||||
const char *timespec;
|
||||
static int verbose;
|
||||
|
||||
int i = 1;
|
||||
/* no mtime change by default */
|
||||
int set_eq = 0;
|
||||
long int set_time = 0;
|
||||
|
||||
if (argc < 3)
|
||||
goto usage;
|
||||
|
||||
timespec = argv[1];
|
||||
set_eq = (*timespec == '=') ? 1 : 0;
|
||||
if (set_eq) {
|
||||
timespec++;
|
||||
if (*timespec == '+') {
|
||||
set_eq = 2; /* relative "in the future" */
|
||||
timespec++;
|
||||
}
|
||||
if (strcmp(argv[i], "--verbose") == 0 || strcmp(argv[i], "-v") == 0) {
|
||||
verbose = 1;
|
||||
++i;
|
||||
}
|
||||
set_time = strtol(timespec, &test, 10);
|
||||
if (*test) {
|
||||
fprintf(stderr, "Not a base-10 integer: %s\n", argv[1] + 1);
|
||||
if (timespec_arg(argv[i], &set_time, &set_eq))
|
||||
++i;
|
||||
else
|
||||
goto usage;
|
||||
}
|
||||
if ((set_eq && set_time < 0) || set_eq == 2) {
|
||||
time_t now = time(NULL);
|
||||
set_time += now;
|
||||
}
|
||||
|
||||
for (i = 2; i < argc; i++) {
|
||||
for (; i < argc; i++) {
|
||||
struct stat sb;
|
||||
struct utimbuf utb;
|
||||
|
||||
|
@ -46,7 +90,12 @@ int main(int argc, const char *argv[])
|
|||
utb.actime = sb.st_atime;
|
||||
utb.modtime = set_eq ? set_time : sb.st_mtime + set_time;
|
||||
|
||||
if (utime(argv[i], &utb) < 0) {
|
||||
if (verbose) {
|
||||
uintmax_t mtime = utb.modtime < 0 ? 0: utb.modtime;
|
||||
printf("%"PRIuMAX"\t%s\n", mtime, argv[i]);
|
||||
}
|
||||
|
||||
if (utb.modtime != sb.st_mtime && utime(argv[i], &utb) < 0) {
|
||||
fprintf(stderr, "Failed to modify time on %s: %s\n",
|
||||
argv[i], strerror(errno));
|
||||
return -1;
|
||||
|
|
Загрузка…
Ссылка в новой задаче