зеркало из https://github.com/microsoft/git.git
Merge branch 'maint-1.5.4' into maint
* maint-1.5.4: core-tutorial.txt: Fix showing the current behaviour. git-archive: ignore prefix when checking file attribute Fix documentation syntax of optional arguments in short options.
This commit is contained in:
Коммит
179c94b24a
|
@ -535,18 +535,18 @@ with the associated patches use the more complex (and much more
|
||||||
powerful)
|
powerful)
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
$ git-whatchanged -p --root
|
$ git-whatchanged -p
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
and you will see exactly what has changed in the repository over its
|
and you will see exactly what has changed in the repository over its
|
||||||
short history.
|
short history.
|
||||||
|
|
||||||
[NOTE]
|
[NOTE]
|
||||||
The `\--root` flag is a flag to `git-diff-tree` to tell it to
|
When using the above two commands, the initial commit will be shown.
|
||||||
show the initial aka 'root' commit too. Normally you'd probably not
|
If this is a problem because it is huge, you can hide it by setting
|
||||||
want to see the initial import diff, but since the tutorial project
|
the log.showroot configuration variable to false. Having this, you
|
||||||
was started from scratch and is so small, we use it to make the result
|
can still show it for each command just adding the `\--root` option,
|
||||||
a bit more interesting.
|
which is a flag for `git-diff-tree` accepted by both commands.
|
||||||
|
|
||||||
With that, you should now be having some inkling of what git does, and
|
With that, you should now be having some inkling of what git does, and
|
||||||
can explore on your own.
|
can explore on your own.
|
||||||
|
|
|
@ -11,7 +11,7 @@ SYNOPSIS
|
||||||
[verse]
|
[verse]
|
||||||
'git-tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] <name> [<head>]
|
'git-tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] <name> [<head>]
|
||||||
'git-tag' -d <name>...
|
'git-tag' -d <name>...
|
||||||
'git-tag' [-n [<num>]] -l [<pattern>]
|
'git-tag' [-n[<num>]] -l [<pattern>]
|
||||||
'git-tag' -v <name>...
|
'git-tag' -v <name>...
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
@ -57,7 +57,7 @@ OPTIONS
|
||||||
-v::
|
-v::
|
||||||
Verify the gpg signature of the given tag names.
|
Verify the gpg signature of the given tag names.
|
||||||
|
|
||||||
-n <num>::
|
-n<num>::
|
||||||
<num> specifies how many lines from the annotation, if any,
|
<num> specifies how many lines from the annotation, if any,
|
||||||
are printed when using -l.
|
are printed when using -l.
|
||||||
The default is not to print any annotation lines.
|
The default is not to print any annotation lines.
|
||||||
|
|
|
@ -17,6 +17,7 @@ static time_t archive_time;
|
||||||
static int tar_umask = 002;
|
static int tar_umask = 002;
|
||||||
static int verbose;
|
static int verbose;
|
||||||
static const struct commit *commit;
|
static const struct commit *commit;
|
||||||
|
static size_t base_len;
|
||||||
|
|
||||||
/* writes out the whole block, but only if it is full */
|
/* writes out the whole block, but only if it is full */
|
||||||
static void write_if_needed(void)
|
static void write_if_needed(void)
|
||||||
|
@ -251,8 +252,8 @@ static int write_tar_entry(const unsigned char *sha1,
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
size = 0;
|
size = 0;
|
||||||
} else {
|
} else {
|
||||||
buffer = sha1_file_to_archive(path.buf, sha1, mode, &type,
|
buffer = sha1_file_to_archive(path.buf + base_len, sha1, mode,
|
||||||
&size, commit);
|
&type, &size, commit);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
die("cannot read %s", sha1_to_hex(sha1));
|
die("cannot read %s", sha1_to_hex(sha1));
|
||||||
}
|
}
|
||||||
|
@ -272,6 +273,7 @@ int write_tar_archive(struct archiver_args *args)
|
||||||
archive_time = args->time;
|
archive_time = args->time;
|
||||||
verbose = args->verbose;
|
verbose = args->verbose;
|
||||||
commit = args->commit;
|
commit = args->commit;
|
||||||
|
base_len = args->base ? strlen(args->base) : 0;
|
||||||
|
|
||||||
if (args->commit_sha1)
|
if (args->commit_sha1)
|
||||||
write_global_extended_header(args->commit_sha1);
|
write_global_extended_header(args->commit_sha1);
|
||||||
|
|
|
@ -13,6 +13,7 @@ static int verbose;
|
||||||
static int zip_date;
|
static int zip_date;
|
||||||
static int zip_time;
|
static int zip_time;
|
||||||
static const struct commit *commit;
|
static const struct commit *commit;
|
||||||
|
static size_t base_len;
|
||||||
|
|
||||||
static unsigned char *zip_dir;
|
static unsigned char *zip_dir;
|
||||||
static unsigned int zip_dir_size;
|
static unsigned int zip_dir_size;
|
||||||
|
@ -197,8 +198,8 @@ static int write_zip_entry(const unsigned char *sha1,
|
||||||
if (S_ISREG(mode) && zlib_compression_level != 0)
|
if (S_ISREG(mode) && zlib_compression_level != 0)
|
||||||
method = 8;
|
method = 8;
|
||||||
result = 0;
|
result = 0;
|
||||||
buffer = sha1_file_to_archive(path, sha1, mode, &type, &size,
|
buffer = sha1_file_to_archive(path + base_len, sha1, mode,
|
||||||
commit);
|
&type, &size, commit);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
die("cannot read %s", sha1_to_hex(sha1));
|
die("cannot read %s", sha1_to_hex(sha1));
|
||||||
crc = crc32(crc, buffer, size);
|
crc = crc32(crc, buffer, size);
|
||||||
|
@ -321,6 +322,7 @@ int write_zip_archive(struct archiver_args *args)
|
||||||
zip_dir_size = ZIP_DIRECTORY_MIN_SIZE;
|
zip_dir_size = ZIP_DIRECTORY_MIN_SIZE;
|
||||||
verbose = args->verbose;
|
verbose = args->verbose;
|
||||||
commit = args->commit;
|
commit = args->commit;
|
||||||
|
base_len = args->base ? strlen(args->base) : 0;
|
||||||
|
|
||||||
if (args->base && plen > 0 && args->base[plen - 1] == '/') {
|
if (args->base && plen > 0 && args->base[plen - 1] == '/') {
|
||||||
char *base = xstrdup(args->base);
|
char *base = xstrdup(args->base);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
static const char * const git_tag_usage[] = {
|
static const char * const git_tag_usage[] = {
|
||||||
"git-tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]",
|
"git-tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]",
|
||||||
"git-tag -d <tagname>...",
|
"git-tag -d <tagname>...",
|
||||||
"git-tag -l [-n [<num>]] [<pattern>]",
|
"git-tag -l [-n[<num>]] [<pattern>]",
|
||||||
"git-tag -v <tagname>...",
|
"git-tag -v <tagname>...",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
|
@ -344,7 +344,7 @@ void usage_with_options_internal(const char * const *usagestr,
|
||||||
break;
|
break;
|
||||||
case OPTION_INTEGER:
|
case OPTION_INTEGER:
|
||||||
if (opts->flags & PARSE_OPT_OPTARG)
|
if (opts->flags & PARSE_OPT_OPTARG)
|
||||||
pos += fprintf(stderr, " [<n>]");
|
pos += fprintf(stderr, "[<n>]");
|
||||||
else
|
else
|
||||||
pos += fprintf(stderr, " <n>");
|
pos += fprintf(stderr, " <n>");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -109,9 +109,10 @@ test_expect_success \
|
||||||
'diff -r a c/prefix/a'
|
'diff -r a c/prefix/a'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'create an archive with a substfiles' \
|
'create archives with substfiles' \
|
||||||
'echo "substfile?" export-subst >a/.gitattributes &&
|
'echo "substfile?" export-subst >a/.gitattributes &&
|
||||||
git archive HEAD >f.tar &&
|
git archive HEAD >f.tar &&
|
||||||
|
git archive --prefix=prefix/ HEAD >g.tar &&
|
||||||
rm a/.gitattributes'
|
rm a/.gitattributes'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
|
@ -126,6 +127,18 @@ test_expect_success \
|
||||||
diff a/substfile2 f/a/substfile2
|
diff a/substfile2 f/a/substfile2
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success \
|
||||||
|
'extract substfiles from archive with prefix' \
|
||||||
|
'(mkdir g && cd g && $TAR xf -) <g.tar'
|
||||||
|
|
||||||
|
test_expect_success \
|
||||||
|
'validate substfile contents from archive with prefix' \
|
||||||
|
'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
|
||||||
|
>g/prefix/a/substfile1.expected &&
|
||||||
|
diff g/prefix/a/substfile1.expected g/prefix/a/substfile1 &&
|
||||||
|
diff a/substfile2 g/prefix/a/substfile2
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'git archive --format=zip' \
|
'git archive --format=zip' \
|
||||||
'git archive --format=zip HEAD >d.zip'
|
'git archive --format=zip HEAD >d.zip'
|
||||||
|
|
Загрузка…
Ссылка в новой задаче