* Re: From 200 to 404 to 407.
From: Avery Pennarun @ 2009-10-28 16:35 UTC (permalink / raw)
To: Peter Odéus; +Cc: git
In-Reply-To: <loom.20091028T170227-957@post.gmane.org>
On Wed, Oct 28, 2009 at 12:10 PM, Peter Odéus <peter.odeus@gmail.com> wrote:
> Avery Pennarun <apenwarr <at> gmail.com> writes:
> If you wouldn't have posted the base64-encoded password it would have never hit
> the gmane list ;-)
Sorry about that. The To: line indicated that the message had been
sent to the list, so I didn't realize that your copy was rejected. I
have no idea what made gmane reject it for you (or whether my own copy
was rejected, for that matter :)).
Avery
^ permalink raw reply
* Re: From 200 to 404 to 407.
From: Avery Pennarun @ 2009-10-28 16:48 UTC (permalink / raw)
To: Peter Odéus; +Cc: git
In-Reply-To: <loom.20091028T170227-957@post.gmane.org>
On Wed, Oct 28, 2009 at 12:10 PM, Peter Odéus <peter.odeus@gmail.com> wrote:
> Anyway. Behind these corporate walls, the proxy is a reality to deal with, so
> hopefully someone else can bring us closer to a solutiuon.
I was just looking at the source and it seems all the curl-related
stuff is isolated in git/http.c, and is pretty easy to understand.
Since I have no way to reproduce your problem, I won't attempt to look
into it myself. But if you look for "proxy" (and especially
CURLOPT_PROXY) in that file, you might find something.
Specifically, I would suggest resetting the CURLOPT_PROXY setting
before each URL request (eg. in new_http_object_request).
Hope this helps.
Avery
^ permalink raw reply
* [PATCH] commit: More generous accepting of RFC-2822 footer lines.
From: David Brown @ 2009-10-28 17:13 UTC (permalink / raw)
To: git
In-Reply-To: <20091027234520.GA11433@quaoar.codeaurora.org>
From: David Brown <davidb@quicinc.com>
'git commit -s' will insert a blank line before the Signed-off-by
line at the end of the message, unless this last line is a
Signed-off-by line itself. Common use has other trailing lines
at the ends of commit text, in the style of RFC2822 headers.
Be more generous in considering lines to be part of this footer.
If the last paragraph of the commit message reasonably resembles
RFC-2822 formatted lines, don't insert that blank line.
The new Signed-off-by line is still only suppressed when the
author's existing Signed-off-by is the last line of the message.
Signed-off-by: David Brown <davidb@quicinc.com>
---
builtin-commit.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
t/t7501-commit.sh | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 83 insertions(+), 1 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 200ffda..c395cbf 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -414,6 +414,47 @@ static void determine_author_info(void)
author_date = date;
}
+static int ends_rfc2822_footer(struct strbuf *sb)
+{
+ int ch;
+ int hit = 0;
+ int i, j, k;
+ int len = sb->len;
+ int first = 1;
+ const char *buf = sb->buf;
+
+ for (i = len - 1; i > 0; i--) {
+ if (hit && buf[i] == '\n')
+ break;
+ hit = (buf[i] == '\n');
+ }
+
+ while (i < len - 1 && buf[i] == '\n')
+ i++;
+
+ for (; i < len; i = k) {
+ for (k = i; k < len && buf[k] != '\n'; k++)
+ ; /* do nothing */
+ k++;
+
+ if ((buf[k] == ' ' || buf[k] == '\t') && !first)
+ continue;
+
+ first = 0;
+
+ for (j = 0; i + j < len; j++) {
+ ch = buf[i + j];
+ if (ch == ':')
+ break;
+ if (isalnum(ch) ||
+ (ch == '-'))
+ continue;
+ return 0;
+ }
+ }
+ return 1;
+}
+
static int prepare_to_commit(const char *index_file, const char *prefix,
struct wt_status *s)
{
@@ -489,7 +530,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
for (i = sb.len - 1; i > 0 && sb.buf[i - 1] != '\n'; i--)
; /* do nothing */
if (prefixcmp(sb.buf + i, sob.buf)) {
- if (prefixcmp(sb.buf + i, sign_off_header))
+ if (!ends_rfc2822_footer(&sb))
strbuf_addch(&sb, '\n');
strbuf_addbuf(&sb, &sob);
}
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index e2ef532..d2de576 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -247,6 +247,47 @@ $existing" &&
'
+test_expect_success 'signoff gap' '
+
+ echo 3 >positive &&
+ git add positive &&
+ alt="Alt-RFC-822-Header: Value" &&
+ git commit -s -m "welcome
+
+$alt" &&
+ git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
+ (
+ echo welcome
+ echo
+ echo $alt
+ git var GIT_COMMITTER_IDENT |
+ sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
+ ) >expected &&
+ test_cmp expected actual
+'
+
+test_expect_success 'signoff gap 2' '
+
+ echo 4 >positive &&
+ git add positive &&
+ alt="fixed: 34" &&
+ git commit -s -m "welcome
+
+We have now
+$alt" &&
+ git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
+ (
+ echo welcome
+ echo
+ echo We have now
+ echo $alt
+ echo
+ git var GIT_COMMITTER_IDENT |
+ sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
+ ) >expected &&
+ test_cmp expected actual
+'
+
test_expect_success 'multiple -m' '
>negative &&
--
1.6.5.1
^ permalink raw reply related
* [PATCH] t5540: test both smart and dumb protocols
From: Clemens Buchacher @ 2009-10-28 17:52 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Mark Lodato, git
In-Reply-To: <20091028001737.GN10505@spearce.org>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---
On Tue, Oct 27, 2009 at 05:17:38PM -0700, Shawn O. Pearce wrote:
> Clemens Buchacher <drizzd@aon.at> wrote:
> > Set LIB_HTTPD_GIT to enable smart HTTP tests.
>
> My concern here is we have to run the test suite twice in order to
> test HTTP support. We should only run it once, with GIT_TEST_HTTPD=1
> set and have it all run at once.
How about this? The original code is not touched except for the test
description.
Clemens
t/lib-httpd.sh | 2 +
t/t5540-http-push.sh | 160 ++-----------------------------------------------
t/test-http-push.sh | 159 +++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 168 insertions(+), 153 deletions(-)
create mode 100755 t/test-http-push.sh
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index aaa0a71..cf1f1df 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -121,4 +121,6 @@ stop_httpd() {
"$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
-f "$TEST_PATH/apache.conf" $HTTPD_PARA -k stop
+
+ rm -f "$HTTPD_ROOT_PATH/modules"
}
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index 049e129..a156f37 100755
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
@@ -1,155 +1,9 @@
#!/bin/sh
-#
-# Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>
-#
-test_description='test http-push
-
-This test runs various sanity checks on http-push.'
-
-. ./test-lib.sh
-
-ROOT_PATH="$PWD"
-if test -z "$LIB_HTTPD_GIT"
-then
- LIB_HTTPD_DAV=t
-fi
-LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5540'}
-
-if git http-push > /dev/null 2>&1 || [ $? -eq 128 ]
-then
- say "skipping test, USE_CURL_MULTI is not defined"
- test_done
-fi
-
-. "$TEST_DIRECTORY"/lib-httpd.sh
-start_httpd
-
-test_expect_success 'setup remote repository' '
- cd "$ROOT_PATH" &&
- mkdir test_repo &&
- cd test_repo &&
- git init &&
- : >path1 &&
- git add path1 &&
- test_tick &&
- git commit -m initial &&
- cd - &&
- git clone --bare test_repo test_repo.git &&
- cd test_repo.git &&
- ORIG_HEAD=$(git rev-parse --verify HEAD) &&
- if test -n "$LIB_HTTPD_GIT"
- then
- git config http.receivepack true
- else
- git --bare update-server-info &&
- mv hooks/post-update.sample hooks/post-update
- fi &&
- cd - &&
- mv test_repo.git "$HTTPD_GIT_PATH"
-'
-
-test_expect_success 'clone remote repository' '
- cd "$ROOT_PATH" &&
- git clone $HTTPD_GIT_URL/test_repo.git test_repo_clone
-'
-
-test_expect_success 'push to remote repository with packed refs' '
- cd "$ROOT_PATH"/test_repo_clone &&
- : >path2 &&
- git add path2 &&
- test_tick &&
- git commit -m path2 &&
- HEAD=$(git rev-parse --verify HEAD) &&
- git push &&
- (cd "$HTTPD_GIT_PATH"/test_repo.git &&
- test $HEAD = $(git rev-parse --verify HEAD))
-'
-
-test_expect_success 'push already up-to-date' '
- git push
-'
-
-test_expect_success 'push to remote repository with unpacked refs' '
- (cd "$HTTPD_GIT_PATH"/test_repo.git &&
- rm packed-refs &&
- git update-ref refs/heads/master $ORIG_HEAD &&
- git --bare update-server-info) &&
- git push &&
- (cd "$HTTPD_GIT_PATH"/test_repo.git &&
- test $HEAD = $(git rev-parse --verify HEAD))
-'
-
-test_expect_success 'http-push fetches unpacked objects' '
- cp -R "$HTTPD_GIT_PATH"/test_repo.git \
- "$HTTPD_GIT_PATH"/test_repo_unpacked.git &&
-
- git clone $HTTPD_GIT_URL/test_repo_unpacked.git \
- "$ROOT_PATH"/fetch_unpacked &&
-
- # By reset, we force git to retrieve the object
- (cd "$ROOT_PATH"/fetch_unpacked &&
- git reset --hard HEAD^ &&
- git remote rm origin &&
- git reflog expire --expire=0 --all &&
- git prune &&
- git push -f -v $HTTPD_GIT_URL/test_repo_unpacked.git master)
-'
-
-test_expect_success 'http-push fetches packed objects' '
- cp -R "$HTTPD_GIT_PATH"/test_repo.git \
- "$HTTPD_GIT_PATH"/test_repo_packed.git &&
-
- git clone $HTTPD_GIT_URL/test_repo_packed.git \
- "$ROOT_PATH"/test_repo_clone_packed &&
-
- (cd "$HTTPD_GIT_PATH"/test_repo_packed.git &&
- git --bare repack &&
- git --bare prune-packed) &&
-
- # By reset, we force git to retrieve the packed object
- (cd "$ROOT_PATH"/test_repo_clone_packed &&
- git reset --hard HEAD^ &&
- git remote rm origin &&
- git reflog expire --expire=0 --all &&
- git prune &&
- git push -f -v $HTTPD_GIT_URL/test_repo_packed.git master)
-'
-
-test_expect_success 'create and delete remote branch' '
- cd "$ROOT_PATH"/test_repo_clone &&
- git checkout -b dev &&
- : >path3 &&
- git add path3 &&
- test_tick &&
- git commit -m dev &&
- git push origin dev &&
- git fetch &&
- git push origin :dev &&
- git fetch &&
- test_must_fail git show-ref --verify refs/remotes/origin/dev
-'
-
-test -n "$LIB_HTTPD_GIT" ||
-test_expect_success 'MKCOL sends directory names with trailing slashes' '
-
- ! grep "\"MKCOL.*[^/] HTTP/[^ ]*\"" < "$HTTPD_ROOT_PATH"/access.log
-
-'
-
-x1="[0-9a-f]"
-x2="$x1$x1"
-x5="$x1$x1$x1$x1$x1"
-x38="$x5$x5$x5$x5$x5$x5$x5$x1$x1$x1"
-x40="$x38$x2"
-
-test -n "$LIB_HTTPD_GIT" ||
-test_expect_success 'PUT and MOVE sends object to URLs with SHA-1 hash suffix' '
- sed -e "s/PUT /OP /" -e "s/MOVE /OP /" "$HTTPD_ROOT_PATH"/access.log |
- grep -e "\"OP .*/objects/$x2/${x38}_$x40 HTTP/[.0-9]*\" 20[0-9] "
-
-'
-
-stop_httpd
-
-test_done
+LIB_HTTPD_GIT=t
+export LIB_HTTPD_GIT
+./test-http-push.sh $@
+sleep 1
+LIB_HTTPD_GIT=
+export LIB_HTTPD_GIT
+./test-http-push.sh $@
diff --git a/t/test-http-push.sh b/t/test-http-push.sh
new file mode 100755
index 0000000..c557541
--- /dev/null
+++ b/t/test-http-push.sh
@@ -0,0 +1,159 @@
+#!/bin/sh
+
+if test -n "$LIB_HTTPD_GIT"
+then
+ protocol=smart
+else
+ protocol=dumb
+fi
+
+test_description="test http-push ($protocol)
+
+This test runs various sanity checks on http-push."
+
+. ./test-lib.sh
+
+ROOT_PATH="$PWD"
+if test -z "$LIB_HTTPD_GIT"
+then
+ LIB_HTTPD_DAV=t
+fi
+LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5540'}
+
+if git http-push > /dev/null 2>&1 || [ $? -eq 128 ]
+then
+ say "skipping test, USE_CURL_MULTI is not defined"
+ test_done
+fi
+
+. "$TEST_DIRECTORY"/lib-httpd.sh
+start_httpd
+
+test_expect_success 'setup remote repository' '
+ cd "$ROOT_PATH" &&
+ mkdir test_repo &&
+ cd test_repo &&
+ git init &&
+ : >path1 &&
+ git add path1 &&
+ test_tick &&
+ git commit -m initial &&
+ cd - &&
+ git clone --bare test_repo test_repo.git &&
+ cd test_repo.git &&
+ ORIG_HEAD=$(git rev-parse --verify HEAD) &&
+ if test -n "$LIB_HTTPD_GIT"
+ then
+ git config http.receivepack true
+ else
+ git --bare update-server-info &&
+ mv hooks/post-update.sample hooks/post-update
+ fi &&
+ cd - &&
+ mv test_repo.git "$HTTPD_GIT_PATH"
+'
+
+test_expect_success 'clone remote repository' '
+ cd "$ROOT_PATH" &&
+ git clone $HTTPD_GIT_URL/test_repo.git test_repo_clone
+'
+
+test_expect_success 'push to remote repository with packed refs' '
+ cd "$ROOT_PATH"/test_repo_clone &&
+ : >path2 &&
+ git add path2 &&
+ test_tick &&
+ git commit -m path2 &&
+ HEAD=$(git rev-parse --verify HEAD) &&
+ git push &&
+ (cd "$HTTPD_GIT_PATH"/test_repo.git &&
+ test $HEAD = $(git rev-parse --verify HEAD))
+'
+
+test_expect_success 'push already up-to-date' '
+ git push
+'
+
+test_expect_success 'push to remote repository with unpacked refs' '
+ (cd "$HTTPD_GIT_PATH"/test_repo.git &&
+ rm packed-refs &&
+ git update-ref refs/heads/master $ORIG_HEAD &&
+ git --bare update-server-info) &&
+ git push &&
+ (cd "$HTTPD_GIT_PATH"/test_repo.git &&
+ test $HEAD = $(git rev-parse --verify HEAD))
+'
+
+test_expect_success 'http-push fetches unpacked objects' '
+ cp -R "$HTTPD_GIT_PATH"/test_repo.git \
+ "$HTTPD_GIT_PATH"/test_repo_unpacked.git &&
+
+ git clone $HTTPD_GIT_URL/test_repo_unpacked.git \
+ "$ROOT_PATH"/fetch_unpacked &&
+
+ # By reset, we force git to retrieve the object
+ (cd "$ROOT_PATH"/fetch_unpacked &&
+ git reset --hard HEAD^ &&
+ git remote rm origin &&
+ git reflog expire --expire=0 --all &&
+ git prune &&
+ git push -f -v $HTTPD_GIT_URL/test_repo_unpacked.git master)
+'
+
+test_expect_success 'http-push fetches packed objects' '
+ cp -R "$HTTPD_GIT_PATH"/test_repo.git \
+ "$HTTPD_GIT_PATH"/test_repo_packed.git &&
+
+ git clone $HTTPD_GIT_URL/test_repo_packed.git \
+ "$ROOT_PATH"/test_repo_clone_packed &&
+
+ (cd "$HTTPD_GIT_PATH"/test_repo_packed.git &&
+ git --bare repack &&
+ git --bare prune-packed) &&
+
+ # By reset, we force git to retrieve the packed object
+ (cd "$ROOT_PATH"/test_repo_clone_packed &&
+ git reset --hard HEAD^ &&
+ git remote rm origin &&
+ git reflog expire --expire=0 --all &&
+ git prune &&
+ git push -f -v $HTTPD_GIT_URL/test_repo_packed.git master)
+'
+
+test_expect_success 'create and delete remote branch' '
+ cd "$ROOT_PATH"/test_repo_clone &&
+ git checkout -b dev &&
+ : >path3 &&
+ git add path3 &&
+ test_tick &&
+ git commit -m dev &&
+ git push origin dev &&
+ git fetch &&
+ git push origin :dev &&
+ git fetch &&
+ test_must_fail git show-ref --verify refs/remotes/origin/dev
+'
+
+test -n "$LIB_HTTPD_GIT" ||
+test_expect_success 'MKCOL sends directory names with trailing slashes' '
+
+ ! grep "\"MKCOL.*[^/] HTTP/[^ ]*\"" < "$HTTPD_ROOT_PATH"/access.log
+
+'
+
+x1="[0-9a-f]"
+x2="$x1$x1"
+x5="$x1$x1$x1$x1$x1"
+x38="$x5$x5$x5$x5$x5$x5$x5$x1$x1$x1"
+x40="$x38$x2"
+
+test -n "$LIB_HTTPD_GIT" ||
+test_expect_success 'PUT and MOVE sends object to URLs with SHA-1 hash suffix' '
+ sed -e "s/PUT /OP /" -e "s/MOVE /OP /" "$HTTPD_ROOT_PATH"/access.log |
+ grep -e "\"OP .*/objects/$x2/${x38}_$x40 HTTP/[.0-9]*\" 20[0-9] "
+
+'
+
+stop_httpd
+
+test_done
--
1.6.5.1.208.gd7b37
^ permalink raw reply related
* Re: packaging vs default pager
From: Junio C Hamano @ 2009-10-28 17:55 UTC (permalink / raw)
To: Ben Walton; +Cc: GIT List
In-Reply-To: <1256742357-sup-3798@ntdws12.chass.utoronto.ca>
Ben Walton <bwalton@artsci.utoronto.ca> writes:
> On (old) solaris systems, /usr/bin/less (typically the first less
> found) doesn't understand the default arguments (FXRS), which forces
> users to alter their environment (PATH, GIT_PAGER, LESS, etc) or have
> a local or global gitconfig before paging works as expected.
>
> Would it be completely out of line to provide a knob so that the
> fallback $pager could be set to something more specific/appropriate
> during the build?
I think that is a sensible thing to do. Something like this?
Makefile | 6 ++++++
| 6 +++++-
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 268aede..342d49a 100644
--- a/Makefile
+++ b/Makefile
@@ -200,6 +200,9 @@ all::
# memory allocators with the nedmalloc allocator written by Niall Douglas.
#
# Define NO_REGEX if you have no or inferior regex support in your C library.
+#
+# Define DEFAULT_PAGER to the path of a sensible pager (defaults to "less") if
+# you want to use something different.
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -1294,6 +1297,9 @@ ifdef NO_REGEX
COMPAT_CFLAGS += -Icompat/regex
COMPAT_OBJS += compat/regex/regex.o
endif
+ifdef DEFAULT_PAGER
+ BASIC_CFLAGS += -DDEFAULT_PAGER='"$(DEFAULT_PAGER)"'
+endif
ifdef USE_NED_ALLOCATOR
COMPAT_CFLAGS += -DUSE_NED_ALLOCATOR -DOVERRIDE_STRDUP -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR -Icompat/nedmalloc
--git a/pager.c b/pager.c
index 86facec..f4c992d 100644
--- a/pager.c
+++ b/pager.c
@@ -2,6 +2,10 @@
#include "run-command.h"
#include "sigchain.h"
+#ifndef DEFAULT_PAGER
+#define DEFAULT_PAGER "less"
+#endif
+
/*
* This is split up from the rest of git so that we can do
* something different on Windows.
@@ -58,7 +62,7 @@ void setup_pager(void)
if (!pager)
pager = getenv("PAGER");
if (!pager)
- pager = "less";
+ pager = DEFAULT_PAGER;
else if (!*pager || !strcmp(pager, "cat"))
return;
^ permalink raw reply related
* Re: [PATCH] imap-send.c: fix pointer to be const
From: Junio C Hamano @ 2009-10-28 17:56 UTC (permalink / raw)
To: Michael J Gruber; +Cc: Vietor Liu, git
In-Reply-To: <4AE8482F.7020807@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
> Since this is only about warnings, maybe git 1.7.0 is the right time
> frame to adjust this to the upcoming standard?
This does not look like "one group wants this way, but the others want
differently. We have to pick one and sacrifice the other because it is
impossible to have it both ways"; there is no excuse to bring up 1.7.0 for
something like this.
Doesn't inclusing "ssl.h" give us some indication whether "const" is
needed to allow us to use #if/#else/#endif in order to compile with
headers from either versions? I.e. something like...
diff --git a/imap-send.c b/imap-send.c
index 3847fd1..a199db8 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -273,7 +273,11 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve
fprintf(stderr, "SSL requested but SSL support not compiled in\n");
return -1;
#else
+#if (OPENSSL_VERSION_NUMBER >= 0x1000000fL)
+ const SSL_METHOD *meth;
+#else
SSL_METHOD *meth;
+#endif
SSL_CTX *ctx;
int ret;
^ permalink raw reply related
* Re: [PATCH 2/4] Add I18N-wrappers for low-level IO-routines
From: Timur Sufiev @ 2009-10-28 18:01 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20091027210817.GA1577@sigill.intra.peff.net>
> Hmm. Two questions about this series:
>
> 1. Patch 3/4 didn't seem to make it to the list. Presumably that is
> where you actually use these routines in git? Or are they just for
> mingw?
Yes, it actually haven't made it to the list. Perhaps this was due to
patch size: it was approx. 3300 lines long (BTW, what's the message size
limit?) So I've rewritten the patch to make it more compact, using mingw
approach with macros. Subj prefix for a patch series is 'PATCH I18N
filenames v2'.
> 2. I seem to recall that Linus added a filename translation layer for
> doing much more, like handling unicode normalizations (but I
> confess I haven't looked closely at that code). Should this be part
> of that system?
I've heard nothing about that :(. Could you point me directly at Linus'
changes?
> -Peff
--
Timur Sufiev
^ permalink raw reply
* [PATCH I18N filenames v2 1/3] Add IO-wrappers for filenames encoding <local encoding> <-> UTF-8
From: Timur Sufiev @ 2009-10-28 18:01 UTC (permalink / raw)
To: git; +Cc: Timur Sufiev
The point is to make Git aware of filenames local encoding and make it
keep all filenames in UTF-8 internally. If
`i18n.filenameslocalencoding' option was set via git-config to a
correct <codepage> encoding, 2 things should be done:
1. Translate all filenames read by READDIR from <codepage> into UTF-8.
2. Translate all filenames passed to IO-routines from UTF-8 into
<codepage>.
This patch provides:
1. Routines for reencoding filenames from local encoding into UTF-8
and back (taking `i18n.filenameslocalencoding' into consideration).
2. I18N-wrappers around OPENDIR, READDIR, OPEN, FOPEN, STAT, LSTAT,
CHMOD, LINK AND UNLINK.
3. Makes `git-config' support `i18n.filenameslocalencoding' option.
Signed-off-by: Timur Sufiev <timur@iris-comp.ru>
---
Makefile | 2 +
cache.h | 1 +
config.c | 3 +
environment.c | 1 +
io-i18n.c | 231 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
io-i18n.h | 33 ++++++++
6 files changed, 271 insertions(+), 0 deletions(-)
create mode 100644 io-i18n.c
create mode 100644 io-i18n.h
diff --git a/Makefile b/Makefile
index 42b7d60..ac8e807 100644
--- a/Makefile
+++ b/Makefile
@@ -459,6 +459,7 @@ LIB_H += tree-walk.h
LIB_H += unpack-trees.h
LIB_H += userdiff.h
LIB_H += utf8.h
+LIB_H += io-i18n.h
LIB_H += wt-status.h
LIB_OBJS += abspath.o
@@ -562,6 +563,7 @@ LIB_OBJS += unpack-trees.o
LIB_OBJS += usage.o
LIB_OBJS += userdiff.o
LIB_OBJS += utf8.o
+LIB_OBJS += io-i18n.o
LIB_OBJS += walker.o
LIB_OBJS += wrapper.o
LIB_OBJS += write_or_die.o
diff --git a/cache.h b/cache.h
index 96840c7..7f19f7a 100644
--- a/cache.h
+++ b/cache.h
@@ -919,6 +919,7 @@ extern int user_ident_explicitly_given;
extern const char *git_commit_encoding;
extern const char *git_log_output_encoding;
+extern const char *git_filenames_local_encoding;
extern const char *git_mailmap_file;
/* IO helper functions */
diff --git a/config.c b/config.c
index c644061..2be6531 100644
--- a/config.c
+++ b/config.c
@@ -539,6 +539,9 @@ static int git_default_i18n_config(const char *var, const char *value)
if (!strcmp(var, "i18n.logoutputencoding"))
return git_config_string(&git_log_output_encoding, var, value);
+ if (!strcmp(var, "i18n.filenameslocalencoding"))
+ return git_config_string(&git_filenames_local_encoding, var, value);
+
/* Add other config variables here and to Documentation/config.txt. */
return 0;
}
diff --git a/environment.c b/environment.c
index 5de6837..b101f7b 100644
--- a/environment.c
+++ b/environment.c
@@ -24,6 +24,7 @@ int warn_ambiguous_refs = 1;
int repository_format_version;
const char *git_commit_encoding;
const char *git_log_output_encoding;
+const char *git_filenames_local_encoding;
int shared_repository = PERM_UMASK;
const char *apply_default_whitespace;
const char *apply_default_ignorewhitespace;
diff --git a/io-i18n.c b/io-i18n.c
new file mode 100644
index 0000000..ed88a68
--- /dev/null
+++ b/io-i18n.c
@@ -0,0 +1,231 @@
+#include <stdarg.h>
+#include <stddef.h>
+#include "utf8.h"
+#include "cache.h"
+#include "io-i18n.h"
+
+inline static int is_string_ascii(const char *str)
+{
+ int is_ascii = 1;
+
+ for (; *str && is_ascii; str++)
+ is_ascii &= isascii(*str);
+
+ return is_ascii;
+}
+
+char *filename_to_utf8(const char *filename)
+{
+ char *out;
+
+ if (is_string_ascii(filename))
+ return NULL;
+
+#ifndef NO_ICONV
+ if (git_filenames_local_encoding && !is_utf8(filename)) {
+ out = reencode_string(filename,
+ "utf-8", git_filenames_local_encoding);
+#ifdef DEBUG_I18N
+ fprintf(stderr, "Local -> UTF8 encoding: <%s> -> <%s>\n",
+ filename, out);
+#endif
+ return out;
+ } else if (git_filenames_local_encoding && is_utf8(filename)) {
+#ifdef DEBUG_I18N
+ fprintf(stderr,
+ "Filename <%s> is already utf8-encoded, doing nothing...\n",
+ filename);
+#endif
+ return NULL;
+ } else {
+#ifdef DEBUG_I18N
+ fprintf(stderr, "No local encoding set, doing nothing...\n");
+#endif
+ return NULL;
+ }
+#else /* #ifdef NO_ICONV */
+ warning("No iconv support, doing nothing...\n");
+ return NULL;
+#endif
+}
+
+char *filename_to_local(const char *filename)
+{
+ char *out;
+
+ if (is_string_ascii(filename))
+ return NULL;
+
+#ifndef NO_ICONV
+ if (git_filenames_local_encoding && is_utf8(filename)) {
+ out = reencode_string(filename,
+ git_filenames_local_encoding, "utf-8");
+#ifdef DEBUG_I18N
+ fprintf(stderr, "UTF8 -> local encoding: <%s> -> <%s>\n",
+ filename, out);
+#endif
+ return out;
+ } else if (git_filenames_local_encoding && !is_utf8(filename)) {
+#ifdef DEBUG_I18N
+ fprintf(stderr,
+ "Filename <%s> is already local-encoded, doing nothing...\n",
+ filename);
+#endif
+ return NULL;
+ } else {
+#ifdef DEBUG_I18N
+ fprintf(stderr, "No local encoding set, doing nothing...\n");
+#endif
+ return NULL;
+ }
+#else /* #ifdef NO_ICONV */
+ warning("No iconv support, doing nothing...\n");
+ return NULL;
+#endif
+}
+
+#undef stat
+int stat_i18n(const char *filename, struct stat *buf)
+{
+ int ret;
+ char *out = filename_to_local(filename);
+
+ if (out != NULL) {
+ ret = stat(out, buf);
+ free(out);
+ } else
+ ret = stat(filename, buf);
+ return ret;
+}
+
+#undef lstat
+int lstat_i18n(const char *filename, struct stat *buf)
+{
+
+ int ret;
+ char *out = filename_to_local(filename);
+
+ if (out != NULL) {
+ ret = lstat(out, buf);
+ free(out);
+ } else
+ ret = lstat(filename, buf);
+ return ret;
+}
+
+#undef link
+int link_i18n(const char *oldname, const char *newname)
+{
+ char *old_out = filename_to_local(oldname);
+ char *new_out = filename_to_local(newname);
+ int ret = link(old_out ? old_out : oldname,
+ new_out ? new_out : newname);
+
+ if (old_out)
+ free(old_out);
+ if (new_out)
+ free(new_out);
+ return ret;
+}
+
+#undef open
+int open_i18n(const char *filename, int flags, ...)
+{
+ int ret;
+ mode_t mode = 0;
+ char *out = filename_to_local(filename);
+
+ if ( flags & O_CREAT ) {
+ va_list ap;
+
+ va_start(ap, flags);
+ mode = va_arg(ap, int);
+ va_end(ap);
+ }
+
+ if (out != NULL) {
+ ret = open(out, flags, mode);
+ free(out);
+ } else
+ ret = open(filename, flags, mode);
+ return ret;
+}
+
+#undef unlink
+int unlink_i18n(const char *filename)
+{
+ char *out = filename_to_local(filename);
+ int ret;
+
+ if (out) {
+ ret = unlink(out);
+ free(out);
+ } else
+ ret = unlink(filename);
+ return ret;
+}
+
+#undef readdir
+struct dirent *readdir_i18n(DIR * dirstream)
+{
+ struct dirent *de = readdir(dirstream);
+
+ if (de) {
+ char *out = filename_to_utf8(de->d_name);
+
+ if (out) {
+ int len = strlen(out);
+ if (len >= NAME_MAX) {
+ warning("readdir_i18n: converted dir entry name length exceeds NAME_MAX and will be truncated\n");
+ len = NAME_MAX - 1;
+ }
+ memcpy(de->d_name, out, len);
+ de->d_name[len] = '\0';
+ free(out);
+ }
+ return de;
+ } else
+ return NULL;
+}
+
+#undef opendir
+DIR *opendir_i18n(const char *dirname)
+{
+ DIR *dir;
+ char *out = filename_to_local(dirname);
+
+ if (out != NULL) {
+ dir = opendir(out);
+ free(out);
+ } else
+ dir = opendir(dirname);
+ return dir;
+}
+
+#undef fopen
+FILE *fopen_i18n(const char *filename, const char *opentype)
+{
+ FILE *file;
+ char *out = filename_to_local(filename);
+
+ if (out != NULL) {
+ file = fopen(out, opentype);
+ free(out);
+ } else
+ file = fopen(filename, opentype);
+ return file;
+}
+
+#undef chmod
+int chmod_i18n(const char *filename, mode_t mode)
+{
+ int ret;
+ char *out = filename_to_local(filename);
+
+ if (out != NULL) {
+ ret = chmod(out, mode);
+ free(out);
+ } else
+ ret = chmod(filename, mode);
+ return ret;
+}
diff --git a/io-i18n.h b/io-i18n.h
new file mode 100644
index 0000000..2369d31
--- /dev/null
+++ b/io-i18n.h
@@ -0,0 +1,33 @@
+#ifndef GIT_IO_I18N_H
+#define GIT_IO_I18N_H
+
+#define _FILE_OFFSET_BITS 64
+
+#include <sys/stat.h>
+#include <dirent.h>
+#include <stdio.h>
+#include <unistd.h>
+
+char *filename_to_local (const char* filename);
+char *filename_to_utf8(const char *filename);
+int stat_i18n(const char *filename, struct stat *buf);
+int lstat_i18n(const char *filename, struct stat *buf);
+DIR* opendir_i18n(const char *dirname);
+struct dirent *readdir_i18n(DIR *dirstream);
+int open_i18n(const char *filename, int flags, ...);
+FILE *fopen_i18n(const char *filename, const char *opentype);
+int chmod_i18n(const char *filename, mode_t mode);
+int link_i18n(const char *oldname, const char *newname);
+int unlink_i18n(const char *filename);
+
+#define opendir(a) opendir_i18n(a)
+#define fopen(a, b) fopen_i18n(a, b)
+#define chmod(a, b) chmod_i18n(a, b)
+#define open open_i18n
+#define stat(a, b) stat_i18n(a, b)
+#define lstat(a, b) lstat_i18n(a, b)
+#define readdir(a) readdir_i18n(a)
+#define unlink(a) unlink_i18n(a)
+#define link(a, b) link_i18n(a, b)
+
+#endif /* GIT_IO_I18N_H */
--
1.6.5.1
^ permalink raw reply related
* [PATCH I18N filenames v2 2/3] Use I18N-wrappers everywhere in Git
From: Timur Sufiev @ 2009-10-28 18:01 UTC (permalink / raw)
To: git; +Cc: Timur Sufiev
In-Reply-To: <1256752900-2615-1-git-send-email-timur@iris-comp.ru>
Signed-off-by: Timur Sufiev <timur@iris-comp.ru>
---
abspath.c | 1 +
attr.c | 1 +
bisect.c | 1 +
branch.c | 1 +
builtin-add.c | 1 +
builtin-apply.c | 1 +
builtin-archive.c | 1 +
builtin-blame.c | 1 +
builtin-clean.c | 1 +
builtin-clone.c | 1 +
builtin-commit.c | 1 +
builtin-count-objects.c | 1 +
builtin-diff.c | 1 +
builtin-fast-export.c | 1 +
builtin-fetch--tool.c | 1 +
builtin-fetch-pack.c | 1 +
builtin-fetch.c | 1 +
builtin-fmt-merge-msg.c | 1 +
builtin-fsck.c | 1 +
builtin-gc.c | 1 +
builtin-grep.c | 1 +
builtin-help.c | 1 +
builtin-init-db.c | 1 +
builtin-ls-files.c | 1 +
builtin-mailinfo.c | 1 +
builtin-mailsplit.c | 1 +
builtin-merge-file.c | 1 +
builtin-merge.c | 1 +
builtin-mv.c | 1 +
builtin-pack-objects.c | 1 +
builtin-prune-packed.c | 1 +
builtin-prune.c | 1 +
builtin-reflog.c | 1 +
builtin-remote.c | 1 +
builtin-rerere.c | 1 +
builtin-rm.c | 1 +
builtin-tag.c | 1 +
builtin-update-index.c | 1 +
builtin-verify-tag.c | 1 +
bundle.c | 1 +
check-racy.c | 1 +
combine-diff.c | 1 +
commit.c | 1 +
config.c | 1 +
copy.c | 1 +
daemon.c | 1 +
diff-lib.c | 1 +
diff-no-index.c | 1 +
diff.c | 1 +
diffcore-order.c | 1 +
dir.c | 1 +
entry.c | 1 +
fast-import.c | 1 +
hash-object.c | 1 +
help.c | 1 +
http.c | 1 +
index-pack.c | 1 +
ll-merge.c | 1 +
lockfile.c | 1 +
mailmap.c | 1 +
merge-recursive.c | 1 +
pack-write.c | 1 +
path.c | 1 +
preload-index.c | 1 +
read-cache.c | 1 +
refs.c | 1 +
remote.c | 1 +
rerere.c | 1 +
server-info.c | 1 +
setup.c | 1 +
sha1_file.c | 1 +
sha1_name.c | 1 +
shallow.c | 1 +
strbuf.c | 1 +
symlinks.c | 1 +
test-chmtime.c | 1 +
test-delta.c | 1 +
trace.c | 1 +
transport.c | 1 +
unpack-trees.c | 1 +
wrapper.c | 1 +
xdiff-interface.c | 1 +
82 files changed, 82 insertions(+), 0 deletions(-)
diff --git a/abspath.c b/abspath.c
index b88122c..b672c18 100644
--- a/abspath.c
+++ b/abspath.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "io-i18n.h"
/*
* Do not use this for inspecting *tracked* content. When path is a
diff --git a/attr.c b/attr.c
index 55bdb7c..6422254 100644
--- a/attr.c
+++ b/attr.c
@@ -1,6 +1,7 @@
#define NO_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "attr.h"
+#include "io-i18n.h"
const char git_attr__true[] = "(builtin)true";
const char git_attr__false[] = "\0(builtin)false";
diff --git a/bisect.c b/bisect.c
index dc18db8..fe9fbb5 100644
--- a/bisect.c
+++ b/bisect.c
@@ -9,6 +9,7 @@
#include "run-command.h"
#include "log-tree.h"
#include "bisect.h"
+#include "io-i18n.h"
struct sha1_array {
unsigned char (*sha1)[20];
diff --git a/branch.c b/branch.c
index 05ef3f5..1569809 100644
--- a/branch.c
+++ b/branch.c
@@ -3,6 +3,7 @@
#include "refs.h"
#include "remote.h"
#include "commit.h"
+#include "io-i18n.h"
struct tracking {
struct refspec spec;
diff --git a/builtin-add.c b/builtin-add.c
index cb6e590..027170c 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -12,6 +12,7 @@
#include "parse-options.h"
#include "diff.h"
#include "revision.h"
+#include "io-i18n.h"
static const char * const builtin_add_usage[] = {
"git add [options] [--] <filepattern>...",
diff --git a/builtin-apply.c b/builtin-apply.c
index f667368..7d2f4f4 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -15,6 +15,7 @@
#include "string-list.h"
#include "dir.h"
#include "parse-options.h"
+#include "io-i18n.h"
/*
* --check turns on checking that the working tree matches the
diff --git a/builtin-archive.c b/builtin-archive.c
index 12351e9..528676e 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -8,6 +8,7 @@
#include "parse-options.h"
#include "pkt-line.h"
#include "sideband.h"
+#include "io-i18n.h"
static void create_output_file(const char *output_file)
{
diff --git a/builtin-blame.c b/builtin-blame.c
index 7512773..d349198 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -20,6 +20,7 @@
#include "mailmap.h"
#include "parse-options.h"
#include "utf8.h"
+#include "io-i18n.h"
static char blame_usage[] = "git blame [options] [rev-opts] [rev] [--] file";
diff --git a/builtin-clean.c b/builtin-clean.c
index 28cdcd0..37293f7 100644
--- a/builtin-clean.c
+++ b/builtin-clean.c
@@ -11,6 +11,7 @@
#include "dir.h"
#include "parse-options.h"
#include "quote.h"
+#include "io-i18n.h"
static int force = -1; /* unset */
diff --git a/builtin-clone.c b/builtin-clone.c
index 5762a6f..5949438 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -23,6 +23,7 @@
#include "branch.h"
#include "remote.h"
#include "run-command.h"
+#include "io-i18n.h"
/*
* Overall FIXMEs:
diff --git a/builtin-commit.c b/builtin-commit.c
index 200ffda..a124d88 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -24,6 +24,7 @@
#include "string-list.h"
#include "rerere.h"
#include "unpack-trees.h"
+#include "io-i18n.h"
static const char * const builtin_commit_usage[] = {
"git commit [options] [--] <filepattern>...",
diff --git a/builtin-count-objects.c b/builtin-count-objects.c
index 1b0b6c8..dde93dc 100644
--- a/builtin-count-objects.c
+++ b/builtin-count-objects.c
@@ -8,6 +8,7 @@
#include "dir.h"
#include "builtin.h"
#include "parse-options.h"
+#include "io-i18n.h"
static void count_objects(DIR *d, char *path, int len, int verbose,
unsigned long *loose,
diff --git a/builtin-diff.c b/builtin-diff.c
index ffcdd05..49748f0 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -13,6 +13,7 @@
#include "revision.h"
#include "log-tree.h"
#include "builtin.h"
+#include "io-i18n.h"
struct blobinfo {
unsigned char sha1[20];
diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index b0a4029..932b964 100644
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -16,6 +16,7 @@
#include "string-list.h"
#include "utf8.h"
#include "parse-options.h"
+#include "io-i18n.h"
static const char *fast_export_usage[] = {
"git fast-export [rev-list-opts]",
diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
index 3dbdf7a..91b774d 100644
--- a/builtin-fetch--tool.c
+++ b/builtin-fetch--tool.c
@@ -3,6 +3,7 @@
#include "refs.h"
#include "commit.h"
#include "sigchain.h"
+#include "io-i18n.h"
static char *get_stdin(void)
{
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index 629735f..aecc2f4 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -9,6 +9,7 @@
#include "fetch-pack.h"
#include "remote.h"
#include "run-command.h"
+#include "io-i18n.h"
static int transfer_unpack_limit = -1;
static int fetch_unpack_limit = -1;
diff --git a/builtin-fetch.c b/builtin-fetch.c
index a35a6f8..14e7f79 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -11,6 +11,7 @@
#include "run-command.h"
#include "parse-options.h"
#include "sigchain.h"
+#include "io-i18n.h"
static const char * const builtin_fetch_usage[] = {
"git fetch [options] [<repository> <refspec>...]",
diff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c
index 9d52400..c002968 100644
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
@@ -4,6 +4,7 @@
#include "diff.h"
#include "revision.h"
#include "tag.h"
+#include "io-i18n.h"
static const char * const fmt_merge_msg_usage[] = {
"git fmt-merge-msg [--log|--no-log] [--file <file>]",
diff --git a/builtin-fsck.c b/builtin-fsck.c
index 2d88e45..67d0826 100644
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
@@ -11,6 +11,7 @@
#include "fsck.h"
#include "parse-options.h"
#include "dir.h"
+#include "io-i18n.h"
#define REACHABLE 0x0001
#define SEEN 0x0002
diff --git a/builtin-gc.c b/builtin-gc.c
index 093517e..e66c817 100644
--- a/builtin-gc.c
+++ b/builtin-gc.c
@@ -14,6 +14,7 @@
#include "cache.h"
#include "parse-options.h"
#include "run-command.h"
+#include "io-i18n.h"
#define FAILED_RUN "failed to run %s"
diff --git a/builtin-grep.c b/builtin-grep.c
index 1df25b0..3f37fab 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -14,6 +14,7 @@
#include "userdiff.h"
#include "grep.h"
#include "quote.h"
+#include "io-i18n.h"
#ifndef NO_EXTERNAL_GREP
#ifdef __unix__
diff --git a/builtin-help.c b/builtin-help.c
index e1eba77..7d54179 100644
--- a/builtin-help.c
+++ b/builtin-help.c
@@ -10,6 +10,7 @@
#include "parse-options.h"
#include "run-command.h"
#include "help.h"
+#include "io-i18n.h"
static struct man_viewer_list {
struct man_viewer_list *next;
diff --git a/builtin-init-db.c b/builtin-init-db.c
index dd84cae..61b3f28 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -7,6 +7,7 @@
#include "builtin.h"
#include "exec_cmd.h"
#include "parse-options.h"
+#include "io-i18n.h"
#ifndef DEFAULT_GIT_TEMPLATE_DIR
#define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates"
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index c5c0407..3669d37 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -11,6 +11,7 @@
#include "builtin.h"
#include "tree.h"
#include "parse-options.h"
+#include "io-i18n.h"
static int abbrev;
static int show_deleted;
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index c90cd31..a5f6160 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -6,6 +6,7 @@
#include "builtin.h"
#include "utf8.h"
#include "strbuf.h"
+#include "io-i18n.h"
static FILE *cmitmsg, *patchfile, *fin, *fout;
diff --git a/builtin-mailsplit.c b/builtin-mailsplit.c
index dfe5b15..637a0f9 100644
--- a/builtin-mailsplit.c
+++ b/builtin-mailsplit.c
@@ -8,6 +8,7 @@
#include "builtin.h"
#include "string-list.h"
#include "strbuf.h"
+#include "io-i18n.h"
static const char git_mailsplit_usage[] =
"git mailsplit [-d<prec>] [-f<n>] [-b] -o<directory> [<mbox>|<Maildir>...]";
diff --git a/builtin-merge-file.c b/builtin-merge-file.c
index afd2ea7..d986758 100644
--- a/builtin-merge-file.c
+++ b/builtin-merge-file.c
@@ -3,6 +3,7 @@
#include "xdiff/xdiff.h"
#include "xdiff-interface.h"
#include "parse-options.h"
+#include "io-i18n.h"
static const char *const merge_file_usage[] = {
"git merge-file [options] [-L name1 [-L orig [-L name2]]] file1 orig_file file2",
diff --git a/builtin-merge.c b/builtin-merge.c
index b6b8428..2759c25 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -24,6 +24,7 @@
#include "rerere.h"
#include "help.h"
#include "merge-recursive.h"
+#include "io-i18n.h"
#define DEFAULT_TWOHEAD (1<<0)
#define DEFAULT_OCTOPUS (1<<1)
diff --git a/builtin-mv.c b/builtin-mv.c
index 1b20028..8ce8dfd 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -9,6 +9,7 @@
#include "cache-tree.h"
#include "string-list.h"
#include "parse-options.h"
+#include "io-i18n.h"
static const char * const builtin_mv_usage[] = {
"git mv [options] <source>... <destination>",
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 02f9246..2fe3e64 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -16,6 +16,7 @@
#include "list-objects.h"
#include "progress.h"
#include "refs.h"
+#include "io-i18n.h"
#ifdef THREADED_DELTA_SEARCH
#include "thread-utils.h"
diff --git a/builtin-prune-packed.c b/builtin-prune-packed.c
index be99eb0..30f5a8a 100644
--- a/builtin-prune-packed.c
+++ b/builtin-prune-packed.c
@@ -2,6 +2,7 @@
#include "cache.h"
#include "progress.h"
#include "parse-options.h"
+#include "io-i18n.h"
static const char * const prune_packed_usage[] = {
"git prune-packed [-n|--dry-run] [-q|--quiet]",
diff --git a/builtin-prune.c b/builtin-prune.c
index 8459aec..bfb7eee 100644
--- a/builtin-prune.c
+++ b/builtin-prune.c
@@ -6,6 +6,7 @@
#include "reachable.h"
#include "parse-options.h"
#include "dir.h"
+#include "io-i18n.h"
static const char * const prune_usage[] = {
"git prune [-n] [-v] [--expire <time>] [--] [<head>...]",
diff --git a/builtin-reflog.c b/builtin-reflog.c
index e23b5ef..b8b637e 100644
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -7,6 +7,7 @@
#include "diff.h"
#include "revision.h"
#include "reachable.h"
+#include "io-i18n.h"
/*
* reflog expire
diff --git a/builtin-remote.c b/builtin-remote.c
index 0777dd7..95ba635 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -6,6 +6,7 @@
#include "strbuf.h"
#include "run-command.h"
#include "refs.h"
+#include "io-i18n.h"
static const char * const builtin_remote_usage[] = {
"git remote [-v | --verbose]",
diff --git a/builtin-rerere.c b/builtin-rerere.c
index adfb7b5..d3e29e0 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -5,6 +5,7 @@
#include "rerere.h"
#include "xdiff/xdiff.h"
#include "xdiff-interface.h"
+#include "io-i18n.h"
static const char git_rerere_usage[] =
"git rerere [clear | status | diff | gc]";
diff --git a/builtin-rm.c b/builtin-rm.c
index 57975db..a4ba0cd 100644
--- a/builtin-rm.c
+++ b/builtin-rm.c
@@ -9,6 +9,7 @@
#include "cache-tree.h"
#include "tree-walk.h"
#include "parse-options.h"
+#include "io-i18n.h"
static const char * const builtin_rm_usage[] = {
"git rm [options] [--] <file>...",
diff --git a/builtin-tag.c b/builtin-tag.c
index c479018..fd42072 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -12,6 +12,7 @@
#include "tag.h"
#include "run-command.h"
#include "parse-options.h"
+#include "io-i18n.h"
static const char * const git_tag_usage[] = {
"git tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]",
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 92beaaf..0dab755 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -9,6 +9,7 @@
#include "tree-walk.h"
#include "builtin.h"
#include "refs.h"
+#include "io-i18n.h"
/*
* Default to not allowing changes to the list of files. The
diff --git a/builtin-verify-tag.c b/builtin-verify-tag.c
index 9f482c2..6271aaf 100644
--- a/builtin-verify-tag.c
+++ b/builtin-verify-tag.c
@@ -11,6 +11,7 @@
#include "run-command.h"
#include <signal.h>
#include "parse-options.h"
+#include "io-i18n.h"
static const char * const verify_tag_usage[] = {
"git verify-tag [-v|--verbose] <tag>...",
diff --git a/bundle.c b/bundle.c
index df95e15..46e6b9e 100644
--- a/bundle.c
+++ b/bundle.c
@@ -7,6 +7,7 @@
#include "list-objects.h"
#include "run-command.h"
#include "refs.h"
+#include "io-i18n.h"
static const char bundle_signature[] = "# v2 git bundle\n";
diff --git a/check-racy.c b/check-racy.c
index 00d92a1..05eeedf 100644
--- a/check-racy.c
+++ b/check-racy.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "io-i18n.h"
int main(int ac, char **av)
{
diff --git a/combine-diff.c b/combine-diff.c
index 5b63af1..1d6eb1c 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -7,6 +7,7 @@
#include "xdiff-interface.h"
#include "log-tree.h"
#include "refs.h"
+#include "io-i18n.h"
static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr, int n, int num_parent)
{
diff --git a/commit.c b/commit.c
index fedbd5e..cbdc8c3 100644
--- a/commit.c
+++ b/commit.c
@@ -5,6 +5,7 @@
#include "utf8.h"
#include "diff.h"
#include "revision.h"
+#include "io-i18n.h"
int save_commit_buffer = 1;
diff --git a/config.c b/config.c
index 2be6531..9826eff 100644
--- a/config.c
+++ b/config.c
@@ -7,6 +7,7 @@
*/
#include "cache.h"
#include "exec_cmd.h"
+#include "io-i18n.h"
#define MAXNAME (256)
diff --git a/copy.c b/copy.c
index a7f58fd..de64127 100644
--- a/copy.c
+++ b/copy.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "io-i18n.h"
int copy_fd(int ifd, int ofd)
{
diff --git a/daemon.c b/daemon.c
index 1b5ada6..42f70e5 100644
--- a/daemon.c
+++ b/daemon.c
@@ -3,6 +3,7 @@
#include "exec_cmd.h"
#include "run-command.h"
#include "strbuf.h"
+#include "io-i18n.h"
#include <syslog.h>
diff --git a/diff-lib.c b/diff-lib.c
index 0c74ef5..988baee 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -10,6 +10,7 @@
#include "cache-tree.h"
#include "unpack-trees.h"
#include "refs.h"
+#include "io-i18n.h"
/*
* diff-files
diff --git a/diff-no-index.c b/diff-no-index.c
index 4ebc1db..b12ad8f 100644
--- a/diff-no-index.c
+++ b/diff-no-index.c
@@ -15,6 +15,7 @@
#include "log-tree.h"
#include "builtin.h"
#include "string-list.h"
+#include "io-i18n.h"
static int read_directory(const char *path, struct string_list *list)
{
diff --git a/diff.c b/diff.c
index b0c7e61..b875429 100644
--- a/diff.c
+++ b/diff.c
@@ -13,6 +13,7 @@
#include "utf8.h"
#include "userdiff.h"
#include "sigchain.h"
+#include "io-i18n.h"
#ifdef NO_FAST_WORKING_DIRECTORY
#define FAST_WORKING_DIRECTORY 0
diff --git a/diffcore-order.c b/diffcore-order.c
index 23e9385..6ce4d4a 100644
--- a/diffcore-order.c
+++ b/diffcore-order.c
@@ -4,6 +4,7 @@
#include "cache.h"
#include "diff.h"
#include "diffcore.h"
+#include "io-i18n.h"
static char **order;
static int order_cnt;
diff --git a/dir.c b/dir.c
index d0999ba..8bbee16 100644
--- a/dir.c
+++ b/dir.c
@@ -8,6 +8,7 @@
#include "cache.h"
#include "dir.h"
#include "refs.h"
+#include "io-i18n.h"
struct path_simplify {
int len;
diff --git a/entry.c b/entry.c
index 06d24f1..b01a23b 100644
--- a/entry.c
+++ b/entry.c
@@ -1,6 +1,7 @@
#include "cache.h"
#include "blob.h"
#include "dir.h"
+#include "io-i18n.h"
static void create_directories(const char *path, int path_len,
const struct checkout *state)
diff --git a/fast-import.c b/fast-import.c
index 6faaaac..97d010d 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -152,6 +152,7 @@ Format of STDIN stream:
#include "csum-file.h"
#include "quote.h"
#include "exec_cmd.h"
+#include "io-i18n.h"
#define PACK_ID_BITS 16
#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
diff --git a/hash-object.c b/hash-object.c
index 9455dd0..0f17bbd 100644
--- a/hash-object.c
+++ b/hash-object.c
@@ -9,6 +9,7 @@
#include "quote.h"
#include "parse-options.h"
#include "exec_cmd.h"
+#include "io-i18n.h"
static void hash_fd(int fd, const char *type, int write_object, const char *path)
{
diff --git a/help.c b/help.c
index e8db31f..fcbb8c0 100644
--- a/help.c
+++ b/help.c
@@ -3,6 +3,7 @@
#include "exec_cmd.h"
#include "levenshtein.h"
#include "help.h"
+#include "io-i18n.h"
/* most GUI terminals set COLUMNS (although some don't export it) */
static int term_columns(void)
diff --git a/http.c b/http.c
index 23b2a19..d064f58 100644
--- a/http.c
+++ b/http.c
@@ -1,5 +1,6 @@
#include "http.h"
#include "pack.h"
+#include "io-i18n.h"
int data_received;
int active_requests;
diff --git a/index-pack.c b/index-pack.c
index b4f8278..2ae89c4 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -9,6 +9,7 @@
#include "progress.h"
#include "fsck.h"
#include "exec_cmd.h"
+#include "io-i18n.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>] }";
diff --git a/ll-merge.c b/ll-merge.c
index 2d6b6d6..beff7a9 100644
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -9,6 +9,7 @@
#include "xdiff-interface.h"
#include "run-command.h"
#include "ll-merge.h"
+#include "io-i18n.h"
struct ll_merge_driver;
diff --git a/lockfile.c b/lockfile.c
index 6851fa5..fea9f4c 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -3,6 +3,7 @@
*/
#include "cache.h"
#include "sigchain.h"
+#include "io-i18n.h"
static struct lock_file *lock_file_list;
static const char *alternate_index_output;
diff --git a/mailmap.c b/mailmap.c
index f167c00..7239fb7 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -1,6 +1,7 @@
#include "cache.h"
#include "string-list.h"
#include "mailmap.h"
+#include "io-i18n.h"
#define DEBUG_MAILMAP 0
#if DEBUG_MAILMAP
diff --git a/merge-recursive.c b/merge-recursive.c
index f55b7eb..3258c49 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -19,6 +19,7 @@
#include "attr.h"
#include "merge-recursive.h"
#include "dir.h"
+#include "io-i18n.h"
static struct tree *shift_tree_object(struct tree *one, struct tree *two)
{
diff --git a/pack-write.c b/pack-write.c
index 741efcd..00d2c4a 100644
--- a/pack-write.c
+++ b/pack-write.c
@@ -1,6 +1,7 @@
#include "cache.h"
#include "pack.h"
#include "csum-file.h"
+#include "io-i18n.h"
uint32_t pack_idx_default_version = 2;
uint32_t pack_idx_off32_limit = 0x7fffffff;
diff --git a/path.c b/path.c
index 047fdb0..b598190 100644
--- a/path.c
+++ b/path.c
@@ -11,6 +11,7 @@
* which is what it's designed for.
*/
#include "cache.h"
+#include "io-i18n.h"
static char bad_path[] = "/bad-path/";
diff --git a/preload-index.c b/preload-index.c
index 9289933..bfab0c3 100644
--- a/preload-index.c
+++ b/preload-index.c
@@ -2,6 +2,7 @@
* Copyright (C) 2008 Linus Torvalds
*/
#include "cache.h"
+#include "io-i18n.h"
#ifdef NO_PTHREADS
static void preload_index(struct index_state *index, const char **pathspec)
diff --git a/read-cache.c b/read-cache.c
index 1bbaf1c..cc06da2 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -14,6 +14,7 @@
#include "diffcore.h"
#include "revision.h"
#include "blob.h"
+#include "io-i18n.h"
/* Index extensions.
*
diff --git a/refs.c b/refs.c
index 808f56b..53f6539 100644
--- a/refs.c
+++ b/refs.c
@@ -3,6 +3,7 @@
#include "object.h"
#include "tag.h"
#include "dir.h"
+#include "io-i18n.h"
/* ISSYMREF=01 and ISPACKED=02 are public interfaces */
#define REF_KNOWS_PEELED 04
diff --git a/remote.c b/remote.c
index 73d33f2..780ff75 100644
--- a/remote.c
+++ b/remote.c
@@ -6,6 +6,7 @@
#include "revision.h"
#include "dir.h"
#include "tag.h"
+#include "io-i18n.h"
static struct refspec s_tag_refspec = {
0,
diff --git a/rerere.c b/rerere.c
index 29f95f6..dfff2ac 100644
--- a/rerere.c
+++ b/rerere.c
@@ -3,6 +3,7 @@
#include "rerere.h"
#include "xdiff/xdiff.h"
#include "xdiff-interface.h"
+#include "io-i18n.h"
/* if rerere_enabled == -1, fall back to detection of .git/rr-cache */
static int rerere_enabled = -1;
diff --git a/server-info.c b/server-info.c
index 4098ca2..f074057 100644
--- a/server-info.c
+++ b/server-info.c
@@ -3,6 +3,7 @@
#include "object.h"
#include "commit.h"
#include "tag.h"
+#include "io-i18n.h"
/* refs */
static FILE *info_ref_fp;
diff --git a/setup.c b/setup.c
index 029371e..c87efa3 100644
--- a/setup.c
+++ b/setup.c
@@ -1,5 +1,6 @@
#include "cache.h"
#include "dir.h"
+#include "io-i18n.h"
static int inside_git_dir = -1;
static int inside_work_tree = -1;
diff --git a/sha1_file.c b/sha1_file.c
index 63981fb..3f9145f 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -16,6 +16,7 @@
#include "refs.h"
#include "pack-revindex.h"
#include "sha1-lookup.h"
+#include "io-i18n.h"
#ifndef O_NOATIME
#if defined(__linux__) && (defined(__i386__) || defined(__PPC__))
diff --git a/sha1_name.c b/sha1_name.c
index 44bb62d..bee34aa 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -5,6 +5,7 @@
#include "blob.h"
#include "tree-walk.h"
#include "refs.h"
+#include "io-i18n.h"
static int find_short_object_filename(int len, const char *name, unsigned char *sha1)
{
diff --git a/shallow.c b/shallow.c
index 4d90eda..745b64f 100644
--- a/shallow.c
+++ b/shallow.c
@@ -1,6 +1,7 @@
#include "cache.h"
#include "commit.h"
#include "tag.h"
+#include "io-i18n.h"
static int is_shallow = -1;
diff --git a/strbuf.c b/strbuf.c
index a6153dc..1baa78a 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -1,5 +1,6 @@
#include "cache.h"
#include "refs.h"
+#include "io-i18n.h"
int prefixcmp(const char *str, const char *prefix)
{
diff --git a/symlinks.c b/symlinks.c
index 7b0a86d..7907186 100644
--- a/symlinks.c
+++ b/symlinks.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "io-i18n.h"
/*
* Returns the length (on a path component basis) of the longest
diff --git a/test-chmtime.c b/test-chmtime.c
index fe476cb..6471850 100644
--- a/test-chmtime.c
+++ b/test-chmtime.c
@@ -29,6 +29,7 @@
*/
#include "git-compat-util.h"
#include <utime.h>
+#include "io-i18n.h"
static const char usage_str[] = "-v|--verbose (+|=|=+|=-|-)<seconds> <file>...";
diff --git a/test-delta.c b/test-delta.c
index af40a3c..24d678f 100644
--- a/test-delta.c
+++ b/test-delta.c
@@ -11,6 +11,7 @@
#include "git-compat-util.h"
#include "delta.h"
#include "cache.h"
+#include "io-i18n.h"
static const char usage_str[] =
"test-delta (-d|-p) <from_file> <data_file> <out_file>";
diff --git a/trace.c b/trace.c
index 4229ae1..616a64e 100644
--- a/trace.c
+++ b/trace.c
@@ -24,6 +24,7 @@
#include "cache.h"
#include "quote.h"
+#include "io-i18n.h"
/* Get a trace file descriptor from GIT_TRACE env variable. */
static int get_trace_fd(int *need_close)
diff --git a/transport.c b/transport.c
index 644a30a..3e898aa 100644
--- a/transport.c
+++ b/transport.c
@@ -8,6 +8,7 @@
#include "bundle.h"
#include "dir.h"
#include "refs.h"
+#include "io-i18n.h"
/* rsync support */
diff --git a/unpack-trees.c b/unpack-trees.c
index 720f7a1..5bad618 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -8,6 +8,7 @@
#include "progress.h"
#include "refs.h"
#include "attr.h"
+#include "io-i18n.h"
/*
* Error messages expected by scripts out of plumbing commands such as
diff --git a/wrapper.c b/wrapper.c
index c9be140..0a89eec 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -2,6 +2,7 @@
* Various trivial helper wrappers around standard functions
*/
#include "cache.h"
+#include "io-i18n.h"
char *xstrdup(const char *str)
{
diff --git a/xdiff-interface.c b/xdiff-interface.c
index 01f14fb..dee800c 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -4,6 +4,7 @@
#include "xdiff/xdiffi.h"
#include "xdiff/xemit.h"
#include "xdiff/xmacros.h"
+#include "io-i18n.h"
struct xdiff_emit_state {
xdiff_emit_consume_fn consume;
--
1.6.5.1
^ permalink raw reply related
* [PATCH I18N filenames v2 3/3] Provide compatibility with MinGW
From: Timur Sufiev @ 2009-10-28 18:01 UTC (permalink / raw)
To: git; +Cc: Timur Sufiev
In-Reply-To: <1256752900-2615-2-git-send-email-timur@iris-comp.ru>
Signed-off-by: Timur Sufiev <timur@iris-comp.ru>
---
compat/fopen.c | 5 +++--
compat/mingw.c | 37 ++++++++++++++++++++++++++++---------
compat/mingw.h | 6 +++++-
compat/mkstemps.c | 3 ++-
compat/win32.h | 13 +++++++++++--
io-i18n.c | 5 +++++
io-i18n.h | 7 +++++++
7 files changed, 61 insertions(+), 15 deletions(-)
diff --git a/compat/fopen.c b/compat/fopen.c
index b5ca142..9136a14 100644
--- a/compat/fopen.c
+++ b/compat/fopen.c
@@ -10,6 +10,7 @@
*/
#undef FREAD_READS_DIRECTORIES
#include "../git-compat-util.h"
+#include "io-i18n.h"
FILE *git_fopen(const char *path, const char *mode)
{
@@ -17,9 +18,9 @@ FILE *git_fopen(const char *path, const char *mode)
struct stat st;
if (mode[0] == 'w' || mode[0] == 'a')
- return fopen(path, mode);
+ return fopen_i18n(path, mode);
- if (!(fp = fopen(path, mode)))
+ if (!(fp = fopen_i18n(path, mode)))
return NULL;
if (fstat(fileno(fp), &st)) {
diff --git a/compat/mingw.c b/compat/mingw.c
index 6b5b5b2..2a2ebcb 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2,7 +2,7 @@
#include "win32.h"
#include <conio.h>
#include "../strbuf.h"
-
+#include "../io-i18n.h"
#include <shellapi.h>
static int err_win_to_posix(DWORD winerr)
@@ -132,7 +132,7 @@ int mingw_open (const char *filename, int oflags, ...)
if (!strcmp(filename, "/dev/null"))
filename = "nul";
- fd = open(filename, oflags, mode);
+ fd = open_i18n(filename, oflags, mode);
if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {
DWORD attrs = GetFileAttributes(filename);
@@ -253,7 +253,7 @@ int mingw_utime (const char *file_name, const struct utimbuf *times)
int fh, rc;
/* must have write permission */
- if ((fh = open(file_name, O_RDWR | O_BINARY)) < 0)
+ if ((fh = open_i18n(file_name, O_RDWR | O_BINARY)) < 0)
return -1;
time_t_to_filetime(times->modtime, &mft);
@@ -278,7 +278,7 @@ int mkstemp(char *template)
char *filename = mktemp(template);
if (filename == NULL)
return -1;
- return open(filename, O_RDWR | O_CREAT, 0600);
+ return open_i18n(filename, O_RDWR | O_CREAT, 0600);
}
int gettimeofday(struct timeval *tv, void *tz)
@@ -519,7 +519,7 @@ static const char *parse_interpreter(const char *cmd)
if (n >= 4 && !strcasecmp(cmd+n-4, ".exe"))
return NULL;
- fd = open(cmd, O_RDONLY);
+ fd = open_i18n(cmd, O_RDONLY);
if (fd < 0)
return NULL;
n = read(fd, buf, sizeof(buf)-1);
@@ -1135,10 +1135,14 @@ sig_handler_t mingw_signal(int sig, sig_handler_t handler)
static const char *make_backslash_path(const char *path)
{
static char buf[PATH_MAX + 1];
+ char *out = filename_to_local(path);
char *c;
- if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)
- die("Too long path: %.*s", 60, path);
+ if ( strlcpy(buf, out ? out : path, PATH_MAX) >= PATH_MAX) {
+ die("Too long path: %.*s", 60, out ? out : path);
+ free(out);
+ }
+ free(out);
for (c = buf; *c; c++) {
if (*c == '/')
@@ -1158,6 +1162,9 @@ int link(const char *oldpath, const char *newpath)
{
typedef BOOL (WINAPI *T)(const char*, const char*, LPSECURITY_ATTRIBUTES);
static T create_hard_link = NULL;
+ char *old_out = filename_to_local(oldpath);
+ char *new_out = filename_to_local(newpath);
+
if (!create_hard_link) {
create_hard_link = (T) GetProcAddress(
GetModuleHandle("kernel32.dll"), "CreateHardLinkA");
@@ -1168,10 +1175,15 @@ int link(const char *oldpath, const char *newpath)
errno = ENOSYS;
return -1;
}
- if (!create_hard_link(newpath, oldpath, NULL)) {
+ if (!create_hard_link(new_out ? new_out : newpath,
+ old_out ? old_out : oldpath, NULL)) {
+ free(new_out);
+ free(old_out);
errno = err_win_to_posix(GetLastError());
return -1;
}
+ free(new_out);
+ free(old_out);
return 0;
}
@@ -1206,6 +1218,7 @@ struct dirent *mingw_readdir(DIR *dir)
WIN32_FIND_DATAA buf;
HANDLE handle;
struct mingw_DIR *mdir = (struct mingw_DIR*)dir;
+ char *out;
if (!dir->dd_handle) {
errno = EBADF; /* No set_errno for mingw */
@@ -1236,7 +1249,13 @@ struct dirent *mingw_readdir(DIR *dir)
}
/* We get here if `buf' contains valid data. */
- strcpy(dir->dd_dir.d_name, buf.cFileName);
+ out = filename_to_utf8(buf.cFileName);
+ if ( strlcpy(dir->dd_dir.d_name,
+ out ? out : buf.cFileName, FILENAME_MAX) >= FILENAME_MAX) {
+ die("Too long dir entry name: %.*s", 60,
+ out ? out : buf.cFileName);
+ free(out);
+ }
++dir->dd_stat;
/* Set file type, based on WIN32_FIND_DATA */
diff --git a/compat/mingw.h b/compat/mingw.h
index 5b5258b..2447aa7 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -1,4 +1,7 @@
+#ifndef GIT_MINGW_H
+#define GIT_MINGW_H
#include <winsock2.h>
+#include "../io-i18n.h"
/*
* things that are not available in header files
@@ -112,7 +115,7 @@ static inline int mingw_unlink(const char *pathname)
{
/* read-only files cannot be removed */
chmod(pathname, 0666);
- return unlink(pathname);
+ return unlink_i18n(pathname);
}
#define unlink mingw_unlink
@@ -273,3 +276,4 @@ struct mingw_dirent
#define readdir(x) mingw_readdir(x)
struct dirent *mingw_readdir(DIR *dir);
#endif // !NO_MINGW_REPLACE_READDIR
+#endif // GIT_MINGW_H
diff --git a/compat/mkstemps.c b/compat/mkstemps.c
index 14179c8..0cdd42d 100644
--- a/compat/mkstemps.c
+++ b/compat/mkstemps.c
@@ -1,4 +1,5 @@
#include "../git-compat-util.h"
+#include "../io-i18n.h"
/* Adapted from libiberty's mkstemp.c. */
@@ -47,7 +48,7 @@ int gitmkstemps(char *pattern, int suffix_len)
template[4] = letters[v % num_letters]; v /= num_letters;
template[5] = letters[v % num_letters]; v /= num_letters;
- fd = open(pattern, O_CREAT | O_EXCL | O_RDWR, 0600);
+ fd = open_i18n(pattern, O_CREAT | O_EXCL | O_RDWR, 0600);
if (fd > 0)
return fd;
/*
diff --git a/compat/win32.h b/compat/win32.h
index 8ce9104..f71e36d 100644
--- a/compat/win32.h
+++ b/compat/win32.h
@@ -20,8 +20,17 @@ static inline int file_attr_to_st_mode (DWORD attr)
static inline int get_file_attr(const char *fname, WIN32_FILE_ATTRIBUTE_DATA *fdata)
{
- if (GetFileAttributesExA(fname, GetFileExInfoStandard, fdata))
- return 0;
+ char *out = filename_to_local(fname);
+ int ret;
+
+ if ( out != NULL ) {
+ ret = GetFileAttributesExA(out, GetFileExInfoStandard, fdata);
+ free(out);
+ } else
+ ret = GetFileAttributesExA(fname, GetFileExInfoStandard, fdata);
+
+ if ( ret )
+ return 0;
switch (GetLastError()) {
case ERROR_ACCESS_DENIED:
diff --git a/io-i18n.c b/io-i18n.c
index ed88a68..63e88b8 100644
--- a/io-i18n.c
+++ b/io-i18n.c
@@ -84,6 +84,7 @@ char *filename_to_local(const char *filename)
#endif
}
+#ifndef __USE_MINGW_ACCESS
#undef stat
int stat_i18n(const char *filename, struct stat *buf)
{
@@ -127,6 +128,7 @@ int link_i18n(const char *oldname, const char *newname)
free(new_out);
return ret;
}
+#endif // __USE_MINGW_ACCESS
#undef open
int open_i18n(const char *filename, int flags, ...)
@@ -165,6 +167,8 @@ int unlink_i18n(const char *filename)
return ret;
}
+#if !defined(__USE_MINGW_ACCESS) || \
+ (defined(__USE_MINGW_ACCESS) && defined(NO_MINGW_REPLACE_READDIR))
#undef readdir
struct dirent *readdir_i18n(DIR * dirstream)
{
@@ -187,6 +191,7 @@ struct dirent *readdir_i18n(DIR * dirstream)
} else
return NULL;
}
+#endif
#undef opendir
DIR *opendir_i18n(const char *dirname)
diff --git a/io-i18n.h b/io-i18n.h
index 2369d31..38f73b3 100644
--- a/io-i18n.h
+++ b/io-i18n.h
@@ -23,11 +23,18 @@ int unlink_i18n(const char *filename);
#define opendir(a) opendir_i18n(a)
#define fopen(a, b) fopen_i18n(a, b)
#define chmod(a, b) chmod_i18n(a, b)
+
+#ifndef __USE_MINGW_ACCESS
#define open open_i18n
#define stat(a, b) stat_i18n(a, b)
#define lstat(a, b) lstat_i18n(a, b)
#define readdir(a) readdir_i18n(a)
#define unlink(a) unlink_i18n(a)
#define link(a, b) link_i18n(a, b)
+#endif // __USE_MINGW_ACCESS
+
+#if defined(__USE_MINGW_ACCESS) && defined(NO_MINGW_REPLACE_READDIR)
+#define readdir(a) readdir_i18n(a)
+#endif
#endif /* GIT_IO_I18N_H */
--
1.6.5.1
^ permalink raw reply related
* Re: [PATCH] commit: More generous accepting of RFC-2822 footer lines.
From: Junio C Hamano @ 2009-10-28 18:06 UTC (permalink / raw)
To: David Brown; +Cc: git
In-Reply-To: <20091028171344.GA22290@quaoar.codeaurora.org>
David Brown <davidb@codeaurora.org> writes:
> From: David Brown <davidb@quicinc.com>
>
> 'git commit -s' will insert a blank line before the Signed-off-by
> line at the end of the message, unless this last line is a
> Signed-off-by line itself. Common use has other trailing lines
> at the ends of commit text, in the style of RFC2822 headers.
>
> Be more generous in considering lines to be part of this footer.
> If the last paragraph of the commit message reasonably resembles
> RFC-2822 formatted lines, don't insert that blank line.
I do not think it is particularly readable to add Cc: at the end, and in a
sense this patch encourages that practice (without the patch, the end
result looks ugly and that has an effect to discourage people from adding
Cc: there).
But this is not a strong objection. Applied.
Thanks.
^ permalink raw reply
* Re: [PATCH 2/4] Add I18N-wrappers for low-level IO-routines
From: Jeff King @ 2009-10-28 18:10 UTC (permalink / raw)
To: Timur Sufiev; +Cc: git
In-Reply-To: <4ae886f4.0b38560a.6cfb.5ac4@mx.google.com>
On Wed, Oct 28, 2009 at 09:01:21PM +0300, Timur Sufiev wrote:
> Yes, it actually haven't made it to the list. Perhaps this was due to
> patch size: it was approx. 3300 lines long (BTW, what's the message size
> limit?) So I've rewritten the patch to make it more compact, using mingw
> approach with macros. Subj prefix for a patch series is 'PATCH I18N
> filenames v2'.
Thanks. The rules for vger are here:
http://vger.kernel.org/majordomo-info.html
The max size is 100K, but you may also be triggering something from the
taboo list accidentally.
> > 2. I seem to recall that Linus added a filename translation layer for
> > doing much more, like handling unicode normalizations (but I
> > confess I haven't looked closely at that code). Should this be part
> > of that system?
>
> I've heard nothing about that :(. Could you point me directly at Linus'
> changes?
Try looking at this series:
http://thread.gmane.org/gmane.comp.version-control.git/119222
-Peff
^ permalink raw reply
* git svn show-ignore is excrutiatingly slow
From: Adam Spiers @ 2009-10-28 17:43 UTC (permalink / raw)
To: git mailing list
Something is badly wrong here ...
$ cd $svn_wd
$ time svn propget -R svn:ignore >/dev/null
svn propget -R svn:ignore > /dev/null 0.28s user 0.20s system 98% cpu 0.490 total
$ cd $git_wd
$ time git svn show-ignore > show-ignore.out
git svn show-ignore > show-ignore.out 20.52s user 33.69s system 1% cpu 1:23:42.17 total
That's 10,000 times slower for what is effectively the same source
tree! Admittedly the svn propget was a "warm" run and took longer the
first time around, but even so there are several orders of magnitude
difference.
I had a quick look at the code and it seemed to be doing the svn tree
recursion itself via Git::SVN::prop_walk(), which might explain why.
However I did not have time to dig deeper, so would welcome any ideas.
Thanks,
Adam
^ permalink raw reply
* Re: [PATCH 0/3] fix "git diff --color-words -U0"
From: Junio C Hamano @ 2009-10-28 18:14 UTC (permalink / raw)
To: Markus Heidelberg; +Cc: git, Johannes Schindelin
In-Reply-To: <1256732672-11817-1-git-send-email-markus.heidelberg@web.de>
Is this a serious enough breakage that deserves to be fixed in the
maintenance track (1.6.5.X)?
^ permalink raw reply
* Re: [PATCH] commit: More generous accepting of RFC-2822 footer lines.
From: David Brown @ 2009-10-28 18:17 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Brown, git@vger.kernel.org
In-Reply-To: <7vd447o0jp.fsf@alter.siamese.dyndns.org>
On Wed, Oct 28, 2009 at 11:06:50AM -0700, Junio C Hamano wrote:
> I do not think it is particularly readable to add Cc: at the end, and in a
> sense this patch encourages that practice (without the patch, the end
> result looks ugly and that has an effect to discourage people from adding
> Cc: there).
I wasn't actually even thinking of Cc: at the end. I was
thinking more of things like Acked-by:, or Bugs-fixed:, or
Patch-applied-even-though-I-dont-like-it-by:, or
like that.
David
^ permalink raw reply
* Re: Is it possible to use git as a remote file storage without making any local repos?
From: Avery Pennarun @ 2009-10-28 18:33 UTC (permalink / raw)
To: matvejchikov; +Cc: git
In-Reply-To: <8496f91a0910280509p49447d6egd7c07b382657c375@mail.gmail.com>
On Wed, Oct 28, 2009 at 8:09 AM, Matvejchikov Ilya
<matvejchikov@gmail.com> wrote:
> I have a remote storage server with a git-daemon running and I want to
> be able to put some data in that repo
> in a way like 'git hash-object -w <object>'. The general problem for
> me is that I don't want to create any local
> git repositories that is needed by 'pit push ...' etc.
>
> So, is it possible to use git for remote storage purposes without
> making local repository?
This functionality isn't built into git (and it might be considered a
security hole, strictly speaking, if a repository let you download any
object by default). However, it would be pretty easy to create your
own server that does this.
For example, you could make one CGI script that dumps its POST data
into a pipe to "git hash-object --stdin -w"
I've written a service similar to this at work. It's relatively
simple to do a basic version. Of course, as you get into more
complicated situations (what about multiple users updating the same
filename? merges? authentication?) it gets more complicated. But I
think everybody would want this for a different reason, so it's
unlikely that there'll ever be a single "standard" solution.
Have fun,
Avery
^ permalink raw reply
* Re: git rebase -i <first_commit_in_repository>
From: Dirk Süsserott @ 2009-10-28 19:24 UTC (permalink / raw)
To: Allan Caffee; +Cc: Dirk Süsserott, eschvoca, kusmabite, git
In-Reply-To: <b2e43f8f0910261347m38ccb608nb5858ff1dc432b33@mail.gmail.com>
Am 26.10.2009 21:47 schrieb Allan Caffee:
> 2009/10/26 Dirk Süsserott <newsletter@dirk.my1.cc>:
>> Am 26.10.2009 19:08 schrieb eschvoca:
>> Hi,
>>
>> probably my approach could help you in the future: When I create a new repo
>> (git init) I firstly create an initial commit with nothing else than an
>> initial commit, i.e.:
>>
>> $ git init
>> $ echo "initial" > initial.commit
>> $ git add initial.commit
>> $ git commit -m "Initial commit"
>
> I don't think this is actually necessary. You should just be able to do:
> $ git init
> $ git commit --allow-empty -m "Initial commit (empty)"
>
Allan,
that works great and is not as cumbersome as my solution.
Thank you!
Dirk
^ permalink raw reply
* Re: [PATCH] help -a: do not unnecessarily look for a repository
From: Junio C Hamano @ 2009-10-28 20:26 UTC (permalink / raw)
To: Gerrit Pape; +Cc: Junio C Hamano, Johannes Schindelin, git
In-Reply-To: <20091028093022.30253.qmail@d8110c1e8cdcdf.315fe32.mid.smarden.org>
Thanks.
^ permalink raw reply
* What's cooking in git.git (Oct 2009, #05; Wed, 28)
From: Junio C Hamano @ 2009-10-28 21:11 UTC (permalink / raw)
To: git
Here are the topics that have been cooking. Commits prefixed with '-' are
only in 'pu' while commits prefixed with '+' are in 'next'. The ones
marked with '.' do not appear in any of the integration branches, but I am
still holding onto them.
In 1.7.0, we plan to correct handful of warts in the interfaces everybody
agrees that they were mistakes. The resulting system may not be strictly
backward compatible. Currently planeed changes are:
* refuse push to update the checked out branch in a non-bare repo by
default
Make "git push" into a repository to update the branch that is checked
out fail by default. You can countermand this default by setting a
configuration variable in the receiving repository.
http://thread.gmane.org/gmane.comp.version-control.git/107758/focus=108007
* refuse push to delete the current branch by default
Make "git push $there :$killed" to delete the branch that is pointed at
by its HEAD fail by default. You can countermand this default by
setting a configuration variable in the receiving repository.
http://thread.gmane.org/gmane.comp.version-control.git/108862/focus=108936
* git-send-email won't make deep threads by default
Many people said that by default when sending more than 2 patches the
threading git-send-email makes by default is hard to read, and they
prefer the default be one cover letter and each patch as a direct
follow-up to the cover letter. You can countermand this by setting a
configuration variable.
http://article.gmane.org/gmane.comp.version-control.git/109790
* git-status won't be "git-commit --dry-run" anymore
http://thread.gmane.org/gmane.comp.version-control.git/125989/focus=125993
* "git-diff -w --exit-code" will exit success if only differences it
found are whitespace changes that are stripped away from the output.
http://thread.gmane.org/gmane.comp.version-control.git/119731/focus=119751
--------------------------------------------------
[Graduated to "master"]
* jc/fsck-default-full (2009-10-20) 1 commit
+ fsck: default to "git fsck --full"
* jc/maint-fix-unpack-zlib-check (2009-10-21) 1 commit.
+ Fix incorrect error check while reading deflated pack data
* jc/receive-pack-auto (2009-10-20) 2 commits.
+ receive-pack: run "gc --auto --quiet" and optionally "update-server-info"
+ gc --auto --quiet: make the notice a bit less verboase
* bg/clone-doc (2009-10-20) 1 commit.
+ git-clone.txt: Fix grammar and formatting
* iv/tar-lzma-xz (2009-10-20) 1 commit.
+ import-tars: Add support for tarballs compressed with lzma, xz
* jk/maint-cvsimport-pathname (2009-10-19) 1 commit.
+ cvsimport: fix relative argument filenames
* sb/gitweb-link-author (2009-10-15) 1 commit
+ gitweb: linkify author/committer names with search
--------------------------------------------------
[New Topics]
* jp/dirty-describe (2009-10-21) 1 commit.
- Teach "git describe" --dirty option
Soon in 'next'.
* jp/fetch-cull-many-refs (2009-10-25) 2 commits
- fetch: Speed up fetch of large numbers of refs
- remote: Make ref_remove_duplicates faster for large numbers of refs
* bg/format-patch-p-noop (2009-10-25) 3 commits.
- format-patch documentation: Fix formatting
- format-patch documentation: Remove diff options that are not useful
- format-patch: Make implementation and documentation agree
* jk/gitignore-anchored (2009-10-26) 1 commit
- gitignore: root most patterns at the top-level directory
* jk/maint-add-p-empty (2009-10-27) 1 commit.
- add-interactive: handle deletion of empty files
Soon in 'next'.
* jk/maint-push-config (2009-10-25) 1 commit.
- push: always load default config
Soon in 'next'.
* lt/revision-bisect (2009-10-27) 1 commit.
- Add '--bisect' revision machinery argument
* mh/maint-diff-color-words (2009-10-28) 3 commits
- diff: fix the location of hunk headers for "git diff --color-words -U0"
- diff: move the handling of the hunk header after the changed lines
- t4034-diff-words: add a test for word diff without context
--------------------------------------------------
[Stalled]
* tr/filter-branch (2009-10-21) 2 commits.
- filter-branch: nearest-ancestor rewriting outside subdir filter
- filter-branch: stop special-casing $filter_subdir argument
J6t already has some comments on this.
* mr/gitweb-snapshot (2009-09-26) 2 commits.
- gitweb: append short hash ids to snapshot files
(merged to 'next' on 2009-10-11 at 22ba047)
+ gitweb: check given hash before trying to create snapshot
Jakub says the tip one needs updates.
* ne/rev-cache (2009-10-19) 7 commits.
- support for commit grafts, slight change to general mechanism
- support for path name caching in rev-cache
- full integration of rev-cache into git, completed test suite
- administrative functions for rev-cache, start of integration into git
- support for non-commit object caching in rev-cache
- basic revision cache system, no integration or features
- man page and technical discussion for rev-cache
The author indicated that there is another round coming.
* jl/submodule-add-noname (2009-09-22) 1 commit.
- git submodule add: make the <path> parameter optional
Dscho started an interesting discussion regarding the larger workflow in
which the "submodule add" is used. I think the patch itself makes sense
but at the same time it probably makes sense to also take the <path> and
infer the <repository> as Dscho suggested, probably in "git submodule
add", not in "git add" proper, at least initially.
* sr/gfi-options (2009-09-06) 6 commits.
- fast-import: test the new option command
- fast-import: add option command
- fast-import: test the new feature command
- fast-import: add feature command
- fast-import: put marks reading in it's own function
- fast-import: put option parsing code in separate functions
???
* je/send-email-no-subject (2009-08-05) 1 commit.
(merged to 'next' on 2009-10-11 at 1b99c56)
+ send-email: confirm on empty mail subjects
The existing tests cover the positive case (i.e. as long as the user says
"yes" to the "do you really want to send this message that lacks subject",
the message is sent) of this feature, but the feature itself needs its own
test to verify the negative case (i.e. does it correctly stop if the user
says "no"?)
--------------------------------------------------
[Cooking]
* db/vcs-helper-rest (2009-10-27) 7 commits.
- Fix memory leak in helper method for disconnect
- Allow helpers to report in "list" command that the ref is unchanged
- Add support for "import" helper command
- Add a config option for remotes to specify a foreign vcs
- Allow programs to not depend on remotes having urls
- Allow fetch to modify refs
- Use a function to determine whether a remote is valid
(this branch is used by jh/cvs-helper.)
Queued a fix-up.
* jh/cvs-helper (2009-08-18) 8 commits.
- More fixes to the git-remote-cvs installation procedure
- Fix the Makefile-generated path to the git_remote_cvs package in git-remote-cvs
- Add simple selftests of git-remote-cvs functionality
- git-remote-cvs: Remote helper program for CVS repositories
- 2/2: Add Python support library for CVS remote helper
- 1/2: Add Python support library for CVS remote helper
- Basic build infrastructure for Python scripts
- Allow helpers to request marks for fast-import
(this branch uses db/vcs-helper-rest.)
This depends on the above.
* cb/doc-fetch-pull-merge (2009-10-21) 1 commit.
(merged to 'next' on 2009-10-21 at 1d9190d)
+ modernize fetch/merge/pull examples
Soon in 'master'.
* ja/fetch-doc (2009-10-22) 3 commits.
(merged to 'next' on 2009-10-22 at 8868407)
+ Documentation/merge-options.txt: order options in alphabetical groups
+ Documentation/git-pull.txt: Add subtitles above included option files
(merged to 'next' on 2009-10-21 at bf09f62)
+ Documentation/fetch-options.txt: order options alphabetically
Soon in 'master'.
* tr/maint-roff-quote (2009-10-22) 1 commit.
(merged to 'next' on 2009-10-22 at 14c5631)
+ Quote ' as \(aq in manpages
Soon in 'master'.
* rs/pretty-wrap (2009-10-17) 1 commit
- Implement wrap format %w() as if it is a mode switch
(this branch uses js/log-rewrap.)
* jc/pretty-lf (2009-10-04) 1 commit.
- Pretty-format: %[+-]x to tweak inter-item newlines
* js/log-rewrap (2009-10-18) 3 commits
- Teach --wrap to only indent without wrapping
- Add strbuf_add_wrapped_text() to utf8.[ch]
- print_wrapped_text(): allow hard newlines
(this branch is used by rs/pretty-wrap.)
Before discarding jc/strbuf-nested-expand, I cherry-picked the tip of it
to this series.
* sr/blame-incomplete (2009-10-19) 1 commit.
(merged to 'next' on 2009-10-22 at 133e0ce)
+ blame: make sure that the last line ends in an LF
I think this is _good enough_ as-is; although it would be better if we
added some hint to the output for Porcelain implementations, that can be
done as a follow-up fix.
* ak/bisect-reset-to-switch (2009-10-13) 1 commit.
(merged to 'next' on 2009-10-22 at 592fff3)
+ bisect reset: Allow resetting to any commit, not just a branch
Soon in 'master'.
* fc/doc-fast-forward (2009-10-24) 1 commit.
- Use 'fast-forward' all over the place
* jc/maint-1.6.3-graft-trailing-space (2009-10-14) 1 commit.
(merged to 'next' on 2009-10-22 at 90ccac6)
+ info/grafts: allow trailing whitespaces at the end of line
Soon in 'master'.
* jn/show-normalized-refs (2009-10-12) 3 commits.
(merged to 'next' on 2009-10-23 at 332aad3)
+ check-ref-format: simplify --print implementation
+ git check-ref-format --print
+ Add tests for git check-ref-format
Soon in 'master'.
* jc/checkout-auto-track (2009-10-18) 3 commits
(merged to 'next' on 2009-10-23 at ff7e8f3)
+ git checkout --no-guess
+ DWIM "git checkout frotz" to "git checkout -b frotz origin/frotz"
+ check_filename(): make verify_filename() callable without dying
The final shape of this series ended up to be more or less exactly what
Dscho hinted he wanted to have in one of the discussion.
Soon in 'master'.
* tr/stash-format (2009-10-19) 5 commits
(merged to 'next' on 2009-10-23 at 6c551c3)
+ stash list: drop the default limit of 10 stashes
+ stash list: use new %g formats instead of sed
+ Introduce new pretty formats %g[sdD] for reflog information
+ reflog-walk: refactor the branch@{num} formatting
+ Refactor pretty_print_commit arguments into a struct
Soon in 'master'.
* ks/precompute-completion (2009-10-26) 3 commits.
(merged to 'next' on 2009-10-28 at cd5177f)
+ completion: ignore custom merge strategies when pre-generating
(merged to 'next' on 2009-10-22 at f46a28a)
+ bug: precomputed completion includes scripts sources
(merged to 'next' on 2009-10-14 at adf722a)
+ Speedup bash completion loading
* sp/smart-http (2009-10-25) 24 commits
- remote-helpers: return successfully if everything up-to-date
- update http tests according to remote-curl capabilities
- http-backend: more explict LocationMatch
- http-backend: add example for gitweb on same URL
- http-backend: use mod_alias instead of mod_rewrite
- http-backend: reword some documentation
- http-backend: add GIT_PROJECT_ROOT environment var
- Smart HTTP fetch: gzip requests
- Smart fetch over HTTP: client side
- Smart push over HTTP: client side
- Discover refs via smart HTTP server when available
- Smart fetch and push over HTTP: server side
- Add stateless RPC options to upload-pack, receive-pack
- Git-aware CGI to provide dumb HTTP transport
- Move WebDAV HTTP push under remote-curl
- remote-helpers: Support custom transport options
- remote-helpers: Fetch more than one ref in a batch
- fetch: Allow transport -v -v -v to set verbosity to 3
- remote-curl: Refactor walker initialization
- Add multi_ack_detailed capability to fetch-pack/upload-pack
- Move "get_ack()" back to fetch-pack
- fetch-pack: Use a strbuf to compose the want list
- pkt-line: Make packet_read_line easier to debug
- pkt-line: Add strbuf based functions
Shawn plans another round of re-roll.
* ef/msys-imap (2009-10-22) 9 commits.
- Windows: use BLK_SHA1 again
- MSVC: Enable OpenSSL, and translate -lcrypto
- mingw: enable OpenSSL
- mingw: wrap SSL_set_(w|r)fd to call _get_osfhandle
- imap-send: build imap-send on Windows
- imap-send: fix compilation-error on Windows
- imap-send: use run-command API for tunneling
- imap-send: use separate read and write fds
- imap-send: remove useless uid code
This is pulled from J6t; I'll merge it to 'next' if Dscho is Ok with it.
* js/diff-verbose-submodule (2009-10-23) 2 commits.
(merged to 'next' on 2009-10-23 at e479773)
+ add tests for git diff --submodule
+ Add the --submodule option to the diff option family
Soon in 'master'.
* jc/fix-tree-walk (2009-10-22) 11 commits.
(merged to 'next' on 2009-10-22 at 10c0c8f)
+ Revert failed attempt since 353c5ee
+ read-tree --debug-unpack
(merged to 'next' on 2009-10-11 at 0b058e2)
+ unpack-trees.c: look ahead in the index
+ unpack-trees.c: prepare for looking ahead in the index
+ Aggressive three-way merge: fix D/F case
+ traverse_trees(): handle D/F conflict case sanely
+ more D/F conflict tests
+ tests: move convenience regexp to match object names to test-lib.sh
+ unpack_callback(): use unpack_failed() consistently
+ unpack-trees: typofix
+ diff-lib.c: fix misleading comments on oneway_diff()
This has some stupid bugs and temporarily reverted from 'next' until I can
fix it.
* jh/notes (2009-10-09) 22 commits.
- fast-import: Proper notes tree manipulation using the notes API
- Refactor notes concatenation into a flexible interface for combining notes
- Notes API: Allow multiple concurrent notes trees with new struct notes_tree
- Notes API: for_each_note(): Traverse the entire notes tree with a callback
- Notes API: get_note(): Return the note annotating the given object
- Notes API: add_note(): Add note objects to the internal notes tree structure
- Notes API: init_notes(): Initialize the notes tree from the given notes ref
- Notes API: get_commit_notes() -> format_note() + remove the commit restriction
- Add selftests verifying concatenation of multiple notes for the same commit
- Refactor notes code to concatenate multiple notes annotating the same object
- Add selftests verifying that we can parse notes trees with various fanouts
- Teach the notes lookup code to parse notes trees with various fanout schemes
- Teach notes code to free its internal data structures on request
- Add '%N'-format for pretty-printing commit notes
- Add flags to get_commit_notes() to control the format of the note string
- t3302-notes-index-expensive: Speed up create_repo()
- fast-import: Add support for importing commit notes
- Teach "-m <msg>" and "-F <file>" to "git notes edit"
- Add an expensive test for git-notes
- Speed up git notes lookup
- Add a script to edit/inspect notes
- Introduce commit notes
I think Johan indicated that early parts of it is ready for 'next', so I
may do so up to "Add selftests" one.
* jn/gitweb-blame (2009-09-01) 5 commits.
- gitweb: Minify gitweb.js if JSMIN is defined
- gitweb: Create links leading to 'blame_incremental' using JavaScript
(merged to 'next' on 2009-10-11 at 73c4a83)
+ gitweb: Colorize 'blame_incremental' view during processing
+ gitweb: Incremental blame (using JavaScript)
+ gitweb: Add optional "time to generate page" info in footer
Ajax-y blame. Probably the first three should go to 'master' by now?
* nd/sparse (2009-08-20) 19 commits.
- sparse checkout: inhibit empty worktree
- Add tests for sparse checkout
- read-tree: add --no-sparse-checkout to disable sparse checkout support
- unpack-trees(): ignore worktree check outside checkout area
- unpack_trees(): apply $GIT_DIR/info/sparse-checkout to the final index
- unpack-trees(): "enable" sparse checkout and load $GIT_DIR/info/sparse-checkout
- unpack-trees.c: generalize verify_* functions
- unpack-trees(): add CE_WT_REMOVE to remove on worktree alone
- Introduce "sparse checkout"
- dir.c: export excluded_1() and add_excludes_from_file_1()
- excluded_1(): support exclude files in index
- unpack-trees(): carry skip-worktree bit over in merged_entry()
- Read .gitignore from index if it is skip-worktree
- Avoid writing to buffer in add_excludes_from_file_1()
- Teach Git to respect skip-worktree bit (writing part)
- Teach Git to respect skip-worktree bit (reading part)
- Introduce "skip-worktree" bit in index, teach Git to get/set this bit
- Add test-index-version
- update-index: refactor mark_valid() in preparation for new options
--------------------------------------------------
[For 1.7.0]
* jc/1.7.0-no-commit-no-ff-2 (2009-10-22) 1 commit.
- git-merge: forbid fast-forward and up-to-date when --no-commit is given
This makes "git merge --no-commit" fail when it results in fast-forward or
up-to-date. I haven't described this at the beginning of this message
yet, as it is not clear if this change is even necessary. Opinions?
* jk/1.7.0-status (2009-09-05) 5 commits.
- docs: note that status configuration affects only long format
(merged to 'next' on 2009-10-11 at 65c8513)
+ commit: support alternate status formats
+ status: add --porcelain output format
+ status: refactor format option parsing
+ status: refactor short-mode printing to its own function
(this branch uses jc/1.7.0-status.)
Gives the --short output format to post 1.7.0 "git commit --dry-run" that
is similar to that of post 1.7.0 "git status".
The tip one is not in 'next' as I have been hoping that somebody may want
to change the code to make it unnecessary, but it does not seem to be
happening, so probably it should also go to 'next'.
* jc/1.7.0-status (2009-09-05) 4 commits.
(merged to 'next' on 2009-10-11 at 9558627)
+ status: typo fix in usage
+ git status: not "commit --dry-run" anymore
+ git stat -s: short status output
+ git stat: the beginning of "status that is not a dry-run of commit"
(this branch is used by jk/1.7.0-status.)
With this, "git status" is no longer "git commit --dry-run".
* jc/1.7.0-send-email-no-thread-default (2009-08-22) 1 commit.
(merged to 'next' on 2009-10-11 at 043acdf)
+ send-email: make --no-chain-reply-to the default
* jc/1.7.0-diff-whitespace-only-status (2009-08-30) 4 commits.
(merged to 'next' on 2009-10-11 at 546c74d)
+ diff.c: fix typoes in comments
+ Make test case number unique
+ diff: Rename QUIET internal option to QUICK
+ diff: change semantics of "ignore whitespace" options
This changes exit code from "git diff --ignore-whitespace" and friends
when there is no actual output. It is a backward incompatible change, but
we could argue that it is a bugfix.
* jc/1.7.0-push-safety (2009-02-09) 2 commits.
(merged to 'next' on 2009-10-11 at 81b8128)
+ Refuse deleting the current branch via push
+ Refuse updating the current branch in a non-bare repository via push
--------------------------------------------------
[I have been too busy to purge these]
* jc/log-tz (2009-03-03) 1 commit.
- Allow --date=local --date=other-format to work as expected
Maybe some people care about this. I dunno.
* jc/mailinfo-remove-brackets (2009-07-15) 1 commit.
- mailinfo: -b option keeps [bracketed] strings that is not a [PATCH] marker
Maybe some people care about this. I dunno.
* jg/log-format-body-indent (2009-09-19) 1 commit.
. git-log --format: Add %B tag with %B(x) option
^ permalink raw reply
* Fwd: [ANN] gitsharp 0.2 released
From: Meinrad Recheis @ 2009-10-28 21:33 UTC (permalink / raw)
To: git
In-Reply-To: <658c7e11-85ad-4ae6-a2a3-dec5aff121d1@b2g2000yqi.googlegroups.com>
Dear fellow git enthusiasts,
We are proud to announce version 0.2 which marks significant
improvements in the new Git api we are building around GitSharp.Core.
The core is a line-by-line port of jgit. We found it quite hard to use
without good knowledge of git's internals and technical concepts.
The api which is documented by examples at
http://www.eqqon.com/index.php/GitSharp/Examples
encapsulates and abstracts this knowledge so that everyone with a
little git experience can easily make use of the library.
The improvements mentioned above allow to add files to the index and
commit them. It is as easy as this:
var repo = Repository.Init("path/to/new/repo");
Now suppose you have created some files in the new repository and want
to stage them for committing:
repo.Index.Add("README", "License.txt");
var commit=repo.Commit("My first commit with gitsharp", new Author
("henon", "meinrad.recheis@gmail.com"));
Easy, isn't it? Now let's have a look at the changes of this commit:
foreach(var change in commit.Changes) Console.WriteLine
(change.Name + " " + change.ChangeType);
Of course there is still much work to do until this new API will
completely reflect the full range of git interactions a standard
application is probably going to need. We hope to quickly build up the
most important parts until the end of the year. If you check it out,
please give us feedback which will be greatly appreciated.
Download Gitsharp 0.2 binaries from
http://www.eqqon.com/index.php?title=GitSharp/v0.2.0
Have a nice day,
--Henon 21:22, 28 October 2009 (CET)
^ permalink raw reply
* [PATCH] mergetool--lib: add p4merge as a pre-configured mergetool option
From: Scott Chacon @ 2009-10-28 21:39 UTC (permalink / raw)
To: git list; +Cc: Junio C Hamano, Charles Bailey, David Aguilar
In-Reply-To: <d411cc4a0910280837h52596089je9ab4d03383d43cc@mail.gmail.com>
p4merge is now a built-in diff/merge tool.
This adds p4merge to git-completion and updates
the documentation to mention p4merge.
Signed-Off-By: Scott Chacon <schacon@gmail.com>
---
This is the same patch, but I tested it on Linux as well as Mac and it
works fine as long as the [difftool|mergetool].p4merge.path configs
are set or it's in your path.
Documentation/git-difftool.txt | 2 +-
Documentation/git-mergetool.txt | 2 +-
Documentation/merge-config.txt | 2 +-
contrib/completion/git-completion.bash | 2 +-
git-mergetool--lib.sh | 17 +++++++++++++++--
5 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/Documentation/git-difftool.txt b/Documentation/git-difftool.txt
index 96a6c51..8e9aed6 100644
--- a/Documentation/git-difftool.txt
+++ b/Documentation/git-difftool.txt
@@ -31,7 +31,7 @@ OPTIONS
Use the diff tool specified by <tool>.
Valid merge tools are:
kdiff3, kompare, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff,
- ecmerge, diffuse, opendiff and araxis.
+ ecmerge, diffuse, opendiff, p4merge and araxis.
+
If a diff tool is not specified, 'git-difftool'
will use the configuration variable `diff.tool`. If the
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index 68ed6c0..4a6f7f3 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -27,7 +27,7 @@ OPTIONS
Use the merge resolution program specified by <tool>.
Valid merge tools are:
kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge,
- diffuse, tortoisemerge, opendiff and araxis.
+ diffuse, tortoisemerge, opendiff, p4merge and araxis.
+
If a merge resolution program is not specified, 'git-mergetool'
will use the configuration variable `merge.tool`. If the
diff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt
index c0f96e7..a403155 100644
--- a/Documentation/merge-config.txt
+++ b/Documentation/merge-config.txt
@@ -23,7 +23,7 @@ merge.tool::
Controls which merge resolution program is used by
linkgit:git-mergetool[1]. Valid built-in values are: "kdiff3",
"tkdiff", "meld", "xxdiff", "emerge", "vimdiff", "gvimdiff",
- "diffuse", "ecmerge", "tortoisemerge", "araxis", and
+ "diffuse", "ecmerge", "tortoisemerge", "p4merge", "araxis" and
"opendiff". Any other value is treated is custom merge tool
and there must be a corresponding mergetool.<tool>.cmd option.
diff --git a/contrib/completion/git-completion.bash
b/contrib/completion/git-completion.bash
index d3fec32..5fb6017 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -953,7 +953,7 @@ _git_diff ()
}
__git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
- tkdiff vimdiff gvimdiff xxdiff araxis
+ tkdiff vimdiff gvimdiff xxdiff araxis p4merge
"
_git_difftool ()
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index bfb01f7..f7c571e 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -46,7 +46,7 @@ check_unchanged () {
valid_tool () {
case "$1" in
kdiff3 | tkdiff | xxdiff | meld | opendiff | \
- emerge | vimdiff | gvimdiff | ecmerge | diffuse | araxis)
+ emerge | vimdiff | gvimdiff | ecmerge | diffuse | araxis | p4merge)
;; # happy
tortoisemerge)
if ! merge_mode; then
@@ -130,6 +130,19 @@ run_merge_tool () {
"$merge_tool_path" "$LOCAL" "$REMOTE"
fi
;;
+ p4merge)
+ if merge_mode; then
+ touch "$BACKUP"
+ if $base_present; then
+ "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
+ else
+ "$merge_tool_path" "$LOCAL" "$LOCAL" "$REMOTE" "$MERGED"
+ fi
+ check_unchanged
+ else
+ "$merge_tool_path" "$LOCAL" "$REMOTE"
+ fi
+ ;;
meld)
if merge_mode; then
touch "$BACKUP"
@@ -323,7 +336,7 @@ guess_merge_tool () {
else
tools="opendiff kdiff3 tkdiff xxdiff meld $tools"
fi
- tools="$tools gvimdiff diffuse ecmerge araxis"
+ tools="$tools gvimdiff diffuse ecmerge p4merge araxis"
fi
if echo "${VISUAL:-$EDITOR}" | grep emacs > /dev/null 2>&1; then
# $EDITOR is emacs so add emerge as a candidate
--
1.6.5.2.75.gad2f8
^ permalink raw reply related
* Re: What's cooking in git.git (Oct 2009, #01; Wed, 07)
From: Sverre Rabbelier @ 2009-10-28 22:08 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Johannes Schindelin, git, vcs-fast-import-devs
In-Reply-To: <fabb9a1e0910081058m59527600o392a6b438b18512e@mail.gmail.com>
Heya,
On Thu, Oct 8, 2009 at 10:58, Sverre Rabbelier <srabbelier@gmail.com> wrote:
> I think it makes to ignore options that are not for our vcs, as long
> as options that change import behavior (such as marks, date-format)
> are combined with, say, 'feature tool=git'. This way we can be sure
> that when outputting out a vcs specific stream, it is only parsed by
> that vcs.
>
> Note: yes, I know that marks and date-format are features now, but
> there's really no other suitable example that I could think of).
>
> vcs fast import devs please ack this idea (and perhaps suggest
> something other than "feature tool=git" if preferable) so that I can
> reroll my gfi-options series :).
Shawn, what do you want to do with this, it seems the vcs devs are not
very interested in this feature, should I implement it as described
above? That is:
* If you use any option that is stream-changing you should include
"feature tool=git" in your stream
* import-marks and export-marks are made into features
* "option vcs" is ignored if vcs is a different vcs
* "option vcs" must be recognised if vcs is this vcs
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: What's cooking in git.git (Oct 2009, #05; Wed, 28)
From: Sverre Rabbelier @ 2009-10-28 22:09 UTC (permalink / raw)
To: Junio C Hamano, Shawn O. Pearce; +Cc: git
In-Reply-To: <7vfx93jkb1.fsf@alter.siamese.dyndns.org>
Heya,
On Wed, Oct 28, 2009 at 14:11, Junio C Hamano <gitster@pobox.com> wrote:
> * sr/gfi-options (2009-09-06) 6 commits.
> - fast-import: test the new option command
> - fast-import: add option command
> - fast-import: test the new feature command
> - fast-import: add feature command
> - fast-import: put marks reading in it's own function
> - fast-import: put option parsing code in separate functions
>
> ???
Repinged Shawn and the vcs list to decide what to do, I really want to
get this done with...
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* [PATCH v2] describe: when failing, tell the user about options that work
From: Thomas Rast @ 2009-10-28 22:10 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Eugene Sajine
In-Reply-To: <7vmy3iaqfr.fsf@alter.siamese.dyndns.org>
Users seem to call git-describe without reading the manpage, and then
wonder why it doesn't work with unannotated tags by default.
Make a minimal effort towards seeing if there would have been
unannotated tags, and tell the user. Specifically, we say that --tags
could work if we found any unannotated tags. If not, we say that
--always would have given results.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Junio C Hamano wrote:
> Thomas Rast <trast@student.ethz.ch> writes:
> > However, it could be written e.g.
> >
> > No annotated tags can describe '%s'. However, there were
> > unannotated tags: try --tags.
>
> Sounds better.
Then let's make it so. Sorry for taking so long.
builtin-describe.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/builtin-describe.c b/builtin-describe.c
index 2dcfd3d..4ea6f88 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -96,8 +96,6 @@ static int get_name(const char *path, const unsigned char *sha1, int flag, void
if (!all) {
if (!prio)
return 0;
- if (!tags && prio < 2)
- return 0;
}
add_to_known_names(all ? path + 5 : path + 10, commit, prio, sha1);
return 0;
@@ -184,6 +182,7 @@ static void describe(const char *arg, int last_one)
struct possible_tag all_matches[MAX_TAGS];
unsigned int match_cnt = 0, annotated_cnt = 0, cur_match;
unsigned long seen_commits = 0;
+ unsigned int unannotated_cnt = 0;
if (get_sha1(arg, sha1))
die("Not a valid object name %s", arg);
@@ -217,7 +216,9 @@ static void describe(const char *arg, int last_one)
seen_commits++;
n = c->util;
if (n) {
- if (match_cnt < max_candidates) {
+ if (!tags && !all && n->prio < 2) {
+ unannotated_cnt++;
+ } else if (match_cnt < max_candidates) {
struct possible_tag *t = &all_matches[match_cnt++];
t->name = n;
t->depth = seen_commits - 1;
@@ -259,7 +260,14 @@ static void describe(const char *arg, int last_one)
printf("%s\n", find_unique_abbrev(sha1, abbrev));
return;
}
- die("cannot describe '%s'", sha1_to_hex(sha1));
+ if (unannotated_cnt)
+ die("No annotated tags can describe '%s'.\n"
+ "However, there were unannotated tags: try --tags.",
+ sha1_to_hex(sha1));
+ else
+ die("No tags can describe '%s'.\n"
+ "Try --always, or create some tags.",
+ sha1_to_hex(sha1));
}
qsort(all_matches, match_cnt, sizeof(all_matches[0]), compare_pt);
--
1.6.5.1.161.g3b9c0
^ permalink raw reply related
* [PATCH] Teach 'git merge' and 'git pull' the option --ff-only
From: Björn Gustavsson @ 2009-10-28 22:15 UTC (permalink / raw)
To: git; +Cc: gitster
For convenience in scripts and aliases, add the option
--ff-only to only allow fast-forwards.
Acknowledgements: I did look at Yuval Kogman's earlier
patch (107768 in gmane), mainly as shortcut to find my
way in the code, but I did not copy anything directly.
Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
---
When I started to use git earlier this year, I was suprised
that there was a --no-ff option but no --ff-only option.
I saw in the mailing list archive at gmane that there has
been two previous attempts to implement --ff-only. The first
patch was made to the git-merge.sh script (before
builtin-merge.c was created). As far as I understand it,
the author of the patch said he would send some corrections
of the patch, but he never did, and nothing more happened.
So here is my patch, the third attempt.
Documentation/merge-options.txt | 4 ++++
builtin-merge.c | 16 ++++++++++++++--
git-pull.sh | 7 +++++--
t/t7600-merge.sh | 29 +++++++++++++++++++++++++++++
4 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt
index adadf8e..fbf8976 100644
--- a/Documentation/merge-options.txt
+++ b/Documentation/merge-options.txt
@@ -60,6 +60,10 @@
a fast-forward, only update the branch pointer. This is
the default behavior of git-merge.
+--ff-only::
+ Refuse to merge unless the merge can be resolved as a
+ fast-forward.
+
-s <strategy>::
--strategy=<strategy>::
Use the given merge strategy; can be supplied more than
diff --git a/builtin-merge.c b/builtin-merge.c
index b6b8428..298adfb 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -43,6 +43,7 @@ static const char * const builtin_merge_usage[] = {
static int show_diffstat = 1, option_log, squash;
static int option_commit = 1, allow_fast_forward = 1;
+static int fast_forward_only;
static int allow_trivial = 1, have_message;
static struct strbuf merge_msg;
static struct commit_list *remoteheads;
@@ -167,6 +168,8 @@ static struct option builtin_merge_options[] = {
"perform a commit if the merge succeeds (default)"),
OPT_BOOLEAN(0, "ff", &allow_fast_forward,
"allow fast forward (default)"),
+ OPT_BOOLEAN(0, "ff-only", &fast_forward_only,
+ "abort if fast forward is not possible"),
OPT_CALLBACK('s', "strategy", &use_strategies, "strategy",
"merge strategy to use", option_parse_strategy),
OPT_CALLBACK('m', "message", &merge_msg, "message",
@@ -874,6 +877,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
option_commit = 0;
}
+ if (!allow_fast_forward && fast_forward_only)
+ die("You cannot combine --no-ff with --ff-only.");
+
if (!argc)
usage_with_options(builtin_merge_usage,
builtin_merge_options);
@@ -969,8 +975,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
}
for (i = 0; i < use_strategies_nr; i++) {
- if (use_strategies[i]->attr & NO_FAST_FORWARD)
+ if (use_strategies[i]->attr & NO_FAST_FORWARD) {
allow_fast_forward = 0;
+ if (fast_forward_only)
+ die("You cannot combine --ff-only with the merge strategy '%s'.", use_strategies[i]->name);
+ }
if (use_strategies[i]->attr & NO_TRIVIAL)
allow_trivial = 0;
}
@@ -1040,7 +1049,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
* only one common.
*/
refresh_cache(REFRESH_QUIET);
- if (allow_trivial) {
+ if (allow_trivial && !fast_forward_only) {
/* See if it is really trivial. */
git_committer_info(IDENT_ERROR_ON_NO_NAME);
printf("Trying really trivial in-index merge...\n");
@@ -1079,6 +1088,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
}
}
+ if (fast_forward_only)
+ die("Not possible to fast forward, aborting.");
+
/* We are going to make a new commit. */
git_committer_info(IDENT_ERROR_ON_NO_NAME);
diff --git a/git-pull.sh b/git-pull.sh
index fc78592..37f3d93 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -16,7 +16,8 @@ cd_to_toplevel
test -z "$(git ls-files -u)" ||
die "You are in the middle of a conflicted merge."
-strategy_args= diffstat= no_commit= squash= no_ff= log_arg= verbosity=
+strategy_args= diffstat= no_commit= squash= no_ff= ff_only=
+log_arg= verbosity=
curr_branch=$(git symbolic-ref -q HEAD)
curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||")
rebase=$(git config --bool branch.$curr_branch_short.rebase)
@@ -45,6 +46,8 @@ do
no_ff=--ff ;;
--no-ff)
no_ff=--no-ff ;;
+ --ff-only)
+ ff_only=--ff-only ;;
-s=*|--s=*|--st=*|--str=*|--stra=*|--strat=*|--strate=*|\
--strateg=*|--strategy=*|\
-s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
@@ -215,5 +218,5 @@ merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit
test true = "$rebase" &&
exec git-rebase $diffstat $strategy_args --onto $merge_head \
${oldremoteref:-$merge_head}
-exec git-merge $diffstat $no_commit $squash $no_ff $log_arg $strategy_args \
+exec git-merge $diffstat $no_commit $squash $no_ff $ff_only $log_arg $strategy_args \
"$merge_name" HEAD $merge_head $verbosity
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index e5b210b..d696ea9 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -243,6 +243,16 @@ test_expect_success 'merge c0 with c1' '
test_debug 'gitk --all'
+test_expect_success 'merge c0 with c1 with --ff-only' '
+ git reset --hard c0 &&
+ git merge --ff-only c1 &&
+ git merge --ff-only HEAD c0 c1 &&
+ verify_merge file result.1 &&
+ verify_head "$c1"
+'
+
+test_debug 'gitk --all'
+
test_expect_success 'merge c1 with c2' '
git reset --hard c1 &&
test_tick &&
@@ -263,6 +273,14 @@ test_expect_success 'merge c1 with c2 and c3' '
test_debug 'gitk --all'
+test_expect_success 'failing merges with --ff-only' '
+ git reset --hard c1 &&
+ test_tick &&
+ test_must_fail git merge --ff-only c2 &&
+ test_must_fail git merge --ff-only c3 &&
+ test_must_fail git merge --ff-only c2 c3
+'
+
test_expect_success 'merge c0 with c1 (no-commit)' '
git reset --hard c0 &&
git merge --no-commit c1 &&
@@ -432,6 +450,17 @@ test_expect_success 'combining --squash and --no-ff is refused' '
test_must_fail git merge --no-ff --squash c1
'
+test_expect_success 'combining --ff-only and --no-ff is refused' '
+ test_must_fail git merge --ff-only --no-ff c1 &&
+ test_must_fail git merge --no-ff --ff-only c1
+'
+
+test_expect_success 'combining --ff-only with certain merge strategies is refused' '
+ git reset --hard c0 &&
+ test_must_fail git merge --ff-only --strategy=ours c1 &&
+ test_must_fail git merge --ff-only --strategy=subtree c1
+'
+
test_expect_success 'merge c0 with c1 (ff overrides no-ff)' '
git reset --hard c0 &&
git config branch.master.mergeoptions "--no-ff" &&
--
1.6.5.1.69.g36942
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox