* Re: Compact view of history in gitk
From: Johannes Sixt @ 2009-09-29 12:07 UTC (permalink / raw)
To: Yakup Akbay; +Cc: git
In-Reply-To: <4AC1F435.4030802@ubicom.com>
Yakup Akbay schrieb:
> Think of the gitk version of the history below:
>
> E-*-*-*-F
> /
> A-*-*-*-*-*-*-B-C-*-*-*-D
> \
> G-*-*-H-*-*-*-I
> \
> J-*-*-*-*-*-K
>
>
> I want an output like this:
>
> E-~-F
> /
> A-~-B-C-~-D
> \
> G-~-H-~-I
> \
> J-~-K
>
> Is there an option in gitk (or in any other tool) to get such a view?
I think, --simplify-by-decoration comes close, even though it may not be
100% what you describe.
-- Hannes
^ permalink raw reply
* Re: Compact view of history in gitk
From: Yakup Akbay @ 2009-09-29 12:44 UTC (permalink / raw)
To: Johannes Sixt; +Cc: git
In-Reply-To: <4AC1F88E.7080802@viscovery.net>
Johannes Sixt wrote:
> Yakup Akbay schrieb:
>
>> Think of the gitk version of the history below:
>>
>> E-*-*-*-F
>> /
>> A-*-*-*-*-*-*-B-C-*-*-*-D
>> \
>> G-*-*-H-*-*-*-I
>> \
>> J-*-*-*-*-*-K
>>
>>
>> I want an output like this:
>>
>> E-~-F
>> /
>> A-~-B-C-~-D
>> \
>> G-~-H-~-I
>> \
>> J-~-K
>>
>> Is there an option in gitk (or in any other tool) to get such a view?
>>
>
> I think, --simplify-by-decoration comes close, even though it may not be
> 100% what you describe.
>
> -- Hannes
>
Thanks Hannes, this is exactly what I need!
Yakup
^ permalink raw reply
* git-diff/git-diff-files: Turn off copy-detection?
From: Marius Storm-Olsen @ 2009-09-29 12:50 UTC (permalink / raw)
To: Git Mailing List
Hi,
I'm trying to diff the header files between two version of a repo, to
do an ABI review, but get too many diffs from 'similar copy', which
makes the review hard. These are generally unrelated files, but due to
large copyright header, and spaces, the actual changes are not large
enough to be detected as new files. I'd therefore like to turn off
copy detection completely, or at least set some kind of threshold
before a file is considered a copy in the diff.
Doing a 'git diff origin/4.5..origin/4.6 -- src/corelib' gives me this
excerpt:
diff --git origin/4.5/src/corelib/tools/qtimeline.h
origin/4.6/src/corelib/animation/qabstractanimation.h
similarity index 58%
...
diff --git origin/4.5/src/corelib/kernel/qsystemsemaphore.h
origin/4.6/src/corelib/animation/qanimationgroup.h
similarity index 63%
...
diff --git origin/4.5/src/corelib/kernel/qsystemsemaphore.h
origin/4.6/src/corelib/animation/qparallelanimationgroup.h
similarity index 63%
...
diff --git origin/4.5/src/corelib/io/qresource_iterator_p.h
origin/4.6/src/corelib/animation/qpauseanimation.h
similarity index 68%
...
diff --git origin/4.5/src/corelib/kernel/qsystemsemaphore.h
origin/4.6/src/corelib/animation/qpropertyanimation.h
similarity index 60%
...
diff --git origin/4.5/src/corelib/kernel/qsystemsemaphore.h
origin/4.6/src/corelib/animation/qsequentialanimationgroup.h
similarity index 55%
...
diff --git origin/4.5/src/corelib/animation/qvariantanimation.h
origin/4.6/src/corelib/animation/qvariantanimation.h
new file mode 100644
...
diff --git origin/4.5/src/corelib/arch/qatomic_arch.h
origin/4.6/src/corelib/arch/qatomic_arch.h
index 52ab101..548a5e9 100644
So, not even related. They should really had shown up as new files,
IMO. (I guess git stores the creation of the file as a delta of the
indicated 'copy', but in this case I don't care about that :)
Thanks!
--
.marius
^ permalink raw reply
* Re: Alles wird Git, Berlin, Oct 3rd, 2009
From: Erik Faye-Lund @ 2009-09-29 12:51 UTC (permalink / raw)
To: Christian Halstrick; +Cc: git
In-Reply-To: <loom.20090929T111919-714@post.gmane.org>
On Tue, Sep 29, 2009 at 11:30 AM, Christian Halstrick
<christian.halstrick@sap.com> wrote:
> Thank god msysgit has learned git send-email.
You're welcome ;)
--
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656
^ permalink raw reply
* Re: git-diff/git-diff-files: Turn off copy-detection?
From: Johannes Sixt @ 2009-09-29 13:40 UTC (permalink / raw)
To: Marius Storm-Olsen; +Cc: Git Mailing List
In-Reply-To: <4AC20286.6020108@gmail.com>
Marius Storm-Olsen schrieb:
> I'm trying to diff the header files between two version of a repo, to do
> an ABI review, but get too many diffs from 'similar copy', which makes
> the review hard. These are generally unrelated files, but due to large
> copyright header, and spaces, the actual changes are not large enough to
> be detected as new files. I'd therefore like to turn off copy detection
> completely, or at least set some kind of threshold before a file is
> considered a copy in the diff.
>
> Doing a 'git diff origin/4.5..origin/4.6 -- src/corelib' gives me this
> excerpt:
>
> diff --git origin/4.5/src/corelib/tools/qtimeline.h
> origin/4.6/src/corelib/animation/qabstractanimation.h
> similarity index 58%
> ...
You must have the config variable diff.renames set. But I would not expect
that this setting applies to 'git diff-files', only to 'git diff'.
You can also try 'git diff -C99 -M99' if you don't want to unset the
config variable.
-- Hannes
^ permalink raw reply
* Re: git-diff/git-diff-files: Turn off copy-detection?
From: Miklos Vajna @ 2009-09-29 13:42 UTC (permalink / raw)
To: Marius Storm-Olsen; +Cc: Git Mailing List
In-Reply-To: <4AC20286.6020108@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 563 bytes --]
On Tue, Sep 29, 2009 at 02:50:14PM +0200, Marius Storm-Olsen <mstormo@gmail.com> wrote:
> So, not even related. They should really had shown up as new files,
> IMO. (I guess git stores the creation of the file as a delta of the
> indicated 'copy', but in this case I don't care about that :)
No, it does not (as long as we are not talking about packfiles). AFAIK
copy detection is disabled by default, so probably you have a setting
that enables it for you and you forgot about it. Are you sure you don't
have any settings like diff.renames = copies?
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [PATCH] git-blame.el: Change how blame information is shown.
From: David Kågedal @ 2009-09-29 13:39 UTC (permalink / raw)
To: git
In-Reply-To: <1254230666-18283-1-git-send-email-davidk@lysator.liu.se>
>From: David@krank.kagedal.org, Kågedal@krank.kagedal.org, davidk@lysator.liu.se
Sorry about the broken from address.
--
David Kågedal
^ permalink raw reply
* clone from url with email address as username?(escaping @ symbol)
From: Ben Bennett @ 2009-09-29 14:20 UTC (permalink / raw)
To: git
Is there any escape sequence for the @ symbol when cloning?
Thanks,
Ben
^ permalink raw reply
* Re: git-diff/git-diff-files: Turn off copy-detection?
From: Marius Storm-Olsen @ 2009-09-29 14:24 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Git Mailing List
In-Reply-To: <4AC20E37.3090204@viscovery.net>
Johannes Sixt said the following on 29.09.2009 15:40:
> Marius Storm-Olsen schrieb:
>> Doing a 'git diff origin/4.5..origin/4.6 -- src/corelib' gives me this
>> excerpt:
>>
>> diff --git origin/4.5/src/corelib/tools/qtimeline.h
>> origin/4.6/src/corelib/animation/qabstractanimation.h
>> similarity index 58%
>> ...
>
> You must have the config variable diff.renames set. But I would not expect
> that this setting applies to 'git diff-files', only to 'git diff'.
$ git config diff.renames
copies
That's it, thanks! Strange that nothing in the git-diff documentation
pointed me in this direction? Obviously I didn't connect the dots
between 'copy' and 'renames' either..
> You can also try 'git diff -C99 -M99' if you don't want to unset the
> config variable.
Thanks, I'll add that to my review script. Much appreciated!
--
.marius
^ permalink raw reply
* Re: clone from url with email address as username?(escaping @ symbol)
From: Sverre Rabbelier @ 2009-09-29 14:25 UTC (permalink / raw)
To: Ben Bennett; +Cc: git
In-Reply-To: <970bc7c80909290720i1c5566fer1c1a3db744edc609@mail.gmail.com>
Heya,
On Tue, Sep 29, 2009 at 16:20, Ben Bennett <benbennett@gmail.com> wrote:
> Is there any escape sequence for the @ symbol when cloning?
I thought @ is not allowed to be in an url? What do you need to escape it for?
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: clone from url with email address as username?(escaping @ symbol)
From: Matthieu Moy @ 2009-09-29 14:30 UTC (permalink / raw)
To: Sverre Rabbelier; +Cc: Ben Bennett, git
In-Reply-To: <fabb9a1e0909290725w616c3ea9vcb1d2c53950f7788@mail.gmail.com>
Sverre Rabbelier <srabbelier@gmail.com> writes:
> Heya,
>
> On Tue, Sep 29, 2009 at 16:20, Ben Bennett <benbennett@gmail.com> wrote:
>> Is there any escape sequence for the @ symbol when cloning?
>
> I thought @ is not allowed to be in an url? What do you need to
> escape it for?
If your username is "foo@bar.com", then the clone URL might well be
ssh://foo@bar.com@server.com/path/to/repo
The question is which @ is the login/server separator, and which one
is included in the login. A quick test with
git clone ssh://foo@bar.com@localhost/path/to/repo
shows me that Git does the right thing, i.e. uses "foo@bar.com" as the
login, without the need to escape it.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply
* Re: clone from url with email address as username?(escaping @ symbol)
From: Sverre Rabbelier @ 2009-09-29 14:32 UTC (permalink / raw)
To: Matthieu Moy; +Cc: Ben Bennett, git
In-Reply-To: <vpq1vlp962h.fsf@bauges.imag.fr>
Heya,
On Tue, Sep 29, 2009 at 16:30, Matthieu Moy
<Matthieu.Moy@grenoble-inp.fr> wrote:
> The question is which @ is the login/server separator, and which one
> is included in the login. A quick test with
I think it only makes sense that this would work, since any @ can
never be part of the server name (since it's not an allowed
character), so I'm still curious why Ben wants to escape his @.
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: git-diff/git-diff-files: Turn off copy-detection?
From: Miklos Vajna @ 2009-09-29 15:05 UTC (permalink / raw)
To: Marius Storm-Olsen; +Cc: Johannes Sixt, Git Mailing List
In-Reply-To: <4AC218BB.4080807@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 348 bytes --]
On Tue, Sep 29, 2009 at 04:24:59PM +0200, Marius Storm-Olsen <marius@storm-olsen.com> wrote:
> $ git config diff.renames
> copies
>
> That's it, thanks! Strange that nothing in the git-diff documentation
> pointed me in this direction? Obviously I didn't connect the dots
> between 'copy' and 'renames' either..
See man git-config. :)
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* [PATCH] git-blame.el: Change how blame information is shown.
From: David Kågedal @ 2009-09-29 15:12 UTC (permalink / raw)
To: git
It is more customizable, and uses a line prefix to show the commit.
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---
I have only tested this on Emacs 23, so please test it on at least
Emacs 22 and let me know if there are any problems.
Suggestions for the default value of git-blame-prefix-format are also
welcome.
contrib/emacs/git-blame.el | 156 +++++++++++++++++++++++++++++---------------
1 files changed, 102 insertions(+), 54 deletions(-)
diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index 4fa70c5..2f25ff4 100644
--- a/contrib/emacs/git-blame.el
+++ b/contrib/emacs/git-blame.el
@@ -80,6 +80,57 @@
(eval-when-compile (require 'cl)) ; to use `push', `pop'
+(defface git-blame-prefix-face
+ '((((background dark)) (:foreground "gray"
+ :background "black"))
+ (((background light)) (:foreground "gray"
+ :background "white"))
+ (t (:weight bold)))
+ "The face used for the hash prefix."
+ :group 'git-blame)
+
+(defgroup git-blame nil
+ "A minor mode showing Git blame information."
+ :group 'git
+ :link '(function-link git-blame-mode))
+
+
+(defcustom git-blame-use-colors t
+ "Use colors to indicate commits in `git-blame-mode'."
+ :type 'boolean
+ :group 'git-blame)
+
+(defcustom git-blame-prefix-format
+ "%h %20A:"
+ "The format of the prefix added to each line in `git-blame'
+mode. The format is passed to `format-spec' with the following format keys:
+
+ %h - the abbreviated hash
+ %H - the full hash
+ %a - the author name
+ %A - the author email
+ %c - the committer name
+ %C - the committer email
+ %s - the commit summary
+"
+ :group 'git-blame)
+
+(defcustom git-blame-mouseover-format
+ "%h %a %A: %s"
+ "The format of the description shown when pointing at a line in
+`git-blame' mode. The format string is passed to `format-spec'
+with the following format keys:
+
+ %h - the abbreviated hash
+ %H - the full hash
+ %a - the author name
+ %A - the author email
+ %c - the committer name
+ %C - the committer email
+ %s - the commit summary
+"
+ :group 'git-blame)
+
(defun git-blame-color-scale (&rest elements)
"Given a list, returns a list of triples formed with each
@@ -302,72 +353,69 @@ See also function `git-blame-mode'."
(src-line (string-to-number (match-string 2)))
(res-line (string-to-number (match-string 3)))
(num-lines (string-to-number (match-string 4))))
- (setq git-blame-current
- (if (string= hash "0000000000000000000000000000000000000000")
- nil
- (git-blame-new-commit
- hash src-line res-line num-lines))))
- (delete-region (point) (match-end 0))
- t)
- ((looking-at "filename \\(.+\\)\n")
- (let ((filename (match-string 1)))
- (git-blame-add-info "filename" filename))
- (delete-region (point) (match-end 0))
+ (delete-region (point) (match-end 0))
+ (setq git-blame-current (list (git-blame-new-commit hash)
+ src-line res-line num-lines)))
t)
((looking-at "\\([a-z-]+\\) \\(.+\\)\n")
(let ((key (match-string 1))
(value (match-string 2)))
- (git-blame-add-info key value))
- (delete-region (point) (match-end 0))
- t)
- ((looking-at "boundary\n")
- (setq git-blame-current nil)
- (delete-region (point) (match-end 0))
+ (delete-region (point) (match-end 0))
+ (git-blame-add-info (car git-blame-current) key value)
+ (when (string= key "filename")
+ (git-blame-create-overlay (car git-blame-current)
+ (caddr git-blame-current)
+ (cadddr git-blame-current))
+ (setq git-blame-current nil)))
t)
(t
nil)))
-(defun git-blame-new-commit (hash src-line res-line num-lines)
+(defun git-blame-new-commit (hash)
+ (with-current-buffer git-blame-file
+ (or (gethash hash git-blame-cache)
+ ;; Assign a random color to each new commit info
+ ;; Take care not to select the same color multiple times
+ (let* ((color (if git-blame-colors
+ (git-blame-random-pop git-blame-colors)
+ git-blame-ancient-color))
+ (info `(,hash (color . ,color))))
+ (puthash hash info git-blame-cache)
+ info))))
+
+(defun git-blame-create-overlay (info start-line num-lines)
(save-excursion
(set-buffer git-blame-file)
- (let ((info (gethash hash git-blame-cache))
- (inhibit-point-motion-hooks t)
+ (let ((inhibit-point-motion-hooks t)
(inhibit-modification-hooks t))
- (when (not info)
- ;; Assign a random color to each new commit info
- ;; Take care not to select the same color multiple times
- (let ((color (if git-blame-colors
- (git-blame-random-pop git-blame-colors)
- git-blame-ancient-color)))
- (setq info (list hash src-line res-line num-lines
- (git-describe-commit hash)
- (cons 'color color))))
- (puthash hash info git-blame-cache))
- (goto-line res-line)
- (while (> num-lines 0)
- (if (get-text-property (point) 'git-blame)
- (forward-line)
- (let* ((start (point))
- (end (progn (forward-line 1) (point)))
- (ovl (make-overlay start end)))
- (push ovl git-blame-overlays)
- (overlay-put ovl 'git-blame info)
- (overlay-put ovl 'help-echo hash)
+ (goto-line start-line)
+ (let* ((start (point))
+ (end (progn (forward-line num-lines) (point)))
+ (ovl (make-overlay start end))
+ (hash (car info))
+ (spec `((?h . ,(substring hash 0 6))
+ (?H . ,hash)
+ (?a . ,(git-blame-get-info info 'author))
+ (?A . ,(git-blame-get-info info 'author-mail))
+ (?c . ,(git-blame-get-info info 'committer))
+ (?C . ,(git-blame-get-info info 'committer-mail))
+ (?s . ,(git-blame-get-info info 'summary)))))
+ (push ovl git-blame-overlays)
+ (overlay-put ovl 'git-blame info)
+ (overlay-put ovl 'help-echo
+ (format-spec git-blame-mouseover-format spec))
+ (if git-blame-use-colors
(overlay-put ovl 'face (list :background
- (cdr (assq 'color (nthcdr 5 info)))))
- ;; the point-entered property doesn't seem to work in overlays
- ;;(overlay-put ovl 'point-entered
- ;; `(lambda (x y) (git-blame-identify ,hash)))
- (let ((modified (buffer-modified-p)))
- (put-text-property (if (= start 1) start (1- start)) (1- end)
- 'point-entered
- `(lambda (x y) (git-blame-identify ,hash)))
- (set-buffer-modified-p modified))))
- (setq num-lines (1- num-lines))))))
-
-(defun git-blame-add-info (key value)
- (if git-blame-current
- (nconc git-blame-current (list (cons (intern key) value)))))
+ (cdr (assq 'color (cdr info))))))
+ (overlay-put ovl 'line-prefix
+ (propertize (format-spec git-blame-prefix-format spec)
+ 'face 'git-blame-prefix-face))))))
+
+(defun git-blame-add-info (info key value)
+ (nconc info (list (cons (intern key) value))))
+
+(defun git-blame-get-info (info key)
+ (cdr (assq key (cdr info))))
(defun git-blame-current-commit ()
(let ((info (get-char-property (point) 'git-blame)))
--
1.6.4.rc3.21.g3b9e
^ permalink raw reply related
* Re: Compact view of history in gitk
From: Martin Langhoff @ 2009-09-29 15:21 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Yakup Akbay, git
In-Reply-To: <4AC1F88E.7080802@viscovery.net>
On Tue, Sep 29, 2009 at 2:07 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> I think, --simplify-by-decoration comes close, even though it may not be
> 100% what you describe.
That is awesome.
Awesomer would be teaching gitk to expand (un-simplify) parts of it.
Probably a pig of a project to do though :-/
m
--
martin.langhoff@gmail.com
martin@laptop.org -- School Server Architect
- ask interesting questions
- don't get distracted with shiny stuff - working code first
- http://wiki.laptop.org/go/User:Martinlanghoff
^ permalink raw reply
* Re: clone from url with email address as username?(escaping @ symbol)
From: Ben Bennett @ 2009-09-29 15:31 UTC (permalink / raw)
To: Sverre Rabbelier; +Cc: Matthieu Moy, git
In-Reply-To: <fabb9a1e0909290732h5119170ew133d906b67e49f99@mail.gmail.com>
I am attempting to do a https clone. The username is an email address
but when I do a clone here is what happens.
Here is what I get , I might be messing up the clone command . btw ,
if i leave switch it to ssh , yes it does resolve the url correctly.
git clone https://benjamin.j.bennett@fooserver.com@fooserver.com/git_repos/main-code.git/
test
Initialized empty Git repository in /home/benjamin/planning_workspace/test/.git/
Password:
error: Couldn't resolve host 'fooserver.com@fooserver.com' while
accessing https://benjamin.j.bennett@fooserver.com@myfooserver.com/git_repos/main-code.git//info/refs
On Tue, Sep 29, 2009 at 9:32 AM, Sverre Rabbelier <srabbelier@gmail.com> wrote:
> Heya,
>
> On Tue, Sep 29, 2009 at 16:30, Matthieu Moy
> <Matthieu.Moy@grenoble-inp.fr> wrote:
>> The question is which @ is the login/server separator, and which one
>> is included in the login. A quick test with
>
> I think it only makes sense that this would work, since any @ can
> never be part of the server name (since it's not an allowed
> character), so I'm still curious why Ben wants to escape his @.
>
> --
> Cheers,
>
> Sverre Rabbelier
>
^ permalink raw reply
* Re: [PATCH 7/6 (v4)] support for commit grafts, slight change to general mechanism
From: Shawn O. Pearce @ 2009-09-29 16:34 UTC (permalink / raw)
To: Nick Edelen
Cc: Junio C Hamano, Nicolas Pitre, Johannes Schindelin, Sam Vilain,
Michael J Gruber, Jeff King, Andreas Ericsson, Christian Couder,
git@vger.kernel.org
In-Reply-To: <op.u0xtfzjrtdk399@sirnot.ed.ac.uk>
Nick Edelen <sirnot@gmail.com> wrote:
> Adds support for graft commits in rev-cache (w/ test), and slightly alters
> graft mechanism. Before, parse_commit() checked the graft list on every
> commit. Now register_commit_graft() preemptively loads graft commits into
> memory, and sets a new 'graft' flag in the object. This allows awareness of
> the commits' medical history without searching a (normally private) array upon
> each commit.
...
> diff --git a/builtin-rev-cache.c b/builtin-rev-cache.c
> index 4c1766d..b36bc39 100644
This doesn't apply against ne/rev-cache^, and I don't have the
blobs in my repostiory. So I'm dropping this patch and will wait
for a resend of the series or something...
--
Shawn.
^ permalink raw reply
* Re: [PATCH 1/2] builtin-mailinfo.c: check error status from rewind and ftruncate
From: Shawn O. Pearce @ 2009-09-29 16:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <1254206409-13256-1-git-send-email-gitster@pobox.com>
Junio C Hamano <gitster@pobox.com> wrote:
> A recent "cut at scissors" implementation rewinds and truncates the output
> file to store the message when it sees a scissors mark, but it did not
> check if these library calls succeeded.
...
> diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
> index d498b1c..3306d9e 100644
> --- a/builtin-mailinfo.c
> +++ b/builtin-mailinfo.c
> @@ -785,8 +785,10 @@ static int handle_commit_msg(struct strbuf *line)
>
> if (use_scissors && is_scissors_line(line)) {
> int i;
> - rewind(cmitmsg);
> - ftruncate(fileno(cmitmsg), 0);
> + if (rewind(cmitmsg))
Uh...
builtin-mailinfo.c: In function 'handle_commit_msg':
builtin-mailinfo.c:788: error: void value not ignored as it ought to be
I think you mean to squash this in, and use fseek instead:
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index 3306d9e..c90cd31 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -785,7 +785,7 @@ static int handle_commit_msg(struct strbuf *line)
if (use_scissors && is_scissors_line(line)) {
int i;
- if (rewind(cmitmsg))
+ if (fseek(cmitmsg, 0L, SEEK_SET))
die_errno("Could not rewind output message file");
if (ftruncate(fileno(cmitmsg), 0))
die_errno("Could not truncate output message file at scissors");
--
Shawn.
^ permalink raw reply related
* [JGIT PATCH] Include description for missing prereqs
From: Sasa Zivkov @ 2009-09-29 14:03 UTC (permalink / raw)
To: Shawn O. Pearce, Robin Rosenberg; +Cc: git, Sasa Zivkov
From: Sasa Zivkov <sasa.zivkov@sap.com>
When throwing MissingBundlePrerequisiteException we
also include the short description, if available, of
each missing object.
This is the fix for the following issue:
http://code.google.com/p/egit/issues/detail?id=25
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
---
.../errors/MissingBundlePrerequisiteException.java | 19 +++++++++++--------
.../jgit/transport/BundleFetchConnection.java | 20 +++++++++++++-------
2 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/errors/MissingBundlePrerequisiteException.java b/org.spearce.jgit/src/org/spearce/jgit/errors/MissingBundlePrerequisiteException.java
index d2335c1..d90350c 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/errors/MissingBundlePrerequisiteException.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/errors/MissingBundlePrerequisiteException.java
@@ -37,7 +37,7 @@
package org.spearce.jgit.errors;
-import java.util.Collection;
+import java.util.Map;
import org.spearce.jgit.lib.ObjectId;
import org.spearce.jgit.transport.URIish;
@@ -48,12 +48,14 @@
public class MissingBundlePrerequisiteException extends TransportException {
private static final long serialVersionUID = 1L;
- private static String format(final Collection<ObjectId> ids) {
+ private static String format(final Map<ObjectId, String> missingCommits) {
final StringBuilder r = new StringBuilder();
r.append("missing prerequisite commits:");
- for (final ObjectId p : ids) {
+ for (final Map.Entry<ObjectId, String> e : missingCommits.entrySet()) {
r.append("\n ");
- r.append(p.name());
+ r.append(e.getKey().name());
+ if (e.getValue() != null)
+ r.append(" ").append(e.getValue());
}
return r.toString();
}
@@ -63,11 +65,12 @@ private static String format(final Collection<ObjectId> ids) {
*
* @param uri
* URI used for transport
- * @param ids
- * the ids of the base/common object(s) we don't have.
+ * @param missingCommits
+ * the Map of the base/common object(s) we don't have. Keys are
+ * ids of the missing objects and values are short descriptions.
*/
public MissingBundlePrerequisiteException(final URIish uri,
- final Collection<ObjectId> ids) {
- super(uri, format(ids));
+ final Map<ObjectId, String> missingCommits) {
+ super(uri, format(missingCommits));
}
}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/BundleFetchConnection.java b/org.spearce.jgit/src/org/spearce/jgit/transport/BundleFetchConnection.java
index 14e0c7d..034e158 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/BundleFetchConnection.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/BundleFetchConnection.java
@@ -44,9 +44,10 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
+import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.spearce.jgit.errors.MissingBundlePrerequisiteException;
@@ -75,7 +76,7 @@
InputStream bin;
- final Set<ObjectId> prereqs = new HashSet<ObjectId>();
+ final Map<ObjectId, String> prereqs = new HashMap<ObjectId, String>();
private String lockMessage;
@@ -120,7 +121,11 @@ private void readBundleV2() throws IOException {
break;
if (line.charAt(0) == '-') {
- prereqs.add(ObjectId.fromString(line.substring(1, 41)));
+ ObjectId id = ObjectId.fromString(line.substring(1, 41));
+ String shortDesc = null;
+ if (line.length() > 42)
+ shortDesc = line.substring(42);
+ prereqs.put(id, shortDesc);
continue;
}
@@ -199,9 +204,10 @@ private void verifyPrerequisites() throws TransportException {
final RevFlag PREREQ = rw.newFlag("PREREQ");
final RevFlag SEEN = rw.newFlag("SEEN");
- final List<ObjectId> missing = new ArrayList<ObjectId>();
+ final Map<ObjectId, String> missing = new HashMap<ObjectId, String>();
final List<RevObject> commits = new ArrayList<RevObject>();
- for (final ObjectId p : prereqs) {
+ for (final Map.Entry<ObjectId, String> e : prereqs.entrySet()) {
+ ObjectId p = e.getKey();
try {
final RevCommit c = rw.parseCommit(p);
if (!c.has(PREREQ)) {
@@ -209,7 +215,7 @@ private void verifyPrerequisites() throws TransportException {
commits.add(c);
}
} catch (MissingObjectException notFound) {
- missing.add(p);
+ missing.put(p, e.getValue());
} catch (IOException err) {
throw new TransportException(transport.uri, "Cannot read commit "
+ p.name(), err);
@@ -243,7 +249,7 @@ private void verifyPrerequisites() throws TransportException {
if (remaining > 0) {
for (final RevObject o : commits) {
if (!o.has(SEEN))
- missing.add(o);
+ missing.put(o, prereqs.get(o));
}
throw new MissingBundlePrerequisiteException(transport.uri, missing);
}
--
1.6.4.msysgit.0
^ permalink raw reply related
* Re: clone from url with email address as username?(escaping @ symbol)
From: Matthieu Moy @ 2009-09-29 17:07 UTC (permalink / raw)
To: Ben Bennett; +Cc: Sverre Rabbelier, git
In-Reply-To: <vpq63b1u1p6.fsf@bauges.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
> In short, you have to use %40 to escape the @, and curl does it this
> way because the RFC doesn't allow @ in usernames.
I've added a FAQ on the wiki. Feel free to improve:
http://git.or.cz/gitwiki/GitFaq#Myusernamecontainsa.27.40.27.2CIcan.27tclonethroughHTTP.2BAC8-HTTPS
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply
* Re: clone from url with email address as username?(escaping @ symbol)
From: Matthieu Moy @ 2009-09-29 16:59 UTC (permalink / raw)
To: Ben Bennett; +Cc: Sverre Rabbelier, git
In-Reply-To: <970bc7c80909290831l59b7fc4at4ec0082f42f3ef87@mail.gmail.com>
Ben Bennett <benbennett@gmail.com> writes:
> I am attempting to do a https clone. The username is an email address
> but when I do a clone here is what happens.
Hmm, right, it works with ssh, but not http.
I tried a quick fix like this:
diff --git a/http.c b/http.c
index 23b2a19..361a6be 100644
--- a/http.c
+++ b/http.c
@@ -281,9 +281,10 @@ static void http_auth_init(const char *url)
* "proto://<host>/..."?
*/
cp += 3;
- at = strchr(cp, '@');
colon = strchr(cp, ':');
slash = strchrnul(cp, '/');
+ for(at = slash-1; *at != '@' && *at != '/'; at--)
+ continue;
if (!at || slash <= at)
return; /* No credentials */
if (!colon || at <= colon) {
Unfortunately, it seems the complete URL is passed to curl, and curl
is the one doing it wrong. Indeed:
$ curl -v https://user@email.com@server.com/path/
* getaddrinfo(3) failed for email.com@server.com:443
* Couldn't resolve host 'email.com@server.com'
* Closing connection #0
curl: (6) Couldn't resolve host 'email.com@server.com'
Now for the good news:
http://curl.haxx.se/mail/lib-2006-02/0134.html
http://sourceforge.net/tracker/index.php?func=detail&aid=2826621&group_id=976&atid=100976
In short, you have to use %40 to escape the @, and curl does it this
way because the RFC doesn't allow @ in usernames.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply related
* Re: clone from url with email address as username?(escaping @ symbol)
From: Ben Bennett @ 2009-09-29 17:51 UTC (permalink / raw)
To: Matthieu Moy; +Cc: Sverre Rabbelier, git
In-Reply-To: <vpq63b1u1p6.fsf@bauges.imag.fr>
Is it escaping the %40 when passed down? I am getting an error 401 ,
and checking the server logs , it is passing the %40 to the server in
the username.
Running curl from command line , I can connect, but through git , the
username is getting mangled or I have something screwed up.
I will look at http.c tonight after work, to see if I am messing something up.
Thanks,
Ben
On Tue, Sep 29, 2009 at 11:59 AM, Matthieu Moy
<Matthieu.Moy@grenoble-inp.fr> wrote:
> Ben Bennett <benbennett@gmail.com> writes:
>
>> I am attempting to do a https clone. The username is an email address
>> but when I do a clone here is what happens.
>
> Hmm, right, it works with ssh, but not http.
>
> I tried a quick fix like this:
>
> diff --git a/http.c b/http.c
> index 23b2a19..361a6be 100644
> --- a/http.c
> +++ b/http.c
> @@ -281,9 +281,10 @@ static void http_auth_init(const char *url)
> * "proto://<host>/..."?
> */
> cp += 3;
> - at = strchr(cp, '@');
> colon = strchr(cp, ':');
> slash = strchrnul(cp, '/');
> + for(at = slash-1; *at != '@' && *at != '/'; at--)
> + continue;
> if (!at || slash <= at)
> return; /* No credentials */
> if (!colon || at <= colon) {
>
> Unfortunately, it seems the complete URL is passed to curl, and curl
> is the one doing it wrong. Indeed:
>
> $ curl -v https://user@email.com@server.com/path/
> * getaddrinfo(3) failed for email.com@server.com:443
> * Couldn't resolve host 'email.com@server.com'
> * Closing connection #0
> curl: (6) Couldn't resolve host 'email.com@server.com'
>
> Now for the good news:
>
> http://curl.haxx.se/mail/lib-2006-02/0134.html
> http://sourceforge.net/tracker/index.php?func=detail&aid=2826621&group_id=976&atid=100976
>
> In short, you have to use %40 to escape the @, and curl does it this
> way because the RFC doesn't allow @ in usernames.
>
> --
> Matthieu Moy
> http://www-verimag.imag.fr/~moy/
>
^ permalink raw reply
* Re: clone from url with email address as username?(escaping @ symbol)
From: Daniel Stenberg @ 2009-09-29 17:48 UTC (permalink / raw)
To: Matthieu Moy; +Cc: Ben Bennett, Sverre Rabbelier, git
In-Reply-To: <vpq63b1u1p6.fsf@bauges.imag.fr>
On Tue, 29 Sep 2009, Matthieu Moy wrote:
> Unfortunately, it seems the complete URL is passed to curl, and curl
> is the one doing it wrong. Indeed:
>
> $ curl -v https://user@email.com@server.com/path/
> * getaddrinfo(3) failed for email.com@server.com:443
This is not exactly curl "doing it wrong". This is a user passing in something
that isn't a URL to the command that asks for a URL to work on. The user part
cannot legally have a '@' letter in a URL, you must encode it.
> In short, you have to use %40 to escape the @, and curl does it this way
> because the RFC doesn't allow @ in usernames.
Exactly. So curl is not "wrong", it just can't work around this user-error.
--
/ daniel.haxx.se
^ permalink raw reply
* Re: clone from url with email address as username?(escaping @ symbol)
From: Matthieu Moy @ 2009-09-29 18:03 UTC (permalink / raw)
To: Ben Bennett; +Cc: Sverre Rabbelier, git
In-Reply-To: <970bc7c80909291051q5dff9209u650cee4f84d92fae@mail.gmail.com>
Ben Bennett <benbennett@gmail.com> writes:
> Is it escaping the %40 when passed down? I am getting an error 401 ,
> and checking the server logs , it is passing the %40 to the server in
> the username.
> Running curl from command line , I can connect, but through git , the
> username is getting mangled or I have something screwed up.
OK, so it seems Git should be fixed to unescape this %40 somewhere,
most likely in http_auth_init in http.c, in addition to by fix below.
http://curl.haxx.se/libcurl/c/curl_easy_unescape.html might help. I've
consumed by Git time budget for now, so if anyone else can have a
look ...
>> --- a/http.c
>> +++ b/http.c
>> @@ -281,9 +281,10 @@ static void http_auth_init(const char *url)
>> * "proto://<host>/..."?
>> */
>> cp += 3;
>> - at = strchr(cp, '@');
>> colon = strchr(cp, ':');
>> slash = strchrnul(cp, '/');
>> + for(at = slash-1; *at != '@' && *at != '/'; at--)
>> + continue;
>> if (!at || slash <= at)
>> return; /* No credentials */
>> if (!colon || at <= colon) {
>>
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply
* Re: clone from url with email address as username?(escaping @ symbol)
From: Matthieu Moy @ 2009-09-29 18:09 UTC (permalink / raw)
To: Daniel Stenberg; +Cc: Ben Bennett, Sverre Rabbelier, git
In-Reply-To: <alpine.DEB.2.00.0909291946520.23903@tvnag.unkk.fr>
Daniel Stenberg <daniel@haxx.se> writes:
> On Tue, 29 Sep 2009, Matthieu Moy wrote:
>
>> Unfortunately, it seems the complete URL is passed to curl, and curl
>> is the one doing it wrong. Indeed:
>>
>> $ curl -v https://user@email.com@server.com/path/
>> * getaddrinfo(3) failed for email.com@server.com:443
>
> This is not exactly curl "doing it wrong". This is a user passing in
> something that isn't a URL to the command that asks for a URL to work
> on. The user part cannot legally have a '@' letter in a URL, you must
> encode it.
>
>> In short, you have to use %40 to escape the @, and curl does it this
>> way because the RFC doesn't allow @ in usernames.
>
> Exactly. So curl is not "wrong", it just can't work around this user-error.
It may not want work around user-errors, but you can hardly say that
it _can't_. Many tools do in this case, Firefox is one of them. And
anyway, trying to connect to email.com@server.com is probably the
worst thing it can do.
At least, it could warn about two @ in the URL and say it can't
handle it ...
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply
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