* format-patch usage
From: William Morgan @ 2008-01-14 0:40 UTC (permalink / raw)
To: Git Mailing List
Hi all,
Two questions from a git neophyte about using format-patch:
First, what's the point of adding the Signed-off-by footer, if you're
the author of the patch? I can see the utility of the committer adding
this, as a record of who committed it, but if you wrote a patch and are
submitting it to the list, then you've presumably "signed off", haven't
you? Or is there some subtle distinction between exploratory patches and
"real" patches being made?
Second, it seems like commentary about a patch can be placed after the
"---" but before the "diff --git" lines. Is that correct? Is that
accepted practice? It seems a little backwards to have the commit
message first, then the commentary. Am I correct in assuming that
git-apply ignores anything between those two lines, including the diff
stat, and so that's the reason people put it there?
Thanks,
--
William <wmorgan-git@masanjin.net>
^ permalink raw reply
* Re: Adding Git to Better SCM Initiative : Comparison
From: Jakub Narebski @ 2008-01-14 0:31 UTC (permalink / raw)
To: Dmitry Potapov, Shlomi Fish
Cc: git, Eyvind Bernhardsen, David Kastrup, Florian Weimer,
Chris Shoemaker
In-Reply-To: <20080114001408.GV2963@dpotapov.dyndns.org>
On Mon, 14 January 2008, Dmitry Potapov wrote:
> On Sun, Jan 13, 2008 at 01:44:10AM +0100, Jakub Narebski wrote:
> >
> > What does "Renames Support" mean?
By the way, the question was to the author of Better SCM Initiative
Comparison, Shlomi Fish.
> Accordingly to the clarification provided there, it means retaining the
> history of the file when its name changed. So I would write like this:
>
> Yes. Git can automatically detects renames and show history together,
> however being content oriented rather than file oriented, the notion of
> "retaining the history of the file" can not exactly applied to it.
"History of a file" can be defined as "<scm> log 'file'", and this is
well defined also for git. And 'rename support' for file means just
that this history of a file (of a current file contents) follows file
renames.
IIRC this des not work for directories... but on the other hand git,
tracking contents only as a goal, does not track directories.
> > Because the answer,
> > especially in the case of git which is a bit different in that it does
> > rename detection and not rename tracking (using inodes / file-ids),
> > depends on that...
>
> Git is different in that it tracks the content as the whole rather than
> tracking a set of files. When you look at some source code, what you
> really want to know who and why wrote *this*, and usually it does not
> matter to you whether it was written in this file or another one. CVS
> is really bad at that, because if you renamed a file, it would be very
> difficult to go back to history and find that. Many file-ids based SCMs
> have solved this problem, however, they do not do any better than CVS
> in another very common case -- when your code is moved around as result
> of refactoring, but Git addresses both problems, not just one!
AFAIK Mercurial (hg) is not file-id based, but does explicitely track
renames. There was even an idea presented on git mailing list to mark
renames in commit object in some "note" header.
> So, it is not as much about explicit renaming vs automatic, but about
> different design goals. After finishing reading this questionnaire,
> it seems to me that a more proper title for it would be "Better CVS
> Initiative", so it is not surprisingly that Git does not fit into it
> well. It is like trying to put characteristics of your LCD into a
> questionnaire for CRT monitors -- some does not make sense, other
> misleading, and most important ones are not mentioned anyway...
Please remember that AFAIK this table is _older_ than Git itself.
But it is a fact that some characteristics are much patterned after
CVS features and misfeatures.
It would be much better if for each feature there was some test
described which would allow to check if the feature is supported.
By the way, even before "git log --follow" you could have "this file
was renamed to that file" in the commit/revision patchset. This is
IMHO enough of rename support. Much more important is correct support
for renames in merges, which is in TODO for Better-SCM comparison...
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: Adding Git to Better SCM Initiative : Comparison
From: Dmitry Potapov @ 2008-01-14 0:14 UTC (permalink / raw)
To: Jakub Narebski
Cc: Shlomi Fish, git, Eyvind Bernhardsen, David Kastrup,
Florian Weimer, Chris Shoemaker
In-Reply-To: <200801130144.14574.jnareb@gmail.com>
On Sun, Jan 13, 2008 at 01:44:10AM +0100, Jakub Narebski wrote:
>
> What does "Renames Support" mean?
Accordingly to the clarification provided there, it means retaining the
history of the file when its name changed. So I would write like this:
Yes. Git can automatically detects renames and show history together,
however being content oriented rather than file oriented, the notion of
"retaining the history of the file" can not exactly applied to it.
> Because the answer,
> especially in the case of git which is a bit different in that it does
> rename detection and not rename tracking (using inodes / file-ids),
> depends on that...
Git is different in that it tracks the content as the whole rather than
tracking a set of files. When you look at some source code, what you
really want to know who and why wrote *this*, and usually it does not
matter to you whether it was written in this file or another one. CVS
is really bad at that, because if you renamed a file, it would be very
difficult to go back to history and find that. Many file-ids based SCMs
have solved this problem, however, they do not do any better than CVS
in another very common case -- when your code is moved around as result
of refactoring, but Git addresses both problems, not just one!
So, it is not as much about explicit renaming vs automatic, but about
different design goals. After finishing reading this questionnaire,
it seems to me that a more proper title for it would be "Better CVS
Initiative", so it is not surprisingly that Git does not fit into it
well. It is like trying to put characteristics of your LCD into a
questionnaire for CRT monitors -- some does not make sense, other
misleading, and most important ones are not mentioned anyway...
Dmitry
^ permalink raw reply
* Re: javadoc (was [EGIT PATCH] Showing abbreviated commit hash of the versions in Compare editor.)
From: Robin Rosenberg @ 2008-01-13 23:54 UTC (permalink / raw)
To: Roger C. Soares; +Cc: git, Shawn O. Pearce
In-Reply-To: <478A7C48.6040501@intelinet.com.br>
söndagen den 13 januari 2008 skrev Roger C. Soares:
> Hi Robin,
>
> For what I've been using it's all working now.
> I saw some typos if you want to update them while you're at it:
Fixed, on pu now. Will push to master tomorrow.
-- robiin
^ permalink raw reply
* [PATCH] Don't display crlf warning twice
From: Dmitry Potapov @ 2008-01-13 23:46 UTC (permalink / raw)
To: Steffen Prohaska; +Cc: gitster, torvalds, git, Dmitry Potapov
In-Reply-To: <1200241847776-git-send-email-prohaska@zib.de>
'git add' could call crlf_to_git() twice, and this caused that the same
crlf warning being display twice. The first time crlf_to_git() is called
when a file is added to index, and it could be called the second time
during writing the index.
This patches sets safe_crlf to false before the second call.
Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
---
On Sun, Jan 13, 2008 at 05:30:47PM +0100, Steffen Prohaska wrote:
>_
> I mentioned earlier that crlf_to_git() would be called twice. Unfortunately,
> I can't reproduce this behaviour and are not even sure if it ever happend.
I think I have found the cause. It can be seen from the following trace:
==============
#0 crlf_to_git (path=0x814b37e "a", src=0xb7fb4000 "Hello\r\nHello\r\nHello\n", len=20, buf=0xbfad504c, action=-1) at convert.c:89
#1 0x080e0454 in convert_to_git (path=0x814b37e "a", src=0xb7fb4000 "Hello\r\nHello\r\nHello\n", len=20, dst=0xbfad504c) at convert.c:578
#2 0x080b7194 in index_fd (sha1=0xbfad508c "", fd=7, st=0xbfad50d8, write_object=0, type=OBJ_BLOB, path=0x814b37e "a") at sha1_file.c:2345
#3 0x080a7dd4 in ce_compare_data (ce=0x814b340, st=0xbfad50d8) at read-cache.c:56
#4 0x080a8045 in ce_modified_check_fs (ce=0x814b340, st=0xbfad50d8) at read-cache.c:111
#5 0x080aa66d in ce_smudge_racily_clean_entry (ce=0x814b340) at read-cache.c:1121
#6 0x080aa79d in write_index (istate=0x814a3e0, newfd=6) at read-cache.c:1177
#7 0x0804c66a in cmd_add (argc=1, argv=0xbfad6408, prefix=0x0) at builtin-add.c:261
==============
#0 crlf_to_git (path=0x814b094 "a", src=0xb7fb4000 "Hello\r\nHello\r\nHello\n", len=20, buf=0xbfad50ec, action=-1) at convert.c:89
#1 0x080e0454 in convert_to_git (path=0x814b094 "a", src=0xb7fb4000 "Hello\r\nHello\r\nHello\n", len=20, dst=0xbfad50ec) at convert.c:578
#2 0x080b7194 in index_fd (sha1=0x814b368 "", fd=7, st=0xbfad5174, write_object=1, type=OBJ_BLOB, path=0x814b094 "a") at sha1_file.c:2345
#3 0x080b731f in index_path (sha1=0x814b368 "", path=0x814b094 "a", st=0xbfad5174, write_object=1) at sha1_file.c:2377
#4 0x080a8c00 in add_file_to_index (istate=0x814a3e0, path=0x814b094 "a", verbose=0) at read-cache.c:433
#5 0x0804c640 in cmd_add (argc=1, argv=0xbfad6408, prefix=0x0) at builtin-add.c:257
==============
This patch works for me but it certainly needs better testing.
builtin-add.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/builtin-add.c b/builtin-add.c
index 5c29cc2..f113fc1 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -258,9 +258,12 @@ int cmd_add(int argc, const char **argv, const char *prefix)
finish:
if (active_cache_changed) {
+ enum safe_crlf old = safe_crlf;
+ safe_crlf = SAFE_CRLF_FALSE;
if (write_cache(newfd, active_cache, active_nr) ||
close(newfd) || commit_locked_index(&lock_file))
die("Unable to write new index file");
+ safe_crlf = old;
}
return 0;
--
1.5.3.5
^ permalink raw reply related
* Re: [PATCH] index: be careful when handling long names
From: Alex Riesen @ 2008-01-13 23:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Linus Torvalds, Git Mailing List
In-Reply-To: <7v4pdhpbmw.fsf@gitster.siamese.dyndns.org>
Junio C Hamano, Mon, Jan 14, 2008 00:08:07 +0100:
> Alex Riesen <raa.lkml@gmail.com> writes:
>
> > Junio C Hamano, Sun, Jan 13, 2008 23:36:34 +0100:
> >> +test_expect_success 'very long name in the index handled sanely' '
> >> +
> >> + a=a && # 1
> >> + a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 16
> >> + a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 256
> >> + a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 4096
> >
> > I'd expect it to fail on some systems (everywindowsthing up to w2k,
> > maybe some commercial unices).
>
> My understanding is that Everywindowsthing do not come with any
> (POSIX compliant) shell that we support by default, so if you
> are talking about a limit of shell variable value, I do not
> think it is an issue to begin with. It is just the matter of
Oh, right. The file system wont even see it, it is passed directly to
update-index.
> picking a sensible shell (I understand both Cygwin and msys
> ports use a shell that supports more than 4k bytes in value
> given to a variable).
can't check right now, but I believe it is so
> I would agree that it might overflow the argument limit when
> this is given to "echo", though. We cannot do much about it,
> but you may have cleverer ideas.
I thought about conditionally disabling the test, like it was done
when the tabs in filenames had to be tested. Wont be needed for this
particular case.
^ permalink raw reply
* Re: [PATCH 1/2] parse_commit_buffer: don't parse invalid commits
From: Junio C Hamano @ 2008-01-13 23:23 UTC (permalink / raw)
To: Martin Koegler; +Cc: git
In-Reply-To: <12002478702664-git-send-email-mkoegler@auto.tuwien.ac.at>
I think I saw this patch and vaguely recall commenting on it,
but your message is not very helpful locating the previous
thread to see what kind of improvements are made to this new
round.
^ permalink raw reply
* Re: [PATCH] index: be careful when handling long names
From: Junio C Hamano @ 2008-01-13 23:08 UTC (permalink / raw)
To: Alex Riesen; +Cc: Linus Torvalds, Git Mailing List
In-Reply-To: <20080113225321.GA19970@steel.home>
Alex Riesen <raa.lkml@gmail.com> writes:
> Junio C Hamano, Sun, Jan 13, 2008 23:36:34 +0100:
>> +test_expect_success 'very long name in the index handled sanely' '
>> +
>> + a=a && # 1
>> + a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 16
>> + a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 256
>> + a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 4096
>
> I'd expect it to fail on some systems (everywindowsthing up to w2k,
> maybe some commercial unices).
My understanding is that Everywindowsthing do not come with any
(POSIX compliant) shell that we support by default, so if you
are talking about a limit of shell variable value, I do not
think it is an issue to begin with. It is just the matter of
picking a sensible shell (I understand both Cygwin and msys
ports use a shell that supports more than 4k bytes in value
given to a variable).
I would agree that it might overflow the argument limit when
this is given to "echo", though. We cannot do much about it,
but you may have cleverer ideas.
^ permalink raw reply
* Re: [EGIT PATCH] Showing commit info similar to the CVS plugin.
From: Robin Rosenberg @ 2008-01-13 23:06 UTC (permalink / raw)
To: Roger C. Soares; +Cc: git, Shawn O. Pearce
In-Reply-To: <1200258510-15235-1-git-send-email-rogersoares@intelinet.com.br>
Thanks. I pushed this code. I changed the comment sligtly and fixed a trailing whitespace.
-- robin
^ permalink raw reply
* Re: [PATCH] http-push: making HTTP push more robust and more user-friendly
From: Junio C Hamano @ 2008-01-13 23:01 UTC (permalink / raw)
To: Grégoire Barbier; +Cc: git
In-Reply-To: <1200250979-19604-1-git-send-email-gb@gbarbier.org>
Grégoire Barbier <gb@gbarbier.org> writes:
> Fail when info/refs exists and is already locked (avoiding strange behaviour
> and errors, and maybe avoiding some repository corruption).
>
> Warn if the URL does not end with '/' (since 302 is not yet handled)
>
> More explicit error message when the URL or password is not set correctly
> (instead of "no DAV locking support").
>
> DAV locking time of 1 minute instead of 10 minutes (avoid waiting 10 minutes
> for a orphan lock to expire before anyone can do a push on the repo).
I do not remember these discussed on the list, and would like to
see people who do use http-push to comment on these. Especially
because there is no correct timeout that is good for everybody,
the last item might be contentious.
The second one to add a couple of "goto cleanup" looked
correct. Acks, people?
Also http-push being unusable without CURL_MULTI was also a news
to me. Is this something that came up on #git perhaps?
This change means people need curl 7.10 or newer (post May 2003,
that is). I do not think it is too new a version to require,
but then it makes me wonder if it makes much sense for us to
keep supporting non CURL_MULTI build these days. Perhaps we
should schedule such a move to drop non MULTI build in the
future?
^ permalink raw reply
* Re: [PATCH] index: be careful when handling long names
From: Alex Riesen @ 2008-01-13 22:53 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Linus Torvalds, Git Mailing List
In-Reply-To: <7vhchhpd3h.fsf_-_@gitster.siamese.dyndns.org>
Junio C Hamano, Sun, Jan 13, 2008 23:36:34 +0100:
> +test_expect_success 'very long name in the index handled sanely' '
> +
> + a=a && # 1
> + a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 16
> + a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 256
> + a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 4096
I'd expect it to fail on some systems (everywindowsthing up to w2k,
maybe some commercial unices).
^ permalink raw reply
* [PATCH] index: be careful when handling long names
From: Junio C Hamano @ 2008-01-13 22:36 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <7vsl11plbe.fsf@gitster.siamese.dyndns.org>
We currently use lower 12-bit (masked with CE_NAMEMASK) in the
ce_flags field to store the length of the name in cache_entry,
without checking the length parameter given to
create_ce_flags(). This can make us store incorrect length.
Currently we are mostly protected by the fact that many
codepaths first copy the path in a variable of size PATH_MAX,
which typically is 4096 that happens to match the limit, but
that feels like a bug waiting to happen. Besides, that would
not allow us to shorten the width of CE_NAMEMASK to use the bits
for new flags.
This redefines the meaning of the name length stored in the
cache_entry. A name that does not fit is represented by storing
CE_NAMEMASK in the field, and the actual length needs to be
computed by actually counting the bytes in the name[] field.
This way, only the unusually long paths need to suffer.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Junio C Hamano <gitster@pobox.com> writes:
> About the CE_NAMEMASK limitation (and currently we do not check
> it, so I think we would be screwed when a pathname that is
> longer than (CE_NAMEMASK+1) and still fits under PATH_MAX is
> given), I think we do not have to limit the maximum pathname
> length. Instead we can teach create_ce_flags() and ce_namelen()
> that a name longer than 2k (or 4k) has the NAMEMASK bits that
> are all 1 and ce->name[] must be counted if so (with an obvious
> optimization to start counting at byte position 2k or 4k in
> ce_namelen()).
This should fix it. Passes tests including the new test that
the existing code fails.
cache.h | 17 +++++++++++++++--
t/t0000-basic.sh | 18 ++++++++++++++++++
2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/cache.h b/cache.h
index 39331c2..ad53acc 100644
--- a/cache.h
+++ b/cache.h
@@ -114,8 +114,21 @@ struct cache_entry {
#define CE_VALID (0x8000)
#define CE_STAGESHIFT 12
-#define create_ce_flags(len, stage) htons((len) | ((stage) << CE_STAGESHIFT))
-#define ce_namelen(ce) (CE_NAMEMASK & ntohs((ce)->ce_flags))
+static inline unsigned create_ce_flags(size_t len, unsigned stage)
+{
+ if (len >= CE_NAMEMASK)
+ len = CE_NAMEMASK;
+ return htons(len | (stage << CE_STAGESHIFT));
+}
+
+static inline size_t ce_namelen(const struct cache_entry *ce)
+{
+ size_t len = ntohs((ce)->ce_flags) & CE_NAMEMASK;
+ if (len < CE_NAMEMASK) /* likely */
+ return len;
+ return strlen(ce->name + CE_NAMEMASK) + CE_NAMEMASK;
+}
+
#define ce_size(ce) cache_entry_size(ce_namelen(ce))
#define ce_stage(ce) ((CE_STAGEMASK & ntohs((ce)->ce_flags)) >> CE_STAGESHIFT)
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 4e49d59..40551a3 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -297,4 +297,22 @@ test_expect_success 'absolute path works as expected' '
test "$sym" = "$(test-absolute-path $dir2/syml)"
'
+test_expect_success 'very long name in the index handled sanely' '
+
+ a=a && # 1
+ a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 16
+ a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 256
+ a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 4096
+ a=${a}q
+
+ >path4 &&
+ git update-index --add path4 &&
+ (
+ git ls-files -s path4 |
+ sed -e "s/ .*/ /" |
+ tr -d "\012"
+ echo "$a"
+ ) | git update-index --index-info
+'
+
test_done
^ permalink raw reply related
* Re: [PATCH v3] safecrlf: Add mechanism to warn about irreversible crlf conversions
From: Dmitry Potapov @ 2008-01-13 22:13 UTC (permalink / raw)
To: Steffen Prohaska; +Cc: gitster, torvalds, git
In-Reply-To: <1200241847776-git-send-email-prohaska@zib.de>
Hi Steffan,
It looks like I was to quick to ack your patch
On Sun, Jan 13, 2008 at 05:30:47PM +0100, Steffen Prohaska wrote:
>
> I mentioned earlier that crlf_to_git() would be called twice. Unfortunately,
> I can't reproduce this behaviour and are not even sure if it ever happend.
that happened to me right now. My setting is autocrlf = input.
and file that I am adding has mixing line-ending:
===
foo
bar\r
===
Dmitry
^ permalink raw reply
* Re: [PATCH v3] safecrlf: Add mechanism to warn about irreversible crlf conversions
From: Dmitry Potapov @ 2008-01-13 22:02 UTC (permalink / raw)
To: Steffen Prohaska; +Cc: gitster, torvalds, git
In-Reply-To: <1200241847776-git-send-email-prohaska@zib.de>
Hi Steffan,
The patch looks good to me. So:
Acked-by: Dmitry Potapov <dpotapov@gmail.com>
Dmitry
^ permalink raw reply
* Re: [PATCH] Teach remote machinery about remotes.default config variable
From: Johannes Schindelin @ 2008-01-13 21:27 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Mark Levedahl, git
In-Reply-To: <7v4pdislrf.fsf@gitster.siamese.dyndns.org>
Hi,
On Sat, 12 Jan 2008, Junio C Hamano wrote:
> Mark Levedahl <mlevedahl@gmail.com> writes:
>
> > Basically, I think an important (but not complete) test of the design
> > is that
> >
> > git clone -o frotz git://frotz.foo.bar/myproject.git
> > cd myproject
> > git submodule init
> > git submodule update
> >
> > work, with origin = frotz throughout the submodules, and with the
> > whole project correctly checked out even if the entire project was
> > rehosted onto a different server.
>
> I like that. This is a very good argument, especially because it
> clarifies very well that the issue is not about "'submodule init'
> misbehaves" but "fetch/pull/merge does not play well with clone -o".
FWIW I disagree.
I never understood why people want to complicate things by being able to
name default _keys_ differently. Why not letting "origin" being the
default being pulled from, and be done with it?
Besides, I _really_ do not understand why we have such a discussion in rc
phase. There are _many_ more interesting discussions now that _also_ do
not belong into a freeze phase.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] Teach remote machinery about remotes.default config variable
From: Johannes Schindelin @ 2008-01-13 21:22 UTC (permalink / raw)
To: Mark Levedahl; +Cc: Junio C Hamano, git
In-Reply-To: <47893F53.2070908@gmail.com>
Hi,
On Sat, 12 Jan 2008, Mark Levedahl wrote:
> Johannes Schindelin wrote:
> > Why is your patch then not about git-submodule?
> >
> > And I still fail to see -- even for submodules -- how you begin to
> > tackle that lookup problem.
>
> Because git-submodule is a wrapper around git-fetch and git-clone and
> git-remote, and those lacked the mechanism to honor the fact that when I
> said
>
> git clone -o frotz frontz.foo.bar/foo.git
>
> I *defined* the upstream's nickname as "frotz", not "origin", and origin
> is *not* defined so don't try to use it. As sub-modules are git
> projects, fixing this in a sub-module necessarily fixes it in any git
> project.
Unfortunately, you _still_ fail to even ackonwledge that you still need a
lookup, and that I have a point when saying "your patch does not help,
since you still have a lookup".
But I start to believe that you do not even want to present an argument
against this reasoning, so I will stop here.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] gitk: Update and fix Makefile (spelling fix)
From: Christian Stimming @ 2008-01-13 21:06 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Junio C Hamano, git
In-Reply-To: <18311.64910.643392.816623@cargo.ozlabs.ibm.com>
Am Samstag, 12. Januar 2008 00:36 schrieb Paul Mackerras:
> > Christian Stimming (2):
> > gitk: Fix typo in user message.
>
> I was going to ignore this one since "descendent" is actually a valid
> alternate spelling, and is the one I am used to. However, I don't
> have a strong feeling about it.
In the dictionaries I consulted before proposing this patch, "descendant" was
the *only* valid spelling. I checked http://dict.leo.org/?search=descendent ,
(on paper) Oxford Advanced Learner's Dictionary (1998 edition). Now when
looking up http://www.m-w.com/dictionary/descendent your original spelling is
also mentioned as a variant, but as the other dictionaries didn't have it, I
assumed this should rather be changed.
Christian
^ permalink raw reply
* [EGIT PATCH] Showing commit info similar to the CVS plugin.
From: Roger C. Soares @ 2008-01-13 21:08 UTC (permalink / raw)
To: git; +Cc: Roger C. Soares
Tooltips for the info were annoying, especially on MacOS where the tooltip center is your pointer location.
It is now possible to copy&paste data.
Like the CVS plugin, there's a menu to show/hide views.
Tooltips can still be enabled via a menu option.
Signed-off-by: Roger C. Soares <rogersoares@intelinet.com.br>
---
It now has a preference to enable/disable tooltips and the
preference is persisted across eclipse restarts.
I already merged this with the pu branch so I could test it while working on this one.
org.spearce.egit.ui/plugin.xml | 4 +
.../src/org/spearce/egit/ui/GitHistoryPage.java | 327 +++++++++++++++++++-
.../egit/ui/PluginPreferenceInitializer.java | 46 +++
.../src/org/spearce/egit/ui/UIPreferences.java | 32 ++
.../src/org/spearce/egit/ui/UIText.java | 9 +
.../src/org/spearce/egit/ui/uitext.properties | 5 +
6 files changed, 406 insertions(+), 17 deletions(-)
create mode 100644 org.spearce.egit.ui/src/org/spearce/egit/ui/PluginPreferenceInitializer.java
create mode 100644 org.spearce.egit.ui/src/org/spearce/egit/ui/UIPreferences.java
diff --git a/org.spearce.egit.ui/plugin.xml b/org.spearce.egit.ui/plugin.xml
index 60519b0..b62c9d7 100644
--- a/org.spearce.egit.ui/plugin.xml
+++ b/org.spearce.egit.ui/plugin.xml
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.spearce.egit.ui.PluginPreferenceInitializer"/>
+ </extension>
+
<extension point="org.eclipse.team.ui.configurationWizards">
<wizard name="%SharingWizard_name"
icon="icons/sharing.gif"
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java
index 45d5903..803adc5 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java
@@ -17,6 +17,7 @@
package org.spearce.egit.ui;
import java.io.IOException;
+import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -34,13 +35,18 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.TextViewer;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.ILazyContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -48,6 +54,7 @@ import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
@@ -72,6 +79,8 @@ import org.eclipse.team.internal.ui.history.DialogHistoryPageSite;
import org.eclipse.team.ui.history.HistoryPage;
import org.eclipse.team.ui.history.IHistoryCompareAdapter;
import org.eclipse.team.ui.history.IHistoryPageSite;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.part.IPageSite;
import org.spearce.egit.core.GitProvider;
import org.spearce.egit.core.internal.mapping.GitCommitFileRevision;
import org.spearce.egit.core.internal.mapping.GitFileHistory;
@@ -98,14 +107,26 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
private static final String PREF_SHOWALLREPOVERSIONS = "org.spearce.egit.ui.githistorypage.showallrepoversions";
private static final String PREF_SHOWALLPROJECTVERSIONS = "org.spearce.egit.ui.githistorypage.showallprojectversions";
private static final String PREF_SHOWALLFOLDERVERSIONS = "org.spearce.egit.ui.githistorypage.showallfolderversions";
+ /* private */static final SimpleDateFormat DATETIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+ /* private */static final SimpleDateFormat DATETIMETZ_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
- private Composite localComposite;
+ private SashForm localComposite;
+ private SashForm revisionInfoComposite;
- private TableViewer viewer;
+ /* private */Preferences prefs = Activator.getDefault().getPluginPreferences();
- private Table table;
+ /* private */TableViewer viewer;
+ /* private */TextViewer revDetailTextViewer;
+ /* private */TextViewer revCommentTextViewer;
+ /* private */IAction toggleCommentWrapAction;
+ /* private */IAction toggleRevDetailAction;
+ /* private */IAction toggleRevCommentAction;
+ /* private */IAction toggleTooltipsAction;
- private List<IFileRevision> fileRevisions;
+ /* private */Table table;
+ private MouseMoveListener tableMouseMoveListener;
+
+ /* private */List<IFileRevision> fileRevisions;
private boolean hintShowDiffNow;
@@ -139,7 +160,8 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
}
public void createControl(Composite parent) {
- localComposite = new Composite(parent, SWT.NONE);
+ localComposite = new SashForm(parent, SWT.VERTICAL);
+
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
@@ -150,6 +172,10 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
createTable(localComposite);
+ revisionInfoComposite = new SashForm(localComposite, SWT.HORIZONTAL);
+ createRevDetailTextViewer(revisionInfoComposite);
+ createRevCommentTextViewer(revisionInfoComposite);
+
IHistoryPageSite parentSite = getHistoryPageSite();
if (parentSite != null && parentSite instanceof DialogHistoryPageSite)
parentSite.setSelectionProvider(viewer);
@@ -158,6 +184,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
"Compare");
final GitCompareRevisionAction compareActionPrev = new GitCompareRevisionAction(
"Show commit");
+
table.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
@@ -166,7 +193,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
});
- table.addMouseMoveListener(new MouseMoveListener() {
+ tableMouseMoveListener = new MouseMoveListener() {
TableItem lastItem;
public void mouseMove(MouseEvent e) {
TableItem item = table.getItem(new Point(e.x,e.y));
@@ -179,7 +206,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
}
lastItem = item;
}
- });
+ };
table.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -190,6 +217,19 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
selection2[i] = (IFileRevision) selection[i].getData();
}
+ // Updates the revision info text viewers
+ cleanRevisionInfoTextViewers();
+ if(selection2.length == 1) {
+ // if the table item is not visible in the UI and it's selected via keyboard
+ // this listener is called before the listener that sets the item data.
+ if(selection2[0] == null) {
+ int ix = table.getSelectionIndex();
+ GitFileRevision revision = (GitFileRevision) fileRevisions.get(ix);
+ selection2[0] = revision;
+ }
+ setRevisionInfoTextViewers(selection2[0]);
+ }
+
compareAction.setCurrentFileRevision(fileRevisions.get(0));
compareAction.selectionChanged(new StructuredSelection(
selection2));
@@ -286,9 +326,99 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
showAllFolderVersionsAction.setChecked(isShowAllFolderVersions());
getSite().getActionBars().getToolBarManager().add(
showAllFolderVersionsAction);
+
+ toggleCommentWrapAction = new Action(UIText.ResourceHistory_toggleCommentWrap) {
+ public void run() {
+ updateResourceHistoryComposites();
+ prefs.setValue(UIPreferences.RESOURCEHISTORY_SHOW_COMMENT_WRAP, toggleCommentWrapAction.isChecked());
+ Activator.getDefault().savePluginPreferences();
+ }
+ };
+ toggleCommentWrapAction.setChecked(prefs.getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_COMMENT_WRAP));
+
+ toggleRevDetailAction = new Action(UIText.ResourceHistory_toggleRevDetail) {
+ public void run() {
+ updateResourceHistoryComposites();
+ prefs.setValue(UIPreferences.RESOURCEHISTORY_SHOW_REV_DETAIL, toggleRevDetailAction.isChecked());
+ Activator.getDefault().savePluginPreferences();
+ }
+ };
+ toggleRevDetailAction.setChecked(prefs.getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_REV_DETAIL));
+
+ toggleRevCommentAction = new Action(UIText.ResourceHistory_toggleRevComment) {
+ public void run() {
+ updateResourceHistoryComposites();
+ prefs.setValue(UIPreferences.RESOURCEHISTORY_SHOW_REV_COMMENT, toggleRevCommentAction.isChecked());
+ Activator.getDefault().savePluginPreferences();
+ }
+ };
+ toggleRevCommentAction.setChecked(prefs.getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_REV_COMMENT));
+
+ toggleTooltipsAction = new Action(UIText.ResourceHistory_toggleTooltips) {
+ public void run() {
+ updateShowTooltips();
+ prefs.setValue(UIPreferences.RESOURCEHISTORY_SHOW_TOOLTIPS, toggleTooltipsAction.isChecked());
+ Activator.getDefault().savePluginPreferences();
+ }
+ };
+ toggleTooltipsAction.setChecked(prefs.getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_TOOLTIPS));
+
+ IActionBars actionBars = getSite().getActionBars();
+ IMenuManager menuManager = actionBars.getMenuManager();
+ if (menuManager != null) {
+ menuManager.add(toggleCommentWrapAction);
+ menuManager.add(new Separator());
+ menuManager.add(toggleRevDetailAction);
+ menuManager.add(toggleRevCommentAction);
+ menuManager.add(toggleTooltipsAction);
+ menuManager.add(new Separator());
+ }
+ actionBars.updateActionBars();
+ updateResourceHistoryComposites();
+ updateShowTooltips();
+
+ localComposite.setWeights(new int[] {65, 35});
+ revisionInfoComposite.setWeights(new int[] {40, 60});
+ }
+
+ /* private */void updateResourceHistoryComposites() {
+ boolean commentWrap = toggleCommentWrapAction.isChecked();
+ boolean showRevDetail = toggleRevDetailAction.isChecked();
+ boolean showRevComment = toggleRevCommentAction.isChecked();
+
+ revCommentTextViewer.getTextWidget().setWordWrap(commentWrap);
+
+ if(showRevDetail && showRevComment) {
+ localComposite.setMaximizedControl(null);
+ revisionInfoComposite.setMaximizedControl(null);
+ } else {
+ if(!(showRevDetail || showRevComment)) {
+ localComposite.setMaximizedControl(table);
+ } else if(showRevDetail) {
+ localComposite.setMaximizedControl(null);
+ revisionInfoComposite.setMaximizedControl(revDetailTextViewer.getControl());
+ } else {
+ localComposite.setMaximizedControl(null);
+ revisionInfoComposite.setMaximizedControl(revCommentTextViewer.getControl());
+ }
+ }
}
- private boolean isShowAllRepoVersions() {
+ /* private */void updateShowTooltips() {
+ boolean showTooltip = toggleTooltipsAction.isChecked();
+
+ if(showTooltip) {
+ table.addMouseMoveListener(tableMouseMoveListener);
+ } else {
+ table.removeMouseMoveListener(tableMouseMoveListener);
+ // TODO: workaround for setToolTipText(null), it doesn't work on eclipse gtk.
+ // Robin suggested a javadoc F2 style tooltip to replace the current one,
+ // so if we move to the javadoc style tooltip, this problem may be irrelevant.
+ table.setToolTipText(null);
+ }
+ }
+
+ /* private */boolean isShowAllRepoVersions() {
return showAllRepoVersions;
}
@@ -298,7 +428,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
PREF_SHOWALLREPOVERSIONS, showAllRepoVersions);
}
- private boolean isShowAllProjectVersions() {
+ /* private */boolean isShowAllProjectVersions() {
return showAllProjectVersions;
}
@@ -308,7 +438,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
PREF_SHOWALLPROJECTVERSIONS, showAllProjectVersions);
}
- private boolean isShowAllFolderVersions() {
+ /* private */boolean isShowAllFolderVersions() {
return showAllFolderVersions;
}
@@ -398,7 +528,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
Date d = new Date(element.getTimestamp());
if (d.getTime() == -1)
return "";
- return d.toString();
+ return DATETIME_FORMAT.format(d);
}
if (columnIndex == 4)
return element.getAuthor();
@@ -417,6 +547,166 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
}
}
+ private void createRevDetailTextViewer(SashForm composite) {
+ revDetailTextViewer = new TextViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
+ }
+
+ private void createRevCommentTextViewer(SashForm composite) {
+ revCommentTextViewer = new TextViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
+ }
+
+ /* private */void setRevisionInfoTextViewers(IFileRevision rev) {
+ StringBuilder revisionInfo = new StringBuilder();
+ if (appliedPatches != null) {
+ String id = rev.getContentIdentifier();
+ if (!id.equals("Workspace") && !id.equals("Index")) {
+ StGitPatch patch = (StGitPatch) appliedPatches
+ .get(new ObjectId(id));
+ if (patch != null) {
+ revisionInfo.append("Patch: ");
+ revisionInfo.append(patch.getName());
+ }
+ } else {
+ revisionInfo.append(id.toString());
+ }
+ }
+ if (revisionInfo.length() == 0) {
+ revisionInfo.append("Commit: ");
+ revisionInfo.append(rev.getContentIdentifier());
+ }
+
+ // Gets the tags for this revision.
+ // TODO: Understand this better and see if there's a simpler/shared way to do it.
+ IProject project = ((IResource) getInput()).getProject();
+ RepositoryMapping repositoryMapping = RepositoryMapping.getMapping(project);
+ Map<ObjectId,Tag[]> newtags = new HashMap<ObjectId,Tag[]>();
+ try {
+ for (String name : repositoryMapping.getRepository().getTags()) {
+ Tag t = repositoryMapping.getRepository().mapTag(name);
+ Tag[] samecommit = newtags.get(t.getObjId());
+ if (samecommit==null) {
+ samecommit = new Tag[] { t };
+ } else {
+ Tag[] n=new Tag[samecommit.length+1];
+ for (int j=0; j<samecommit.length; ++j)
+ n[j] = samecommit[j];
+ n[n.length-1] = t;
+ samecommit = n;
+ }
+ newtags.put(t.getObjId(), samecommit);
+ }
+
+ String id = rev.getContentIdentifier();
+ if (!id.equals("Workspace") && !id.equals("Index")) {
+ ObjectId oid = new ObjectId(id);
+ StringBuilder b=new StringBuilder();
+ if (tags != null) {
+ Tag[] matching = tags.get(oid);
+ if (matching != null) {
+ for (Tag t : matching) {
+ if (b.length() > 0)
+ b.append(", ");
+ String tag = t.getTag();
+ b.append(tag);
+ }
+ }
+ }
+ if(b.length() > 0) {
+ revisionInfo.append("\nTags: ");
+ revisionInfo.append(b);
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ // Gets the branches for this revision.
+ // TODO: Branches should always show all the branches from a commit.
+ Map<ObjectId, String[]> newBranches = new HashMap<ObjectId, String[]>();
+ try {
+ for (String branch : repositoryMapping.getRepository().getBranches()) {
+ ObjectId id = repositoryMapping.getRepository().resolve(branch);
+ String[] samecommit = newBranches.get(id);
+ if (samecommit == null) {
+ samecommit = new String[] { branch };
+ } else {
+ String[] n=new String[samecommit.length + 1];
+ for (int j=0; j<samecommit.length; ++j)
+ n[j] = samecommit[j];
+ n[n.length-1] = branch;
+ samecommit = n;
+ }
+ newBranches.put(id, samecommit);
+ }
+ String[] samecommit = newBranches.get(currentHead);
+ if (samecommit == null) {
+ samecommit = new String[] { "HEAD" };
+ } else {
+ String[] n=new String[samecommit.length + 1];
+ for (int j=0; j<samecommit.length; ++j)
+ n[j] = samecommit[j];
+ n[n.length-1] = "HEAD";
+ samecommit = n;
+ }
+ newBranches.put(currentHead, samecommit);
+ branches = newBranches;
+
+ String id = rev.getContentIdentifier();
+ if (branches != null) {
+ StringBuilder b=new StringBuilder();
+ ObjectId oid = new ObjectId(id);
+ String[] matching = branches.get(oid);
+ if (matching != null) {
+ for (String t : matching) {
+ if (b.length() > 0)
+ b.append(", ");
+ if (t.startsWith("refs/heads/"))
+ t = t.substring(11);
+ b.append(t);
+ }
+ }
+ if(b.length() > 0) {
+ revisionInfo.append("\nBranches: ");
+ revisionInfo.append(b);
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ revisionInfo.append("\nAuthor: ");
+ revisionInfo.append(rev.getAuthor());
+ revisionInfo.append("\nDate: ");
+ revisionInfo.append(DATETIMETZ_FORMAT.format(new Date(rev.getTimestamp())));
+
+ String comment = rev.getComment();
+ revDetailTextViewer.setDocument(new Document(revisionInfo.toString()));
+ revCommentTextViewer.setDocument(new Document(comment));
+
+ // Adds the first comment line in the status line.
+ int enterIndex = comment.indexOf("\n");
+ if(enterIndex > 0) {
+ comment = comment.substring(0, enterIndex);
+ }
+ IPageSite workbenchPageSite = getHistoryPageSite().getWorkbenchPageSite();
+ if (workbenchPageSite != null) {
+ workbenchPageSite.getActionBars().getStatusLineManager().setMessage(comment);
+ }
+ }
+
+ /* private */void cleanRevisionInfoTextViewers() {
+ if(revDetailTextViewer != null && revCommentTextViewer != null) {
+ revDetailTextViewer.setDocument(new Document(""));
+ revCommentTextViewer.setDocument(new Document(""));
+
+ // Cleans the status line
+ IPageSite workbenchPageSite = getHistoryPageSite().getWorkbenchPageSite();
+ if (workbenchPageSite != null) {
+ workbenchPageSite.getActionBars().getStatusLineManager().setMessage(null);
+ }
+ }
+ }
+
private void createTable(Composite composite) {
table = new Table(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI
| SWT.FULL_SELECTION | SWT.VIRTUAL);
@@ -562,10 +852,10 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
viewer.setInput(getInput());
}
- private Map appliedPatches;
+ /* private */Map appliedPatches;
ObjectId currentHead;
- private Map<ObjectId,Tag[]> tags;
- private Map<ObjectId, String[]> branches;
+ /* private */Map<ObjectId,Tag[]> tags;
+ /* private */Map<ObjectId, String[]> branches;
GitHistoryLabelProvider lp = new GitHistoryLabelProvider();
class HistoryRefreshJob extends Job {
@@ -668,6 +958,8 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
table.getDisplay().asyncExec(new Runnable() {
public void run() {
+ cleanRevisionInfoTextViewers();
+
table.removeAll();
table.setItemCount(fileRevisions.size());
table.setData("X");
@@ -726,6 +1018,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
}
public void dispose() {
+ return;
}
public void updateElement(int index) {
@@ -763,7 +1056,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
col.setResizable(true);
col.setText(TeamUIMessages.GenericHistoryTableProvider_RevisionTime);
// X col.addSelectionListener(headerListener);
- ((TableLayout) table.getLayout()).addColumnData(new ColumnWeightData(30,
+ ((TableLayout) table.getLayout()).addColumnData(new ColumnWeightData(20,
true));
// author
@@ -779,7 +1072,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
col.setResizable(true);
col.setText(TeamUIMessages.GenericHistoryTableProvider_Comment);
// X col.addSelectionListener(headerListener);
- ((TableLayout) table.getLayout()).addColumnData(new ColumnWeightData(35,
+ ((TableLayout) table.getLayout()).addColumnData(new ColumnWeightData(45,
true));
}
@@ -859,7 +1152,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable,
// example
String niceComment = unwrapComment(rev.getComment());
String toolTipText = commitStr + "\nAuthor: " + rev.getAuthor()
- + "\nDate: " + new Date(rev.getTimestamp()) + "\n\n"
+ + "\nDate: " + DATETIMETZ_FORMAT.format(new Date(rev.getTimestamp())) + "\n\n"
+ niceComment;
return toolTipText;
}
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/PluginPreferenceInitializer.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/PluginPreferenceInitializer.java
new file mode 100644
index 0000000..ab89bec
--- /dev/null
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/PluginPreferenceInitializer.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2008 Roger C. Soares <rogersoares@intelinet.com.br>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License, version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ */
+package org.spearce.egit.ui;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+
+/**
+ * Plugin extension point to initialize the plugin runtime preferences.
+ */
+public class PluginPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /**
+ * Calls super constructor.
+ */
+ public PluginPreferenceInitializer() {
+ super();
+ }
+
+ /**
+ * This method initializes the plugin preferences with default values.
+ */
+ public void initializeDefaultPreferences() {
+ Preferences prefs = Activator.getDefault().getPluginPreferences();
+
+ prefs.setDefault(UIPreferences.RESOURCEHISTORY_SHOW_COMMENT_WRAP, true);
+ prefs.setDefault(UIPreferences.RESOURCEHISTORY_SHOW_REV_DETAIL, true);
+ prefs.setDefault(UIPreferences.RESOURCEHISTORY_SHOW_REV_COMMENT, true);
+ prefs.setDefault(UIPreferences.RESOURCEHISTORY_SHOW_TOOLTIPS, false);
+ }
+
+}
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIPreferences.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIPreferences.java
new file mode 100644
index 0000000..900023a
--- /dev/null
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIPreferences.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2008 Roger C. Soares <rogersoares@intelinet.com.br>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License, version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ */
+package org.spearce.egit.ui;
+
+/**
+ * Preferences used by the plugin.
+ * All plugin preferences shall be referenced by a constant in this class.
+ */
+public class UIPreferences {
+ /** */
+ public final static String RESOURCEHISTORY_SHOW_COMMENT_WRAP = "resourcehistory_show_comment_wrap";
+ /** */
+ public final static String RESOURCEHISTORY_SHOW_REV_DETAIL = "resourcehistory_show_rev_detail";
+ /** */
+ public final static String RESOURCEHISTORY_SHOW_REV_COMMENT = "resourcehistory_show_rev_comment";
+ /** */
+ public final static String RESOURCEHISTORY_SHOW_TOOLTIPS = "resourcehistory_show_tooltips";
+}
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
index b6c7a28..1454124 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
@@ -53,6 +53,15 @@ public class UIText extends NLS {
/** */
public static String QuickDiff_failedLoading;
+ /** */
+ public static String ResourceHistory_toggleCommentWrap;
+ /** */
+ public static String ResourceHistory_toggleRevDetail;
+ /** */
+ public static String ResourceHistory_toggleRevComment;
+ /** */
+ public static String ResourceHistory_toggleTooltips;
+
static {
initializeMessages(UIText.class.getPackage().getName() + ".uitext",
UIText.class);
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
index 75e975b..be02978 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
@@ -28,3 +28,8 @@ ExistingOrNewPage_createNew=Create a new Git repository for this project
Decorator_failedLazyLoading=Resource decorator failed to load tree contents on demand.
QuickDiff_failedLoading=Quick diff failed to obtain file data.
+
+ResourceHistory_toggleCommentWrap=Wrap Comments
+ResourceHistory_toggleRevDetail=Show Revision Details
+ResourceHistory_toggleRevComment=Show Revision Comment
+ResourceHistory_toggleTooltips=Show Revision Tooltip
--
1.5.3.7
^ permalink raw reply related
* Re: [EGIT PATCH] Showing abbreviated commit hash of the versions in Compare editor.
From: Roger C. Soares @ 2008-01-13 21:02 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git, Shawn O. Pearce
In-Reply-To: <200801121644.21173.robin.rosenberg.lists@dewire.com>
Hi Robin,
For what I've been using it's all working now.
I saw some typos if you want to update them while you're at it:
Activator.java
* Instatiate an error exception.
* Log a dbeug message
GitHistoryPage.java
* @return reformated comment
* This class extendes the build in history page with Git features, such
[]s,
Roger.
--
Robin Rosenberg escreveu:
> lördagen den 12 januari 2008 skrev Roger C. Soares:
>
>> Robin Rosenberg escreveu:
>>
>>> I pushed my doc-branch as pu, you can look at it. My intention is take a look again
>>> and then push it as master if there are no objections. Is it ok and good to flags
>>> public stuff without javadoc as an error (tip pu commit)?
>>>
>>>
>> Got some errors, when trying to export to a deployable plugin:
>> "/home/roger/eclipse/workspace/egit/org.spearce.jgit/tst" does not exist!
>>
>> And on "team -> share project... -> Git", it goes to the CVS wizard.
>>
>
> Due to my lack of testing @_@. I pushed a new pu branch with these two errors fixed.
>
> Thanks
> -- robin
>
>
>
>
^ permalink raw reply
* Re: performance problem: "git commit filename"
From: Junio C Hamano @ 2008-01-13 19:39 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List, Kristian H?gsberg
In-Reply-To: <alpine.LFD.1.00.0801130922030.2806@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Sun, 13 Jan 2008, Junio C Hamano wrote:
>>
>> The attached is a quick and dirty hack which may or may not
>> help. It all looks sane, this also is some core code, and meant
>> only for discussion and not application.
>
> I don't think this will help.
>
> You never set CE_UPTODATE, except in the "fill_stat_cache_info()"
> function, but that one will never be called for an old file that already
> matched the stat.
>
> So at a minimum, you should also make ie_match_stat() set CE_UPTODATE if
> it matches. Or something.
Unfortunately ie_match_stat() is too late. The caller is
supposed to have already called lstat(2) and give the result to
that function.
When refresh_cache_ent() finds the entry actually matched, we
could mark the path with CE_UPTODATE. That would be a
relatively contained and safe optimization that might help
git-commit.
About the CE_NAMEMASK limitation (and currently we do not check
it, so I think we would be screwed when a pathname that is
longer than (CE_NAMEMASK+1) and still fits under PATH_MAX is
given), I think we do not have to limit the maximum pathname
length. Instead we can teach create_ce_flags() and ce_namelen()
that a name longer than 2k (or 4k) has the NAMEMASK bits that
are all 1 and ce->name[] must be counted if so (with an obvious
optimization to start counting at byte position 2k or 4k in
ce_namelen()).
^ permalink raw reply
* Re: performance problem: "git commit filename"
From: Daniel Barkalow @ 2008-01-13 19:31 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Junio C Hamano, Git Mailing List, Kristian H?gsberg
In-Reply-To: <alpine.LFD.1.00.0801130850460.2806@woody.linux-foundation.org>
On Sun, 13 Jan 2008, Linus Torvalds wrote:
> On Sun, 13 Jan 2008, Daniel Barkalow wrote:
> >
> > The only issue I know about with using unpack_trees in C as a replacement
> > for read-tree in shell is that unpack_trees leaves "deletion" index
> > entries in memory which are not written to disk, but may surprise some
> > code (these are used to allow -u to remove the files from the working
> > tree).
>
> I certainly agree that this patch should be double-checked. I'm pretty
> sure the issue you mention wouldn't be an issue, since the end result is
> only used for actually updating the index and writing it out as a tree
> (both of which should handle the magic zero ce_mode case ok), but it would
> certainly be good to walk through all cases.
Yeah, I didn't think it would be an actual problem, but verifying that
requires looking outside of the context of the patch. It may even be worth
putting in a comment for now, since I bet wt_status_print and run_status
could be optimized in a way that would look perfectly reasonable (use
the in-memory index, instead of reading a file) but would expose the
magic case to the diff machinary, which (IIRC) doesn't handle it. But I
agree (having now looked at the rest of builtin-commit) that the odd index
entries can't escape, and this should be fine for 1.5.4.
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply
* Re: Adding Git to Better SCM Initiative : Comparison
From: linux @ 2008-01-13 19:20 UTC (permalink / raw)
To: Matthieu.Moy, linux; +Cc: jnareb, git
In-Reply-To: <20080113184206.22452.qmail@science.horizon.com>
I just had another look at the better-scm.org list, and noticed that
someone else has already given an equivalent answer:
Vesta Yes. The unit of checkout/checkin is a directory tree. Files and
directories can be added, deleted, and renamed between versions.
^ permalink raw reply
* [PATCH] http-push: making HTTP push more robust and more user-friendly
From: Grégoire Barbier @ 2008-01-13 19:02 UTC (permalink / raw)
To: git; +Cc: gitster, Grégoire Barbier
Fail when info/refs exists and is already locked (avoiding strange behaviour
and errors, and maybe avoiding some repository corruption).
Warn if the URL does not end with '/' (since 302 is not yet handled)
More explicit error message when the URL or password is not set correctly
(instead of "no DAV locking support").
DAV locking time of 1 minute instead of 10 minutes (avoid waiting 10 minutes
for a orphan lock to expire before anyone can do a push on the repo).
Signed-off-by: Grégoire Barbier <gb@gbarbier.org>
---
http-push.c | 17 ++++++++++++++++-
http.c | 25 +++++++++++++++++++++++++
http.h | 1 +
3 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/http-push.c b/http-push.c
index 55d0c94..c005903 100644
--- a/http-push.c
+++ b/http-push.c
@@ -57,7 +57,7 @@ enum XML_Status {
#define PROPFIND_ALL_REQUEST "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<D:propfind xmlns:D=\"DAV:\">\n<D:allprop/>\n</D:propfind>"
#define LOCK_REQUEST "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<D:lockinfo xmlns:D=\"DAV:\">\n<D:lockscope><D:exclusive/></D:lockscope>\n<D:locktype><D:write/></D:locktype>\n<D:owner>\n<D:href>mailto:%s</D:href>\n</D:owner>\n</D:lockinfo>"
-#define LOCK_TIME 600
+#define LOCK_TIME 60
#define LOCK_REFRESH 30
/* bits #0-15 in revision.h */
@@ -2224,6 +2224,16 @@ int main(int argc, char **argv)
no_pragma_header = curl_slist_append(no_pragma_header, "Pragma:");
+ /* Verify connexion string (agains bad URLs or password errors) */
+ if (remote->url && remote->url[strlen(remote->url)-1] != '/') {
+ fprintf(stderr, "Warning: remote URL does not end with a '/' which often leads to problems\n");
+ }
+ if (!http_test_connection(remote->url)) {
+ fprintf(stderr, "Error: cannot access to remote URL (maybe malformed URL, network error or bad credentials)\n");
+ rc = 1;
+ goto cleanup;
+ }
+
/* Verify DAV compliance/lock support */
if (!locking_available()) {
fprintf(stderr, "Error: no DAV locking support on remote repo %s\n", remote->url);
@@ -2239,6 +2249,11 @@ int main(int argc, char **argv)
info_ref_lock = lock_remote("info/refs", LOCK_TIME);
if (info_ref_lock)
remote->can_update_info_refs = 1;
+ else {
+ fprintf(stderr, "Error: cannot lock existing info/refs\n");
+ rc = 1;
+ goto cleanup;
+ }
}
if (remote->has_info_packs)
fetch_indices();
diff --git a/http.c b/http.c
index d2c11ae..8b04ae9 100644
--- a/http.c
+++ b/http.c
@@ -634,3 +634,28 @@ int http_fetch_ref(const char *base, const char *ref, unsigned char *sha1)
free(url);
return ret;
}
+
+int http_test_connection(const char *url)
+{
+ struct strbuf buffer = STRBUF_INIT;
+ struct active_request_slot *slot;
+ struct slot_results results;
+ int ret = 0;
+
+ slot = get_active_slot();
+ slot->results = &results;
+ curl_easy_setopt(slot->curl, CURLOPT_FILE, &buffer);
+ curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
+ curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, NULL);
+ curl_easy_setopt(slot->curl, CURLOPT_URL, url);
+ if (start_active_slot(slot)) {
+ run_active_slot(slot);
+ if (results.curl_result == CURLE_OK)
+ ret = -1;
+ else
+ error("Cannot access to URL %s, return code %d", url, results.curl_result);
+ } else
+ error("Unable to start request");
+ strbuf_release(&buffer);
+ return ret;
+}
diff --git a/http.h b/http.h
index aeba930..b353007 100644
--- a/http.h
+++ b/http.h
@@ -77,6 +77,7 @@ extern void step_active_slots(void);
extern void http_init(void);
extern void http_cleanup(void);
+extern int http_test_connection(const char *url);
extern int data_received;
extern int active_requests;
--
1.5.3.6
^ permalink raw reply related
* [PATCH] http-push: fix webdav lock leak.
From: Grégoire Barbier @ 2008-01-13 19:02 UTC (permalink / raw)
To: git; +Cc: gitster, Grégoire Barbier
In-Reply-To: <1200250979-19604-1-git-send-email-gb@gbarbier.org>
Releasing webdav lock even if push fails because of bad (or no) reference
on command line.
Signed-off-by: Grégoire Barbier <gb@gbarbier.org>
---
http-push.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/http-push.c b/http-push.c
index c005903..cbbf432 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2275,11 +2275,14 @@ int main(int argc, char **argv)
if (!remote_tail)
remote_tail = &remote_refs;
if (match_refs(local_refs, remote_refs, &remote_tail,
- nr_refspec, (const char **) refspec, push_all))
- return -1;
+ nr_refspec, (const char **) refspec, push_all)) {
+ rc = -1;
+ goto cleanup;
+ }
if (!remote_refs) {
fprintf(stderr, "No refs in common and none specified; doing nothing.\n");
- return 0;
+ rc = 0;
+ goto cleanup;
}
new_refs = 0;
@@ -2410,10 +2413,10 @@ int main(int argc, char **argv)
fprintf(stderr, "Unable to update server info\n");
}
}
- if (info_ref_lock)
- unlock_remote(info_ref_lock);
cleanup:
+ if (info_ref_lock)
+ unlock_remote(info_ref_lock);
free(remote);
curl_slist_free_all(no_pragma_header);
--
1.5.3.6
^ permalink raw reply related
* [PATCH] http-push: disable http-push without USE_CURL_MULTI
From: Grégoire Barbier @ 2008-01-13 19:02 UTC (permalink / raw)
To: git; +Cc: gitster, Grégoire Barbier
In-Reply-To: <1200250979-19604-2-git-send-email-gb@gbarbier.org>
Make http-push always fail when not compiled with USE_CURL_MULTI, since
otherwise it corrupts the remote repository (and then fails anyway).
Signed-off-by: Grégoire Barbier <gb@gbarbier.org>
---
http-push.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/http-push.c b/http-push.c
index cbbf432..96c8e75 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2212,6 +2212,10 @@ int main(int argc, char **argv)
break;
}
+#ifndef USE_CURL_MULTI
+ die("git-push is not available for http/https repository when not compiled with USE_CURL_MULTI");
+#endif
+
if (!remote->url)
usage(http_push_usage);
--
1.5.3.6
^ 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