mirror of
https://github.com/git/git.git
synced 2024-11-01 23:07:55 +01:00
Merge branch 'ff/svnimport' into next
* ff/svnimport: git-svnimport: Improved detection of merges. Improved pack format documentation. git_exec_path, execv_git_cmd: ignore empty environment variables execv_git_cmd: Fix stack buffer overflow. Fixed Cygwin CR-munging problem in mailsplit
This commit is contained in:
commit
100c25f3cf
4 changed files with 43 additions and 17 deletions
|
@ -5,8 +5,13 @@ GIT pack format
|
|||
|
||||
- The header appears at the beginning and consists of the following:
|
||||
|
||||
4-byte signature
|
||||
4-byte version number (network byte order)
|
||||
4-byte signature:
|
||||
The signature is: {'P', 'A', 'C', 'K'}
|
||||
|
||||
4-byte version number (network byte order):
|
||||
GIT currently accepts version number 2 or 3 but
|
||||
generates version 2 only.
|
||||
|
||||
4-byte number of objects contained in the pack (network byte order)
|
||||
|
||||
Observation: we cannot have more than 4G versions ;-) and
|
||||
|
@ -41,7 +46,7 @@ GIT pack format
|
|||
8-byte integers to go beyond 4G objects per pack, but it is
|
||||
not strictly necessary.
|
||||
|
||||
- The header is followed by sorted 28-byte entries, one entry
|
||||
- The header is followed by sorted 24-byte entries, one entry
|
||||
per object in the pack. Each entry is:
|
||||
|
||||
4-byte network byte order integer, recording where the
|
||||
|
|
36
exec_cmd.c
36
exec_cmd.c
|
@ -21,7 +21,7 @@ const char *git_exec_path(void)
|
|||
return current_exec_path;
|
||||
|
||||
env = getenv("GIT_EXEC_PATH");
|
||||
if (env) {
|
||||
if (env && *env) {
|
||||
return env;
|
||||
}
|
||||
|
||||
|
@ -32,22 +32,25 @@ const char *git_exec_path(void)
|
|||
int execv_git_cmd(const char **argv)
|
||||
{
|
||||
char git_command[PATH_MAX + 1];
|
||||
int len, i;
|
||||
int i;
|
||||
const char *paths[] = { current_exec_path,
|
||||
getenv("GIT_EXEC_PATH"),
|
||||
builtin_exec_path };
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(paths); ++i) {
|
||||
size_t len;
|
||||
int rc;
|
||||
const char *exec_dir = paths[i];
|
||||
const char *tmp;
|
||||
|
||||
if (!exec_dir) continue;
|
||||
if (!exec_dir || !*exec_dir) continue;
|
||||
|
||||
if (*exec_dir != '/') {
|
||||
if (!getcwd(git_command, sizeof(git_command))) {
|
||||
fprintf(stderr, "git: cannot determine "
|
||||
"current directory\n");
|
||||
exit(1);
|
||||
"current directory: %s\n",
|
||||
strerror(errno));
|
||||
break;
|
||||
}
|
||||
len = strlen(git_command);
|
||||
|
||||
|
@ -57,17 +60,28 @@ int execv_git_cmd(const char **argv)
|
|||
while (*exec_dir == '/')
|
||||
exec_dir++;
|
||||
}
|
||||
snprintf(git_command + len, sizeof(git_command) - len,
|
||||
"/%s", exec_dir);
|
||||
|
||||
rc = snprintf(git_command + len,
|
||||
sizeof(git_command) - len, "/%s",
|
||||
exec_dir);
|
||||
if (rc < 0 || rc >= sizeof(git_command) - len) {
|
||||
fprintf(stderr, "git: command name given "
|
||||
"is too long.\n");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (strlen(exec_dir) + 1 > sizeof(git_command)) {
|
||||
fprintf(stderr, "git: command name given "
|
||||
"is too long.\n");
|
||||
break;
|
||||
}
|
||||
strcpy(git_command, exec_dir);
|
||||
}
|
||||
|
||||
len = strlen(git_command);
|
||||
len += snprintf(git_command + len, sizeof(git_command) - len,
|
||||
"/git-%s", argv[0]);
|
||||
|
||||
if (sizeof(git_command) <= len) {
|
||||
rc = snprintf(git_command + len, sizeof(git_command) - len,
|
||||
"/git-%s", argv[0]);
|
||||
if (rc < 0 || rc >= sizeof(git_command) - len) {
|
||||
fprintf(stderr,
|
||||
"git: command name given is too long.\n");
|
||||
break;
|
||||
|
|
|
@ -63,10 +63,17 @@ END
|
|||
|
||||
our @mergerx = ();
|
||||
if ($opt_m) {
|
||||
@mergerx = ( qr/\W(?:from|of|merge|merging|merged) (\w+)/i );
|
||||
my $branch_esc = quotemeta ($branch_name);
|
||||
my $trunk_esc = quotemeta ($trunk_name);
|
||||
@mergerx =
|
||||
(
|
||||
qr!\b(?:merg(?:ed?|ing))\b.*?\b((?:(?<=$branch_esc/)[\w\.\-]+)|(?:$trunk_esc))\b!i,
|
||||
qr!\b(?:from|of)\W+((?:(?<=$branch_esc/)[\w\.\-]+)|(?:$trunk_esc))\b!i,
|
||||
qr!\b(?:from|of)\W+(?:the )?([\w\.\-]+)[-\s]branch\b!i
|
||||
);
|
||||
}
|
||||
if ($opt_M) {
|
||||
push (@mergerx, qr/$opt_M/);
|
||||
unshift (@mergerx, qr/$opt_M/);
|
||||
}
|
||||
|
||||
# Absolutize filename now, since we will have chdir'ed by the time we
|
||||
|
|
|
@ -162,7 +162,7 @@ int main(int argc, const char **argv)
|
|||
|
||||
while (*argp) {
|
||||
const char *file = *argp++;
|
||||
FILE *f = !strcmp(file, "-") ? stdin : fopen(file, "rt");
|
||||
FILE *f = !strcmp(file, "-") ? stdin : fopen(file, "r");
|
||||
int file_done = 0;
|
||||
|
||||
if ( !f )
|
||||
|
|
Loading…
Reference in a new issue