mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
Merge branch 'master' of git://repo.or.cz/alt-git
This commit is contained in:
43
Documentation/RelNotes-1.5.6.4.txt
Normal file
43
Documentation/RelNotes-1.5.6.4.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
GIT v1.5.6.4 Release Notes
|
||||
==========================
|
||||
|
||||
Fixes since v1.5.6.3
|
||||
--------------------
|
||||
|
||||
* Various commands could overflow its internal buffer on a platform
|
||||
with small PATH_MAX value in a repository that has contents with
|
||||
long pathnames.
|
||||
|
||||
* There wasn't a way to make --pretty=format:%<> specifiers to honor
|
||||
.mailmap name rewriting for authors and committers. Now you can with
|
||||
%aN and %cN.
|
||||
|
||||
* Bash completion wasted too many cycles; this has been optimized to be
|
||||
usable again.
|
||||
|
||||
* Bash completion lost ref part when completing something like "git show
|
||||
pu:Makefile".
|
||||
|
||||
* "git-cvsserver" did not clean up its temporary working area after annotate
|
||||
request.
|
||||
|
||||
* "git-daemon" called syslog() from its signal handler, which was a
|
||||
no-no.
|
||||
|
||||
* "git-fetch" into an empty repository used to remind that the fetch will
|
||||
be huge by saying "no common commits", but this was an unnecessary
|
||||
noise; it is already known by the user anyway.
|
||||
|
||||
* "git-mailinfo" (hence "git-am") did not correctly handle in-body [PATCH]
|
||||
line to override the commit title taken from the mail Subject header.
|
||||
|
||||
* "git-rebase -i -p" lost parents that are not involved in the history
|
||||
being rewritten.
|
||||
|
||||
Contains other various documentation fixes.
|
||||
|
||||
--
|
||||
exec >/var/tmp/1
|
||||
echo O=$(git describe maint)
|
||||
O=v1.5.6.3-21-gebcce31
|
||||
git shortlog --no-merges $O..maint
|
||||
@@ -28,6 +28,10 @@ actually affected all git commands, now only affects "git config".
|
||||
GIT_LOCAL_CONFIG, also only documented as affecting "git config" and
|
||||
not different from GIT_CONFIG in a useful way, is removed.
|
||||
|
||||
The ".dotest" temporary area "git am" and "git rebase" use is now moved
|
||||
inside the $GIT_DIR, to avoid mistakes of adding it to the project by
|
||||
accident.
|
||||
|
||||
An ancient merge strategy "stupid" has been removed.
|
||||
|
||||
|
||||
@@ -67,7 +71,8 @@ Updates since v1.5.6
|
||||
|
||||
(performance, robustness, sanity etc.)
|
||||
|
||||
* even more documentation pages are now accessible via "man" and "git help".
|
||||
* index-pack used too much memory when dealing with a deep delta chain.
|
||||
This has been optimized.
|
||||
|
||||
* reduced excessive inlining to shrink size of the "git" binary.
|
||||
|
||||
@@ -79,6 +84,8 @@ Updates since v1.5.6
|
||||
repack -a -f" can be used to fix such a corruption as long as necessary
|
||||
objects are available.
|
||||
|
||||
* Performance of "git-blame -C -C" operation is vastly improved.
|
||||
|
||||
* git-clone does not create refs in loose form anymore (it behaves as
|
||||
if you immediately ran git-pack-refs after cloning). This will help
|
||||
repositories with insanely large number of refs.
|
||||
@@ -92,6 +99,8 @@ Updates since v1.5.6
|
||||
|
||||
(usability, bells and whistles)
|
||||
|
||||
* even more documentation pages are now accessible via "man" and "git help".
|
||||
|
||||
* A new environment variable GIT_CEILING_DIRECTORIES can be used to stop
|
||||
the discovery process of the toplevel of working tree; this may be useful
|
||||
when you are working in a slow network disk and are outside any working tree,
|
||||
@@ -188,6 +197,8 @@ Updates since v1.5.6
|
||||
|
||||
(internal)
|
||||
|
||||
* git-merge has been reimplemented in C.
|
||||
|
||||
|
||||
Fixes since v1.5.6
|
||||
------------------
|
||||
@@ -195,12 +206,8 @@ Fixes since v1.5.6
|
||||
All of the fixes in v1.5.6 maintenance series are included in
|
||||
this release, unless otherwise noted.
|
||||
|
||||
* "git fetch" into an empty repository used to remind the fetch will
|
||||
be huge by saying "no common commits", but it is already known by
|
||||
the user anyway (need to backport 8cb560f to 'maint').
|
||||
|
||||
---
|
||||
exec >/var/tmp/1
|
||||
O=v1.5.6.3-350-g499027b
|
||||
O=v1.5.6.3-436-g1f8dc67
|
||||
echo O=$(git describe refs/heads/master)
|
||||
git shortlog --no-merges $O..refs/heads/master ^refs/heads/maint
|
||||
|
||||
@@ -58,14 +58,14 @@ OPTIONS
|
||||
Usually the command automatically creates a commit with
|
||||
a commit log message stating which commit was
|
||||
cherry-picked. This flag applies the change necessary
|
||||
to cherry-pick the named commit to your working tree,
|
||||
but does not make the commit. In addition, when this
|
||||
option is used, your working tree does not have to match
|
||||
to cherry-pick the named commit to your working tree
|
||||
and the index, but does not make the commit. In addition,
|
||||
when this option is used, your index does not have to match
|
||||
the HEAD commit. The cherry-pick is done against the
|
||||
beginning state of your working tree.
|
||||
beginning state of your index.
|
||||
+
|
||||
This is useful when cherry-picking more than one commits'
|
||||
effect to your working tree in a row.
|
||||
effect to your index in a row.
|
||||
|
||||
-s::
|
||||
--signoff::
|
||||
|
||||
@@ -43,16 +43,16 @@ OPTIONS
|
||||
-n::
|
||||
--no-commit::
|
||||
Usually the command automatically creates a commit with
|
||||
a commit log message stating which commit was reverted.
|
||||
This flag applies the change necessary to revert the
|
||||
named commit to your working tree, but does not make the
|
||||
commit. In addition, when this option is used, your
|
||||
working tree does not have to match the HEAD commit.
|
||||
The revert is done against the beginning state of your
|
||||
working tree.
|
||||
a commit log message stating which commit was
|
||||
reverted. This flag applies the change necessary
|
||||
to revert the named commit to your working tree
|
||||
and the index, but does not make the commit. In addition,
|
||||
when this option is used, your index does not have to match
|
||||
the HEAD commit. The revert is done against the
|
||||
beginning state of your index.
|
||||
+
|
||||
This is useful when reverting more than one commits'
|
||||
effect to your working tree in a row.
|
||||
effect to your index in a row.
|
||||
|
||||
-s::
|
||||
--signoff::
|
||||
|
||||
@@ -16,6 +16,28 @@ SYNOPSIS
|
||||
'git submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...]
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
Submodules are a special kind of tree entries which refer to a particular tree
|
||||
state in another repository. The tree entry describes
|
||||
the existence of a submodule with the given name and the exact revision that
|
||||
should be used, while an entry in `.gitmodules` file gives the location of
|
||||
the repository.
|
||||
|
||||
When checked out, submodules will maintain their own independent repositories
|
||||
within their directories; the only link between the submodule and the "parent
|
||||
project" is the tree entry within the parent project mentioned above.
|
||||
|
||||
This command will manage the tree entries and contents of the gitmodules file
|
||||
for you, as well as inspecting the status of your submodules and updating them.
|
||||
When adding a new submodule to the tree, the 'add' subcommand is to be used.
|
||||
However, when pulling a tree containing submodules, these will not be checked
|
||||
out by default; the 'init' and 'update' subcommands will maintain submodules
|
||||
checked out and at appropriate revision in your working tree. You can inspect
|
||||
the current status of your submodules using the 'submodule' subcommand and get
|
||||
an overview of changes 'update' would perform using the 'summary' subcommand.
|
||||
|
||||
|
||||
COMMANDS
|
||||
--------
|
||||
add::
|
||||
|
||||
2
Makefile
2
Makefile
@@ -1299,7 +1299,7 @@ check: common-cmds.h
|
||||
for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done
|
||||
|
||||
remove-dashes:
|
||||
./fixup-builtins $(BUILT_INS)
|
||||
./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS)
|
||||
|
||||
### Installation rules
|
||||
|
||||
|
||||
115
archive-tar.c
115
archive-tar.c
@@ -13,11 +13,7 @@
|
||||
static char block[BLOCKSIZE];
|
||||
static unsigned long offset;
|
||||
|
||||
static time_t archive_time;
|
||||
static int tar_umask = 002;
|
||||
static int verbose;
|
||||
static const struct commit *commit;
|
||||
static size_t base_len;
|
||||
|
||||
/* writes out the whole block, but only if it is full */
|
||||
static void write_if_needed(void)
|
||||
@@ -114,22 +110,24 @@ static unsigned int ustar_header_chksum(const struct ustar_header *header)
|
||||
return chksum;
|
||||
}
|
||||
|
||||
static int get_path_prefix(const struct strbuf *path, int maxlen)
|
||||
static size_t get_path_prefix(const char *path, size_t pathlen, size_t maxlen)
|
||||
{
|
||||
int i = path->len;
|
||||
size_t i = pathlen;
|
||||
if (i > maxlen)
|
||||
i = maxlen;
|
||||
do {
|
||||
i--;
|
||||
} while (i > 0 && path->buf[i] != '/');
|
||||
} while (i > 0 && path[i] != '/');
|
||||
return i;
|
||||
}
|
||||
|
||||
static void write_entry(const unsigned char *sha1, struct strbuf *path,
|
||||
unsigned int mode, void *buffer, unsigned long size)
|
||||
static int write_tar_entry(struct archiver_args *args,
|
||||
const unsigned char *sha1, const char *path, size_t pathlen,
|
||||
unsigned int mode, void *buffer, unsigned long size)
|
||||
{
|
||||
struct ustar_header header;
|
||||
struct strbuf ext_header;
|
||||
int err = 0;
|
||||
|
||||
memset(&header, 0, sizeof(header));
|
||||
strbuf_init(&ext_header, 0);
|
||||
@@ -143,8 +141,6 @@ static void write_entry(const unsigned char *sha1, struct strbuf *path,
|
||||
mode = 0100666;
|
||||
sprintf(header.name, "%s.paxheader", sha1_to_hex(sha1));
|
||||
} else {
|
||||
if (verbose)
|
||||
fprintf(stderr, "%.*s\n", (int)path->len, path->buf);
|
||||
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
|
||||
*header.typeflag = TYPEFLAG_DIR;
|
||||
mode = (mode | 0777) & ~tar_umask;
|
||||
@@ -155,24 +151,24 @@ static void write_entry(const unsigned char *sha1, struct strbuf *path,
|
||||
*header.typeflag = TYPEFLAG_REG;
|
||||
mode = (mode | ((mode & 0100) ? 0777 : 0666)) & ~tar_umask;
|
||||
} else {
|
||||
error("unsupported file mode: 0%o (SHA1: %s)",
|
||||
mode, sha1_to_hex(sha1));
|
||||
return;
|
||||
return error("unsupported file mode: 0%o (SHA1: %s)",
|
||||
mode, sha1_to_hex(sha1));
|
||||
}
|
||||
if (path->len > sizeof(header.name)) {
|
||||
int plen = get_path_prefix(path, sizeof(header.prefix));
|
||||
int rest = path->len - plen - 1;
|
||||
if (pathlen > sizeof(header.name)) {
|
||||
size_t plen = get_path_prefix(path, pathlen,
|
||||
sizeof(header.prefix));
|
||||
size_t rest = pathlen - plen - 1;
|
||||
if (plen > 0 && rest <= sizeof(header.name)) {
|
||||
memcpy(header.prefix, path->buf, plen);
|
||||
memcpy(header.name, path->buf + plen + 1, rest);
|
||||
memcpy(header.prefix, path, plen);
|
||||
memcpy(header.name, path + plen + 1, rest);
|
||||
} else {
|
||||
sprintf(header.name, "%s.data",
|
||||
sha1_to_hex(sha1));
|
||||
strbuf_append_ext_header(&ext_header, "path",
|
||||
path->buf, path->len);
|
||||
path, pathlen);
|
||||
}
|
||||
} else
|
||||
memcpy(header.name, path->buf, path->len);
|
||||
memcpy(header.name, path, pathlen);
|
||||
}
|
||||
|
||||
if (S_ISLNK(mode) && buffer) {
|
||||
@@ -187,7 +183,7 @@ static void write_entry(const unsigned char *sha1, struct strbuf *path,
|
||||
|
||||
sprintf(header.mode, "%07o", mode & 07777);
|
||||
sprintf(header.size, "%011lo", S_ISREG(mode) ? size : 0);
|
||||
sprintf(header.mtime, "%011lo", archive_time);
|
||||
sprintf(header.mtime, "%011lo", args->time);
|
||||
|
||||
sprintf(header.uid, "%07o", 0);
|
||||
sprintf(header.gid, "%07o", 0);
|
||||
@@ -202,22 +198,30 @@ static void write_entry(const unsigned char *sha1, struct strbuf *path,
|
||||
sprintf(header.chksum, "%07o", ustar_header_chksum(&header));
|
||||
|
||||
if (ext_header.len > 0) {
|
||||
write_entry(sha1, NULL, 0, ext_header.buf, ext_header.len);
|
||||
err = write_tar_entry(args, sha1, NULL, 0, 0, ext_header.buf,
|
||||
ext_header.len);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
strbuf_release(&ext_header);
|
||||
write_blocked(&header, sizeof(header));
|
||||
if (S_ISREG(mode) && buffer && size > 0)
|
||||
write_blocked(buffer, size);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void write_global_extended_header(const unsigned char *sha1)
|
||||
static int write_global_extended_header(struct archiver_args *args)
|
||||
{
|
||||
const unsigned char *sha1 = args->commit_sha1;
|
||||
struct strbuf ext_header;
|
||||
int err;
|
||||
|
||||
strbuf_init(&ext_header, 0);
|
||||
strbuf_append_ext_header(&ext_header, "comment", sha1_to_hex(sha1), 40);
|
||||
write_entry(NULL, NULL, 0, ext_header.buf, ext_header.len);
|
||||
err = write_tar_entry(args, NULL, NULL, 0, 0, ext_header.buf,
|
||||
ext_header.len);
|
||||
strbuf_release(&ext_header);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int git_tar_config(const char *var, const char *value, void *cb)
|
||||
@@ -234,64 +238,17 @@ static int git_tar_config(const char *var, const char *value, void *cb)
|
||||
return git_default_config(var, value, cb);
|
||||
}
|
||||
|
||||
static int write_tar_entry(const unsigned char *sha1,
|
||||
const char *base, int baselen,
|
||||
const char *filename, unsigned mode, int stage)
|
||||
{
|
||||
static struct strbuf path = STRBUF_INIT;
|
||||
void *buffer;
|
||||
enum object_type type;
|
||||
unsigned long size;
|
||||
|
||||
strbuf_reset(&path);
|
||||
strbuf_grow(&path, PATH_MAX);
|
||||
strbuf_add(&path, base, baselen);
|
||||
strbuf_addstr(&path, filename);
|
||||
if (is_archive_path_ignored(path.buf + base_len))
|
||||
return 0;
|
||||
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
|
||||
strbuf_addch(&path, '/');
|
||||
buffer = NULL;
|
||||
size = 0;
|
||||
} else {
|
||||
buffer = sha1_file_to_archive(path.buf + base_len, sha1, mode,
|
||||
&type, &size, commit);
|
||||
if (!buffer)
|
||||
die("cannot read %s", sha1_to_hex(sha1));
|
||||
}
|
||||
|
||||
write_entry(sha1, &path, mode, buffer, size);
|
||||
free(buffer);
|
||||
|
||||
return READ_TREE_RECURSIVE;
|
||||
}
|
||||
|
||||
int write_tar_archive(struct archiver_args *args)
|
||||
{
|
||||
int plen = args->base ? strlen(args->base) : 0;
|
||||
int err = 0;
|
||||
|
||||
git_config(git_tar_config, NULL);
|
||||
|
||||
archive_time = args->time;
|
||||
verbose = args->verbose;
|
||||
commit = args->commit;
|
||||
base_len = args->base ? strlen(args->base) : 0;
|
||||
|
||||
if (args->commit_sha1)
|
||||
write_global_extended_header(args->commit_sha1);
|
||||
|
||||
if (args->base && plen > 0 && args->base[plen - 1] == '/') {
|
||||
char *base = xstrdup(args->base);
|
||||
int baselen = strlen(base);
|
||||
|
||||
while (baselen > 0 && base[baselen - 1] == '/')
|
||||
base[--baselen] = '\0';
|
||||
write_tar_entry(args->tree->object.sha1, "", 0, base, 040777, 0);
|
||||
free(base);
|
||||
}
|
||||
read_tree_recursive(args->tree, args->base, plen, 0,
|
||||
args->pathspec, write_tar_entry);
|
||||
write_trailer();
|
||||
|
||||
return 0;
|
||||
err = write_global_extended_header(args);
|
||||
if (!err)
|
||||
err = write_archive_entries(args, write_tar_entry);
|
||||
if (!err)
|
||||
write_trailer();
|
||||
return err;
|
||||
}
|
||||
|
||||
100
archive-zip.c
100
archive-zip.c
@@ -9,11 +9,8 @@
|
||||
#include "builtin.h"
|
||||
#include "archive.h"
|
||||
|
||||
static int verbose;
|
||||
static int zip_date;
|
||||
static int zip_time;
|
||||
static const struct commit *commit;
|
||||
static size_t base_len;
|
||||
|
||||
static unsigned char *zip_dir;
|
||||
static unsigned int zip_dir_size;
|
||||
@@ -128,33 +125,9 @@ static void *zlib_deflate(void *data, unsigned long size,
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static char *construct_path(const char *base, int baselen,
|
||||
const char *filename, int isdir, int *pathlen)
|
||||
{
|
||||
int filenamelen = strlen(filename);
|
||||
int len = baselen + filenamelen;
|
||||
char *path, *p;
|
||||
|
||||
if (isdir)
|
||||
len++;
|
||||
p = path = xmalloc(len + 1);
|
||||
|
||||
memcpy(p, base, baselen);
|
||||
p += baselen;
|
||||
memcpy(p, filename, filenamelen);
|
||||
p += filenamelen;
|
||||
if (isdir)
|
||||
*p++ = '/';
|
||||
*p = '\0';
|
||||
|
||||
*pathlen = len;
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
static int write_zip_entry(const unsigned char *sha1,
|
||||
const char *base, int baselen,
|
||||
const char *filename, unsigned mode, int stage)
|
||||
static int write_zip_entry(struct archiver_args *args,
|
||||
const unsigned char *sha1, const char *path, size_t pathlen,
|
||||
unsigned int mode, void *buffer, unsigned long size)
|
||||
{
|
||||
struct zip_local_header header;
|
||||
struct zip_dir_header dirent;
|
||||
@@ -163,33 +136,20 @@ static int write_zip_entry(const unsigned char *sha1,
|
||||
unsigned long uncompressed_size;
|
||||
unsigned long crc;
|
||||
unsigned long direntsize;
|
||||
unsigned long size;
|
||||
int method;
|
||||
int result = -1;
|
||||
int pathlen;
|
||||
unsigned char *out;
|
||||
char *path;
|
||||
enum object_type type;
|
||||
void *buffer = NULL;
|
||||
void *deflated = NULL;
|
||||
|
||||
crc = crc32(0, NULL, 0);
|
||||
|
||||
path = construct_path(base, baselen, filename, S_ISDIR(mode), &pathlen);
|
||||
if (is_archive_path_ignored(path + base_len))
|
||||
return 0;
|
||||
if (verbose)
|
||||
fprintf(stderr, "%s\n", path);
|
||||
if (pathlen > 0xffff) {
|
||||
error("path too long (%d chars, SHA1: %s): %s", pathlen,
|
||||
sha1_to_hex(sha1), path);
|
||||
goto out;
|
||||
return error("path too long (%d chars, SHA1: %s): %s",
|
||||
(int)pathlen, sha1_to_hex(sha1), path);
|
||||
}
|
||||
|
||||
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
|
||||
method = 0;
|
||||
attr2 = 16;
|
||||
result = (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0);
|
||||
out = NULL;
|
||||
uncompressed_size = 0;
|
||||
compressed_size = 0;
|
||||
@@ -199,19 +159,13 @@ static int write_zip_entry(const unsigned char *sha1,
|
||||
(mode & 0111) ? ((mode) << 16) : 0;
|
||||
if (S_ISREG(mode) && zlib_compression_level != 0)
|
||||
method = 8;
|
||||
result = 0;
|
||||
buffer = sha1_file_to_archive(path + base_len, sha1, mode,
|
||||
&type, &size, commit);
|
||||
if (!buffer)
|
||||
die("cannot read %s", sha1_to_hex(sha1));
|
||||
crc = crc32(crc, buffer, size);
|
||||
out = buffer;
|
||||
uncompressed_size = size;
|
||||
compressed_size = size;
|
||||
} else {
|
||||
error("unsupported file mode: 0%o (SHA1: %s)", mode,
|
||||
sha1_to_hex(sha1));
|
||||
goto out;
|
||||
return error("unsupported file mode: 0%o (SHA1: %s)", mode,
|
||||
sha1_to_hex(sha1));
|
||||
}
|
||||
|
||||
if (method == 8) {
|
||||
@@ -278,12 +232,9 @@ static int write_zip_entry(const unsigned char *sha1,
|
||||
zip_offset += compressed_size;
|
||||
}
|
||||
|
||||
out:
|
||||
free(buffer);
|
||||
free(deflated);
|
||||
free(path);
|
||||
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void write_zip_trailer(const unsigned char *sha1)
|
||||
@@ -316,43 +267,18 @@ static void dos_time(time_t *time, int *dos_date, int *dos_time)
|
||||
|
||||
int write_zip_archive(struct archiver_args *args)
|
||||
{
|
||||
int plen = strlen(args->base);
|
||||
int err;
|
||||
|
||||
dos_time(&args->time, &zip_date, &zip_time);
|
||||
|
||||
zip_dir = xmalloc(ZIP_DIRECTORY_MIN_SIZE);
|
||||
zip_dir_size = ZIP_DIRECTORY_MIN_SIZE;
|
||||
verbose = args->verbose;
|
||||
commit = args->commit;
|
||||
base_len = args->base ? strlen(args->base) : 0;
|
||||
|
||||
if (args->base && plen > 0 && args->base[plen - 1] == '/') {
|
||||
char *base = xstrdup(args->base);
|
||||
int baselen = strlen(base);
|
||||
|
||||
while (baselen > 0 && base[baselen - 1] == '/')
|
||||
base[--baselen] = '\0';
|
||||
write_zip_entry(args->tree->object.sha1, "", 0, base, 040777, 0);
|
||||
free(base);
|
||||
}
|
||||
read_tree_recursive(args->tree, args->base, plen, 0,
|
||||
args->pathspec, write_zip_entry);
|
||||
write_zip_trailer(args->commit_sha1);
|
||||
err = write_archive_entries(args, write_zip_entry);
|
||||
if (!err)
|
||||
write_zip_trailer(args->commit_sha1);
|
||||
|
||||
free(zip_dir);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *parse_extra_zip_args(int argc, const char **argv)
|
||||
{
|
||||
for (; argc > 0; argc--, argv++) {
|
||||
const char *arg = argv[0];
|
||||
|
||||
if (arg[0] == '-' && isdigit(arg[1]) && arg[2] == '\0')
|
||||
zlib_compression_level = arg[1] - '0';
|
||||
else
|
||||
die("Unknown argument for zip format: %s", arg);
|
||||
}
|
||||
return NULL;
|
||||
return err;
|
||||
}
|
||||
|
||||
132
archive.c
132
archive.c
@@ -1,6 +1,7 @@
|
||||
#include "cache.h"
|
||||
#include "commit.h"
|
||||
#include "attr.h"
|
||||
#include "archive.h"
|
||||
|
||||
static void format_subst(const struct commit *commit,
|
||||
const char *src, size_t len,
|
||||
@@ -35,34 +36,9 @@ static void format_subst(const struct commit *commit,
|
||||
free(to_free);
|
||||
}
|
||||
|
||||
static int convert_to_archive(const char *path,
|
||||
const void *src, size_t len,
|
||||
struct strbuf *buf,
|
||||
const struct commit *commit)
|
||||
{
|
||||
static struct git_attr *attr_export_subst;
|
||||
struct git_attr_check check[1];
|
||||
|
||||
if (!commit)
|
||||
return 0;
|
||||
|
||||
if (!attr_export_subst)
|
||||
attr_export_subst = git_attr("export-subst", 12);
|
||||
|
||||
check[0].attr = attr_export_subst;
|
||||
if (git_checkattr(path, ARRAY_SIZE(check), check))
|
||||
return 0;
|
||||
if (!ATTR_TRUE(check[0].value))
|
||||
return 0;
|
||||
|
||||
format_subst(commit, src, len, buf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void *sha1_file_to_archive(const char *path, const unsigned char *sha1,
|
||||
unsigned int mode, enum object_type *type,
|
||||
unsigned long *sizep,
|
||||
const struct commit *commit)
|
||||
static void *sha1_file_to_archive(const char *path, const unsigned char *sha1,
|
||||
unsigned int mode, enum object_type *type,
|
||||
unsigned long *sizep, const struct commit *commit)
|
||||
{
|
||||
void *buffer;
|
||||
|
||||
@@ -74,7 +50,8 @@ void *sha1_file_to_archive(const char *path, const unsigned char *sha1,
|
||||
strbuf_init(&buf, 0);
|
||||
strbuf_attach(&buf, buffer, *sizep, *sizep + 1);
|
||||
convert_to_working_tree(path, buf.buf, buf.len, &buf);
|
||||
convert_to_archive(path, buf.buf, buf.len, &buf, commit);
|
||||
if (commit)
|
||||
format_subst(commit, buf.buf, buf.len, &buf);
|
||||
buffer = strbuf_detach(&buf, &size);
|
||||
*sizep = size;
|
||||
}
|
||||
@@ -82,16 +59,99 @@ void *sha1_file_to_archive(const char *path, const unsigned char *sha1,
|
||||
return buffer;
|
||||
}
|
||||
|
||||
int is_archive_path_ignored(const char *path)
|
||||
static void setup_archive_check(struct git_attr_check *check)
|
||||
{
|
||||
static struct git_attr *attr_export_ignore;
|
||||
struct git_attr_check check[1];
|
||||
static struct git_attr *attr_export_subst;
|
||||
|
||||
if (!attr_export_ignore)
|
||||
if (!attr_export_ignore) {
|
||||
attr_export_ignore = git_attr("export-ignore", 13);
|
||||
|
||||
attr_export_subst = git_attr("export-subst", 12);
|
||||
}
|
||||
check[0].attr = attr_export_ignore;
|
||||
if (git_checkattr(path, ARRAY_SIZE(check), check))
|
||||
return 0;
|
||||
return ATTR_TRUE(check[0].value);
|
||||
check[1].attr = attr_export_subst;
|
||||
}
|
||||
|
||||
struct archiver_context {
|
||||
struct archiver_args *args;
|
||||
write_archive_entry_fn_t write_entry;
|
||||
};
|
||||
|
||||
static int write_archive_entry(const unsigned char *sha1, const char *base,
|
||||
int baselen, const char *filename, unsigned mode, int stage,
|
||||
void *context)
|
||||
{
|
||||
static struct strbuf path = STRBUF_INIT;
|
||||
struct archiver_context *c = context;
|
||||
struct archiver_args *args = c->args;
|
||||
write_archive_entry_fn_t write_entry = c->write_entry;
|
||||
struct git_attr_check check[2];
|
||||
const char *path_without_prefix;
|
||||
int convert = 0;
|
||||
int err;
|
||||
enum object_type type;
|
||||
unsigned long size;
|
||||
void *buffer;
|
||||
|
||||
strbuf_reset(&path);
|
||||
strbuf_grow(&path, PATH_MAX);
|
||||
strbuf_add(&path, base, baselen);
|
||||
strbuf_addstr(&path, filename);
|
||||
path_without_prefix = path.buf + args->baselen;
|
||||
|
||||
setup_archive_check(check);
|
||||
if (!git_checkattr(path_without_prefix, ARRAY_SIZE(check), check)) {
|
||||
if (ATTR_TRUE(check[0].value))
|
||||
return 0;
|
||||
convert = ATTR_TRUE(check[1].value);
|
||||
}
|
||||
|
||||
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
|
||||
strbuf_addch(&path, '/');
|
||||
if (args->verbose)
|
||||
fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
|
||||
err = write_entry(args, sha1, path.buf, path.len, mode, NULL, 0);
|
||||
if (err)
|
||||
return err;
|
||||
return READ_TREE_RECURSIVE;
|
||||
}
|
||||
|
||||
buffer = sha1_file_to_archive(path_without_prefix, sha1, mode,
|
||||
&type, &size, convert ? args->commit : NULL);
|
||||
if (!buffer)
|
||||
return error("cannot read %s", sha1_to_hex(sha1));
|
||||
if (args->verbose)
|
||||
fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
|
||||
err = write_entry(args, sha1, path.buf, path.len, mode, buffer, size);
|
||||
free(buffer);
|
||||
return err;
|
||||
}
|
||||
|
||||
int write_archive_entries(struct archiver_args *args,
|
||||
write_archive_entry_fn_t write_entry)
|
||||
{
|
||||
struct archiver_context context;
|
||||
int err;
|
||||
|
||||
if (args->baselen > 0 && args->base[args->baselen - 1] == '/') {
|
||||
size_t len = args->baselen;
|
||||
|
||||
while (len > 1 && args->base[len - 2] == '/')
|
||||
len--;
|
||||
if (args->verbose)
|
||||
fprintf(stderr, "%.*s\n", (int)len, args->base);
|
||||
err = write_entry(args, args->tree->object.sha1, args->base,
|
||||
len, 040777, NULL, 0);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
context.args = args;
|
||||
context.write_entry = write_entry;
|
||||
|
||||
err = read_tree_recursive(args->tree, args->base, args->baselen, 0,
|
||||
args->pathspec, write_archive_entry, &context);
|
||||
if (err == READ_TREE_RECURSIVE)
|
||||
err = 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
15
archive.h
15
archive.h
@@ -6,29 +6,26 @@
|
||||
|
||||
struct archiver_args {
|
||||
const char *base;
|
||||
size_t baselen;
|
||||
struct tree *tree;
|
||||
const unsigned char *commit_sha1;
|
||||
const struct commit *commit;
|
||||
time_t time;
|
||||
const char **pathspec;
|
||||
unsigned int verbose : 1;
|
||||
void *extra;
|
||||
};
|
||||
|
||||
typedef int (*write_archive_fn_t)(struct archiver_args *);
|
||||
|
||||
typedef void *(*parse_extra_args_fn_t)(int argc, const char **argv);
|
||||
typedef int (*write_archive_entry_fn_t)(struct archiver_args *args, const unsigned char *sha1, const char *path, size_t pathlen, unsigned int mode, void *buffer, unsigned long size);
|
||||
|
||||
struct archiver {
|
||||
const char *name;
|
||||
struct archiver_args args;
|
||||
write_archive_fn_t write_archive;
|
||||
parse_extra_args_fn_t parse_extra;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
extern int parse_archive_args(int argc,
|
||||
const char **argv,
|
||||
struct archiver *ar);
|
||||
extern int parse_archive_args(int argc, const char **argv, const struct archiver **ar, struct archiver_args *args);
|
||||
|
||||
extern void parse_treeish_arg(const char **treeish,
|
||||
struct archiver_args *ar_args,
|
||||
@@ -41,9 +38,7 @@ extern void parse_pathspec_arg(const char **pathspec,
|
||||
*/
|
||||
extern int write_tar_archive(struct archiver_args *);
|
||||
extern int write_zip_archive(struct archiver_args *);
|
||||
extern void *parse_extra_zip_args(int argc, const char **argv);
|
||||
|
||||
extern void *sha1_file_to_archive(const char *path, const unsigned char *sha1, unsigned int mode, enum object_type *type, unsigned long *size, const struct commit *commit);
|
||||
extern int is_archive_path_ignored(const char *path);
|
||||
extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
|
||||
|
||||
#endif /* ARCHIVE_H */
|
||||
|
||||
15
attr.c
15
attr.c
@@ -459,7 +459,9 @@ static void prepare_attr_stack(const char *path, int dirlen)
|
||||
{
|
||||
struct attr_stack *elem, *info;
|
||||
int len;
|
||||
char pathbuf[PATH_MAX];
|
||||
struct strbuf pathbuf;
|
||||
|
||||
strbuf_init(&pathbuf, dirlen+2+strlen(GITATTRIBUTES_FILE));
|
||||
|
||||
/*
|
||||
* At the bottom of the attribute stack is the built-in
|
||||
@@ -510,13 +512,14 @@ static void prepare_attr_stack(const char *path, int dirlen)
|
||||
len = strlen(attr_stack->origin);
|
||||
if (dirlen <= len)
|
||||
break;
|
||||
memcpy(pathbuf, path, dirlen);
|
||||
memcpy(pathbuf + dirlen, "/", 2);
|
||||
cp = strchr(pathbuf + len + 1, '/');
|
||||
strbuf_reset(&pathbuf);
|
||||
strbuf_add(&pathbuf, path, dirlen);
|
||||
strbuf_addch(&pathbuf, '/');
|
||||
cp = strchr(pathbuf.buf + len + 1, '/');
|
||||
strcpy(cp + 1, GITATTRIBUTES_FILE);
|
||||
elem = read_attr(pathbuf, 0);
|
||||
elem = read_attr(pathbuf.buf, 0);
|
||||
*cp = '\0';
|
||||
elem->origin = strdup(pathbuf);
|
||||
elem->origin = strdup(pathbuf.buf);
|
||||
elem->prev = attr_stack;
|
||||
attr_stack = elem;
|
||||
debug_push(elem);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "parse-options.h"
|
||||
|
||||
static const char * const builtin_add_usage[] = {
|
||||
"git-add [options] [--] <filepattern>...",
|
||||
"git add [options] [--] <filepattern>...",
|
||||
NULL
|
||||
};
|
||||
static int patch_interactive = 0, add_interactive = 0;
|
||||
|
||||
@@ -46,7 +46,7 @@ static const char *fake_ancestor;
|
||||
static int line_termination = '\n';
|
||||
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|fix|error|error-all>] <patch>...";
|
||||
"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|fix|error|error-all>] <patch>...";
|
||||
|
||||
static enum ws_error_action {
|
||||
nowarn_ws_error,
|
||||
|
||||
@@ -13,16 +13,13 @@
|
||||
#include "attr.h"
|
||||
|
||||
static const char archive_usage[] = \
|
||||
"git-archive --format=<fmt> [--prefix=<prefix>/] [--verbose] [<extra>] <tree-ish> [path...]";
|
||||
"git archive --format=<fmt> [--prefix=<prefix>/] [--verbose] [<extra>] <tree-ish> [path...]";
|
||||
|
||||
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 },
|
||||
#define USES_ZLIB_COMPRESSION 1
|
||||
|
||||
const struct archiver archivers[] = {
|
||||
{ "tar", write_tar_archive },
|
||||
{ "zip", write_zip_archive, USES_ZLIB_COMPRESSION },
|
||||
};
|
||||
|
||||
static int run_remote_archiver(const char *remote, int argc,
|
||||
@@ -79,21 +76,15 @@ static int run_remote_archiver(const char *remote, int argc,
|
||||
return !!rv;
|
||||
}
|
||||
|
||||
static int init_archiver(const char *name, struct archiver *ar)
|
||||
static const struct archiver *lookup_archiver(const char *name)
|
||||
{
|
||||
int rv = -1, i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(archivers); i++) {
|
||||
if (!strcmp(name, archivers[i].name)) {
|
||||
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;
|
||||
}
|
||||
if (!strcmp(name, archivers[i].name))
|
||||
return &archivers[i];
|
||||
}
|
||||
return rv;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void parse_pathspec_arg(const char **pathspec, struct archiver_args *ar_args)
|
||||
@@ -145,12 +136,12 @@ void parse_treeish_arg(const char **argv, struct archiver_args *ar_args,
|
||||
ar_args->time = archive_time;
|
||||
}
|
||||
|
||||
int parse_archive_args(int argc, const char **argv, struct archiver *ar)
|
||||
int parse_archive_args(int argc, const char **argv, const struct archiver **ar,
|
||||
struct archiver_args *args)
|
||||
{
|
||||
const char *extra_argv[MAX_EXTRA_ARGS];
|
||||
int extra_argc = 0;
|
||||
const char *format = "tar";
|
||||
const char *base = "";
|
||||
int compression_level = -1;
|
||||
int verbose = 0;
|
||||
int i;
|
||||
|
||||
@@ -178,29 +169,33 @@ int parse_archive_args(int argc, const char **argv, struct archiver *ar)
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
if (arg[0] == '-') {
|
||||
if (extra_argc > MAX_EXTRA_ARGS - 1)
|
||||
die("Too many extra options");
|
||||
extra_argv[extra_argc++] = arg;
|
||||
if (arg[0] == '-' && isdigit(arg[1]) && arg[2] == '\0') {
|
||||
compression_level = arg[1] - '0';
|
||||
continue;
|
||||
}
|
||||
if (arg[0] == '-')
|
||||
die("Unknown argument: %s", arg);
|
||||
break;
|
||||
}
|
||||
|
||||
/* We need at least one parameter -- tree-ish */
|
||||
if (argc - 1 < i)
|
||||
usage(archive_usage);
|
||||
if (init_archiver(format, ar) < 0)
|
||||
*ar = lookup_archiver(format);
|
||||
if (!*ar)
|
||||
die("Unknown archive format '%s'", format);
|
||||
|
||||
if (extra_argc) {
|
||||
if (!ar->parse_extra)
|
||||
die("'%s' format does not handle %s",
|
||||
ar->name, extra_argv[0]);
|
||||
ar->args.extra = ar->parse_extra(extra_argc, extra_argv);
|
||||
if (compression_level != -1) {
|
||||
if ((*ar)->flags & USES_ZLIB_COMPRESSION)
|
||||
zlib_compression_level = compression_level;
|
||||
else {
|
||||
die("Argument not supported for format '%s': -%d",
|
||||
format, compression_level);
|
||||
}
|
||||
}
|
||||
ar->args.verbose = verbose;
|
||||
ar->args.base = base;
|
||||
args->verbose = verbose;
|
||||
args->base = base;
|
||||
args->baselen = strlen(base);
|
||||
|
||||
return i;
|
||||
}
|
||||
@@ -238,7 +233,8 @@ static const char *extract_remote_arg(int *ac, const char **av)
|
||||
|
||||
int cmd_archive(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
struct archiver ar;
|
||||
const struct archiver *ar = NULL;
|
||||
struct archiver_args args;
|
||||
int tree_idx;
|
||||
const char *remote = NULL;
|
||||
|
||||
@@ -248,14 +244,13 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
|
||||
|
||||
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
|
||||
|
||||
memset(&ar, 0, sizeof(ar));
|
||||
tree_idx = parse_archive_args(argc, argv, &ar);
|
||||
tree_idx = parse_archive_args(argc, argv, &ar, &args);
|
||||
if (prefix == NULL)
|
||||
prefix = setup_git_directory();
|
||||
|
||||
argv += tree_idx;
|
||||
parse_treeish_arg(argv, &ar.args, prefix);
|
||||
parse_pathspec_arg(argv + 1, &ar.args);
|
||||
parse_treeish_arg(argv, &args, prefix);
|
||||
parse_pathspec_arg(argv + 1, &args);
|
||||
|
||||
return ar.write_archive(&ar.args);
|
||||
return ar->write_archive(&args);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "mailmap.h"
|
||||
#include "parse-options.h"
|
||||
|
||||
static char blame_usage[] = "git-blame [options] [rev-opts] [rev] [--] file";
|
||||
static char blame_usage[] = "git blame [options] [rev-opts] [rev] [--] file";
|
||||
|
||||
static const char *blame_opt_usage[] = {
|
||||
blame_usage,
|
||||
@@ -153,6 +153,10 @@ struct blame_entry {
|
||||
*/
|
||||
char guilty;
|
||||
|
||||
/* true if the entry has been scanned for copies in the current parent
|
||||
*/
|
||||
char scanned;
|
||||
|
||||
/* the line number of the first line of this group in the
|
||||
* suspect's file; internally all line numbers are 0 based.
|
||||
*/
|
||||
@@ -1008,7 +1012,8 @@ static int find_move_in_parent(struct scoreboard *sb,
|
||||
while (made_progress) {
|
||||
made_progress = 0;
|
||||
for (e = sb->ent; e; e = e->next) {
|
||||
if (e->guilty || !same_suspect(e->suspect, target))
|
||||
if (e->guilty || !same_suspect(e->suspect, target) ||
|
||||
ent_score(sb, e) < blame_move_score)
|
||||
continue;
|
||||
find_copy_in_blob(sb, e, parent, split, &file_p);
|
||||
if (split[1].suspect &&
|
||||
@@ -1033,6 +1038,7 @@ struct blame_list {
|
||||
*/
|
||||
static struct blame_list *setup_blame_list(struct scoreboard *sb,
|
||||
struct origin *target,
|
||||
int min_score,
|
||||
int *num_ents_p)
|
||||
{
|
||||
struct blame_entry *e;
|
||||
@@ -1040,18 +1046,32 @@ static struct blame_list *setup_blame_list(struct scoreboard *sb,
|
||||
struct blame_list *blame_list = NULL;
|
||||
|
||||
for (e = sb->ent, num_ents = 0; e; e = e->next)
|
||||
if (!e->guilty && same_suspect(e->suspect, target))
|
||||
if (!e->scanned && !e->guilty &&
|
||||
same_suspect(e->suspect, target) &&
|
||||
min_score < ent_score(sb, e))
|
||||
num_ents++;
|
||||
if (num_ents) {
|
||||
blame_list = xcalloc(num_ents, sizeof(struct blame_list));
|
||||
for (e = sb->ent, i = 0; e; e = e->next)
|
||||
if (!e->guilty && same_suspect(e->suspect, target))
|
||||
if (!e->scanned && !e->guilty &&
|
||||
same_suspect(e->suspect, target) &&
|
||||
min_score < ent_score(sb, e))
|
||||
blame_list[i++].ent = e;
|
||||
}
|
||||
*num_ents_p = num_ents;
|
||||
return blame_list;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the scanned status on all entries.
|
||||
*/
|
||||
static void reset_scanned_flag(struct scoreboard *sb)
|
||||
{
|
||||
struct blame_entry *e;
|
||||
for (e = sb->ent; e; e = e->next)
|
||||
e->scanned = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* For lines target is suspected for, see if we can find code movement
|
||||
* across file boundary from the parent commit. porigin is the path
|
||||
@@ -1070,7 +1090,7 @@ static int find_copy_in_parent(struct scoreboard *sb,
|
||||
struct blame_list *blame_list;
|
||||
int num_ents;
|
||||
|
||||
blame_list = setup_blame_list(sb, target, &num_ents);
|
||||
blame_list = setup_blame_list(sb, target, blame_copy_score, &num_ents);
|
||||
if (!blame_list)
|
||||
return 1; /* nothing remains for this target */
|
||||
|
||||
@@ -1144,18 +1164,21 @@ static int find_copy_in_parent(struct scoreboard *sb,
|
||||
split_blame(sb, split, blame_list[j].ent);
|
||||
made_progress = 1;
|
||||
}
|
||||
else
|
||||
blame_list[j].ent->scanned = 1;
|
||||
decref_split(split);
|
||||
}
|
||||
free(blame_list);
|
||||
|
||||
if (!made_progress)
|
||||
break;
|
||||
blame_list = setup_blame_list(sb, target, &num_ents);
|
||||
blame_list = setup_blame_list(sb, target, blame_copy_score, &num_ents);
|
||||
if (!blame_list) {
|
||||
retval = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
reset_scanned_flag(sb);
|
||||
diff_flush(&diff_opts);
|
||||
diff_tree_release_paths(&diff_opts);
|
||||
return retval;
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
#include "branch.h"
|
||||
|
||||
static const char * const builtin_branch_usage[] = {
|
||||
"git-branch [options] [-r | -a] [--merged | --no-merged]",
|
||||
"git-branch [options] [-l] [-f] <branchname> [<start-point>]",
|
||||
"git-branch [options] [-r] (-d | -D) <branchname>",
|
||||
"git-branch [options] (-m | -M) [<oldbranch>] <newbranch>",
|
||||
"git branch [options] [-r | -a] [--merged | --no-merged]",
|
||||
"git branch [options] [-l] [-f] <branchname> [<start-point>]",
|
||||
"git branch [options] [-r] (-d | -D) <branchname>",
|
||||
"git branch [options] (-m | -M) [<oldbranch>] <newbranch>",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -202,8 +202,8 @@ static int batch_objects(int print_contents)
|
||||
}
|
||||
|
||||
static const char * const cat_file_usage[] = {
|
||||
"git-cat-file [-t|-s|-e|-p|<type>] <sha1>",
|
||||
"git-cat-file [--batch|--batch-check] < <list_of_sha1s>",
|
||||
"git cat-file [-t|-s|-e|-p|<type>] <sha1>",
|
||||
"git cat-file [--batch|--batch-check] < <list_of_sha1s>",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "quote.h"
|
||||
|
||||
static const char check_attr_usage[] =
|
||||
"git-check-attr attr... [--] pathname...";
|
||||
"git check-attr attr... [--] pathname...";
|
||||
|
||||
int cmd_check_attr(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
|
||||
@@ -154,7 +154,7 @@ static void checkout_all(const char *prefix, int prefix_length)
|
||||
}
|
||||
|
||||
static const char checkout_cache_usage[] =
|
||||
"git-checkout-index [-u] [-q] [-a] [-f] [-n] [--stage=[123]|all] [--prefix=<string>] [--temp] [--] <file>...";
|
||||
"git checkout-index [-u] [-q] [-a] [-f] [-n] [--stage=[123]|all] [--prefix=<string>] [--temp] [--] <file>...";
|
||||
|
||||
static struct lock_file lock_file;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ static int post_checkout_hook(struct commit *old, struct commit *new,
|
||||
}
|
||||
|
||||
static int update_some(const unsigned char *sha1, const char *base, int baselen,
|
||||
const char *pathname, unsigned mode, int stage)
|
||||
const char *pathname, unsigned mode, int stage, void *context)
|
||||
{
|
||||
int len;
|
||||
struct cache_entry *ce;
|
||||
@@ -67,7 +67,7 @@ static int update_some(const unsigned char *sha1, const char *base, int baselen,
|
||||
|
||||
static int read_tree_some(struct tree *tree, const char **pathspec)
|
||||
{
|
||||
read_tree_recursive(tree, "", 0, 0, pathspec, update_some);
|
||||
read_tree_recursive(tree, "", 0, 0, pathspec, update_some, NULL);
|
||||
|
||||
/* update the index with the given tree's info
|
||||
* for all args, expanding wildcards, and exit
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
static int force = -1; /* unset */
|
||||
|
||||
static const char *const builtin_clean_usage[] = {
|
||||
"git-clean [-d] [-f] [-n] [-q] [-x | -X] [--] <paths>...",
|
||||
"git clean [-d] [-f] [-n] [-q] [-x | -X] [--] <paths>...",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
*
|
||||
*/
|
||||
static const char * const builtin_clone_usage[] = {
|
||||
"git-clone [options] [--] <repo> [<dir>]",
|
||||
"git clone [options] [--] <repo> [<dir>]",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
#include "unpack-trees.h"
|
||||
|
||||
static const char * const builtin_commit_usage[] = {
|
||||
"git-commit [options] [--] <filepattern>...",
|
||||
"git commit [options] [--] <filepattern>...",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char * const builtin_status_usage[] = {
|
||||
"git-status [options] [--] <filepattern>...",
|
||||
"git status [options] [--] <filepattern>...",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "color.h"
|
||||
|
||||
static const char git_config_set_usage[] =
|
||||
"git-config [ --global | --system | [ -f | --file ] config-file ] [ --bool | --int | --bool-or-int ] [ -z | --null ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --remove-section name | --list | --get-color var [default] | --get-colorbool name [stdout-is-tty]";
|
||||
"git config [ --global | --system | [ -f | --file ] config-file ] [ --bool | --int | --bool-or-int ] [ -z | --null ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --remove-section name | --list | --get-color var [default] | --get-colorbool name [stdout-is-tty]";
|
||||
|
||||
static char *key;
|
||||
static regex_t *key_regexp;
|
||||
|
||||
@@ -67,7 +67,7 @@ static void count_objects(DIR *d, char *path, int len, int verbose,
|
||||
}
|
||||
|
||||
static char const * const count_objects_usage[] = {
|
||||
"git-count-objects [-v]",
|
||||
"git count-objects [-v]",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#define MAX_TAGS (FLAG_BITS - 1)
|
||||
|
||||
static const char * const describe_usage[] = {
|
||||
"git-describe [options] <committish>*",
|
||||
"git describe [options] <committish>*",
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ static int tags; /* But allow any tags if --tags is specified */
|
||||
static int longformat;
|
||||
static int abbrev = DEFAULT_ABBREV;
|
||||
static int max_candidates = 10;
|
||||
const char *pattern = NULL;
|
||||
static const char *pattern;
|
||||
static int always;
|
||||
|
||||
struct commit_name {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "builtin.h"
|
||||
|
||||
static const char diff_files_usage[] =
|
||||
"git-diff-files [-q] [-0/-1/2/3 |-c|--cc] [<common diff options>] [<path>...]"
|
||||
"git diff-files [-q] [-0/-1/2/3 |-c|--cc] [<common diff options>] [<path>...]"
|
||||
COMMON_DIFF_OPTIONS_HELP;
|
||||
|
||||
int cmd_diff_files(int argc, const char **argv, const char *prefix)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "builtin.h"
|
||||
|
||||
static const char diff_cache_usage[] =
|
||||
"git-diff-index [-m] [--cached] "
|
||||
"git diff-index [-m] [--cached] "
|
||||
"[<common diff options>] <tree-ish> [<path>...]"
|
||||
COMMON_DIFF_OPTIONS_HELP;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ static int diff_tree_stdin(char *line)
|
||||
}
|
||||
|
||||
static const char diff_tree_usage[] =
|
||||
"git-diff-tree [--stdin] [-m] [-c] [--cc] [-s] [-v] [--pretty] [-t] [-r] [--root] "
|
||||
"git diff-tree [--stdin] [-m] [-c] [--cc] [-s] [-v] [--pretty] [-t] [-r] [--root] "
|
||||
"[<common diff options>] <tree-ish> [<tree-ish>] [<path>...]\n"
|
||||
" -r diff recursively\n"
|
||||
" --root include the initial commit as diff against /dev/null\n"
|
||||
|
||||
@@ -21,7 +21,7 @@ struct blobinfo {
|
||||
};
|
||||
|
||||
static const char builtin_diff_usage[] =
|
||||
"git-diff <options> <rev>{0,2} -- <path>*";
|
||||
"git diff <options> <rev>{0,2} -- <path>*";
|
||||
|
||||
static void stuff_change(struct diff_options *opt,
|
||||
unsigned old_mode, unsigned new_mode,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "parse-options.h"
|
||||
|
||||
static const char *fast_export_usage[] = {
|
||||
"git-fast-export [rev-list-opts]",
|
||||
"git fast-export [rev-list-opts]",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ static struct fetch_pack_args args = {
|
||||
};
|
||||
|
||||
static const char fetch_pack_usage[] =
|
||||
"git-fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--include-tag] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]";
|
||||
"git fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--include-tag] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]";
|
||||
|
||||
#define COMPLETE (1U << 0)
|
||||
#define COMMON (1U << 1)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "parse-options.h"
|
||||
|
||||
static const char * const builtin_fetch_usage[] = {
|
||||
"git-fetch [options] [<repository> <refspec>...]",
|
||||
"git fetch [options] [<repository> <refspec>...]",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "tag.h"
|
||||
|
||||
static const char *fmt_merge_msg_usage =
|
||||
"git-fmt-merge-msg [--log] [--no-log] [--file <file>]";
|
||||
"git fmt-merge-msg [--log] [--no-log] [--file <file>]";
|
||||
|
||||
static int merge_summary;
|
||||
|
||||
|
||||
@@ -831,7 +831,7 @@ int opt_parse_sort(const struct option *opt, const char *arg, int unset)
|
||||
}
|
||||
|
||||
static char const * const for_each_ref_usage[] = {
|
||||
"git-for-each-ref [options] [<pattern>]",
|
||||
"git for-each-ref [options] [<pattern>]",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -539,7 +539,7 @@ static int fsck_cache_tree(struct cache_tree *it)
|
||||
}
|
||||
|
||||
static char const * const fsck_usage[] = {
|
||||
"git-fsck [options] [<object>...]",
|
||||
"git fsck [options] [<object>...]",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#define FAILED_RUN "failed to run %s"
|
||||
|
||||
static const char * const builtin_gc_usage[] = {
|
||||
"git-gc [options]",
|
||||
"git gc [options]",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -427,33 +427,35 @@ static int grep_tree(struct grep_opt *opt, const char **paths,
|
||||
struct name_entry entry;
|
||||
char *down;
|
||||
int tn_len = strlen(tree_name);
|
||||
char *path_buf = xmalloc(PATH_MAX + tn_len + 100);
|
||||
struct strbuf pathbuf;
|
||||
|
||||
strbuf_init(&pathbuf, PATH_MAX + tn_len);
|
||||
|
||||
if (tn_len) {
|
||||
tn_len = sprintf(path_buf, "%s:", tree_name);
|
||||
down = path_buf + tn_len;
|
||||
strcat(down, base);
|
||||
strbuf_add(&pathbuf, tree_name, tn_len);
|
||||
strbuf_addch(&pathbuf, ':');
|
||||
tn_len = pathbuf.len;
|
||||
}
|
||||
else {
|
||||
down = path_buf;
|
||||
strcpy(down, base);
|
||||
}
|
||||
len = strlen(path_buf);
|
||||
strbuf_addstr(&pathbuf, base);
|
||||
len = pathbuf.len;
|
||||
|
||||
while (tree_entry(tree, &entry)) {
|
||||
strcpy(path_buf + len, entry.path);
|
||||
int te_len = tree_entry_len(entry.path, entry.sha1);
|
||||
pathbuf.len = len;
|
||||
strbuf_add(&pathbuf, entry.path, te_len);
|
||||
|
||||
if (S_ISDIR(entry.mode))
|
||||
/* Match "abc/" against pathspec to
|
||||
* decide if we want to descend into "abc"
|
||||
* directory.
|
||||
*/
|
||||
strcpy(path_buf + len + tree_entry_len(entry.path, entry.sha1), "/");
|
||||
strbuf_addch(&pathbuf, '/');
|
||||
|
||||
down = pathbuf.buf + tn_len;
|
||||
if (!pathspec_matches(paths, down))
|
||||
;
|
||||
else if (S_ISREG(entry.mode))
|
||||
hit |= grep_sha1(opt, entry.sha1, path_buf, tn_len);
|
||||
hit |= grep_sha1(opt, entry.sha1, pathbuf.buf, tn_len);
|
||||
else if (S_ISDIR(entry.mode)) {
|
||||
enum object_type type;
|
||||
struct tree_desc sub;
|
||||
@@ -469,6 +471,7 @@ static int grep_tree(struct grep_opt *opt, const char **paths,
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
strbuf_release(&pathbuf);
|
||||
return hit;
|
||||
}
|
||||
|
||||
@@ -495,7 +498,7 @@ static int grep_object(struct grep_opt *opt, const char **paths,
|
||||
}
|
||||
|
||||
static const char builtin_grep_usage[] =
|
||||
"git-grep <option>* <rev>* [-e] <pattern> [<path>...]";
|
||||
"git grep <option>* <rev>* [-e] <pattern> [<path>...]";
|
||||
|
||||
static const char emsg_invalid_context_len[] =
|
||||
"%s: invalid context length argument";
|
||||
|
||||
@@ -354,7 +354,7 @@ static int guess_repository_type(const char *git_dir)
|
||||
}
|
||||
|
||||
static const char init_db_usage[] =
|
||||
"git-init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]]";
|
||||
"git init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]]";
|
||||
|
||||
/*
|
||||
* If you want to, you can share the DB area with any number of branches.
|
||||
|
||||
@@ -313,7 +313,7 @@ static int show_object(const unsigned char *sha1, int show_tag_object,
|
||||
|
||||
static int show_tree_object(const unsigned char *sha1,
|
||||
const char *base, int baselen,
|
||||
const char *pathname, unsigned mode, int stage)
|
||||
const char *pathname, unsigned mode, int stage, void *context)
|
||||
{
|
||||
printf("%s%s\n", pathname, S_ISDIR(mode) ? "/" : "");
|
||||
return 0;
|
||||
@@ -366,7 +366,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
|
||||
name,
|
||||
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
|
||||
read_tree_recursive((struct tree *)o, "", 0, 0, NULL,
|
||||
show_tree_object);
|
||||
show_tree_object, NULL);
|
||||
break;
|
||||
case OBJ_COMMIT:
|
||||
rev.pending.nr = rev.pending.alloc = 0;
|
||||
@@ -1082,7 +1082,7 @@ static int add_pending_commit(const char *arg, struct rev_info *revs, int flags)
|
||||
}
|
||||
|
||||
static const char cherry_usage[] =
|
||||
"git-cherry [-v] <upstream> [<head>] [<limit>]";
|
||||
"git cherry [-v] <upstream> [<head>] [<limit>]";
|
||||
int cmd_cherry(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
struct rev_info revs;
|
||||
|
||||
@@ -423,7 +423,7 @@ int report_path_error(const char *ps_matched, const char **pathspec, int prefix_
|
||||
}
|
||||
|
||||
static const char ls_files_usage[] =
|
||||
"git-ls-files [-z] [-t] [-v] (--[cached|deleted|others|stage|unmerged|killed|modified])* "
|
||||
"git ls-files [-z] [-t] [-v] (--[cached|deleted|others|stage|unmerged|killed|modified])* "
|
||||
"[ --ignored ] [--exclude=<pattern>] [--exclude-from=<file>] "
|
||||
"[ --exclude-per-directory=<filename> ] [--exclude-standard] "
|
||||
"[--full-name] [--abbrev] [--] [<file>]*";
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "remote.h"
|
||||
|
||||
static const char ls_remote_usage[] =
|
||||
"git-ls-remote [--upload-pack=<git-upload-pack>] [<host>:]<directory>";
|
||||
"git ls-remote [--upload-pack=<git-upload-pack>] [<host>:]<directory>";
|
||||
|
||||
/*
|
||||
* Is there one among the list of patterns that match the tail part
|
||||
|
||||
@@ -23,7 +23,7 @@ static int chomp_prefix;
|
||||
static const char *ls_tree_prefix;
|
||||
|
||||
static const char ls_tree_usage[] =
|
||||
"git-ls-tree [-d] [-r] [-t] [-l] [-z] [--name-only] [--name-status] [--full-name] [--abbrev[=<n>]] <tree-ish> [path...]";
|
||||
"git ls-tree [-d] [-r] [-t] [-l] [-z] [--name-only] [--name-status] [--full-name] [--abbrev[=<n>]] <tree-ish> [path...]";
|
||||
|
||||
static int show_recursive(const char *base, int baselen, const char *pathname)
|
||||
{
|
||||
@@ -56,7 +56,7 @@ static int show_recursive(const char *base, int baselen, const char *pathname)
|
||||
}
|
||||
|
||||
static int show_tree(const unsigned char *sha1, const char *base, int baselen,
|
||||
const char *pathname, unsigned mode, int stage)
|
||||
const char *pathname, unsigned mode, int stage, void *context)
|
||||
{
|
||||
int retval = 0;
|
||||
const char *type = blob_type;
|
||||
@@ -189,7 +189,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
|
||||
tree = parse_tree_indirect(sha1);
|
||||
if (!tree)
|
||||
die("not a tree object");
|
||||
read_tree_recursive(tree, "", 0, 0, pathspec, show_tree);
|
||||
read_tree_recursive(tree, "", 0, 0, pathspec, show_tree, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@
|
||||
#include "path-list.h"
|
||||
|
||||
static const char git_mailsplit_usage[] =
|
||||
"git-mailsplit [-d<prec>] [-f<n>] [-b] -o<directory> [<mbox>|<Maildir>...]";
|
||||
"git mailsplit [-d<prec>] [-f<n>] [-b] -o<directory> [<mbox>|<Maildir>...]";
|
||||
|
||||
static int is_from_line(const char *line, int len)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ static int show_merge_base(struct commit *rev1, struct commit *rev2, int show_al
|
||||
}
|
||||
|
||||
static const char merge_base_usage[] =
|
||||
"git-merge-base [--all] <commit-id> <commit-id>";
|
||||
"git merge-base [--all] <commit-id> <commit-id>";
|
||||
|
||||
int cmd_merge_base(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
|
||||
@@ -248,7 +248,7 @@ struct tree *write_tree_from_memory(void)
|
||||
|
||||
static int save_files_dirs(const unsigned char *sha1,
|
||||
const char *base, int baselen, const char *path,
|
||||
unsigned int mode, int stage)
|
||||
unsigned int mode, int stage, void *context)
|
||||
{
|
||||
int len = strlen(path);
|
||||
char *newpath = xmalloc(baselen + len + 1);
|
||||
@@ -268,7 +268,7 @@ static int save_files_dirs(const unsigned char *sha1,
|
||||
static int get_files_dirs(struct tree *tree)
|
||||
{
|
||||
int n;
|
||||
if (read_tree_recursive(tree, "", 0, 0, NULL, save_files_dirs) != 0)
|
||||
if (read_tree_recursive(tree, "", 0, 0, NULL, save_files_dirs, NULL))
|
||||
return 0;
|
||||
n = current_file_set.nr + current_directory_set.nr;
|
||||
return n;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "parse-options.h"
|
||||
|
||||
static const char * const builtin_mv_usage[] = {
|
||||
"git-mv [options] <source>... <destination>",
|
||||
"git mv [options] <source>... <destination>",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ static void show_name(const struct object *obj,
|
||||
}
|
||||
|
||||
static char const * const name_rev_usage[] = {
|
||||
"git-name-rev [options] ( --all | --stdin | <commit>... )",
|
||||
"git name-rev [options] ( --all | --stdin | <commit>... )",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "pack-refs.h"
|
||||
|
||||
static char const * const pack_refs_usage[] = {
|
||||
"git-pack-refs [options]",
|
||||
"git pack-refs [options]",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "progress.h"
|
||||
|
||||
static const char prune_packed_usage[] =
|
||||
"git-prune-packed [-n] [-q]";
|
||||
"git prune-packed [-n] [-q]";
|
||||
|
||||
#define DRY_RUN 01
|
||||
#define VERBOSE 02
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "parse-options.h"
|
||||
|
||||
static const char * const prune_usage[] = {
|
||||
"git-prune [-n] [--expire <time>] [--] [<head>...]",
|
||||
"git prune [-n] [--expire <time>] [--] [<head>...]",
|
||||
NULL
|
||||
};
|
||||
static int show_only;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "parse-options.h"
|
||||
|
||||
static const char * const push_usage[] = {
|
||||
"git-push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]",
|
||||
"git push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]",
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
*/
|
||||
|
||||
static const char reflog_expire_usage[] =
|
||||
"git-reflog (show|expire) [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
|
||||
"git reflog (show|expire) [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
|
||||
static const char reflog_delete_usage[] =
|
||||
"git-reflog delete [--verbose] [--dry-run] [--rewrite] [--updateref] <refs>...";
|
||||
"git reflog delete [--verbose] [--dry-run] [--rewrite] [--updateref] <refs>...";
|
||||
|
||||
static unsigned long default_reflog_expire;
|
||||
static unsigned long default_reflog_expire_unreachable;
|
||||
@@ -630,7 +630,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
|
||||
*/
|
||||
|
||||
static const char reflog_usage[] =
|
||||
"git-reflog (expire | ...)";
|
||||
"git reflog (expire | ...)";
|
||||
|
||||
int cmd_reflog(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "xdiff-interface.h"
|
||||
|
||||
static const char git_rerere_usage[] =
|
||||
"git-rerere [clear | status | diff | gc]";
|
||||
"git rerere [clear | status | diff | gc]";
|
||||
|
||||
/* these values are days */
|
||||
static int cutoff_noresolve = 15;
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#include "parse-options.h"
|
||||
|
||||
static const char * const git_reset_usage[] = {
|
||||
"git-reset [--mixed | --soft | --hard] [-q] [<commit>]",
|
||||
"git-reset [--mixed] <commit> [--] <paths>...",
|
||||
"git reset [--mixed | --soft | --hard] [-q] [<commit>]",
|
||||
"git reset [--mixed] <commit> [--] <paths>...",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#define COUNTED (1u<<16)
|
||||
|
||||
static const char rev_list_usage[] =
|
||||
"git-rev-list [OPTION] <commit-id>... [ -- paths... ]\n"
|
||||
"git rev-list [OPTION] <commit-id>... [ -- paths... ]\n"
|
||||
" limiting output:\n"
|
||||
" --max-count=nr\n"
|
||||
" --max-age=epoch\n"
|
||||
|
||||
@@ -268,7 +268,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
static int keep_dashdash = 0;
|
||||
static char const * const parseopt_usage[] = {
|
||||
"git-rev-parse --parseopt [options] -- [<args>...]",
|
||||
"git rev-parse --parseopt [options] -- [<args>...]",
|
||||
NULL
|
||||
};
|
||||
static struct option parseopt_opts[] = {
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
*/
|
||||
|
||||
static const char * const revert_usage[] = {
|
||||
"git-revert [options] <commit-ish>",
|
||||
"git revert [options] <commit-ish>",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char * const cherry_pick_usage[] = {
|
||||
"git-cherry-pick [options] <commit-ish>",
|
||||
"git cherry-pick [options] <commit-ish>",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "parse-options.h"
|
||||
|
||||
static const char * const builtin_rm_usage[] = {
|
||||
"git-rm [options] [--] <file>...",
|
||||
"git rm [options] [--] <file>...",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "send-pack.h"
|
||||
|
||||
static const char send_pack_usage[] =
|
||||
"git-send-pack [--all | --mirror] [--dry-run] [--force] [--receive-pack=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]\n"
|
||||
"git send-pack [--all | --mirror] [--dry-run] [--force] [--receive-pack=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]\n"
|
||||
" --all and explicit <ref> specification are mutually exclusive.";
|
||||
|
||||
static struct send_pack_args args = {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "parse-options.h"
|
||||
|
||||
static char const * const shortlog_usage[] = {
|
||||
"git-shortlog [-n] [-s] [-e] [-w] [rev-opts] [--] [<commit-id>... ]",
|
||||
"git shortlog [-n] [-s] [-e] [-w] [rev-opts] [--] [<commit-id>... ]",
|
||||
"",
|
||||
"[rev-opts] are documented in git-rev-list(1)",
|
||||
NULL
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "builtin.h"
|
||||
|
||||
static const char show_branch_usage[] =
|
||||
"git-show-branch [--sparse] [--current] [--all] [--remotes] [--topo-order] [--more=count | --list | --independent | --merge-base ] [--topics] [<refs>...] | --reflog[=n[,b]] <branch>";
|
||||
"git show-branch [--sparse] [--current] [--all] [--remotes] [--topo-order] [--more=count | --list | --independent | --merge-base ] [--topics] [<refs>...] | --reflog[=n[,b]] <branch>";
|
||||
static const char show_branch_usage_reflog[] =
|
||||
"--reflog is incompatible with --all, --remotes, --independent or --merge-base";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "parse-options.h"
|
||||
|
||||
static const char * const git_symbolic_ref_usage[] = {
|
||||
"git-symbolic-ref [options] name [ref]",
|
||||
"git symbolic-ref [options] name [ref]",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
#include "parse-options.h"
|
||||
|
||||
static const char * const git_tag_usage[] = {
|
||||
"git-tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]",
|
||||
"git-tag -d <tagname>...",
|
||||
"git-tag -l [-n[<num>]] [<pattern>]",
|
||||
"git-tag -v <tagname>...",
|
||||
"git tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]",
|
||||
"git tag -d <tagname>...",
|
||||
"git tag -l [-n[<num>]] [<pattern>]",
|
||||
"git tag -v <tagname>...",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "quote.h"
|
||||
|
||||
static const char tar_tree_usage[] =
|
||||
"git-tar-tree [--remote=<repo>] <tree-ish> [basedir]\n"
|
||||
"git tar-tree [--remote=<repo>] <tree-ish> [basedir]\n"
|
||||
"*** Note that this command is now deprecated; use git-archive instead.";
|
||||
|
||||
int cmd_tar_tree(int argc, const char **argv, const char *prefix)
|
||||
|
||||
@@ -387,7 +387,7 @@ static void read_index_info(int line_termination)
|
||||
}
|
||||
|
||||
static const char update_index_usage[] =
|
||||
"git-update-index [-q] [--add] [--replace] [--remove] [--unmerged] [--refresh] [--really-refresh] [--cacheinfo] [--chmod=(+|-)x] [--assume-unchanged] [--info-only] [--force-remove] [--stdin] [--index-info] [--unresolve] [--again | -g] [--ignore-missing] [-z] [--verbose] [--] <file>...";
|
||||
"git update-index [-q] [--add] [--replace] [--remove] [--unmerged] [--refresh] [--really-refresh] [--cacheinfo] [--chmod=(+|-)x] [--assume-unchanged] [--info-only] [--force-remove] [--stdin] [--index-info] [--unresolve] [--again | -g] [--ignore-missing] [-z] [--verbose] [--] <file>...";
|
||||
|
||||
static unsigned char head_sha1[20];
|
||||
static unsigned char merge_head_sha1[20];
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include "parse-options.h"
|
||||
|
||||
static const char * const git_update_ref_usage[] = {
|
||||
"git-update-ref [options] -d <refname> [<oldval>]",
|
||||
"git-update-ref [options] <refname> <newval> [<oldval>]",
|
||||
"git update-ref [options] -d <refname> [<oldval>]",
|
||||
"git update-ref [options] <refname> <newval> [<oldval>]",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -8,18 +8,19 @@
|
||||
#include "sideband.h"
|
||||
|
||||
static const char upload_archive_usage[] =
|
||||
"git-upload-archive <repo>";
|
||||
"git upload-archive <repo>";
|
||||
|
||||
static const char deadchild[] =
|
||||
"git-upload-archive: archiver died with error";
|
||||
"git upload-archive: archiver died with error";
|
||||
|
||||
static const char lostchild[] =
|
||||
"git-upload-archive: archiver process was lost";
|
||||
"git upload-archive: archiver process was lost";
|
||||
|
||||
|
||||
static int run_upload_archive(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
struct archiver ar;
|
||||
const struct archiver *ar;
|
||||
struct archiver_args args;
|
||||
const char *sent_argv[MAX_ARGS];
|
||||
const char *arg_cmd = "argument ";
|
||||
char *p, buf[4096];
|
||||
@@ -65,12 +66,12 @@ static int run_upload_archive(int argc, const char **argv, const char *prefix)
|
||||
sent_argv[sent_argc] = NULL;
|
||||
|
||||
/* parse all options sent by the client */
|
||||
treeish_idx = parse_archive_args(sent_argc, sent_argv, &ar);
|
||||
treeish_idx = parse_archive_args(sent_argc, sent_argv, &ar, &args);
|
||||
|
||||
parse_treeish_arg(sent_argv + treeish_idx, &ar.args, prefix);
|
||||
parse_pathspec_arg(sent_argv + treeish_idx + 1, &ar.args);
|
||||
parse_treeish_arg(sent_argv + treeish_idx, &args, prefix);
|
||||
parse_pathspec_arg(sent_argv + treeish_idx + 1, &args);
|
||||
|
||||
return ar.write_archive(&ar.args);
|
||||
return ar->write_archive(&args);
|
||||
}
|
||||
|
||||
static void error_clnt(const char *fmt, ...)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <signal.h>
|
||||
|
||||
static const char builtin_verify_tag_usage[] =
|
||||
"git-verify-tag [-v|--verbose] <tag>...";
|
||||
"git verify-tag [-v|--verbose] <tag>...";
|
||||
|
||||
#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "cache-tree.h"
|
||||
|
||||
static const char write_tree_usage[] =
|
||||
"git-write-tree [--missing-ok] [--prefix=<prefix>/]";
|
||||
"git write-tree [--missing-ok] [--prefix=<prefix>/]";
|
||||
|
||||
int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
|
||||
{
|
||||
|
||||
@@ -507,7 +507,7 @@ struct cache_tree *cache_tree_read(const char *buffer, unsigned long size)
|
||||
return read_one(&buffer, &size);
|
||||
}
|
||||
|
||||
struct cache_tree *cache_tree_find(struct cache_tree *it, const char *path)
|
||||
static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *path)
|
||||
{
|
||||
while (*path) {
|
||||
const char *slash;
|
||||
|
||||
@@ -28,8 +28,6 @@ struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
|
||||
int cache_tree_fully_valid(struct cache_tree *);
|
||||
int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int, int);
|
||||
|
||||
struct cache_tree *cache_tree_find(struct cache_tree *, const char *);
|
||||
|
||||
#define WRITE_TREE_UNREADABLE_INDEX (-1)
|
||||
#define WRITE_TREE_UNMERGED_INDEX (-2)
|
||||
#define WRITE_TREE_PREFIX_ERROR (-3)
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
OPTIONS_KEEPDASHDASH=
|
||||
OPTIONS_SPEC="\
|
||||
git-merge [options] <remote>...
|
||||
git-merge [options] <msg> HEAD <remote>
|
||||
git merge [options] <remote>...
|
||||
git merge [options] <msg> HEAD <remote>
|
||||
--
|
||||
stat show a diffstat at the end of the merge
|
||||
n don't show a diffstat at the end of the merge
|
||||
|
||||
2
daemon.c
2
daemon.c
@@ -18,7 +18,7 @@ static int verbose;
|
||||
static int reuseaddr;
|
||||
|
||||
static const char daemon_usage[] =
|
||||
"git-daemon [--verbose] [--syslog] [--export-all]\n"
|
||||
"git daemon [--verbose] [--syslog] [--export-all]\n"
|
||||
" [--timeout=n] [--init-timeout=n] [--strict-paths]\n"
|
||||
" [--base-path=path] [--base-path-relaxed]\n"
|
||||
" [--user-path | --user-path=path]\n"
|
||||
|
||||
@@ -171,7 +171,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
|
||||
if (silent_on_removed)
|
||||
continue;
|
||||
diff_addremove(&revs->diffopt, '-', ce->ce_mode,
|
||||
ce->sha1, ce->name, NULL);
|
||||
ce->sha1, ce->name);
|
||||
continue;
|
||||
}
|
||||
changed = ce_match_stat(ce, &st, ce_option);
|
||||
@@ -184,7 +184,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
|
||||
newmode = ce_mode_from_stat(ce, st.st_mode);
|
||||
diff_change(&revs->diffopt, oldmode, newmode,
|
||||
ce->sha1, (changed ? null_sha1 : ce->sha1),
|
||||
ce->name, NULL);
|
||||
ce->name);
|
||||
|
||||
}
|
||||
diffcore_std(&revs->diffopt);
|
||||
@@ -208,7 +208,7 @@ static void diff_index_show_file(struct rev_info *revs,
|
||||
const unsigned char *sha1, unsigned int mode)
|
||||
{
|
||||
diff_addremove(&revs->diffopt, prefix[0], mode,
|
||||
sha1, ce->name, NULL);
|
||||
sha1, ce->name);
|
||||
}
|
||||
|
||||
static int get_stat_data(struct cache_entry *ce,
|
||||
@@ -312,7 +312,7 @@ static int show_modified(struct oneway_unpack_data *cbdata,
|
||||
return 0;
|
||||
|
||||
diff_change(&revs->diffopt, oldmode, mode,
|
||||
old->sha1, sha1, old->name, NULL);
|
||||
old->sha1, sha1, old->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
11
diff.c
11
diff.c
@@ -3412,9 +3412,8 @@ int diff_result_code(struct diff_options *opt, int status)
|
||||
void diff_addremove(struct diff_options *options,
|
||||
int addremove, unsigned mode,
|
||||
const unsigned char *sha1,
|
||||
const char *base, const char *path)
|
||||
const char *concatpath)
|
||||
{
|
||||
char concatpath[PATH_MAX];
|
||||
struct diff_filespec *one, *two;
|
||||
|
||||
if (DIFF_OPT_TST(options, IGNORE_SUBMODULES) && S_ISGITLINK(mode))
|
||||
@@ -3436,9 +3435,6 @@ void diff_addremove(struct diff_options *options,
|
||||
addremove = (addremove == '+' ? '-' :
|
||||
addremove == '-' ? '+' : addremove);
|
||||
|
||||
if (!path) path = "";
|
||||
sprintf(concatpath, "%s%s", base, path);
|
||||
|
||||
if (options->prefix &&
|
||||
strncmp(concatpath, options->prefix, options->prefix_length))
|
||||
return;
|
||||
@@ -3459,9 +3455,8 @@ void diff_change(struct diff_options *options,
|
||||
unsigned old_mode, unsigned new_mode,
|
||||
const unsigned char *old_sha1,
|
||||
const unsigned char *new_sha1,
|
||||
const char *base, const char *path)
|
||||
const char *concatpath)
|
||||
{
|
||||
char concatpath[PATH_MAX];
|
||||
struct diff_filespec *one, *two;
|
||||
|
||||
if (DIFF_OPT_TST(options, IGNORE_SUBMODULES) && S_ISGITLINK(old_mode)
|
||||
@@ -3474,8 +3469,6 @@ void diff_change(struct diff_options *options,
|
||||
tmp = old_mode; old_mode = new_mode; new_mode = tmp;
|
||||
tmp_c = old_sha1; old_sha1 = new_sha1; new_sha1 = tmp_c;
|
||||
}
|
||||
if (!path) path = "";
|
||||
sprintf(concatpath, "%s%s", base, path);
|
||||
|
||||
if (options->prefix &&
|
||||
strncmp(concatpath, options->prefix, options->prefix_length))
|
||||
|
||||
9
diff.h
9
diff.h
@@ -14,12 +14,12 @@ typedef void (*change_fn_t)(struct diff_options *options,
|
||||
unsigned old_mode, unsigned new_mode,
|
||||
const unsigned char *old_sha1,
|
||||
const unsigned char *new_sha1,
|
||||
const char *base, const char *path);
|
||||
const char *fullpath);
|
||||
|
||||
typedef void (*add_remove_fn_t)(struct diff_options *options,
|
||||
int addremove, unsigned mode,
|
||||
const unsigned char *sha1,
|
||||
const char *base, const char *path);
|
||||
const char *fullpath);
|
||||
|
||||
typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
|
||||
struct diff_options *options, void *data);
|
||||
@@ -164,14 +164,13 @@ extern void diff_addremove(struct diff_options *,
|
||||
int addremove,
|
||||
unsigned mode,
|
||||
const unsigned char *sha1,
|
||||
const char *base,
|
||||
const char *path);
|
||||
const char *fullpath);
|
||||
|
||||
extern void diff_change(struct diff_options *,
|
||||
unsigned mode1, unsigned mode2,
|
||||
const unsigned char *sha1,
|
||||
const unsigned char *sha2,
|
||||
const char *base, const char *path);
|
||||
const char *fullpath);
|
||||
|
||||
extern void diff_unmerge(struct diff_options *,
|
||||
const char *path,
|
||||
|
||||
@@ -2374,7 +2374,7 @@ static int git_pack_config(const char *k, const char *v, void *cb)
|
||||
}
|
||||
|
||||
static const char fast_import_usage[] =
|
||||
"git-fast-import [--date-format=f] [--max-pack-size=n] [--depth=n] [--active-branches=n] [--export-marks=marks.file]";
|
||||
"git fast-import [--date-format=f] [--max-pack-size=n] [--depth=n] [--active-branches=n] [--export-marks=marks.file]";
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#!/bin/sh
|
||||
while [ "$1" ]
|
||||
do
|
||||
old="$1"
|
||||
new=$(echo "$1" | sed 's/git-/git /')
|
||||
echo "Converting '$old' to '$new'"
|
||||
git ls-files '*.sh' | while read file
|
||||
do
|
||||
sed "s/\\<$old\\>/$new/g" < $file > $file.new
|
||||
chmod --reference=$file $file.new
|
||||
mv $file.new $file
|
||||
done
|
||||
if [ "$1" != "git-sh-setup" -a "$1" != "git-parse-remote" -a "$1" != "git-svn" ]; then
|
||||
old="$1"
|
||||
new=$(echo "$1" | sed 's/git-/git /')
|
||||
echo "Converting '$old' to '$new'"
|
||||
sed -i "s/\\<$old\\>/$new/g" $(git ls-files '*.sh')
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
sed -i 's/git merge-one-file/git-merge-one-file/g
|
||||
s/git rebase-todo/git-rebase-todo/g' $(git ls-files '*.sh')
|
||||
git update-index --refresh >& /dev/null
|
||||
exit 0
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
SUBDIRECTORY_OK=Yes
|
||||
OPTIONS_KEEPDASHDASH=
|
||||
OPTIONS_SPEC="\
|
||||
git-am [options] [<mbox>|<Maildir>...]
|
||||
git-am [options] --resolved
|
||||
git-am [options] --skip
|
||||
git am [options] [<mbox>|<Maildir>...]
|
||||
git am [options] --resolved
|
||||
git am [options] --skip
|
||||
--
|
||||
d,dotest= (removed -- do not use)
|
||||
i,interactive run interactively
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
=head1 Invocation
|
||||
|
||||
git-archimport [ -h ] [ -v ] [ -o ] [ -a ] [ -f ] [ -T ]
|
||||
git archimport [ -h ] [ -v ] [ -o ] [ -a ] [ -f ] [ -T ]
|
||||
[ -D depth] [ -t tempdir ] <archive>/<branch> [ <archive>/<branch> ]
|
||||
|
||||
Imports a project from one or more Arch repositories. It will follow branches
|
||||
@@ -74,7 +74,7 @@ our($opt_h,$opt_f,$opt_v,$opt_T,$opt_t,$opt_D,$opt_a,$opt_o);
|
||||
|
||||
sub usage() {
|
||||
print STDERR <<END;
|
||||
Usage: ${\basename $0} # fetch/update GIT from Arch
|
||||
Usage: git archimport # fetch/update GIT from Arch
|
||||
[ -h ] [ -v ] [ -o ] [ -a ] [ -f ] [ -T ] [ -D depth ] [ -t tempdir ]
|
||||
repository/arch-branch [ repository/arch-branch] ...
|
||||
END
|
||||
|
||||
@@ -149,7 +149,7 @@ bisect_start() {
|
||||
echo "$start_head" >"$GIT_DIR/BISECT_START" &&
|
||||
sq "$@" >"$GIT_DIR/BISECT_NAMES" &&
|
||||
eval "$eval" &&
|
||||
echo "git-bisect start$orig_args" >>"$GIT_DIR/BISECT_LOG" || exit
|
||||
echo "git bisect start$orig_args" >>"$GIT_DIR/BISECT_LOG" || exit
|
||||
#
|
||||
# Check if we can proceed to the next bisect state.
|
||||
#
|
||||
@@ -169,7 +169,7 @@ bisect_write() {
|
||||
esac
|
||||
git update-ref "refs/bisect/$tag" "$rev" || exit
|
||||
echo "# $state: $(git show-branch $rev)" >>"$GIT_DIR/BISECT_LOG"
|
||||
test -n "$nolog" || echo "git-bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
|
||||
test -n "$nolog" || echo "git bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
|
||||
}
|
||||
|
||||
bisect_state() {
|
||||
@@ -426,9 +426,13 @@ bisect_clean_state() {
|
||||
bisect_replay () {
|
||||
test -r "$1" || die "cannot read $1 for replaying"
|
||||
bisect_reset
|
||||
while read bisect command rev
|
||||
while read git bisect command rev
|
||||
do
|
||||
test "$bisect" = "git-bisect" || continue
|
||||
test "$git $bisect" = "git bisect" -o "$git" = "git-bisect" || continue
|
||||
if test "$git" = "git-bisect"; then
|
||||
rev="$command"
|
||||
command="$bisect"
|
||||
fi
|
||||
case "$command" in
|
||||
start)
|
||||
cmd="bisect_start $rev"
|
||||
|
||||
@@ -370,7 +370,7 @@ sleep(1);
|
||||
|
||||
sub usage {
|
||||
print STDERR <<END;
|
||||
Usage: GIT_DIR=/path/to/.git ${\basename $0} [-h] [-p] [-v] [-c] [-f] [-u] [-w cvsworkdir] [-m msgprefix] [ parent ] commit
|
||||
Usage: GIT_DIR=/path/to/.git git cvsexportcommit [-h] [-p] [-v] [-c] [-f] [-u] [-w cvsworkdir] [-m msgprefix] [ parent ] commit
|
||||
END
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ sub usage(;$) {
|
||||
my $msg = shift;
|
||||
print(STDERR "Error: $msg\n") if $msg;
|
||||
print STDERR <<END;
|
||||
Usage: ${\basename $0} # fetch/update GIT from CVS
|
||||
Usage: git cvsimport # fetch/update GIT from CVS
|
||||
[-o branch-for-HEAD] [-h] [-v] [-d CVSROOT] [-A author-conv-file]
|
||||
[-p opts-for-cvsps] [-P file] [-C GIT_repository] [-z fuzz] [-i] [-k]
|
||||
[-u] [-s subst] [-a] [-m] [-M regex] [-S regex] [-L commitlimit]
|
||||
|
||||
@@ -101,7 +101,7 @@ my $work =
|
||||
$log->info("--------------- STARTING -----------------");
|
||||
|
||||
my $usage =
|
||||
"Usage: git-cvsserver [options] [pserver|server] [<directory> ...]\n".
|
||||
"Usage: git cvsserver [options] [pserver|server] [<directory> ...]\n".
|
||||
" --base-path <path> : Prepend to requested CVSROOT\n".
|
||||
" --strict-paths : Don't allow recursing into subdirectories\n".
|
||||
" --export-all : Don't check for gitcvs.enabled in config\n".
|
||||
@@ -1884,7 +1884,7 @@ sub req_annotate
|
||||
}
|
||||
|
||||
# done; get out of the tempdir
|
||||
cleanupWorkDir();
|
||||
cleanupWorkTree();
|
||||
|
||||
print "ok\n";
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
PERL='@@PERL@@'
|
||||
OPTIONS_KEEPDASHDASH=
|
||||
OPTIONS_SPEC="\
|
||||
git-instaweb [options] (--start | --stop | --restart)
|
||||
git instaweb [options] (--start | --stop | --restart)
|
||||
--
|
||||
l,local only bind on 127.0.0.1
|
||||
p,port= the port to bind to
|
||||
|
||||
@@ -121,7 +121,7 @@ test true = "$rebase" && {
|
||||
"refs/remotes/$origin/$reflist" 2>/dev/null)"
|
||||
}
|
||||
orig_head=$(git rev-parse --verify HEAD 2>/dev/null)
|
||||
git-fetch --update-head-ok "$@" || exit 1
|
||||
git fetch --update-head-ok "$@" || exit 1
|
||||
|
||||
curr_head=$(git rev-parse --verify HEAD 2>/dev/null)
|
||||
if test "$curr_head" != "$orig_head"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
OPTIONS_KEEPDASHDASH=
|
||||
OPTIONS_SPEC="\
|
||||
git-quiltimport [options]
|
||||
git quiltimport [options]
|
||||
--
|
||||
n,dry-run dry run
|
||||
author= author name and email address for patches without any
|
||||
|
||||
@@ -174,6 +174,8 @@ pick_one_preserving_merges () {
|
||||
new_parents="$new_parents $new_p"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
new_parents="$new_parents $p"
|
||||
fi
|
||||
done
|
||||
case $fast_forward in
|
||||
|
||||
@@ -376,8 +376,7 @@ fi
|
||||
|
||||
# Detach HEAD and reset the tree
|
||||
echo "First, rewinding head to replay your work on top of it..."
|
||||
git checkout "$onto^0" >/dev/null 2>&1 ||
|
||||
die "could not detach HEAD"
|
||||
git checkout -q "$onto^0" || die "could not detach HEAD"
|
||||
git update-ref ORIG_HEAD $branch
|
||||
|
||||
# If the $onto is a proper descendant of the tip of the branch, then
|
||||
|
||||
@@ -163,7 +163,7 @@ sub link_two_files($$) {
|
||||
|
||||
|
||||
sub usage() {
|
||||
print("Usage: $0 [--safe] <dir> [<dir> ...] <master_dir> \n");
|
||||
print("Usage: git relink [--safe] <dir> [<dir> ...] <master_dir> \n");
|
||||
print("All directories should contain a .git/objects/ subdirectory.\n");
|
||||
print("Options\n");
|
||||
print("\t--safe\t" .
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
OPTIONS_KEEPDASHDASH=
|
||||
OPTIONS_SPEC="\
|
||||
git-repack [options]
|
||||
git repack [options]
|
||||
--
|
||||
a pack everything in a single pack
|
||||
A same as -a, and turn unreachable objects loose
|
||||
|
||||
@@ -38,7 +38,7 @@ package main;
|
||||
|
||||
sub usage {
|
||||
print <<EOT;
|
||||
git-send-email [options] <file | directory>...
|
||||
git send-email [options] <file | directory>...
|
||||
Options:
|
||||
--from Specify the "From:" line of the email to be sent.
|
||||
|
||||
|
||||
@@ -32,15 +32,16 @@ if test -n "$OPTIONS_SPEC"; then
|
||||
echo exit $?
|
||||
)"
|
||||
else
|
||||
dashless=$(basename "$0" | sed -e 's/-/ /')
|
||||
usage() {
|
||||
die "Usage: $0 $USAGE"
|
||||
die "Usage: $dashless $USAGE"
|
||||
}
|
||||
|
||||
if [ -z "$LONG_USAGE" ]
|
||||
then
|
||||
LONG_USAGE="Usage: $0 $USAGE"
|
||||
LONG_USAGE="Usage: $dashless $USAGE"
|
||||
else
|
||||
LONG_USAGE="Usage: $0 $USAGE
|
||||
LONG_USAGE="Usage: $dashless $USAGE
|
||||
|
||||
$LONG_USAGE"
|
||||
fi
|
||||
|
||||
@@ -261,7 +261,7 @@ sub usage {
|
||||
my $fd = $exit ? \*STDERR : \*STDOUT;
|
||||
print $fd <<"";
|
||||
git-svn - bidirectional operations between a single Subversion tree and git
|
||||
Usage: $0 <command> [options] [arguments]\n
|
||||
Usage: git svn <command> [options] [arguments]\n
|
||||
|
||||
print $fd "Available commands:\n" unless $cmd;
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ static void hash_stdin_paths(const char *type, int write_objects)
|
||||
}
|
||||
|
||||
static const char hash_object_usage[] =
|
||||
"git-hash-object [ [-t <type>] [-w] [--stdin] <file>... | --stdin-paths < <list-of-paths> ]";
|
||||
"git hash-object [ [-t <type>] [-w] [--stdin] <file>... | --stdin-paths < <list-of-paths> ]";
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
2
help.c
2
help.c
@@ -40,7 +40,7 @@ static struct option builtin_help_options[] = {
|
||||
};
|
||||
|
||||
static const char * const builtin_help_usage[] = {
|
||||
"git-help [--all] [--man|--web|--info] [command]",
|
||||
"git help [--all] [--man|--web|--info] [command]",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <expat.h>
|
||||
|
||||
static const char http_push_usage[] =
|
||||
"git-http-push [--all] [--dry-run] [--force] [--verbose] <remote> [<head>...]\n";
|
||||
"git http-push [--all] [--dry-run] [--force] [--verbose] <remote> [<head>...]\n";
|
||||
|
||||
#ifndef XML_STATUS_OK
|
||||
enum XML_Status {
|
||||
|
||||
144
index-pack.c
144
index-pack.c
@@ -10,7 +10,7 @@
|
||||
#include "fsck.h"
|
||||
|
||||
static const char index_pack_usage[] =
|
||||
"git-index-pack [-v] [-o <index-file>] [{ ---keep | --keep=<msg> }] [--strict] { <pack-file> | --stdin [--fix-thin] [<pack-file>] }";
|
||||
"git index-pack [-v] [-o <index-file>] [{ ---keep | --keep=<msg> }] [--strict] { <pack-file> | --stdin [--fix-thin] [<pack-file>] }";
|
||||
|
||||
struct object_entry
|
||||
{
|
||||
@@ -26,6 +26,14 @@ union delta_base {
|
||||
off_t offset;
|
||||
};
|
||||
|
||||
struct base_data {
|
||||
struct base_data *base;
|
||||
struct base_data *child;
|
||||
struct object_entry *obj;
|
||||
void *data;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
/*
|
||||
* Even if sizeof(union delta_base) == 24 on 64-bit archs, we really want
|
||||
* to memcmp() only the first 20 bytes.
|
||||
@@ -43,6 +51,8 @@ struct delta_entry
|
||||
|
||||
static struct object_entry *objects;
|
||||
static struct delta_entry *deltas;
|
||||
static struct base_data *base_cache;
|
||||
static size_t base_cache_used;
|
||||
static int nr_objects;
|
||||
static int nr_deltas;
|
||||
static int nr_resolved_deltas;
|
||||
@@ -211,6 +221,46 @@ static void bad_object(unsigned long offset, const char *format, ...)
|
||||
die("pack has bad object at offset %lu: %s", offset, buf);
|
||||
}
|
||||
|
||||
static void prune_base_data(struct base_data *retain)
|
||||
{
|
||||
struct base_data *b = base_cache;
|
||||
for (b = base_cache;
|
||||
base_cache_used > delta_base_cache_limit && b;
|
||||
b = b->child) {
|
||||
if (b->data && b != retain) {
|
||||
free(b->data);
|
||||
b->data = NULL;
|
||||
base_cache_used -= b->size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void link_base_data(struct base_data *base, struct base_data *c)
|
||||
{
|
||||
if (base)
|
||||
base->child = c;
|
||||
else
|
||||
base_cache = c;
|
||||
|
||||
c->base = base;
|
||||
c->child = NULL;
|
||||
base_cache_used += c->size;
|
||||
prune_base_data(c);
|
||||
}
|
||||
|
||||
static void unlink_base_data(struct base_data *c)
|
||||
{
|
||||
struct base_data *base = c->base;
|
||||
if (base)
|
||||
base->child = NULL;
|
||||
else
|
||||
base_cache = NULL;
|
||||
if (c->data) {
|
||||
free(c->data);
|
||||
base_cache_used -= c->size;
|
||||
}
|
||||
}
|
||||
|
||||
static void *unpack_entry_data(unsigned long offset, unsigned long size)
|
||||
{
|
||||
z_stream stream;
|
||||
@@ -426,33 +476,60 @@ static void sha1_object(const void *data, unsigned long size,
|
||||
}
|
||||
}
|
||||
|
||||
static void resolve_delta(struct object_entry *delta_obj, void *base_data,
|
||||
unsigned long base_size, enum object_type type)
|
||||
static void *get_base_data(struct base_data *c)
|
||||
{
|
||||
if (!c->data) {
|
||||
struct object_entry *obj = c->obj;
|
||||
|
||||
if (obj->type == OBJ_REF_DELTA || obj->type == OBJ_OFS_DELTA) {
|
||||
void *base = get_base_data(c->base);
|
||||
void *raw = get_data_from_pack(obj);
|
||||
c->data = patch_delta(
|
||||
base, c->base->size,
|
||||
raw, obj->size,
|
||||
&c->size);
|
||||
free(raw);
|
||||
if (!c->data)
|
||||
bad_object(obj->idx.offset, "failed to apply delta");
|
||||
} else
|
||||
c->data = get_data_from_pack(obj);
|
||||
|
||||
base_cache_used += c->size;
|
||||
prune_base_data(c);
|
||||
}
|
||||
return c->data;
|
||||
}
|
||||
|
||||
static void resolve_delta(struct object_entry *delta_obj,
|
||||
struct base_data *base_obj, enum object_type type)
|
||||
{
|
||||
void *delta_data;
|
||||
unsigned long delta_size;
|
||||
void *result;
|
||||
unsigned long result_size;
|
||||
union delta_base delta_base;
|
||||
int j, first, last;
|
||||
struct base_data result;
|
||||
|
||||
delta_obj->real_type = type;
|
||||
delta_data = get_data_from_pack(delta_obj);
|
||||
delta_size = delta_obj->size;
|
||||
result = patch_delta(base_data, base_size, delta_data, delta_size,
|
||||
&result_size);
|
||||
result.data = patch_delta(get_base_data(base_obj), base_obj->size,
|
||||
delta_data, delta_size,
|
||||
&result.size);
|
||||
free(delta_data);
|
||||
if (!result)
|
||||
if (!result.data)
|
||||
bad_object(delta_obj->idx.offset, "failed to apply delta");
|
||||
sha1_object(result, result_size, type, delta_obj->idx.sha1);
|
||||
sha1_object(result.data, result.size, type, delta_obj->idx.sha1);
|
||||
nr_resolved_deltas++;
|
||||
|
||||
result.obj = delta_obj;
|
||||
link_base_data(base_obj, &result);
|
||||
|
||||
hashcpy(delta_base.sha1, delta_obj->idx.sha1);
|
||||
if (!find_delta_children(&delta_base, &first, &last)) {
|
||||
for (j = first; j <= last; j++) {
|
||||
struct object_entry *child = objects + deltas[j].obj_no;
|
||||
if (child->real_type == OBJ_REF_DELTA)
|
||||
resolve_delta(child, result, result_size, type);
|
||||
resolve_delta(child, &result, type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,11 +539,11 @@ static void resolve_delta(struct object_entry *delta_obj, void *base_data,
|
||||
for (j = first; j <= last; j++) {
|
||||
struct object_entry *child = objects + deltas[j].obj_no;
|
||||
if (child->real_type == OBJ_OFS_DELTA)
|
||||
resolve_delta(child, result, result_size, type);
|
||||
resolve_delta(child, &result, type);
|
||||
}
|
||||
}
|
||||
|
||||
free(result);
|
||||
unlink_base_data(&result);
|
||||
}
|
||||
|
||||
static int compare_delta_entry(const void *a, const void *b)
|
||||
@@ -481,7 +558,6 @@ static void parse_pack_objects(unsigned char *sha1)
|
||||
{
|
||||
int i;
|
||||
struct delta_entry *delta = deltas;
|
||||
void *data;
|
||||
struct stat st;
|
||||
|
||||
/*
|
||||
@@ -496,7 +572,7 @@ static void parse_pack_objects(unsigned char *sha1)
|
||||
nr_objects);
|
||||
for (i = 0; i < nr_objects; i++) {
|
||||
struct object_entry *obj = &objects[i];
|
||||
data = unpack_raw_entry(obj, &delta->base);
|
||||
void *data = unpack_raw_entry(obj, &delta->base);
|
||||
obj->real_type = obj->type;
|
||||
if (obj->type == OBJ_REF_DELTA || obj->type == OBJ_OFS_DELTA) {
|
||||
nr_deltas++;
|
||||
@@ -545,6 +621,7 @@ static void parse_pack_objects(unsigned char *sha1)
|
||||
struct object_entry *obj = &objects[i];
|
||||
union delta_base base;
|
||||
int j, ref, ref_first, ref_last, ofs, ofs_first, ofs_last;
|
||||
struct base_data base_obj;
|
||||
|
||||
if (obj->type == OBJ_REF_DELTA || obj->type == OBJ_OFS_DELTA)
|
||||
continue;
|
||||
@@ -555,22 +632,24 @@ static void parse_pack_objects(unsigned char *sha1)
|
||||
ofs = !find_delta_children(&base, &ofs_first, &ofs_last);
|
||||
if (!ref && !ofs)
|
||||
continue;
|
||||
data = get_data_from_pack(obj);
|
||||
base_obj.data = get_data_from_pack(obj);
|
||||
base_obj.size = obj->size;
|
||||
base_obj.obj = obj;
|
||||
link_base_data(NULL, &base_obj);
|
||||
|
||||
if (ref)
|
||||
for (j = ref_first; j <= ref_last; j++) {
|
||||
struct object_entry *child = objects + deltas[j].obj_no;
|
||||
if (child->real_type == OBJ_REF_DELTA)
|
||||
resolve_delta(child, data,
|
||||
obj->size, obj->type);
|
||||
resolve_delta(child, &base_obj, obj->type);
|
||||
}
|
||||
if (ofs)
|
||||
for (j = ofs_first; j <= ofs_last; j++) {
|
||||
struct object_entry *child = objects + deltas[j].obj_no;
|
||||
if (child->real_type == OBJ_OFS_DELTA)
|
||||
resolve_delta(child, data,
|
||||
obj->size, obj->type);
|
||||
resolve_delta(child, &base_obj, obj->type);
|
||||
}
|
||||
free(data);
|
||||
unlink_base_data(&base_obj);
|
||||
display_progress(progress, nr_resolved_deltas);
|
||||
}
|
||||
}
|
||||
@@ -601,7 +680,8 @@ static int write_compressed(int fd, void *in, unsigned int size, uint32_t *obj_c
|
||||
return size;
|
||||
}
|
||||
|
||||
static void append_obj_to_pack(const unsigned char *sha1, void *buf,
|
||||
static struct object_entry *append_obj_to_pack(
|
||||
const unsigned char *sha1, void *buf,
|
||||
unsigned long size, enum object_type type)
|
||||
{
|
||||
struct object_entry *obj = &objects[nr_objects++];
|
||||
@@ -622,6 +702,7 @@ static void append_obj_to_pack(const unsigned char *sha1, void *buf,
|
||||
obj[1].idx.offset = obj[0].idx.offset + n;
|
||||
obj[1].idx.offset += write_compressed(output_fd, buf, size, &obj[0].idx.crc32);
|
||||
hashcpy(obj->idx.sha1, sha1);
|
||||
return obj;
|
||||
}
|
||||
|
||||
static int delta_pos_compare(const void *_a, const void *_b)
|
||||
@@ -656,28 +737,31 @@ static void fix_unresolved_deltas(int nr_unresolved)
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
struct delta_entry *d = sorted_by_pos[i];
|
||||
void *data;
|
||||
unsigned long size;
|
||||
enum object_type type;
|
||||
int j, first, last;
|
||||
struct base_data base_obj;
|
||||
|
||||
if (objects[d->obj_no].real_type != OBJ_REF_DELTA)
|
||||
continue;
|
||||
data = read_sha1_file(d->base.sha1, &type, &size);
|
||||
if (!data)
|
||||
base_obj.data = read_sha1_file(d->base.sha1, &type, &base_obj.size);
|
||||
if (!base_obj.data)
|
||||
continue;
|
||||
|
||||
if (check_sha1_signature(d->base.sha1, base_obj.data,
|
||||
base_obj.size, typename(type)))
|
||||
die("local object %s is corrupt", sha1_to_hex(d->base.sha1));
|
||||
base_obj.obj = append_obj_to_pack(d->base.sha1, base_obj.data,
|
||||
base_obj.size, type);
|
||||
link_base_data(NULL, &base_obj);
|
||||
|
||||
find_delta_children(&d->base, &first, &last);
|
||||
for (j = first; j <= last; j++) {
|
||||
struct object_entry *child = objects + deltas[j].obj_no;
|
||||
if (child->real_type == OBJ_REF_DELTA)
|
||||
resolve_delta(child, data, size, type);
|
||||
resolve_delta(child, &base_obj, type);
|
||||
}
|
||||
|
||||
if (check_sha1_signature(d->base.sha1, data, size, typename(type)))
|
||||
die("local object %s is corrupt", sha1_to_hex(d->base.sha1));
|
||||
append_obj_to_pack(d->base.sha1, data, size, type);
|
||||
free(data);
|
||||
unlink_base_data(&base_obj);
|
||||
display_progress(progress, nr_resolved_deltas);
|
||||
}
|
||||
free(sorted_by_pos);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user