mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
Conflicts:
Makefile
RelNotes
builtin-ls-files.c
builtin-tag.c
cache.h
compat/mingw.c
config.c
connect.c
cpio.sh
diff.c
exec_cmd.c
git-gui/Makefile
git-gui/lib/commit.tcl
git-gui/lib/console.tcl
git-mergetool.sh
lockfile.c
path.c
rsh.c
run-command.c
setup.c
show-index.c
spawn-pipe.c
t/Makefile
t/t0000-basic.sh
t/t1300-repo-config.sh
t/t7501-commit.sh
t/test-lib.sh
Resolve as follows
--- Makefile
- mingw/devel removes
SHELL_PATH = /bin/sh
PERL_PATH = /bin/perl
This looks ok. Both are set early in the Makefile to sensible values.
mingw accepts to execute /usr/bin/perl.
- NO_SYMLINKS is no longer needed. Should be auto-detected.
- According to our 0e2bdc35af
we want
NO_R_TO_GCC_LINKER = YesPlease
take our before their change.
- Conflict prefix, SCRIPT_SH:
our 7999f434d7 set prefix =
their 4a7c98dbaf removes cpio emulator
resolve to achieve both.
- Conflict NO_MEMMEM, THREADED_DELTA_SEARCH: take theirs
--- RelNotes
take our: removed file
--- builtin-ls-files.c
Conflict write_name_quoted: take their change.
--- builtin-tag.c
Conflict strip CR
our 7734ad404c adds strip CR
their fd17f5b5f7 modifies code to use strbuf
resolve by removing our code. TODO: we probably need a replacement?
--- cache.h
Conflict is_absolute_path()
our ef5af72062 ifdef
their 637fc51696 ifndef
both achieve the same.
our is a bit more strict but we take their code because we want
to reduce differences to mingw.
--- compat/mingw.c
Conflict at end of file:
our 194c1dbb5a adds git_exit()
resolve by taking their first, followed by our.
--- config.c
Conflict 'fd ='
our 0a453a237e merge junio/master
introduced strange 'fd ='. Resolve by removing 'fd ='.
--- connect.c
- Conflict 'host must have at least 2 chars ...' take their code.
- git_connect(): take their implementation.
--- cpio.sh
Accepted their delete file.
--- diff.c
Resolve using their implementation.
--- exec_cmd.c
Resolve using their implementation.
--- git-gui/**
Resolve using our implementation.
--- git-mergetool.sh
Resolve using their implementation
--- lockfile.c
trivial resolution (empty line removed)
--- path.c
Conflict 'tmp': accepting their implementation, trying TMP, TEMP on all platforms.
--- rsh.c
Accept their delete file.
--- run-command.c
Resolve using their implementation
--- setup.c
Resolve using their implementation
--- show-index.c
Conflict PRIuMAX
our 89697a4c15 fix warning
their 5be507fc95 PRIuMAX
resolve fixing warning in their code.
--- spawn-pipe.c
Conflict environ vs lookup_prog: resolve taking neither
--- t/Makefile
our d1f83218dc --no-hardlinks
their c603988c10 automtically detect symlink support
Resolve using our --no-hardlinks but removing --no-symlinks.
--- t/0000-basic.sh
Resolve using their implementation.
--- t/t1300-repo-config.sh
Resolve using their implementation.
--- t/t7501-commit.sh
Resolve using their implementation.
--- t/test-lib.sh
our d1f83218dc --no-hardlink
their c603988c10 automatically detect symlink support
Resolve using our --no-hardlinks but removing --no-symlinks.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
128 lines
3.5 KiB
C
128 lines
3.5 KiB
C
/*
|
|
* GIT - The information manager from hell
|
|
*
|
|
* Copyright (C) 2000-2002 Michael R. Elkins <me@mutt.org>
|
|
* Copyright (C) 2002-2004 Oswald Buddenhagen <ossi@users.sf.net>
|
|
* Copyright (C) 2004 Theodore Y. Ts'o <tytso@mit.edu>
|
|
* Copyright (C) 2006 Mike McCormack
|
|
* Copyright (C) 2006 Christian Couder
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#include "cache.h"
|
|
#include "quote.h"
|
|
|
|
/* Get a trace file descriptor from GIT_TRACE env variable. */
|
|
static int get_trace_fd(int *need_close)
|
|
{
|
|
char *trace = getenv("GIT_TRACE");
|
|
|
|
if (!trace || !strcmp(trace, "") ||
|
|
!strcmp(trace, "0") || !strcasecmp(trace, "false"))
|
|
return 0;
|
|
if (!strcmp(trace, "1") || !strcasecmp(trace, "true"))
|
|
return STDERR_FILENO;
|
|
if (strlen(trace) == 1 && isdigit(*trace))
|
|
return atoi(trace);
|
|
if (is_absolute_path(trace)) {
|
|
int fd = open(trace, O_WRONLY | O_APPEND | O_CREAT, 0666);
|
|
if (fd == -1) {
|
|
fprintf(stderr,
|
|
"Could not open '%s' for tracing: %s\n"
|
|
"Defaulting to tracing on stderr...\n",
|
|
trace, strerror(errno));
|
|
return STDERR_FILENO;
|
|
}
|
|
*need_close = 1;
|
|
return fd;
|
|
}
|
|
|
|
fprintf(stderr, "What does '%s' for GIT_TRACE means ?\n", trace);
|
|
fprintf(stderr, "If you want to trace into a file, "
|
|
"then please set GIT_TRACE to an absolute pathname "
|
|
"(starting with /).\n");
|
|
fprintf(stderr, "Defaulting to tracing on stderr...\n");
|
|
|
|
return STDERR_FILENO;
|
|
}
|
|
|
|
static const char err_msg[] = "Could not trace into fd given by "
|
|
"GIT_TRACE environment variable";
|
|
|
|
void trace_printf(const char *fmt, ...)
|
|
{
|
|
struct strbuf buf;
|
|
va_list ap;
|
|
int fd, len, need_close = 0;
|
|
|
|
fd = get_trace_fd(&need_close);
|
|
if (!fd)
|
|
return;
|
|
|
|
strbuf_init(&buf, 0);
|
|
va_start(ap, fmt);
|
|
len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);
|
|
va_end(ap);
|
|
if (len >= strbuf_avail(&buf)) {
|
|
strbuf_grow(&buf, len - strbuf_avail(&buf) + 128);
|
|
va_start(ap, fmt);
|
|
len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);
|
|
va_end(ap);
|
|
if (len >= strbuf_avail(&buf))
|
|
die("broken vsnprintf");
|
|
}
|
|
strbuf_setlen(&buf, len);
|
|
|
|
write_or_whine_pipe(fd, buf.buf, buf.len, err_msg);
|
|
strbuf_release(&buf);
|
|
|
|
if (need_close)
|
|
close(fd);
|
|
}
|
|
|
|
void trace_argv_printf(const char **argv, int count, const char *fmt, ...)
|
|
{
|
|
struct strbuf buf;
|
|
va_list ap;
|
|
int fd, len, need_close = 0;
|
|
|
|
fd = get_trace_fd(&need_close);
|
|
if (!fd)
|
|
return;
|
|
|
|
strbuf_init(&buf, 0);
|
|
va_start(ap, fmt);
|
|
len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);
|
|
va_end(ap);
|
|
if (len >= strbuf_avail(&buf)) {
|
|
strbuf_grow(&buf, len - strbuf_avail(&buf) + 128);
|
|
va_start(ap, fmt);
|
|
len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);
|
|
va_end(ap);
|
|
if (len >= strbuf_avail(&buf))
|
|
die("broken vsnprintf");
|
|
}
|
|
strbuf_setlen(&buf, len);
|
|
|
|
sq_quote_argv(&buf, argv, count, 0);
|
|
strbuf_addch(&buf, '\n');
|
|
write_or_whine_pipe(fd, buf.buf, buf.len, err_msg);
|
|
strbuf_release(&buf);
|
|
|
|
if (need_close)
|
|
close(fd);
|
|
}
|