* [PATCH 2/2] move the color variables to color.c
From: Markus Heidelberg @ 2009-01-18 20:39 UTC (permalink / raw)
To: Jeff King; +Cc: René Scharfe, Junio C Hamano, git
In-Reply-To: <200901182137.16562.markus.heidelberg@web.de>
To be consistent with where the branch color variable is located now,
move the variables for diff and status color to the same place.
Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
color.c | 4 ++--
color.h | 2 ++
diff.c | 1 -
diff.h | 1 -
wt-status.c | 1 -
wt-status.h | 1 -
6 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/color.c b/color.c
index 7a8bf6e..b23c39c 100644
--- a/color.c
+++ b/color.c
@@ -1,12 +1,12 @@
#include "cache.h"
#include "color.h"
-#include "diff.h"
-#include "wt-status.h"
#define COLOR_RESET "\033[m"
int git_use_color_default = 0;
int branch_use_color = -1;
+int diff_use_color_default = -1;
+int wt_status_use_color = -1;
static int parse_color(const char *name, int len)
{
diff --git a/color.h b/color.h
index 6924848..3b47d99 100644
--- a/color.h
+++ b/color.h
@@ -10,6 +10,8 @@
extern int git_use_color_default;
extern int branch_use_color;
+extern int diff_use_color_default;
+extern int wt_status_use_color;
/*
* Use this instead of git_default_config if you need the value of color.ui.
diff --git a/diff.c b/diff.c
index d235482..4bd068c 100644
--- a/diff.c
+++ b/diff.c
@@ -22,7 +22,6 @@
static int diff_detect_rename_default;
static int diff_rename_limit_default = 200;
static int diff_suppress_blank_empty;
-int diff_use_color_default = -1;
static const char *external_diff_cmd_cfg;
int diff_auto_refresh_index = 1;
static int diff_mnemonic_prefix;
diff --git a/diff.h b/diff.h
index 4d5a327..f2c9984 100644
--- a/diff.h
+++ b/diff.h
@@ -188,7 +188,6 @@ extern void diff_unmerge(struct diff_options *,
extern int git_diff_basic_config(const char *var, const char *value, void *cb);
extern int git_diff_ui_config(const char *var, const char *value, void *cb);
-extern int diff_use_color_default;
extern void diff_setup(struct diff_options *);
extern int diff_opt_parse(struct diff_options *, const char **, int);
extern int diff_setup_done(struct diff_options *);
diff --git a/wt-status.c b/wt-status.c
index 96ff2f8..5c3742b 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -12,7 +12,6 @@
#include "remote.h"
int wt_status_relative_paths = 1;
-int wt_status_use_color = -1;
int wt_status_submodule_summary;
static char wt_status_colors[][COLOR_MAXLEN] = {
"", /* WT_STATUS_HEADER: normal */
diff --git a/wt-status.h b/wt-status.h
index 78add09..6258fd0 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -36,7 +36,6 @@ struct wt_status {
};
int git_status_config(const char *var, const char *value, void *cb);
-extern int wt_status_use_color;
extern int wt_status_relative_paths;
void wt_status_prepare(struct wt_status *s);
void wt_status_print(struct wt_status *s);
--
1.6.1.208.g3a5f4
^ permalink raw reply related
* Re: [PATCH] interpret_nth_last_branch(): avoid traversing the reflogs twice
From: Johannes Schindelin @ 2009-01-18 20:59 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Thomas Rast, git, Johannes Sixt, Johan Herland
In-Reply-To: <7vprilyt1w.fsf@gitster.siamese.dyndns.org>
Hi,
On Sat, 17 Jan 2009, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > Note: these are the memory requirements after some really unrealistically
> > high activity, and the memory is free()d during parameter parsing.
> >
> > A much more realistical expectation would be to switch branches maybe 20
> > times a day, which would amount to something like 36 kilobyte. And again,
> > they are free()d before the action really starts.
>
> My HEAD reflog is 7MB long with 39000 entries, and among them, 13100
> entries have "checkout: moving ".
>
> I know I will never want to switch back to the 10000th from the last
> branch. I am quite sure that I would forget which branch I was on after
> switching branches three or four times (hence my original hardcoded
> limitation of 10 which "should be plenty"). When I know I only have to
> keep track of 10 entries, having to keep track of 13100 entries, even if
> it is 36kB (it would actually be 260kB in my case) feels there is
> something wrong in the design.
Hrm. So let's leave it as a two-pass thing?
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH 2/3] Teach read_tree_recursive() how to traverse into submodules
From: Johannes Schindelin @ 2009-01-18 21:02 UTC (permalink / raw)
To: Lars Hjemli; +Cc: Junio C Hamano, git
In-Reply-To: <8c5c35580901181145x2e14fe0fq4ab0e94c13bad38a@mail.gmail.com>
Hi,
On Sun, 18 Jan 2009, Lars Hjemli wrote:
> On Sun, Jan 18, 2009 at 19:33, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> > On Sun, 18 Jan 2009, Lars Hjemli wrote:
> >> Actually, I want this to work for bare repositories by specifying the
> >> submodule odbs in the alternates file. So if the current submodule odb
> >> wasn't found my plan was to check if the commit object was accessible
> >> anyways but don't die() if it wasn't.
> >
> > Please make that an explicit option (cannot think of a good name, though),
> > otherwise I will not be able to use your feature. Making it the default
> > would be inconsistent with the rest of our submodules framework.
>
> Would a test on is_bare_repository() suffice for your use-case?
No. Inconsistent is inconsistent.
> If this isn't good enough, how do you propose it be solved?
As I said, with an extra option that you _have_ to pass when you want
that behavior.
> >> >> + commit = lookup_commit(sha1);
> >> >> + if (!commit)
> >> >> + die("traverse_gitlink(): internal error");
> >> >
> >> > s/internal error/could not access commit '%s' of submodule '%s'",
> >> > sha1_to_hex(sha1), path);/
> >>
> >> Ok (I belive this codepath is virtually impossible to hit, hence the
> >> "internal error", but I could of course be mistaken).
> >
> > You make it a function that is exported to other parts of Git in cache.h.
> > So you might just as well expect it to be used by other parts at some
> > stage.
>
> This function is local to tree.c, but your point is still valid.
My point is still valid because I never talked about the static function,
but the non-static one which calls the static one.
Ciao,
Dscho
^ permalink raw reply
* Re: [WIP Patch 02/12] Some cleanup in get_refs_via_curl()
From: Johannes Schindelin @ 2009-01-18 21:09 UTC (permalink / raw)
To: Mike Hommey; +Cc: git, gitster
In-Reply-To: <20090118193002.GA25134@glandium.org>
Hi,
On Sun, 18 Jan 2009, Mike Hommey wrote:
> On Sun, Jan 18, 2009 at 08:11:07PM +0100, Johannes Schindelin wrote:
> > Hi,
> >
> > On Sun, 18 Jan 2009, Johannes Schindelin wrote:
> >
> > > On Sun, 18 Jan 2009, Mike Hommey wrote:
> > >
> > > > diff --git a/transport.c b/transport.c
> > > > index 56831c5..6919ff1 100644
> > > > --- a/transport.c
> > > > +++ b/transport.c
> > > > @@ -508,6 +508,8 @@ static struct ref *get_refs_via_curl(struct transport *transport)
> > > > free(ref);
> > > > }
> > > >
> > > > + http_cleanup();
> > > > + free(refs_url);
> > > > return refs;
> > > > }
> > >
> > > You cannot http_cleanup() here, as http-push calls that function, but
> > > continues to want to use curl.
> >
> > Worse, a http clone will hit the same issue.
>
> IIRC, it doesn't break anything because getting refs is going to happen
> at the beginning, and the following http request is going to
> reinitialize the whole thing.
>
> It is suboptimal, I agree.
>From the output of t5540-http-push.sh (which tests http clone
as case 2, incidentally):
-- snip --
* ok 1: setup remote repository
* expecting success:
cd "$ROOT_PATH" &&
git clone $HTTPD_URL/test_repo.git test_repo_clone
*** glibc detected *** git: double free or corruption (!prev):
0x000000000077e090 ***
======= Backtrace: =========
/lib/libc.so.6[0x2ba4f5ac8b0a]
/lib/libc.so.6(cfree+0x8c)[0x2ba4f5acc6fc]
git[0x4d7ef2]
git[0x4d9073]
git[0x4d90b7]
git[0x4d1626]
git[0x4d1b2f]
git[0x4c9abb]
git[0x4ca00d]
git[0x4cad1a]
git[0x41c5f3]
git[0x404ee8]
git[0x405095]
git[0x40517b]
git[0x4053b8]
/lib/libc.so.6(__libc_start_main+0xf4)[0x2ba4f5a74b44]
git[0x404589]
======= Memory map: ========
00400000-00528000 r-xp 00000000 08:01 45859192
/home/schindelin/git/git
00727000-0072d000 rw-p 00127000 08:01 45859192
/home/schindelin/git/git
0072d000-007b9000 rw-p 0072d000 00:00 0
[heap]
2ba4f4e47000-2ba4f4e64000 r-xp 00000000 08:01 54051869
/lib/ld-2.6.1.so
2ba4f4e64000-2ba4f4e68000 rw-p 2ba4f4e64000 00:00 0
2ba4f5063000-2ba4f5065000 rw-p 0001c000 08:01 54051869
/lib/ld-2.6.1.so
2ba4f5065000-2ba4f50a2000 r-xp 00000000 08:01 49956909
/usr/lib/libcurl.so.4.0.0
2ba4f50a2000-2ba4f52a1000 ---p 0003d000 08:01 49956909
/usr/lib/libcurl.so.4.0.0
2ba4f52a1000-2ba4f52a3000 rw-p 0003c000 08:01 49956909
/usr/lib/libcurl.so.4.0.0
2ba4f52a3000-2ba4f52b9000 r-xp 00000000 08:01 49956837
/usr/lib/libz.so.1.2.3.3
2ba4f52b9000-2ba4f54b9000 ---p 00016000 08:01 49956837
/usr/lib/libz.so.1.2.3.3
2ba4f54b9000-2ba4f54ba000 rw-p 00016000 08:01 49956837
/usr/lib/libz.so.1.2.3.3
2ba4f54ba000-2ba4f5615000 r-xp 00000000 08:01 49957372
/usr/lib/libcrypto.so.0.9.8
2ba4f5615000-2ba4f5815000 ---p 0015b000 08:01 49957372
/usr/lib/libcrypto.so.0.9.8
2ba4f5815000-2ba4f5838000 rw-p 0015b000 08:01 49957372
/usr/lib/libcrypto.so.0.9.8
2ba4f5838000-2ba4f583b000 rw-p 2ba4f5838000 00:00 0
2ba4f583b000-2ba4f5851000 r-xp 00000000 08:01 54051886
/lib/libpthread-2.6.1.so
2ba4f5851000-2ba4f5a50000 ---p 00016000 08:01 54051886
/lib/libpthread-2.6.1.so
2ba4f5a50000-2ba4f5a52000 rw-p 00015000 08:01 54051886
/lib/libpthread-2.6.1.so
2ba4f5a52000-2ba4f5a57000 rw-p 2ba4f5a52000 00:00 0
2ba4f5a57000-2ba4f5ba9000 r-xp 00000000 08:01 54051872
/lib/libc-2.6.1.so
2ba4f5ba9000-2ba4f5da8000 ---p 00152000 08:01 54051872
/lib/libc-2.6.1.so
2ba4f5da8000-2ba4f5dab000 r--p 00151000 08:01 54051872
/lib/libc-2.6.1.so
2ba4f5dab000-2ba4f5dad000 rw-p 00154000 08:01 54051872
/lib/libc-2.6.1.so
2ba4f5dad000-2ba4f5db2000 rw-p 2ba4f5dad000 00:00 0
2ba4f5db2000-2ba4f5ddc000 r-xp 00000000 08:01 49957359
/usr/lib/libgssapi_krb5.so.2.2
2ba4f5ddc000-2ba4f5fdb000 ---p 0002a000 08:01 49957359
/usr/lib/libgssapi_krb5.so.2.2
2ba4f5fdb000-2ba4f5fdd000 rw-p 00029000 08:01 49957359
/usr/lib/libgssapi_krb5.so.2.2
2ba4f5fdd000-2ba4f600e000 r-xp 00000000 08:01 49957876
/usr/lib/libidn.so.11.5.29
2ba4f600e000-2ba4f620e000 ---p 00031000 08:01 49957876
/usr/lib/libidn.so.11.5.29
2ba4f620e000-2ba4f620f000 rw-p 00031000 08:01 49957876
/usr/lib/libidn.so.11.5.29
2ba4f620f000-2ba4f6210000 rw-p 2ba4f620f000 00:00 0
2ba4f6210000-2ba4f6212000 r-xp 00000000 08:01 54051875
/lib/libdl-2.6.1.so
2ba4f6212000-2ba4f6412000 ---p 00002000 08:01 54051875
/lib/libdl-2.6.1.so
2ba4f6412000-2ba4f6414000 rw-p 00002000 08:01 54051875
/lib/libdl-2.6.1.so
2ba4f6414000-2ba4f6458000 r-xp 00000000 08:01 49957373
/usr/lib/libssl.so.0.9.8
2ba4f6458000-2ba4f6657000 ---p 00044000 08:01 49957373
/usr/lib/libssl.so.0.9.8
2ba4f6657000-2ba4f665d000 rw-p 00043000 08:01 49957373
/usr/lib/libssl.so.0.9.8
2ba4f665d000-2ba4f66ed000 r-xp 00000000 08:01 49957362
/usr/lib/libkrb5.so.3.3
2ba4f66ed000-2ba4f68ed000 ---p 00090000 08:01 49957362
/usr/lib/libkrb5.so.3.3
2ba4f68ed000-2ba4f68f1000 rw-p 00090000 08:01 49957362
/usr/lib/libkrb5.so.3.3
2ba4f68f1000-2ba4f68f2000 rw-p 2ba4f68f1000 00:00 0
2ba4f68f2000-2ba4f6916000 r-xp 00000000 08:01 49957360
/usr/lib/libk5crypto.so.3.1
2ba4f6916000-2ba4f6b15000 ---p 00024000 08:01 49957360
/usr/lib/libk5crypto.so.3.1
2ba4f6b15000-2ba4f6b17000 rw-p 00023000 08:01 49957360
/usr/lib/libk5crypto.so.3.1
2ba4f6b17000-2ba4f6b19000 r-xp 00000000 08:01 54050832
/lib/libcom_err.so.2.1
2ba4f6b19000-2ba4f6d18000 ---p 00002000 08:01 54050832
/lib/libcom_err.so.2.1
2ba4f6d18000-2ba4f6d19000 rw-p 00001000 08:01 54050832
/lib/libcom_err.so.2.1
2ba4f6d19000-2ba4f6d20000 r-xp 00000000 08:01 49957363
/usr/lib/libkrb5support.so.0.1
2ba4f6d20000-2ba4f6f20000 ---p 00007000 08:01 49957363
/usr/lib/libkrb5support.so.0.1
2ba4f6f20000-2ba4f6f21000 rw-p 00007000 08:01 49957363
/usr/lib/libkrb5support.so.0.1
2ba4f6f21000-2ba4f6f22000 rw-p 2ba4f6f21000 00:00 0
2ba4f6f22000-2ba4f6f24000 r-xp 00000000 08:01 54050958
/lib/libkeyutils-1.2.so
2ba4f6f24000-2ba4f7123000 ---p 00002000 08:01 54050958
/lib/libkeyutils-1.2.so
2ba4f7123000-2ba4f7124000 rw-p 00001000 08:01 54050958
/lib/libkeyutils-1.2.so
2ba4f7124000-2ba4f7136error: Request for
0c973ae9bd51902a28466f3850b543fa66a6aaf4 aborted
Initialized empty Git repository in
/home/schindelin/git/t/trash
directory.t5540-http-push/test_repo_clone/.git/
Aborted
* FAIL 2: clone remote repository
cd "$ROOT_PATH" &&
git clone $HTTPD_URL/test_repo.git test_repo_clone
-- snap --
It might be a strange interaction with my patches, though. valgrind
pointed to the http_cleanup() call, and after removing that call, the
message goes away.
Ciao,
Dscho
^ permalink raw reply
* Re: [WIP Patch 02/12] Some cleanup in get_refs_via_curl()
From: Johannes Schindelin @ 2009-01-18 21:10 UTC (permalink / raw)
To: Mike Hommey; +Cc: git, gitster
In-Reply-To: <20090118191928.GA23108@glandium.org>
Hi,
On Sun, 18 Jan 2009, Mike Hommey wrote:
> On Sun, Jan 18, 2009 at 08:06:17PM +0100, Johannes Schindelin wrote:
>
> > You cannot http_cleanup() here, as http-push calls that function, but
> > continues to want to use curl.
>
> Are you really sure? It doesn't seem so, to me.
Nope, sorry. It was http clone.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH 2/2] http-push: remove MOVE step after PUT when sending objects to server
From: Johannes Schindelin @ 2009-01-18 21:14 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Ray Chuan, git
In-Reply-To: <7vocy4wfb2.fsf@gitster.siamese.dyndns.org>
Hi,
On Sun, 18 Jan 2009, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > Which unfortunately means that put && move must stay.
>
> I still do not understand why it is unfortunate.
Because it is slow.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH next v4] git-notes: fix printing of multi-line notes
From: Junio C Hamano @ 2009-01-18 21:27 UTC (permalink / raw)
To: Tor Arne Vestbø; +Cc: Johannes Schindelin, Johannes Sixt, Jeff King, git
In-Reply-To: <49708644.7040809@trolltech.com>
Tor Arne Vestbø <tavestbo@trolltech.com> writes:
> The line length was read from the same position every time,
> causing mangled output when printing notes with multiple lines.
>
> Also, adding new-line manually for each line ensures that we
> get a new-line between commits, matching git-log for commits
> without notes.
>
> Test case added to t3301-notes.sh.
>
> Signed-off-by: Tor Arne Vestbø <tavestbo@trolltech.com>
> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>
> Sorry about the delay. Here's a squashed patch.
Thanks. This exactly matches 22a3d06 (git-notes: fix printing of
multi-line notes, 2009-01-13) I already have, so we are in a good shape.
^ permalink raw reply
* Re: [RFC PATCH] Fix gitdir detection when in subdir of gitdir
From: Junio C Hamano @ 2009-01-18 21:27 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Johannes Schindelin, SZEDER Gábor, git
In-Reply-To: <7vr63386rc.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> I think (1) the solution (almost) makes sense, (2) the patch needs to be
> explained a lot better as you mentioned in your two messages, and (3) if
> it does not affect any other case than when you are in a subdirectory of
> the .git/ directory, then you are doing something funny anyway and
> performance issue Dscho mentions, if any, is not a concern.
>
> My "(almost)" in (1) above is because the patch uses this new behaviour
> even when you are inside the .git/ directory itself (or at the root of a
> bare repository), which is a very common case that we do not have to nor
> want to change the behaviour. It also invalidates the precondition of (3)
> above.
And this is a trivial follow-up on top of Szeder's patch.
setup.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git c/setup.c w/setup.c
index 4049298..dd7c039 100644
--- c/setup.c
+++ w/setup.c
@@ -456,8 +456,11 @@ const char *setup_git_directory_gently(int *nongit_ok)
inside_git_dir = 1;
if (!work_tree_env)
inside_work_tree = 0;
- cwd[offset] = '\0';
- setenv(GIT_DIR_ENVIRONMENT, cwd, 1);
+ if (offset != len) {
+ cwd[offset] = '\0';
+ setenv(GIT_DIR_ENVIRONMENT, cwd, 1);
+ } else
+ setenv(GIT_DIR_ENVIRONMENT, ".", 1);
check_repository_format_gently(nongit_ok);
return NULL;
}
^ permalink raw reply related
* Re: [PATCH] http-push: support full URI in handle_remote_ls_ctx()
From: Junio C Hamano @ 2009-01-18 21:28 UTC (permalink / raw)
To: Kirill A. Korinskiy; +Cc: git
In-Reply-To: <1232278116-6631-1-git-send-email-catap@catap.ru>
"Kirill A. Korinskiy" <catap@catap.ru> writes:
> @@ -1424,9 +1425,18 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
> ls->userFunc(ls);
> }
> } else if (!strcmp(ctx->name, DAV_PROPFIND_NAME) && ctx->cdata) {
> - ls->dentry_name = xmalloc(strlen(ctx->cdata) -
> + char *path = ctx->cdata;
> + if (!strcmp(ctx->cdata, "http://")) {
> + path = strchr(path + sizeof("http://") - 1, '/');
> + } else if (!strcmp(ctx->cdata, "https://")) {
> + path = strchr(path + sizeof("https://") - 1, '/');
> + }
> +
> + path += remote->path_len;
I see you chose to address the issue I pointed out in:
http://thread.gmane.org/gmane.comp.version-control.git/103804/focus=104363
by being more strict. That's the only change I can spot compared to
e1f33ef (http-push: support full URI in handle_remote_ls_ctx(),
2008-12-23) that is already in maint.
Could you make this into an incremental patch?
^ permalink raw reply
* Re: [PATCH 3/7 v2] git_extract_argv0_path(): Move check for valid argv0 from caller to callee
From: Junio C Hamano @ 2009-01-18 21:28 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Steffen Prohaska, git, Johannes Schindelin
In-Reply-To: <200901182028.11345.j6t@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
> On Sonntag, 18. Januar 2009, Johannes Sixt wrote:
>> On Sonntag, 18. Januar 2009, Steffen Prohaska wrote:
>> > This simplifies the calling code.
>>
>> But it could really be squashed into the previous patch, after fixing...
>>
>> > @@ -23,6 +23,9 @@ const char *system_path(const char *path)
>> >
>> > const char *git_extract_argv0_path(const char *argv0)
>> > {
>> > + if (!argv0 || !*argv0)
>> > + return 0;
>> > +
>> > const char *slash = argv0 + strlen(argv0);
>>
>> ... this declaration after statement.
>
> And we prefer NULL over 0 for the null pointer.
>
> The series is nicely done, thank you! I am using it (the previous round)
> without problems so far. I hope we can get this in RSN.
Thanks, both. I take that as your Ack to the whole series.
I've rebased the series to master, squashed in fixes like the above (there
were others) so that each step can compile. Will queue the result.
^ permalink raw reply
* Re: [PATCH 2/3] Teach read_tree_recursive() how to traverse into submodules
From: Lars Hjemli @ 2009-01-18 21:31 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <alpine.DEB.1.00.0901182201140.3586@pacific.mpi-cbg.de>
On Sun, Jan 18, 2009 at 22:02, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Sun, 18 Jan 2009, Lars Hjemli wrote:
>
>> On Sun, Jan 18, 2009 at 19:33, Johannes Schindelin
>> <Johannes.Schindelin@gmx.de> wrote:
>> > On Sun, 18 Jan 2009, Lars Hjemli wrote:
>> >> Actually, I want this to work for bare repositories by specifying the
>> >> submodule odbs in the alternates file. So if the current submodule odb
>> >> wasn't found my plan was to check if the commit object was accessible
>> >> anyways but don't die() if it wasn't.
>> >
>> > Please make that an explicit option (cannot think of a good name, though),
>> > otherwise I will not be able to use your feature. Making it the default
>> > would be inconsistent with the rest of our submodules framework.
>>
>> Would a test on is_bare_repository() suffice for your use-case?
>
> No. Inconsistent is inconsistent.
>
>> If this isn't good enough, how do you propose it be solved?
>
> As I said, with an extra option that you _have_ to pass when you want
> that behavior.
My concern is how to discern between wanted and unwanted submodules in
a bare repository.
With my proposed solution `git archive --submodules HEAD` in a bare
repository would only include the content of the submodule repos
listed in objects/info/alternates (since the commit referenced by the
gitlink would then be reachable).
But you mentioned that you had a repository where all the objects of
all the submodules where stored in the odb of the superproject. With
my solution, `git archive --submodules HEAD` in your (bare) repo would
then always include the content of all the submodules (since all the
objects would always be reachable), and I believe this is the behavior
you don't like.
So, would you rather have something like `git archive --submodules=foo
--submodules=bar HEAD` to explicitly tell which submodule paths to
include in the archive when executed in a bare repo?
--
larsh
^ permalink raw reply
* Re: [PATCH 2/2] http-push: remove MOVE step after PUT when sending objects to server
From: Junio C Hamano @ 2009-01-18 21:43 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Ray Chuan, git
In-Reply-To: <alpine.DEB.1.00.0901182214180.3586@pacific.mpi-cbg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> On Sun, 18 Jan 2009, Junio C Hamano wrote:
>
>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>>
>> > Which unfortunately means that put && move must stay.
>>
>> I still do not understand why it is unfortunate.
>
> Because it is slow.
If "slow" is a problem, why are you using http to begin with ;-)?
I'd take slow but reliable any day over fast and mostly works but
unreliable.
^ permalink raw reply
* Re: [PATCH 2/3] Teach read_tree_recursive() how to traverse into submodules
From: Johannes Schindelin @ 2009-01-18 21:55 UTC (permalink / raw)
To: Lars Hjemli; +Cc: Junio C Hamano, git
In-Reply-To: <8c5c35580901181331v5e54f82fxc6a042962ff1cd06@mail.gmail.com>
Hi,
On Sun, 18 Jan 2009, Lars Hjemli wrote:
> So, would you rather have something like `git archive --submodules=foo
> --submodules=bar HEAD` to explicitly tell which submodule paths to
> include in the archive when executed in a bare repo?
That does not quite say what you tried to do, does it? You tried to
traverse submodules whose commit can be found in the object database.
Setting aside the fact that we usually try to avoid accessing unreachable
objects, which your handling does not do, our "git submodule" does not do
that either; it only handles submodules that are checked out.
Now, this behavior might be wanted, in bare as well as in non-bare
repositories, but I think it should be triggered by an option, such as
"--submodules=look-in-superprojects-odb".
I know, I know, the naming is horrible, but I find it just wrong to
introduce a behavior that would only confuse users because it introduces
inconsistent behavior. As it is, we see too many confused users in #git
already with consistent behavior [*1*].
Ciao,
Dscho
[*1*] Maybe we should allow cloning empty repositories (with no default
branch at all), disable pushing into checked out branches by default, and
make "git add empty-dir/" add a .gitignore and add that -- to squash at
least half of the questions inside #git so that we can go back to fooling
around there.
^ permalink raw reply
* Re: [PATCH 2/2] http-push: remove MOVE step after PUT when sending objects to server
From: Johannes Schindelin @ 2009-01-18 21:58 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Ray Chuan, git
In-Reply-To: <7vvdscthmq.fsf@gitster.siamese.dyndns.org>
Hi,
On Sun, 18 Jan 2009, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > On Sun, 18 Jan 2009, Junio C Hamano wrote:
> >
> >> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> >>
> >> > Which unfortunately means that put && move must stay.
> >>
> >> I still do not understand why it is unfortunate.
> >
> > Because it is slow.
>
> If "slow" is a problem, why are you using http to begin with ;-)?
Heh, indeed.
> I'd take slow but reliable any day over fast and mostly works but
> unreliable.
Right. Issue settled,
Dscho
^ permalink raw reply
* Re: [PATCH 2/3] Teach read_tree_recursive() how to traverse into submodules
From: Lars Hjemli @ 2009-01-18 22:46 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <alpine.DEB.1.00.0901182244310.3586@pacific.mpi-cbg.de>
On Sun, Jan 18, 2009 at 22:55, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Sun, 18 Jan 2009, Lars Hjemli wrote:
>
>> So, would you rather have something like `git archive --submodules=foo
>> --submodules=bar HEAD` to explicitly tell which submodule paths to
>> include in the archive when executed in a bare repo?
>
> That does not quite say what you tried to do, does it? You tried to
> traverse submodules whose commit can be found in the object database.
>
> Setting aside the fact that we usually try to avoid accessing unreachable
> objects, which your handling does not do, our "git submodule" does not do
> that either; it only handles submodules that are checked out.
>
> Now, this behavior might be wanted, in bare as well as in non-bare
> repositories, but I think it should be triggered by an option, such as
> "--submodules=look-in-superprojects-odb".
Sorry, but if your concern is whether to traverse a submodule in a
bare repo when the submodule isn't checked out (yeah, contradiction in
terms), I just don't see the point.
For non-bare repositories the policy has always been to ignore
submodules which isn't checked out, but for bare repositories there is
no obvious way (for me, at least) to apply the same policy. Therefore
I proposed to traverse all submodules where the linked commit is
reachable, but as you pointed out this would be wrong for non-bare
repositories.
I then modified my proposal to include a check on
is_bare_repository(): If we're not in a bare repository,
read_tree_recursive() is only allowed to recurse into checked out
submodules. But if we're in a bare repository, read_tree_recursive()
is allowed to recurse into any submodule with a reachable commit.
Now then, if `--submodules=look-in-superprojects-odb` should be
required to trigger the latter behavior, running `git archive
--submodules HEAD` in a bare repository would always produce identical
output as `git archive HEAD` and this is why I don't understand the
gain of 'look-in-superprojects-odb' (I thought you wanted to limit
which of the reachable submodules to recurse into).
--
larsh
^ permalink raw reply
* Re: [PATCH 2/2] http-push: remove MOVE step after PUT when sending objects to server
From: Sverre Rabbelier @ 2009-01-19 0:12 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, Ray Chuan, git
In-Reply-To: <7vvdscthmq.fsf@gitster.siamese.dyndns.org>
On Sun, Jan 18, 2009 at 22:43, Junio C Hamano <gitster@pobox.com> wrote:
> If "slow" is a problem, why are you using http to begin with ;-)?
Because http might be the only available protocol?
> I'd take slow but reliable any day over fast and mostly works but
> unreliable.
Yes, but if we want, say, git support at code.google.com (which I do,
I totally detest having to use svn because of this), it would be nice
to not dismiss http as "being slow anyway, so who cares about not
making it faster"?
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* [PATCH v2] contrib: add 'git-difftool' for launching common diff tools
From: David Aguilar @ 2009-01-19 0:25 UTC (permalink / raw)
To: git; +Cc: gitster, markus.heidelberg, David Aguilar
In-Reply-To: <200901182025.24045.markus.heidelberg@web.de>
'git-difftool' is a git command that allows you to compare and edit files
between revisions using common merge tools. 'git-difftool' does what
'git-mergetool' does but its use is for non-merge situations such as
when preparing commits or comparing changes against the index.
It uses the same configuration variables as 'git-mergetool' and
provides the same command-line interface as 'git-diff'.
Signed-off-by: David Aguilar <davvid@gmail.com>
---
This newer version addresses the feedback from Markus Heidelberg.
difftool is now more consistent with mergetool and it includes
Markus's vimdiff enhancements for positioning the cursor at startup.
contrib/difftool/git-difftool | 73 ++++++++++
contrib/difftool/git-difftool-helper | 244 ++++++++++++++++++++++++++++++++++
contrib/difftool/git-difftool.txt | 104 ++++++++++++++
3 files changed, 421 insertions(+), 0 deletions(-)
create mode 100755 contrib/difftool/git-difftool
create mode 100755 contrib/difftool/git-difftool-helper
create mode 100644 contrib/difftool/git-difftool.txt
diff --git a/contrib/difftool/git-difftool b/contrib/difftool/git-difftool
new file mode 100755
index 0000000..0cda3d2
--- /dev/null
+++ b/contrib/difftool/git-difftool
@@ -0,0 +1,73 @@
+#!/usr/bin/env perl
+# Copyright (c) 2009 David Aguilar
+#
+# This is a wrapper around the GIT_EXTERNAL_DIFF-compatible
+# git-difftool-helper script. This script exports
+# GIT_EXTERNAL_DIFF and GIT_PAGER for use by git, and
+# GIT_DIFFTOOL_NO_PROMPT and GIT_MERGE_TOOL for use by git-difftool-helper.
+# Any arguments that are unknown to this script are forwarded to 'git diff'.
+
+use strict;
+use warnings;
+use Cwd qw(abs_path);
+use File::Basename qw(dirname);
+
+my $DIR = abs_path(dirname($0));
+
+
+sub usage
+{
+ print << 'USAGE';
+usage: git difftool [--tool=<tool>] [--no-prompt] ["git diff" options]
+USAGE
+ exit 1;
+}
+
+sub setup_environment
+{
+ $ENV{PATH} = "$DIR:$ENV{PATH}";
+ $ENV{GIT_PAGER} = '';
+ $ENV{GIT_EXTERNAL_DIFF} = 'git-difftool-helper';
+}
+
+sub exe
+{
+ my $exe = shift;
+ return defined $ENV{COMSPEC} ? "$exe.exe" : $exe;
+}
+
+sub generate_command
+{
+ my @command = (exe('git'), 'diff');
+ my $skip_next = 0;
+ my $idx = -1;
+ for my $arg (@ARGV) {
+ $idx++;
+ if ($skip_next) {
+ $skip_next = 0;
+ next;
+ }
+ if ($arg eq '-t' or $arg eq '--tool') {
+ usage() if $#ARGV <= $idx;
+ $ENV{GIT_MERGE_TOOL} = $ARGV[$idx + 1];
+ $skip_next = 1;
+ next;
+ }
+ if ($arg =~ /^--tool=/) {
+ $ENV{GIT_MERGE_TOOL} = substr($arg, 7);
+ next;
+ }
+ if ($arg eq '--no-prompt') {
+ $ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true';
+ next;
+ }
+ if ($arg eq '-h' or $arg eq '--help') {
+ usage();
+ }
+ push @command, $arg;
+ }
+ return @command
+}
+
+setup_environment();
+exec(generate_command());
diff --git a/contrib/difftool/git-difftool-helper b/contrib/difftool/git-difftool-helper
new file mode 100755
index 0000000..a6f862f
--- /dev/null
+++ b/contrib/difftool/git-difftool-helper
@@ -0,0 +1,244 @@
+#!/bin/sh
+# git-difftool-helper is a GIT_EXTERNAL_DIFF-compatible diff tool launcher.
+# It supports kdiff3, tkdiff, xxdiff, meld, opendiff, emerge, ecmerge,
+# vimdiff, gvimdiff, and custom user-configurable tools.
+# This script is typically launched by using the 'git difftool'
+# convenience command.
+#
+# Copyright (c) 2009 David Aguilar
+
+# Set GIT_DIFFTOOL_NO_PROMPT to bypass the per-file prompt.
+should_prompt () {
+ ! test -n "$GIT_DIFFTOOL_NO_PROMPT"
+}
+
+# Should we keep the backup .orig file?
+keep_backup_mode="$(git config --bool merge.keepBackup || echo true)"
+keep_backup () {
+ test "$keep_backup_mode" = "true"
+}
+
+# This function manages the backup .orig file.
+# A backup $MERGED.orig file is created if changes are detected.
+cleanup_temp_files () {
+ if test -n "$MERGED"; then
+ if keep_backup && test "$MERGED" -nt "$BACKUP"; then
+ test -f "$BACKUP" && mv -- "$BACKUP" "$MERGED.orig"
+ else
+ rm -f -- "$BACKUP"
+ fi
+ fi
+}
+
+# This is called when users Ctrl-C out of git-difftool-helper
+sigint_handler () {
+ echo
+ cleanup_temp_files
+ exit 1
+}
+
+# This function prepares temporary files and launches the appropriate
+# merge tool.
+launch_merge_tool () {
+ # Merged is the filename as it appears in the work tree
+ # Local is the contents of a/filename
+ # Remote is the contents of b/filename
+ # Custom merge tool commands might use $BASE so we provide it
+ MERGED="$1"
+ LOCAL="$2"
+ REMOTE="$3"
+ BASE="$1"
+ ext="$$$(expr "$MERGED" : '.*\(\.[^/]*\)$')"
+ BACKUP="$MERGED.BACKUP.$ext"
+
+ # Create and ensure that we clean up $BACKUP
+ test -f "$MERGED" && cp -- "$MERGED" "$BACKUP"
+ trap sigint_handler SIGINT
+
+ # $LOCAL and $REMOTE are temporary files so prompt
+ # the user with the real $MERGED name before launching $merge_tool.
+ if should_prompt; then
+ printf "\nViewing: '$MERGED'\n"
+ printf "Hit return to launch '%s': " "$merge_tool"
+ read ans
+ fi
+
+ # Run the appropriate merge tool command
+ case "$merge_tool" in
+ kdiff3)
+ basename=$(basename "$MERGED")
+ "$merge_tool_path" --auto \
+ --L1 "$basename (A)" \
+ --L2 "$basename (B)" \
+ -o "$MERGED" "$LOCAL" "$REMOTE" \
+ > /dev/null 2>&1
+ ;;
+
+ tkdiff)
+ "$merge_tool_path" -o "$MERGED" "$LOCAL" "$REMOTE"
+ ;;
+
+ meld)
+ "$merge_tool_path" "$LOCAL" "$REMOTE"
+ ;;
+
+ vimdiff)
+ "$merge_tool_path" -c "wincmd r" "$LOCAL" "$REMOTE"
+ ;;
+
+ gvimdiff)
+ "$merge_tool_path" -c "wincmd r" -f "$LOCAL" "$REMOTE"
+ ;;
+
+ xxdiff)
+ "$merge_tool_path" \
+ -X \
+ -R 'Accel.SaveAsMerged: "Ctrl-S"' \
+ -R 'Accel.Search: "Ctrl+F"' \
+ -R 'Accel.SearchForward: "Ctrl-G"' \
+ --merged-file "$MERGED" \
+ "$LOCAL" "$REMOTE"
+ ;;
+
+ opendiff)
+ "$merge_tool_path" "$LOCAL" "$REMOTE" \
+ -merge "$MERGED" | cat
+ ;;
+
+ ecmerge)
+ "$merge_tool_path" "$LOCAL" "$REMOTE" \
+ --default --mode=merge2 --to="$MERGED"
+ ;;
+
+ emerge)
+ "$merge_tool_path" -f emerge-files-command \
+ "$LOCAL" "$REMOTE" "$(basename "$MERGED")"
+ ;;
+
+ *)
+ if test -n "$merge_tool_cmd"; then
+ ( eval $merge_tool_cmd )
+ fi
+ ;;
+ esac
+
+ cleanup_temp_files
+}
+
+# Verifies that mergetool.<tool>.cmd exists
+valid_custom_tool() {
+ merge_tool_cmd="$(git config mergetool.$1.cmd)"
+ test -n "$merge_tool_cmd"
+}
+
+# Verifies that the chosen merge tool is properly setup.
+# Built-in merge tools are always valid.
+valid_tool() {
+ case "$1" in
+ kdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | ecmerge)
+ ;; # happy
+ *)
+ if ! valid_custom_tool "$1"
+ then
+ return 1
+ fi
+ ;;
+ esac
+}
+
+# Sets up the merge_tool_path variable.
+# This handles the mergetool.<tool>.path configuration.
+init_merge_tool_path() {
+ merge_tool_path=$(git config mergetool."$1".path)
+ if test -z "$merge_tool_path"; then
+ case "$1" in
+ emerge)
+ merge_tool_path=emacs
+ ;;
+ *)
+ merge_tool_path="$1"
+ ;;
+ esac
+ fi
+}
+
+# Allow the GIT_MERGE_TOOL variable to provide a default value
+test -n "$GIT_MERGE_TOOL" && merge_tool="$GIT_MERGE_TOOL"
+
+# If not merge tool was specified then use the merge.tool
+# configuration variable. If that's invalid then reset merge_tool.
+if test -z "$merge_tool"; then
+ merge_tool=$(git config merge.tool)
+ if test -n "$merge_tool" && ! valid_tool "$merge_tool"; then
+ echo >&2 "git config option merge.tool set to unknown tool: $merge_tool"
+ echo >&2 "Resetting to default..."
+ unset merge_tool
+ fi
+fi
+
+# Try to guess an appropriate merge tool if no tool has been set.
+if test -z "$merge_tool"; then
+
+ # We have a $DISPLAY so try some common UNIX merge tools
+ if test -n "$DISPLAY"; then
+ merge_tool_candidates="kdiff3 tkdiff xxdiff meld gvimdiff"
+ # If gnome then prefer meld
+ if test -n "$GNOME_DESKTOP_SESSION_ID"; then
+ merge_tool_candidates="meld $merge_tool_candidates"
+ fi
+ # If KDE then prefer kdiff3
+ if test "$KDE_FULL_SESSION" = "true"; then
+ merge_tool_candidates="kdiff3 $merge_tool_candidates"
+ fi
+ fi
+
+ # $EDITOR is emacs so add emerge as a candidate
+ if echo "${VISUAL:-$EDITOR}" | grep 'emacs' > /dev/null 2>&1; then
+ merge_tool_candidates="$merge_tool_candidates emerge"
+ fi
+
+ # $EDITOR is vim so add vimdiff as a candidate
+ if echo "${VISUAL:-$EDITOR}" | grep 'vim' > /dev/null 2>&1; then
+ merge_tool_candidates="$merge_tool_candidates vimdiff"
+ fi
+
+ merge_tool_candidates="$merge_tool_candidates opendiff emerge vimdiff"
+ echo "merge tool candidates: $merge_tool_candidates"
+
+ # Loop over each candidate and stop when a valid merge tool is found.
+ for i in $merge_tool_candidates
+ do
+ init_merge_tool_path $i
+ if type "$merge_tool_path" > /dev/null 2>&1; then
+ merge_tool=$i
+ break
+ fi
+ done
+
+ if test -z "$merge_tool" ; then
+ echo "No known merge resolution program available."
+ exit 1
+ fi
+
+else
+ # A merge tool has been set, so verify that it's valid.
+ if ! valid_tool "$merge_tool"; then
+ echo >&2 "Unknown merge tool $merge_tool"
+ exit 1
+ fi
+
+ init_merge_tool_path "$merge_tool"
+
+ if test -z "$merge_tool_cmd" && ! type "$merge_tool_path" > /dev/null 2>&1; then
+ echo "The merge tool $merge_tool is not available as '$merge_tool_path'"
+ exit 1
+ fi
+fi
+
+
+# Launch the merge tool on each path provided by 'git diff'
+while test $# -gt 6
+do
+ launch_merge_tool "$1" "$2" "$5"
+ shift 7
+done
diff --git a/contrib/difftool/git-difftool.txt b/contrib/difftool/git-difftool.txt
new file mode 100644
index 0000000..ca3dbd2
--- /dev/null
+++ b/contrib/difftool/git-difftool.txt
@@ -0,0 +1,104 @@
+git-difftool(1)
+===============
+
+NAME
+----
+git-difftool - compare changes using common merge tools
+
+SYNOPSIS
+--------
+'git difftool' [--tool=<tool>] [--no-prompt] ['git diff' options]
+
+DESCRIPTION
+-----------
+'git-difftool' is a git command that allows you to compare and edit files
+between revisions using common merge tools. At its most basic level,
+'git-difftool' does what 'git-mergetool' does but its use is for non-merge
+situations such as when preparing commits or comparing changes against
+the index.
+
+'git difftool' is a frontend to 'git diff' and accepts the same
+arguments and options.
+
+See linkgit:git-diff[1] for the full list of supported options.
+
+OPTIONS
+-------
+-t <tool>::
+--tool=<tool>::
+ Use the merge resolution program specified by <tool>.
+ Valid merge tools are:
+ kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, and opendiff
++
+If a merge resolution program is not specified, 'git-difftool'
+will use the configuration variable `merge.tool`. If the
+configuration variable `merge.tool` is not set, 'git difftool'
+will pick a suitable default.
++
+You can explicitly provide a full path to the tool by setting the
+configuration variable `mergetool.<tool>.path`. For example, you
+can configure the absolute path to kdiff3 by setting
+`mergetool.kdiff3.path`. Otherwise, 'git-difftool' assumes the
+tool is available in PATH.
++
+Instead of running one of the known merge tool programs,
+'git-difftool' can be customized to run an alternative program
+by specifying the command line to invoke in a configuration
+variable `mergetool.<tool>.cmd`.
++
+When 'git-difftool' is invoked with this tool (either through the
+`-t` or `--tool` option or the `merge.tool` configuration variable)
+the configured command line will be invoked with the following
+variables available: `$LOCAL` is set to the name of the temporary
+file containing the contents of the diff pre-image and `$REMOTE`
+is set to the name of the temporary file containing the contents
+of the diff post-image. `$BASE` is provided for compatibility
+with custom merge tool commands and has the same value as `$LOCAL`.
+
+--no-prompt::
+ Do not prompt before launching a diff tool.
+
+CONFIG VARIABLES
+----------------
+merge.tool::
+ The default merge tool to use.
++
+See the `--tool=<tool>` option above for more details.
+
+merge.keepBackup::
+ The original, unedited file content can be saved to a file with
+ a `.orig` extension. Defaults to `true` (i.e. keep the backup files).
+
+mergetool.<tool>.path::
+ Override the path for the given tool. This is useful in case
+ your tool is not in the PATH.
+
+mergetool.<tool>.cmd::
+ Specify the command to invoke the specified merge tool.
++
+See the `--tool=<tool>` option above for more details.
+
+
+SEE ALSO
+--------
+linkgit:git-diff[1]::
+ Show changes between commits, commit and working tree, etc
+
+linkgit:git-mergetool[1]::
+ Run merge conflict resolution tools to resolve merge conflicts
+
+linkgit:git-config[1]::
+ Get and set repository or global options
+
+
+AUTHOR
+------
+Written by David Aguilar <davvid@gmail.com>.
+
+Documentation
+--------------
+Documentation by David Aguilar and the git-list <git@vger.kernel.org>.
+
+GIT
+---
+Part of the linkgit:git[1] suite
--
1.6.1.149.g7bbd8
^ permalink raw reply related
* Re: [PATCH] contrib: add 'git difftool' for launching common merge tools
From: David Aguilar @ 2009-01-19 0:34 UTC (permalink / raw)
To: markus.heidelberg; +Cc: Git mailing list
In-Reply-To: <200901182025.24045.markus.heidelberg@web.de>
On Sun, Jan 18, 2009 at 11:25 AM, Markus Heidelberg
<markus.heidelberg@web.de> wrote:
> David Aguilar, 16.01.2009:
>
>> +# git-difftool-helper script. This script exports
>> +# GIT_EXTERNAL_DIFF and GIT_PAGER for use by git, and
>> +# GIT_NO_PROMPT and GIT_MERGE_TOOL for use by git-difftool-helper.
>
> GIT_DIFFTOOL_NO_PROMPT
Thanks for catching that.
>> +sub usage
>> +{
>> + print << 'USAGE';
>> +
>
> Why the leading empty line?
Fixed.
>> +usage: git difftool [--no-prompt] [--tool=tool] ["git diff" options]
>
> --tool=<tool>
>
> Swap the order of --no-prompt and --tool for consistency with
> git-difftool.txt and git-mergetool.
Done.
>> + meld|vimdiff)
>> + "$merge_tool_path" "$LOCAL" "$REMOTE"
>> + ;;
>> +
>> + gvimdiff)
>> + "$merge_tool_path" -f "$LOCAL" "$REMOTE"
>> + ;;
>
> Maybe use '-c "wincmd l"' for Vim as in my patch for git-mergetool to
> automatically place the cursor in the editable file? Useful for editing,
> if git-difftool is used to diff a file from the working tree.
>
> See http://thread.gmane.org/gmane.comp.version-control.git/106109
Very cool. When you have unstaged changes git diff sends the local
filename as the 2nd argument so I changed the vim command to "wincmd
r" so that vim places the cursor on the right hand side.
> You have deleted all the '-' chars from git-command, but when using it as the
> name I think it's the preferred method, only when used as command then without
> slash.
I was wondering about that. I think I tried to follow the lead from
the git-diff.txt documentation, but "diff" is a builtin and thus
doesn't have an actual git-diff, so I see why they should be
different.
I've changed the docs as you suggested -- 'git-difftool' is used to
name the script while 'git difftool' is used in the SYNOPSIS section.
>> +SEE ALSO
>> +--------
>> +linkgit:git-diff[7]::
>
> [1]
>
>> + Show changes between commits, commit and working tree, etc
>> +
>> +linkgit:git-mergetool[1]::
>> + Run merge conflict resolution tools to resolve merge conflicts
>> +
>> +linkgit:git-config[7]::
>
> [1]
Oops, I don't know how that happened.
>
> Works fine for me, thanks.
>
> Markus
>
Thanks again for your help.
--
David
^ permalink raw reply
* Re: [PATCH v2] git-svn: Add --localtime option to "fetch"
From: Eric Wong @ 2009-01-19 0:43 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Pete Harlan, Git mailing list
In-Reply-To: <4972ABA6.7060207@pcharlan.com>
Pete Harlan <pgit@pcharlan.com> wrote:
> By default git-svn stores timestamps of fetched commits in
> Subversion's UTC format. Passing --localtime to fetch will convert
> them to the timezone of the server on which git-svn is run.
>
> This makes the timestamps of a resulting "git log" agree with what
> "svn log" shows for the same repository.
>
> Signed-off-by: Pete Harlan <pgit@pcharlan.com>
Thanks Peter,
Acked-by: Eric Wong <normalperson@yhbt.net>
> ---
>
> Changes to v2 after feedback from Eric Wong:
>
> 1. "--convert-timezones" renamed to "--localtime".
>
> 2. Removed warnings about breaking interoperability with Subversion,
> because the option doesn't do that. Instead warn about
> interoperability with other git-svn users cloning from the same
> repository if they don't all use or not use --localtime.
>
> 3. Move config variable into Git::SVN namespace.
>
> 4. Better conformance to coding guidelines.
>
> Documentation/git-svn.txt | 11 ++++++
> contrib/completion/git-completion.bash | 2 +-
> git-svn.perl | 54 ++++++++++++++++++++++++++++++-
> 3 files changed, 64 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
> index 8d0c421..63d2f5e 100644
> --- a/Documentation/git-svn.txt
> +++ b/Documentation/git-svn.txt
> @@ -92,6 +92,17 @@ COMMANDS
> .git/config file may be specified as an optional command-line
> argument.
>
> +--localtime;;
> + Store Git commit times in the local timezone instead of UTC. This
> + makes 'git-log' (even without --date=local) show the same times
> + that `svn log` would in the local timezone.
> +
> +This doesn't interfere with interoperating with the Subversion
> +repository you cloned from, but if you wish for your local Git
> +repository to be able to interoperate with someone else's local Git
> +repository, either don't use this option or you should both use it in
> +the same local timezone.
> +
> 'clone'::
> Runs 'init' and 'fetch'. It will automatically create a
> directory based on the basename of the URL passed to it;
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index f8b845a..c9d2c02 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1575,7 +1575,7 @@ _git_svn ()
> --follow-parent --authors-file= --repack=
> --no-metadata --use-svm-props --use-svnsync-props
> --log-window-size= --no-checkout --quiet
> - --repack-flags --user-log-author $remote_opts
> + --repack-flags --user-log-author --localtime $remote_opts
> "
> local init_opts="
> --template= --shared= --trunk= --tags=
> diff --git a/git-svn.perl b/git-svn.perl
> index ad01e18..0adc8db 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -84,6 +84,7 @@ my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
> \$Git::SVN::_repack_flags,
> 'use-log-author' => \$Git::SVN::_use_log_author,
> 'add-author-from' => \$Git::SVN::_add_author_from,
> + 'localtime' => \$Git::SVN::_localtime,
> %remote_opts );
>
> my ($_trunk, $_tags, $_branches, $_stdlayout);
> @@ -1364,7 +1365,7 @@ use constant rev_map_fmt => 'NH40';
> use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent
> $_repack $_repack_flags $_use_svm_props $_head
> $_use_svnsync_props $no_reuse_existing $_minimize_url
> - $_use_log_author $_add_author_from/;
> + $_use_log_author $_add_author_from $_localtime/;
> use Carp qw/croak/;
> use File::Path qw/mkpath/;
> use File::Copy qw/copy/;
> @@ -2526,12 +2527,61 @@ sub get_untracked {
> \@out;
> }
>
> +# parse_svn_date(DATE)
> +# --------------------
> +# Given a date (in UTC) from Subversion, return a string in the format
> +# "<TZ Offset> <local date/time>" that Git will use.
> +#
> +# By default the parsed date will be in UTC; if $Git::SVN::_localtime
> +# is true we'll convert it to the local timezone instead.
> sub parse_svn_date {
> my $date = shift || return '+0000 1970-01-01 00:00:00';
> my ($Y,$m,$d,$H,$M,$S) = ($date =~ /^(\d{4})\-(\d\d)\-(\d\d)T
> (\d\d)\:(\d\d)\:(\d\d).\d+Z$/x) or
> croak "Unable to parse date: $date\n";
> - "+0000 $Y-$m-$d $H:$M:$S";
> + my $parsed_date; # Set next.
> +
> + if ($Git::SVN::_localtime) {
> + # Translate the Subversion datetime to an epoch time.
> + # Begin by switching ourselves to $date's timezone, UTC.
> + my $old_env_TZ = $ENV{TZ};
> + $ENV{TZ} = 'UTC';
> +
> + my $epoch_in_UTC =
> + POSIX::strftime('%s', $S, $M, $H, $d, $m - 1, $Y - 1900);
> +
> + # Determine our local timezone (including DST) at the
> + # time of $epoch_in_UTC. $Git::SVN::Log::TZ stored the
> + # value of TZ, if any, at the time we were run.
> + if (defined $Git::SVN::Log::TZ) {
> + $ENV{TZ} = $Git::SVN::Log::TZ;
> + } else {
> + delete $ENV{TZ};
> + }
> +
> + my $our_TZ =
> + POSIX::strftime('%Z', $S, $M, $H, $d, $m - 1, $Y - 1900);
> +
> + # This converts $epoch_in_UTC into our local timezone.
> + my ($sec, $min, $hour, $mday, $mon, $year,
> + $wday, $yday, $isdst) = localtime($epoch_in_UTC);
> +
> + $parsed_date = sprintf('%s %04d-%02d-%02d %02d:%02d:%02d',
> + $our_TZ, $year + 1900, $mon + 1,
> + $mday, $hour, $min, $sec);
> +
> + # Reset us to the timezone in effect when we entered
> + # this routine.
> + if (defined $old_env_TZ) {
> + $ENV{TZ} = $old_env_TZ;
> + } else {
> + delete $ENV{TZ};
> + }
> + } else {
> + $parsed_date = "+0000 $Y-$m-$d $H:$M:$S";
> + }
> +
> + return $parsed_date;
> }
>
> sub check_author {
> --
> 1.6.1.77.g953e7
^ permalink raw reply
* [PATCH] git-svn: fix SVN 1.1.x compatibility
From: Eric Wong @ 2009-01-19 0:45 UTC (permalink / raw)
To: Tom G. Christensen; +Cc: git
In-Reply-To: <20090117105811.GB15801@dcvr.yhbt.net>
The get_log() function in the Perl SVN API introduced the limit
parameter in 1.2.0. However, this got discarded in our SVN::Ra
compatibility layer when used with SVN 1.1.x. We now emulate
the limit functionality in older SVN versions by preventing the
original callback from being called if the given limit has been
reached. This emulation is less bandwidth efficient, but SVN
1.1.x is becoming rarer now.
Additionally, the --limit parameter in svn(1) uses the
aforementioned get_log() functionality change in SVN 1.2.x.
t9129 no longer depends on --limit to work and instead uses
Perl to parse out the commit message.
Thanks to Tom G. Christensen for the bug report.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
Hi Tom, this should fix things for you. I've tested this in an old
Debian Sarge chroot running SVN 1.1.4
git-svn.perl | 15 ++++++++++++++-
t/t9129-git-svn-i18n-commitencoding.sh | 13 +++++++++++--
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index e3e125b..71b8ef4 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -4130,10 +4130,23 @@ sub DESTROY {
# do not call the real DESTROY since we store ourselves in $RA
}
+# get_log(paths, start, end, limit,
+# discover_changed_paths, strict_node_history, receiver)
sub get_log {
my ($self, @args) = @_;
my $pool = SVN::Pool->new;
- splice(@args, 3, 1) if ($SVN::Core::VERSION le '1.2.0');
+
+ # the limit parameter was not supported in SVN 1.1.x, so we
+ # drop it. Therefore, the receiver callback passed to it
+ # is made aware of this limitation by being wrapped if
+ # the limit passed to is being wrapped.
+ if ($SVN::Core::VERSION le '1.2.0') {
+ my $limit = splice(@args, 3, 1);
+ if ($limit > 0) {
+ my $receiver = pop @args;
+ push(@args, sub { &$receiver(@_) if (--$limit >= 0) });
+ }
+ }
my $ret = $self->SUPER::get_log(@args, $pool);
$pool->clear;
$ret;
diff --git a/t/t9129-git-svn-i18n-commitencoding.sh b/t/t9129-git-svn-i18n-commitencoding.sh
index 8a9dde4..9c7b1ad 100755
--- a/t/t9129-git-svn-i18n-commitencoding.sh
+++ b/t/t9129-git-svn-i18n-commitencoding.sh
@@ -15,8 +15,17 @@ compare_git_head_with () {
}
compare_svn_head_with () {
- LC_ALL=en_US.UTF-8 svn log --limit 1 `git svn info --url` | \
- sed -e 1,3d -e "/^-\{1,\}\$/d" >current &&
+ # extract just the log message and strip out committer info.
+ # don't use --limit here since svn 1.1.x doesn't have it,
+ LC_ALL=en_US.UTF-8 svn log `git svn info --url` | perl -w -e '
+ use bytes;
+ $/ = ("-"x72) . "\n";
+ my @x = <STDIN>;
+ @x = split(/\n/, $x[1]);
+ splice(@x, 0, 2);
+ $x[-1] = "";
+ print join("\n", @x);
+ ' > current &&
test_cmp current "$1"
}
--
Eric Wong
^ permalink raw reply related
* Re: [PATCH 2/3] Teach read_tree_recursive() how to traverse into submodules
From: Johannes Schindelin @ 2009-01-19 1:24 UTC (permalink / raw)
To: Lars Hjemli; +Cc: Junio C Hamano, git
In-Reply-To: <8c5c35580901181446n3c36a345m5d8e78764a85c123@mail.gmail.com>
Hi,
On Sun, 18 Jan 2009, Lars Hjemli wrote:
> Sorry, but if your concern is whether to traverse a submodule in a bare
> repo when the submodule isn't checked out (yeah, contradiction in
> terms), I just don't see the point.
Obviously.
> For non-bare repositories the policy has always been to ignore
> submodules which isn't checked out, but for bare repositories there is
> no obvious way (for me, at least) to apply the same policy.
There is one: we never traverse them in bare repositories.
Never.
You are introducing that contradicts that on purpose. Which I do not
like at all.
Sure, what you want is a nifty feature, but you'll have to do it right.
For example, your handling for bare repositories precludes everybody from
specifying -- just for this particular call to git archive -- what
submodules they want to include. And you preclude anybody from excluding
-- just for this particular call to git archive -- certain submodules
whose commits just so happen to be present in the superproject.
For me, that is a sign of a bad user interface design.
Ciao,
Dscho
P.S.: if you still don't get the point, I will just shut up, until the
question crops up, and redirect every person confused by that behavior to
you. Be prepared.
^ permalink raw reply
* how to track multiple upstreams in one repository
From: david @ 2009-01-19 2:58 UTC (permalink / raw)
To: git
for linux I want to track both the linus tree and the -stable tree.
Ideally I want to be able to do a checkout of tags from either tree from
the same directory (along with diffs between items in both trees, etc)
I have found documentation on how to clone from each of them, but I
haven't found any simple documentation on how to work with both of them.
David Lang
^ permalink raw reply
* [PATCH/RFC v1 1/1] bug fix, diff whitespace ignore options
From: Keith Cascio @ 2009-01-19 2:01 UTC (permalink / raw)
To: git; +Cc: Johannes Schindelin, Junio C Hamano
In-Reply-To: <alpine.DEB.1.00.0901190218470.3586@pacific.mpi-cbg.de>
Fixed bug in diff whitespace ignore options.
It is now OK to specify more than one whitespace ignore option
on the command line. In unit test 4015, expect success rather
than failure for 4 cases.
Note: I do not fully understand why this fix works, but it passes
all 68 t4???-* diff test scripts.
The semantics of the three whitespace ignore flags
{ -w, -b, --ignore-space-at-eol }
obey a relation of transitive implication, i.e. the stronger
options imply the weaker options:
-w implies the other two
-b implies --ignore-space-at-eol
--ignore-space-at-eol implies only itself
Therefore it is never necessary to specify more than one of these
on the command line. Yet we imagine scenarios where software
wrappers (e.g. GUIs, etc) generate command lines that switch on
more than one of these flags simultaneously. It is unreasonable
to prohibit specifying more than one, since a new user might not
immediately discern the implication relation. Now we call such
a command line valid and legal.
Signed-off-by: Keith Cascio <keith@cs.ucla.edu>
---
t/t4015-diff-whitespace.sh | 8 ++++----
xdiff/xutils.c | 22 ++++++++++++----------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index dbb608c..6d13da3 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -99,11 +99,11 @@ EOF
git diff -w > out
test_expect_success 'another test, with -w' 'test_cmp expect out'
git diff -w -b > out
-test_expect_failure 'another test, with -w -b' 'test_cmp expect out'
+test_expect_success 'another test, with -w -b' 'test_cmp expect out'
git diff -w --ignore-space-at-eol > out
-test_expect_failure 'another test, with -w --ignore-space-at-eol' 'test_cmp expect out'
+test_expect_success 'another test, with -w --ignore-space-at-eol' 'test_cmp expect out'
git diff -w -b --ignore-space-at-eol > out
-test_expect_failure 'another test, with -w -b --ignore-space-at-eol' 'test_cmp expect out'
+test_expect_success 'another test, with -w -b --ignore-space-at-eol' 'test_cmp expect out'
tr 'Q' '\015' << EOF > expect
diff --git a/x b/x
@@ -123,7 +123,7 @@ EOF
git diff -b > out
test_expect_success 'another test, with -b' 'test_cmp expect out'
git diff -b --ignore-space-at-eol > out
-test_expect_failure 'another test, with -b --ignore-space-at-eol' 'test_cmp expect out'
+test_expect_success 'another test, with -b --ignore-space-at-eol' 'test_cmp expect out'
tr 'Q' '\015' << EOF > expect
diff --git a/x b/x
diff --git a/xdiff/xutils.c b/xdiff/xutils.c
index d7974d1..b9bda86 100644
--- a/xdiff/xutils.c
+++ b/xdiff/xutils.c
@@ -245,17 +245,19 @@ static unsigned long xdl_hash_record_with_whitespace(char const **data,
while (ptr + 1 < top && isspace(ptr[1])
&& ptr[1] != '\n')
ptr++;
- if (flags & XDF_IGNORE_WHITESPACE_CHANGE
- && ptr[1] != '\n') {
- ha += (ha << 5);
- ha ^= (unsigned long) ' ';
- }
- if (flags & XDF_IGNORE_WHITESPACE_AT_EOL
- && ptr[1] != '\n') {
- while (ptr2 != ptr + 1) {
+ if( ! ( flags & XDF_IGNORE_WHITESPACE )){
+ if( flags & XDF_IGNORE_WHITESPACE_CHANGE
+ && ptr[1] != '\n') {
ha += (ha << 5);
- ha ^= (unsigned long) *ptr2;
- ptr2++;
+ ha ^= (unsigned long) ' ';
+ }
+ else if( flags & XDF_IGNORE_WHITESPACE_AT_EOL
+ && ptr[1] != '\n') {
+ while (ptr2 != ptr + 1) {
+ ha += (ha << 5);
+ ha ^= (unsigned long) *ptr2;
+ ptr2++;
+ }
}
}
continue;
--
1.6.1.203.ga83c8.dirty
^ permalink raw reply related
* [PATCH] git-svn: Show UUID in svn info for added directories with svn 1.5.5
From: Marcel Koeppen @ 2009-01-19 2:02 UTC (permalink / raw)
To: git; +Cc: normalperson
In svn 1.5.5 the output of "svn info" for added directories was changed
and now shows the repository UUID. This patch implements the same
behavior for "git svn info" and makes t9119-git-svn-info.17 pass if
svn 1.5.5 is used.
Signed-off-by: Marcel Koeppen <git-dev@marzelpan.de>
---
git-svn.perl | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index ad01e18..2f16a4e 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -911,7 +911,8 @@ sub cmd_info {
if ($@) {
$result .= "Repository Root: (offline)\n";
}
- $result .= "Repository UUID: $uuid\n" unless $diff_status eq "A";
+ $result .= "Repository UUID: $uuid\n" unless $diff_status eq "A" &&
+ ($SVN::Core::VERSION le '1.5.4' || $file_type ne "dir");
$result .= "Revision: " . ($diff_status eq "A" ? 0 : $rev) . "\n";
$result .= "Node Kind: " .
--
1.6.1.142.g76f25
^ permalink raw reply related
* Re: [RFC PATCH] Fix gitdir detection when in subdir of gitdir
From: SZEDER Gábor @ 2009-01-19 2:03 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Sixt, Johannes Schindelin, SZEDER Gábor, git
In-Reply-To: <7vhc3wuwxb.fsf@gitster.siamese.dyndns.org>
On Sun, Jan 18, 2009 at 01:27:44PM -0800, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
> > I think (1) the solution (almost) makes sense, (2) the patch needs to be
> > explained a lot better as you mentioned in your two messages, and (3) if
> > it does not affect any other case than when you are in a subdirectory of
> > the .git/ directory, then you are doing something funny anyway and
> > performance issue Dscho mentions, if any, is not a concern.
> >
> > My "(almost)" in (1) above is because the patch uses this new behaviour
> > even when you are inside the .git/ directory itself (or at the root of a
> > bare repository), which is a very common case that we do not have to nor
> > want to change the behaviour. It also invalidates the precondition of (3)
> > above.
>
> And this is a trivial follow-up on top of Szeder's patch.
Thanks. In the meantime I was working on a patch that sets relative
path in this case, too. I got it almost working: all tests passed
except '.git/objects/: is-bare-repository' in 't1500-rev-parse'. I
couldn't figure it out why this test failed, however.
In case somebody might be interested for such an uncommon case, the
patch is below.
Best,
Gábor
setup.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/setup.c b/setup.c
index 6b277b6..b4d37d7 100644
--- a/setup.c
+++ b/setup.c
@@ -375,7 +375,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
static char cwd[PATH_MAX+1];
const char *gitdirenv;
const char *gitfile_dir;
- int len, offset, ceil_offset;
+ int len, offset, ceil_offset, cdup_count = 0;
/*
* Let's assume that we are in a git repository.
@@ -453,10 +453,22 @@ const char *setup_git_directory_gently(int *nongit_ok)
if (is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT))
break;
if (is_git_directory(".")) {
+ char gd_rel_path[PATH_MAX];
inside_git_dir = 1;
if (!work_tree_env)
inside_work_tree = 0;
- setenv(GIT_DIR_ENVIRONMENT, ".", 1);
+ if (cdup_count) {
+ char *p = gd_rel_path;
+ while (cdup_count-- > 1) {
+ *p++ = '.'; *p++ = '.'; *p++ = '/';
+ }
+ *p++ = '.'; *p++ = '.';
+ *p = '\0';
+ } else {
+ gd_rel_path[0] = '.';
+ gd_rel_path[1] = '\0';
+ }
+ setenv(GIT_DIR_ENVIRONMENT, gd_rel_path, 1);
check_repository_format_gently(nongit_ok);
return NULL;
}
@@ -472,6 +484,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
}
if (chdir(".."))
die("Cannot change to %s/..: %s", cwd, strerror(errno));
+ cdup_count++;
}
inside_git_dir = 0;
^ 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