* Re: [PATCH 3/5] honour *_ASKPASS for querying username and for querying further actions like unknown certificates
From: Junio C Hamano @ 2011-12-27 20:56 UTC (permalink / raw)
To: Sven Strickroth; +Cc: git, Jakub Narebski, Jeff King
In-Reply-To: <4EF9ED24.2040902@tu-clausthal.de>
Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:
> git-svn reads usernames (and other stuff) from an interactive terminal.
> This behavior cause GUIs to hang waiting for git-svn to complete (http://code.google.com/p/tortoisegit/issues/detail?id=967).
(style) Wrap the line perhaps after "to complete".
Does the above mean "GUIs hang, until the user goes back to the terminal
and authenticates"? Where is the "interactive terminal" connected when
running the GUI?
With that bit information, I think the above is a decent problem
description (i.e. "what problem is this change trying to solve? is it
worth solving?").
The second paragraph (missing) should then discuss what approach is taken
by the proposed patch to solve that problem. Something like
Instead of using hand-rolled prompt-response code that only works with
the interactive terminal, use the git_prompt() method introduced in
the earlier commit.
would suffice (I didn't check what method name you used, though).
> Also see commit 56a853b62c0ae7ebaad0a7a0a704f5ef561eb795.
I checked that commit, and what you wanted to say is unclear. Are you
saying this patch attempts to fix the breakage by that commit? That commit
tried to go in a right direction but did not go far enough and you are
trying to enhance it? Somerthing else?
Which means that you shouldn't have said "Also see..." at all and instead
directly said what you wanted to say here.
^ permalink raw reply
* Re: [PATCH 4/5] ignore empty *_ASKPASS variables
From: Junio C Hamano @ 2011-12-27 21:00 UTC (permalink / raw)
To: Sven Strickroth; +Cc: git, Jakub Narebski, Jeff King, gitster
In-Reply-To: <4EF9ED38.9010502@tu-clausthal.de>
Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:
> Signed-off-by: Sven Strickroth <email@cs-ware.de>
> ---
I *suspect* that this is a fix-up to a bug in patch 1/5 that lets callers
call _askpass_prompt helper without checking the value of the "askpass",
and if that is the case, this patch should be squashed there.
But there is no justification in the proposed log message above, so I
cannot tell.
> perl/Git.pm | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/perl/Git.pm b/perl/Git.pm
> index 7fdf805..c6b3e11 100644
> --- a/perl/Git.pm
> +++ b/perl/Git.pm
> @@ -537,6 +537,9 @@ sub askpass_prompt {
>
> sub _askpass_prompt {
> my ($self, $askpass, $prompt) = _maybe_self(@_);
> + unless ($askpass) {
> + return undef;
> + }
> my $ret;
> open my $fh, "-|", $askpass, $prompt || return undef;
> $ret = <$fh>;
^ permalink raw reply
* Re: [PATCH 5/5] make askpass_prompt a global prompt method for asking users
From: Junio C Hamano @ 2011-12-27 21:10 UTC (permalink / raw)
To: Sven Strickroth; +Cc: git, Jakub Narebski, Jeff King
In-Reply-To: <4EF9ED58.8080205@tu-clausthal.de>
Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:
> Signed-off-by: Sven Strickroth <email@cs-ware.de>
> ---
I think the end result of having a prompt function that can be used with
or without echoing like Peff's git_prompt() series does is a very good
thing. But then we just should introduce "prompt()" from day one of the
series, instead of introducing a half-featured one "askpass_prompt()" and
then later renaming the callers like this patch does.
It may a good idea to take the stepwise approach like this series does,
but in that case, the proposed log message must explain what the new
"prompt()" function is and does. It is derived from askpass_prompt() and
apparently it does more than its ancestor, but what are differences
between the two?
For example, it is totally unclear why these two are equivalent without
any explanation in the commit log message.
> - $choice = Git->askpass_prompt("Certificate unknown. " . $options);
> - if (!defined $choice) {
> - print STDERR $options;
> - STDERR->flush;
> - $choice = lc(substr(<STDIN> || 'R', 0, 1));
> - }
> + $choice = substr(Git->prompt("Certificate unknown. " . $options) || 'R', 0, 1);
or this:
> - my $filename = Git->askpass_prompt("Client certificate filename:");
> - if (!defined $filename) {
> - print STDERR "Client certificate filename: ";
> - STDERR->flush;
> - chomp($filename = <STDIN>);
> - }
> - $cred->cert_file($filename);
> + $cred->cert_file(Git->prompt("Client certificate filename: "));
I *suspect* the difference is that you discarded that "return false at the
end to let the caller do whatever they want" found in patch 1/5 and have
the fallback inside the prompt() funtion now. And if that is the primary
difference between the old "askpass_prompt()" and the new "prompt()", I
tend to think that the series should be restructured to use the "prompt()"
semantics from the beginning. No reason to start with a known-to-be-wrong
way to do a thing and then fix it in a series that is new to the codebase.
Thanks.
^ permalink raw reply
* Re: [PATCH] add post-fetch hook
From: Johannes Sixt @ 2011-12-27 21:27 UTC (permalink / raw)
To: Joey Hess; +Cc: Junio C Hamano, git
In-Reply-To: <20111226023154.GA3243@gnu.kitenet.net>
Am 26.12.2011 03:31, schrieb Joey Hess:
> +int feed_post_fetch_hook (int in, int out, void *data)
> +{
> + struct ref *ref;
> + struct strbuf buf = STRBUF_INIT;
Is there a particular reason that you accumulate everything in a buffer?
If I read the loop below correctly, you should be able to run it using
only the functions sha1_to_hex(), strlen() and write_in_full(). This
would avoid any problems with concurrent calls to xmalloc().
> + int ret;
> +
> + for (ref = post_fetch_hook_refs; ref; ref = ref->next) {
> + strbuf_addstr(&buf, sha1_to_hex(ref->old_sha1));
sha1_to_hex() works with a static buffer. Are you certain that it is not
called concurrently in the main thread?
> + strbuf_addch(&buf, ' ');
> + strbuf_addstr(&buf, ref->merge ? "merge" : "not-for-merge");
> + strbuf_addch(&buf, ' ');
> + if (ref->name)
> + strbuf_addstr(&buf, ref->name);
> + strbuf_addch(&buf, ' ');
> + if (ref->peer_ref && ref->peer_ref->name)
> + strbuf_addstr(&buf, ref->peer_ref->name);
> + strbuf_addch(&buf, '\n');
> + }
-- Hannes
^ permalink raw reply
* Re: [PATCH 5/5] make askpass_prompt a global prompt method for asking users
From: Junio C Hamano @ 2011-12-27 21:41 UTC (permalink / raw)
To: Sven Strickroth; +Cc: git, Jakub Narebski, Jeff King
In-Reply-To: <7vd3b967ql.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> I *suspect* the difference is that you discarded that "return false at the
> end to let the caller do whatever they want" found in patch 1/5 and have
> the fallback inside the prompt() funtion now. And if that is the primary
> difference between the old "askpass_prompt()" and the new "prompt()", I
> tend to think that the series should be restructured to use the "prompt()"
> semantics from the beginning. No reason to start with a known-to-be-wrong
> way to do a thing and then fix it in a series that is new to the codebase.
After reading the series again, I think the right structure of this patch
series should be more like this:
(1/3) Add Git->prompt($prompt) and make _read_password in git-svn.perl to
use it. The prompt method should implement the Term::ReadKey based
fallback, so that _read_password do not have to roll its own. IOW,
a squash of your 1/5, 2/5, and a part of 5/5, plus possibly 4/5.
(2/3) Enhance Git->prompt($prompt, $is_password), and convert the various
existing terminal interacters to use it. The fallback in the prompt
method, when it is not reading in a noecho mode, should read a
single line from the standard input in cooked mode like your 5/5
does. IOW, a squash of your 3/5 and a part of 5/5.
(3/3) Possibly tests and docs.
Thanks.
^ permalink raw reply
* Re: [PATCH] gc --auto: warn garbage collection happens soon
From: Junio C Hamano @ 2011-12-27 21:52 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <1324993534-16307-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> This gives users a chance to run gc explicitly elsewhere if they do not
> want gc to run suddenly in current terminal.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
As I am still in a cheerly holiday mood, let's be a bit philosophical,
step back a bit and think.
After this patch gets applied, will the users start feeling bothered by
repeated "you will soon see auto-gc" messages and will want "you will soon
start seeing the you will soon see auto-gc messages" warnings?
And if the answer to that tongue-in-cheek question is no, what is the
reason why the users will not find the messages disturbing, while loathing
the auto-gc?
I suspect that is because auto-gc takes long time, making the user wait,
compared to the new message that may be noisy but quick. Perhaps the real
cure for the disease is not to add the message but to make an auto-gc less
painful, no?
What are the things we could do to make auto-gc less painful?
Are we doing something that is not necessary in auto-gc that takes time
but that we can live without doing?
It may be a better cure for the disease to force a full gc after
operations that we know the users already know to take long time (e.g. a
clone, a large fetch), so that the next auto-gc do not have to do much
work.
^ permalink raw reply
* [Wish] use postimage when showing common context in "diff -w"?
From: Junio C Hamano @ 2011-12-27 22:16 UTC (permalink / raw)
To: git; +Cc: Joey Hess
Joey's "write first for-merge ref to FETCH_HEAD first" ($gmane/187699)
wraps an existing large for(;;) loop inside another new loop, making the
existing code indented deeper. After queuing the patch, "git show -w"
displays a hunk like this [*1*]:
+ /*
+ * The first pass writes objects to be merged and then the
+ * second pass writes the rest, in order to allow using
+ * FETCH_HEAD as a refname to refer to the ref to be merged.
+ */
+ for (want_merge = 1; 0 <= want_merge; want_merge--) {
for (rm = ref_map; rm; rm = rm->next) {
struct ref *ref = NULL;
+ commit = lookup_commit_reference_gently(rm->old_sha1, 1);
+ if (!commit)
+ rm->merge = 0;
+
+ if (rm->merge != want_merge)
+ continue;
+
if (rm->peer_ref) {
ref = xcalloc(1, sizeof(*ref) + strlen(rm->peer_ref->name) + 1);
strcpy(ref->name, rm->peer_ref->name);
The context lines we can see in the above hunk are shown with incorrect
indentation level; I think we are showing the lines from the preimage.
It would be a really nice holiday gift to us, if somebody can fix this to
show lines from the postimage. It would make reviewing the change much
more pleasant. I obviously cannot throw this into my Amazon wishlist, so
instead I am posting it here ;-)
[Footnote]
*1* The text has my style fix-ups in it and does not match what was
posted. The patch lacked a sign-off and needs to be amended anyway. Also
it needs to adjust some existing tests (at least 5515 seems to break for
obvious reasons).
^ permalink raw reply
* Re: [PATCH 1/5] add central method for prompting a user using GIT_ASKPASS or SSH_ASKPASS
From: Thomas Adam @ 2011-12-27 23:12 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Sven Strickroth, git, Jakub Narebski, Jeff King
In-Reply-To: <7vwr9h68t9.fsf@alter.siamese.dyndns.org>
On 27 December 2011 20:47, Junio C Hamano <gitster@pobox.com> wrote:
> Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:
>> +sub askpass_prompt {
>> + my ($self, $prompt) = _maybe_self(@_);
>> + if (exists $ENV{'GIT_ASKPASS'}) {
>> + return _askpass_prompt($ENV{'GIT_ASKPASS'}, $prompt);
>> + } elsif (exists $ENV{'SSH_ASKPASS'}) {
>> + return _askpass_prompt($ENV{'SSH_ASKPASS'}, $prompt);
>> + } else {
>> + return undef;
>
> Two problems with this if/elsif/else cascade.
>
> - If _askpass_prompt() fails to open the pipe to ENV{'GIT_ASKPASS'}, it
> will return 'undef' to us. Don't we want to fall back to SSH_ASKPASS in
> such a case?
>
> - The last "return undef" makes all callers of this method to implement a
> fall-back way somehow. I find it very likely that they will want to use
Not only that, "return undef" will have nasty side-effects if this
subroutine is called in list-context -- it's usually discouraged to
have explicit returns of "undef", where in scalar context that might
be OK, but in list context, the caller will see:
(undef)
and not:
()
i.e., the empty list.
-- Thomas Adam
^ permalink raw reply
* Re: [PATCH] add post-fetch hook
From: Junio C Hamano @ 2011-12-27 23:23 UTC (permalink / raw)
To: Joey Hess; +Cc: git
In-Reply-To: <20111226155152.GA29582@gnu.kitenet.net>
Joey Hess <joey@kitenet.net> writes:
> From 073b0921bb5988628e7af423924c410f522f403a Mon Sep 17 00:00:00 2001
> From: Joey Hess <joey@kitenet.net>
> Date: Mon, 26 Dec 2011 10:53:27 -0400
> Subject: [PATCH 2/2] add tweak-fetch hook
>
> The tweak-fetch hook is fed lines on stdin for all refs that were fetched,
> and outputs on stdout possibly modified lines. Its output is parsed and
> used when git fetch updates the remote tracking refs, records the entries
> in FETCH_HEAD, and produces its report.
> ---
Just a few style things, as this is not a signed-off patch yet.
> @@ -162,6 +162,35 @@ This hook can be used to perform repository validity checks, auto-display
> differences from the previous HEAD if different, or set working dir metadata
> properties.
>
> +tweak-fetch
> +~~~~~~~~~~
The underline does not match what is being underlined. Does this format well?
> +This hook is invoked by 'git fetch' (commonly called by 'git pull'), after
> +refs have been fetched from the remote repository. It is not executed, if
> +nothing was fetched.
> +
> +The output of the hook is used to update the remote-tracking branches, and
> +`.git/FETCH_HEAD`, in preparation for for a later merge operation done by
> +'git merge'.
> +
> +It takes no arguments, but is fed a line of the following format on
> +its standard input for each ref that was fetched.
> +
> + <sha1> SP not-for-merge|merge SP <remote-refname> SP <local-refname> LF
> +
> +Where the "not-for-merge" flag indicates the ref is not to be merged into the
> +current branch, and the "merge" flag indicates that 'git merge' should
> +later merge it. The `<remote-refname>` is the remote's name for the ref
> +that was pulled, and `<local-refname>` is a name of a remote-tracking branch,
s/pulled/fetched/; I think. The remainder of the new text seems to use the
right terminology.
> +int feed_tweak_fetch_hook (int in, int out, void *data)
No SP between function name and the opening parenthesis of its parameter
list. We have SP after control-flow keywords e.g. "for (;;)" though.
Does this name need to be external (same question to many other new
functions in this patch)?
The "in" parameter seems unused. Does it have to be there for the "feed"
callback of the generic hook driver? As long as it is the "feed" callback,
I think that it just needs to take "out" and no "in", no?
> + for (ref = data; ref; ref = ref->next) {
> + strbuf_addstr(&buf, sha1_to_hex(ref->old_sha1));
> + strbuf_addch(&buf, ' ');
> + strbuf_addstr(&buf, ref->merge ? "merge" : "not-for-merge");
> + strbuf_addch(&buf, ' ');
strbuf_addf()?
But this might be a moot point, as J6t seems to have valid worries on
running functions that allocate memory in general...
> + ret = write_in_full(out, buf.buf, buf.len) != buf.len;
> + if (ret)
> + warning("%s hook failed to consume all its input",
> + tweak_fetch_hook);
> + close(out);
I was hoping that this part would be part of more generic hook driver
infrastructure. Even if we were to take this series before we refactor
existing other hook drivers, in order to avoid duplicated work later, we
could at least start from a right implementation of a generic hook driver
with a single user (which is the "tweak-fetch" hook driver), no?
> +struct ref *parse_tweak_fetch_hook_line (char *l,
> + struct string_list *existing_refs)
> +{
> + struct ref *ref = NULL, *peer_ref = NULL;
> + struct string_list_item *peer_item = NULL;
> + char *words[4];
> + int i, word=0;
SP around assingment and initialization "var = val" (throughout this
patch).
> + char *problem;
> +
> + for (i=0; l[i]; i++) {
Likewise.
> + if (isspace(l[i])) {
> + l[i]='\0';
> + words[word]=l;
> + l+=i+1;
> + i=0;
> + word++;
> + if (word > 3) {
> + problem="too many words";
> + goto unparsable;
> + }
> + }
> + }
> + if (word < 3) {
> + problem="not enough words";
> + goto unparsable;
> + }
Perhaps loop for up-to ARRAY_SIZE(words) times and use strchr()?
> + if (strcmp(words[1], "merge") == 0) {
We tend to say "if (!strcmp(...))" instead.
> + ref->merge=1;
> + }
> + else if (strcmp(words[1], "not-for-merge") != 0) {
Likewise.
> +struct refs_result read_tweak_fetch_hook (int in) {
Opening brace at column 1 of the next line.
> + if (prevref) {
> + prevref->next=ref;
> + prevref=ref;
> + }
> + else {
if (...) {
...
} else {
...
}
> +/* The hook is fed lines of the form:
> + * <sha1> SP <not-for-merge|merge> SP <remote-refname> SP <local-refname> LF
> + * And should output rewritten lines of the same form.
> + */
/*
* We write our multi-line comments
* like this (applies to a few other comments
* in this patch).
*/
^ permalink raw reply
* Re: [PATCH 1/5] add central method for prompting a user using GIT_ASKPASS or SSH_ASKPASS
From: Junio C Hamano @ 2011-12-27 23:35 UTC (permalink / raw)
To: Thomas Adam; +Cc: Sven Strickroth, git, Jakub Narebski, Jeff King
In-Reply-To: <CA+39Oz5J82GVyLfzWbWz20VS=Gp=8q9WsHQY33GuOKT1PyFCbQ@mail.gmail.com>
Thomas Adam <thomas@xteddy.org> writes:
> On 27 December 2011 20:47, Junio C Hamano <gitster@pobox.com> wrote:
>> Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:
>>> +sub askpass_prompt {
>>> + my ($self, $prompt) = _maybe_self(@_);
>>> + if (exists $ENV{'GIT_ASKPASS'}) {
>>> + return _askpass_prompt($ENV{'GIT_ASKPASS'}, $prompt);
>>> + } elsif (exists $ENV{'SSH_ASKPASS'}) {
>>> + return _askpass_prompt($ENV{'SSH_ASKPASS'}, $prompt);
>>> + } else {
>>> + return undef;
>>
>> Two problems with this if/elsif/else cascade.
>>
>> - If _askpass_prompt() fails to open the pipe to ENV{'GIT_ASKPASS'}, it
>> will return 'undef' to us. Don't we want to fall back to SSH_ASKPASS in
>> such a case?
>>
>> - The last "return undef" makes all callers of this method to implement a
>> fall-back way somehow. I find it very likely that they will want to use
>
> Not only that, "return undef" will have nasty side-effects if this
> subroutine is called in list-context -- it's usually discouraged to
> have explicit returns of "undef", where in scalar context that might
> be OK, but in list context, the caller will see:
>
> (undef)
>
> and not:
>
> ()
>
> i.e., the empty list.
Well, for this particular function whose interface is "I'll give you a
prompt, use it to interact with the user and give me what the user gave us
in response", a scalar caller would do
my $response = askpass_prompt("What is your password?");
while a list context caller would instead do
my ($response) = askpass_prompt("What is your password?");
or
my @answer = askpass_prompt("What is your password?");
my $response = $answer[0];
and all three callers would get "undef" in $response. I suspect returning
(undef) is a better thing to do, than relying that
my @answer = ();
my $response = $answer[0];
happes to give undef to $response because the access goes beyond the end
of the array, no?
^ permalink raw reply
* What's cooking in git.git (Dec 2011, #09; Tue, 27)
From: Junio C Hamano @ 2011-12-27 23:37 UTC (permalink / raw)
To: git
Here are the topics that have been cooking. Commits prefixed with '-' are
only in 'pu' (proposed updates) while commits prefixed with '+' are in
'next'.
By now I know a bit better than taking the lack of serious regression
reports during the holiday weekend as a sign of perfection of the upcoming
release, but I will tag -rc0 soonish anyway. As far as I can see the tip
of 'master' is feature complete for 1.7.9, modulo possible bugs and
regressions.
Here are the repositories that have my integration branches:
With maint, master, next, pu, todo:
git://git.kernel.org/pub/scm/git/git.git
git://repo.or.cz/alt-git.git
https://code.google.com/p/git-core/
https://github.com/git/git
With only maint and master:
git://git.sourceforge.jp/gitroot/git-core/git.git
git://git-core.git.sourceforge.net/gitroot/git-core/git-core
With all the topics and integration branches:
https://github.com/gitster/git
The preformatted documentation in HTML and man format are found in:
git://git.kernel.org/pub/scm/git/git-{htmldocs,manpages}.git/
git://repo.or.cz/git-{htmldocs,manpages}.git/
https://code.google.com/p/git-{htmldocs,manpages}.git/
https://github.com/gitster/git-{htmldocs,manpages}.git/
--------------------------------------------------
[New Topics]
* jh/fetch-head-update (2011-12-27) 1 commit
- write first for-merge ref to FETCH_HEAD first
Needs sign-off. I have squashed minimal fixes in.
* jv/maint-config-set (2011-12-27) 1 commit
(merged to 'next' on 2011-12-27 at 551ac8f)
+ Fix an incorrect reference to --set-all.
Will merge to "master" before -rc0.
* nd/index-pack-no-recurse (2011-12-27) 4 commits
- fixup! 3413d4d
- index-pack: eliminate unlimited recursion in get_delta_base()
- index-pack: eliminate recursion in find_unresolved_deltas
- Eliminate recursion in setting/clearing marks in commit list
Expecting a reroll.
* ss/git-svn-askpass (2011-12-27) 5 commits
- make askpass_prompt a global prompt method for asking users
- ignore empty *_ASKPASS variables
- honour *_ASKPASS for querying username and for querying further actions like unknown certificates
- switch to central prompt method
- add central method for prompting a user using GIT_ASKPASS or SSH_ASKPASS
Expecting a reroll.
--------------------------------------------------
[Graduated to "master"]
* ab/sun-studio-portability (2011-12-21) 3 commits
(merged to 'next' on 2011-12-21 at 0cc5a63)
+ Appease Sun Studio by renaming "tmpfile"
+ Fix a bitwise negation assignment issue spotted by Sun Studio
+ Fix an enum assignment issue spotted by Sun Studio
* jn/maint-gitweb-utf8-fix (2011-12-19) 4 commits
(merged to 'next' on 2011-12-20 at b816812)
+ gitweb: Fix fallback mode of to_utf8 subroutine
+ gitweb: Output valid utf8 in git_blame_common('data')
+ gitweb: esc_html() site name for title in OPML
+ gitweb: Call to_utf8() on input string in chop_and_escape_str()
* rr/revert-cherry-pick (2011-12-15) 6 commits
(merged to 'next' on 2011-12-21 at d0428dc)
+ t3502, t3510: clarify cherry-pick -m failure
+ t3510 (cherry-pick-sequencer): use exit status
+ revert: simplify getting commit subject in format_todo()
+ revert: tolerate extra spaces, tabs in insn sheet
+ revert: make commit subjects in insn sheet optional
+ revert: free msg in format_todo()
* tr/bash-read-unescaped (2011-12-21) 1 commit
(merged to 'next' on 2011-12-21 at de865c1)
+ bash completion: use read -r everywhere
* tr/doc-sh-setup (2011-12-20) 1 commit
(merged to 'next' on 2011-12-21 at bd73695)
+ git-sh-setup: make require_clean_work_tree part of the interface
* tr/pty-all (2011-12-19) 1 commit
(merged to 'next' on 2011-12-20 at 9b637d3)
+ test-terminal: set output terminals to raw mode
Kept only the second one from the original.
--------------------------------------------------
[Stalled]
* jc/advise-push-default (2011-12-18) 1 commit
- push: hint to use push.default=upstream when appropriate
Peff had a good suggestion outlining an updated code structure so that
somebody new can try to dip his or her toes in the development. Any
takers?
Waiting for a reroll.
* mh/ref-api-rest (2011-12-12) 35 commits
- repack_without_ref(): call clear_packed_ref_cache()
- read_packed_refs(): keep track of the directory being worked in
- is_refname_available(): query only possibly-conflicting references
- refs: read loose references lazily
- read_loose_refs(): take a (ref_entry *) as argument
- struct ref_dir: store a reference to the enclosing ref_cache
- sort_ref_dir(): take (ref_entry *) instead of (ref_dir *)
- do_for_each_ref_in_dir*(): take (ref_entry *) instead of (ref_dir *)
- add_entry(): take (ref_entry *) instead of (ref_dir *)
- search_ref_dir(): take (ref_entry *) instead of (ref_dir *)
- find_containing_direntry(): use (ref_entry *) instead of (ref_dir *)
- add_ref(): take (ref_entry *) instead of (ref_dir *)
- read_packed_refs(): take (ref_entry *) instead of (ref_dir *)
- find_ref(): take (ref_entry *) instead of (ref_dir *)
- is_refname_available(): take (ref_entry *) instead of (ref_dir *)
- get_loose_refs(): return (ref_entry *) instead of (ref_dir *)
- get_packed_refs(): return (ref_entry *) instead of (ref_dir *)
- refs: wrap top-level ref_dirs in ref_entries
- get_ref_dir(): keep track of the current ref_dir
- do_for_each_ref(): only iterate over the subtree that was requested
- refs: sort ref_dirs lazily
- sort_ref_dir(): do not sort if already sorted
- refs: store references hierarchically
- refs.c: rename ref_array -> ref_dir
- struct ref_entry: nest the value part in a union
- check_refname_component(): return 0 for zero-length components
- free_ref_entry(): new function
- refs.c: reorder definitions more logically
- is_refname_available(): reimplement using do_for_each_ref_in_array()
- names_conflict(): simplify implementation
- names_conflict(): new function, extracted from is_refname_available()
- repack_without_ref(): reimplement using do_for_each_ref_in_array()
- do_for_each_ref_in_arrays(): new function
- do_for_each_ref_in_array(): new function
- do_for_each_ref(): correctly terminate while processesing extra_refs
The API for extra anchoring points may require rethought first; that would
hopefully make the "ref" part a lot simpler.
Waiting for a reroll.
* jc/split-blob (2011-12-01) 6 commits
. WIP (streaming chunked)
- chunked-object: fallback checkout codepaths
- bulk-checkin: support chunked-object encoding
- bulk-checkin: allow the same data to be multiply hashed
- new representation types in the packstream
- varint-in-pack: refactor varint encoding/decoding
Not ready.
At least pack-objects and fsck need to learn the new encoding for the
series to be usable locally, and then index-pack/unpack-objects needs to
learn it to be used remotely.
* jc/advise-i18n (2011-12-22) 1 commit
- i18n of multi-line advice messages
Allow localization of advice messages that tend to be longer and
multi-line formatted. For now this is deliberately limited to advise()
interface and not vreportf() in general as touching the latter has
interactions with error() that has plumbing callers whose prefix "error: "
should never be translated.
--------------------------------------------------
[Cooking]
* pw/p4-docs-and-tests (2011-12-27) 11 commits
- git-p4: document and test submit options
- git-p4: test and document --use-client-spec
- git-p4: test --keep-path
- git-p4: test --max-changes
- git-p4: document and test --import-local
- git-p4: honor --changesfile option and test
- git-p4: document and test clone --branch
- git-p4: test cloning with two dirs, clarify doc
- git-p4: clone does not use --git-dir
- git-p4: introduce asciidoc documentation
- rename git-p4 tests
Rorolled.
Not urgent.
* jc/signed-commit (2011-11-29) 5 commits
(merged to 'next' on 2011-12-21 at 8fcbf00)
+ gpg-interface: allow use of a custom GPG binary
+ pretty: %G[?GS] placeholders
+ test "commit -S" and "log --show-signature"
+ log: --show-signature
+ commit: teach --gpg-sign option
I am ambivalent on this one. I do not desperately need it myself, I know
the kernel folks do not, I heard some other people might.
Opinions?
^ permalink raw reply
* [PATCH 1/2] git-svn, perl/Git.pm: add central method for prompting passwords honoring GIT_ASKPASS and SSH_ASKPASS
From: Sven Strickroth @ 2011-12-28 0:11 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Jakub Narebski, Jeff King
In-Reply-To: <7vty4l4rr8.fsf@alter.siamese.dyndns.org>
git-svn reads passwords from an interactive terminal or by using
GIT_ASKPASS helper tool. But if GIT_ASKPASS environment variable is not
set, git-svn does not try to use SSH_ASKPASS as git-core does. This
cause GUIs (w/o STDIN connected) to hang waiting forever for git-svn to
complete (http://code.google.com/p/tortoisegit/issues/detail?id=967).
Commit 56a853b62c0ae7ebaad0a7a0a704f5ef561eb795 tried to solve this
issue, but was incomplete as described above.
Instead of using hand-rolled prompt-response code that only works with
the interactive terminal, a reusable prompt() method is introduced in
this commit. This change also adds a fallback to SSH_ASKPASS.
Signed-off-by: Sven Strickroth <email@cs-ware.de>
---
git-svn.perl | 20 +-------------------
perl/Git.pm | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 51 insertions(+), 20 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index eeb83d3..bcee8aa 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -4415,25 +4415,7 @@ sub username {
sub _read_password {
my ($prompt, $realm) = @_;
- my $password = '';
- if (exists $ENV{GIT_ASKPASS}) {
- open(PH, "-|", $ENV{GIT_ASKPASS}, $prompt);
- $password = <PH>;
- $password =~ s/[\012\015]//; # \n\r
- close(PH);
- } else {
- print STDERR $prompt;
- STDERR->flush;
- require Term::ReadKey;
- Term::ReadKey::ReadMode('noecho');
- while (defined(my $key = Term::ReadKey::ReadKey(0))) {
- last if $key =~ /[\012\015]/; # \n\r
- $password .= $key;
- }
- Term::ReadKey::ReadMode('restore');
- print STDERR "\n";
- STDERR->flush;
- }
+ my $password = Git->prompt($prompt);
$password;
}
diff --git a/perl/Git.pm b/perl/Git.pm
index f7ce511..b1c7c50 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -58,7 +58,7 @@ require Exporter;
command_output_pipe command_input_pipe command_close_pipe
command_bidi_pipe command_close_bidi_pipe
version exec_path html_path hash_object git_cmd_try
- remote_refs
+ remote_refs prompt
temp_acquire temp_release temp_reset temp_path);
@@ -512,6 +512,55 @@ C<git --html-path>). Useful mostly only internally.
sub html_path { command_oneline('--html-path') }
+=item prompt ( PROMPT )
+
+Query user C<PROMPT> and return answer from user.
+
+Check if GIT_ASKPASS or SSH_ASKPASS is set, use first matching for querying
+user and return answer. If no *_ASKPASS variable is set, the variable is
+empty or an error occoured, the terminal is tried as a fallback.
+
+=cut
+
+sub prompt {
+ my ($self, $prompt) = _maybe_self(@_);
+ my $ret;
+ if (exists $ENV{'GIT_ASKPASS'}) {
+ $ret = _prompt($ENV{'GIT_ASKPASS'}, $prompt);
+ }
+ if (!defined $ret && exists $ENV{'SSH_ASKPASS'}) {
+ $ret = _prompt($ENV{'SSH_ASKPASS'}, $prompt);
+ }
+ if (!defined $ret) {
+ print STDERR $prompt;
+ STDERR->flush;
+ require Term::ReadKey;
+ Term::ReadKey::ReadMode('noecho');
+ while (defined(my $key = Term::ReadKey::ReadKey(0))) {
+ last if $key =~ /[\012\015]/; # \n\r
+ $ret .= $key;
+ }
+ Term::ReadKey::ReadMode('restore');
+ print STDERR "\n";
+ STDERR->flush;
+ }
+ return $ret;
+}
+
+sub _prompt {
+ my ($askpass, $prompt) = @_;
+ unless ($askpass) {
+ return undef;
+ }
+ my $ret;
+ open my $fh, "-|", $askpass, $prompt || return undef;
+ $ret = <$fh>;
+ $ret =~ s/[\012\015]//g; # strip \n\r, chomp does not work on all systems (i.e. windows) as expected
+ close ($fh);
+ return $ret;
+}
+
+
=item repo_path ()
Return path to the git repository. Must be called on a repository instance.
--
Best regards,
Sven Strickroth
ClamAV, a GPL anti-virus toolkit http://www.clamav.net
PGP key id F5A9D4C4 @ any key-server
^ permalink raw reply related
* [PATCH 2/2] git-svn, perl/Git.pm: extend and use Git->prompt method for querying users
From: Sven Strickroth @ 2011-12-28 0:12 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Jakub Narebski, Jeff King
In-Reply-To: <7vty4l4rr8.fsf@alter.siamese.dyndns.org>
git-svn reads usernames and other user queries from an interactive
terminal. This cause GUIs (w/o STDIN connected) to hang waiting forever
for git-svn to complete (http://code.google.com/p/tortoisegit/issues/detail?id=967).
This change extends the Git->prompt method, so that it can also be used
for non password queries, and makes use of it instead of using
hand-rolled prompt-response code that only works with the interactive
terminal.
Signed-off-by: Sven Strickroth <email@cs-ware.de>
---
git-svn.perl | 16 +++++-----------
perl/Git.pm | 25 +++++++++++++++----------
2 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index bcee8aa..1f30dc2 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -4357,11 +4357,10 @@ sub ssl_server_trust {
issuer_dname fingerprint);
my $choice;
prompt:
- print STDERR $may_save ?
+ my $options = $may_save ?
"(R)eject, accept (t)emporarily or accept (p)ermanently? " :
"(R)eject or accept (t)emporarily? ";
- STDERR->flush;
- $choice = lc(substr(<STDIN> || 'R', 0, 1));
+ $choice = substr(Git->prompt("Certificate unknown. " . $options) || 'R', 0, 1);
if ($choice =~ /^t$/i) {
$cred->may_save(undef);
} elsif ($choice =~ /^r$/i) {
@@ -4378,10 +4377,7 @@ prompt:
sub ssl_client_cert {
my ($cred, $realm, $may_save, $pool) = @_;
$may_save = undef if $_no_auth_cache;
- print STDERR "Client certificate filename: ";
- STDERR->flush;
- chomp(my $filename = <STDIN>);
- $cred->cert_file($filename);
+ $cred->cert_file(Git->prompt("Client certificate filename: "));
$cred->may_save($may_save);
$SVN::_Core::SVN_NO_ERROR;
}
@@ -4404,9 +4400,7 @@ sub username {
if (defined $_username) {
$username = $_username;
} else {
- print STDERR "Username: ";
- STDERR->flush;
- chomp($username = <STDIN>);
+ $username = Git->prompt("Username: ");
}
$cred->username($username);
$cred->may_save($may_save);
@@ -4415,7 +4409,7 @@ sub username {
sub _read_password {
my ($prompt, $realm) = @_;
- my $password = Git->prompt($prompt);
+ my $password = Git->prompt($prompt, 1);
$password;
}
diff --git a/perl/Git.pm b/perl/Git.pm
index b1c7c50..62b824c 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -512,18 +512,19 @@ C<git --html-path>). Useful mostly only internally.
sub html_path { command_oneline('--html-path') }
-=item prompt ( PROMPT )
+=item prompt ( PROMPT , ISPASSWORD )
Query user C<PROMPT> and return answer from user.
Check if GIT_ASKPASS or SSH_ASKPASS is set, use first matching for querying
user and return answer. If no *_ASKPASS variable is set, the variable is
empty or an error occoured, the terminal is tried as a fallback.
+If C<ISPASSWORD> is set and true, the terminal disables echo.
=cut
sub prompt {
- my ($self, $prompt) = _maybe_self(@_);
+ my ($self, $prompt, $isPassword) = _maybe_self(@_);
my $ret;
if (exists $ENV{'GIT_ASKPASS'}) {
$ret = _prompt($ENV{'GIT_ASKPASS'}, $prompt);
@@ -534,15 +535,19 @@ sub prompt {
if (!defined $ret) {
print STDERR $prompt;
STDERR->flush;
- require Term::ReadKey;
- Term::ReadKey::ReadMode('noecho');
- while (defined(my $key = Term::ReadKey::ReadKey(0))) {
- last if $key =~ /[\012\015]/; # \n\r
- $ret .= $key;
+ if (defined $isPassword && $isPassword) {
+ require Term::ReadKey;
+ Term::ReadKey::ReadMode('noecho');
+ while (defined(my $key = Term::ReadKey::ReadKey(0))) {
+ last if $key =~ /[\012\015]/; # \n\r
+ $ret .= $key;
+ }
+ Term::ReadKey::ReadMode('restore');
+ print STDERR "\n";
+ STDERR->flush;
+ } else {
+ chomp($ret = <STDIN>);
}
- Term::ReadKey::ReadMode('restore');
- print STDERR "\n";
- STDERR->flush;
}
return $ret;
}
--
Best regards,
Sven Strickroth
ClamAV, a GPL anti-virus toolkit http://www.clamav.net
PGP key id F5A9D4C4 @ any key-server
^ permalink raw reply related
* Re: Git beginner - Need help understanding
From: chirin @ 2011-12-28 1:38 UTC (permalink / raw)
To: git
In-Reply-To: <7vr4zp7q15.fsf@alter.siamese.dyndns.org>
The problem was solved by using another Gerrit ID for remote.origin.url in
the config. I remain confused with Git.
Junio C Hamano wrote
>
> Compared to that, your version above does not say anything about what the
> state of A, B and the repository A and B interact with were in before the
> problem started, so even if Dob wanted to help you by trying to reproduce
> your situation, there is not enough information to do so.
>
My apologies on being vague.. I'm here for learning purpose instead of
get-someone-to-help-me-solve purpose. :P I'm really keen on learning what to
look for, where to start looking to understand Git.
I'm having difficulties providing information that I do not yet know how to,
as I'm still at the stage where I'm studying simple terminologies like
origin, master, etc. and I tend to confuse myself more by comparing it to
SVN.
What should I know about the 'states of A, B and the repository A and B
interact with'?
--
View this message in context: http://git.661346.n2.nabble.com/Git-beginner-Need-help-understanding-tp7129186p7131536.html
Sent from the git mailing list archive at Nabble.com.
^ permalink raw reply
* Re: [PATCH 1/2] git-svn, perl/Git.pm: add central method for prompting passwords honoring GIT_ASKPASS and SSH_ASKPASS
From: Junio C Hamano @ 2011-12-28 2:34 UTC (permalink / raw)
To: Sven Strickroth; +Cc: git, Jakub Narebski, Jeff King
In-Reply-To: <4EFA5EB3.4000802@tu-clausthal.de>
Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:
> git-svn reads passwords from an interactive terminal or by using
> GIT_ASKPASS helper tool. But if GIT_ASKPASS environment variable is not
> set, git-svn does not try to use SSH_ASKPASS as git-core does. This
> cause GUIs (w/o STDIN connected) to hang waiting forever for git-svn to
> complete (http://code.google.com/p/tortoisegit/issues/detail?id=967).
>
> Commit 56a853b62c0ae7ebaad0a7a0a704f5ef561eb795 tried to solve this
> issue, but was incomplete as described above.
>
> Instead of using hand-rolled prompt-response code that only works with
> the interactive terminal, a reusable prompt() method is introduced in
> this commit. This change also adds a fallback to SSH_ASKPASS.
>
> Signed-off-by: Sven Strickroth <email@cs-ware.de>
> ---
Thanks. Vastly more readable ;-)
I only have a few minor nits, and request for extra set of eyeballs from
Perl-y people.
> sub _read_password {
> my ($prompt, $realm) = @_;
> - my $password = '';
> - if (exists $ENV{GIT_ASKPASS}) {
> - open(PH, "-|", $ENV{GIT_ASKPASS}, $prompt);
> - $password = <PH>;
> - $password =~ s/[\012\015]//; # \n\r
> - ...
> - while (defined(my $key = Term::ReadKey::ReadKey(0))) {
> - last if $key =~ /[\012\015]/; # \n\r
> - $password .= $key;
> - }
> - ...
> + my $password = Git->prompt($prompt);
> $password;
> }
> ...
> +Check if GIT_ASKPASS or SSH_ASKPASS is set, use first matching for querying
> +user and return answer. If no *_ASKPASS variable is set, the variable is
> +empty or an error occoured, the terminal is tried as a fallback.
Looks like a description that is correct, but I feel a slight hiccup when
trying to read the first sentence aloud. Perhaps other reviewers on the
list can offer an easier to read alternative?
> +sub prompt {
> + my ($self, $prompt) = _maybe_self(@_);
> + my $ret;
> + if (exists $ENV{'GIT_ASKPASS'}) {
> + $ret = _prompt($ENV{'GIT_ASKPASS'}, $prompt);
> + }
> + if (!defined $ret && exists $ENV{'SSH_ASKPASS'}) {
> + $ret = _prompt($ENV{'SSH_ASKPASS'}, $prompt);
> + }
> + if (!defined $ret) {
> + print STDERR $prompt;
> + STDERR->flush;
> + require Term::ReadKey;
> + Term::ReadKey::ReadMode('noecho');
> + while (defined(my $key = Term::ReadKey::ReadKey(0))) {
> + last if $key =~ /[\012\015]/; # \n\r
> + $ret .= $key;
Unlike the original in _read_password, $ret ($password over there) is left
"undef" here; I am wondering if "$ret .= $key" might trigger a warning and
if that is the case, probably we should have an explicit "$ret = '';"
before going into the while loop.
> +sub _prompt {
> + my ($askpass, $prompt) = @_;
> + unless ($askpass) {
> + return undef;
> + }
Perl gurus on the list might prefer to rewrite this with statement
modifier as "return undef unless (...);" but I am not one of them.
> + my $ret;
> + open my $fh, "-|", $askpass, $prompt || return undef;
I am so used see this spelled with the lower-precedence "or" like this
open my $fh, "-|", $askpass, $prompt
or return undef;
that I am no longer sure if the use of "||" is Ok here. Help from Perl
gurus on the list?
> + $ret = <$fh>;
> + $ret =~ s/[\012\015]//g; # strip \n\r, chomp does not work on all systems (i.e. windows) as expected
The original reads one line from the helper process, removes the first \n
or \r (expecting there is only one), and returns the result. The new code
reads one line, removes all \n and \r everywhere, and returns the result.
I do not think it makes any difference in practice, but shouldn't this
logically be more like "s/\r?\n$//", that is "remove the CRLF or LF at the
end"?
> + close ($fh);
It seems that we aquired a SP after "close" compared to the
original. What's the prevailing coding style in our Perl code?
This close() of pipe to the subprocess is where a lot of error checking
happens, no? Can this return an error?
I can see the original ignored an error condition, but do we care, or not
care?
^ permalink raw reply
* Re: [PATCH 2/2] git-svn, perl/Git.pm: extend and use Git->prompt method for querying users
From: Junio C Hamano @ 2011-12-28 2:41 UTC (permalink / raw)
To: Sven Strickroth; +Cc: git, Jakub Narebski, Jeff King
In-Reply-To: <4EFA5F08.2060705@tu-clausthal.de>
Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:
> @@ -4357,11 +4357,10 @@ sub ssl_server_trust {
> issuer_dname fingerprint);
> my $choice;
> prompt:
> - print STDERR $may_save ?
> + my $options = $may_save ?
> "(R)eject, accept (t)emporarily or accept (p)ermanently? " :
> "(R)eject or accept (t)emporarily? ";
> - STDERR->flush;
> - $choice = lc(substr(<STDIN> || 'R', 0, 1));
> + $choice = substr(Git->prompt("Certificate unknown. " . $options) || 'R', 0, 1);
I am afraid the extra "Certificate unknown. " prefix may make the prompt
way too long to fit on a line on the terminal or in the GUI. Would it be
Ok to perhaps add LF to make it a multi-line prompt? Do GUI based helpers
make that into a dialog box with multi-line prompt, or do they just barf?
> if ($choice =~ /^t$/i) {
> $cred->may_save(undef);
We seem to have lost lc() there, but it probably is deliberate and
harmless, as the value is checked with /^x$/i later.
As we are making sure $choice has a single character anyway, I think that
checking with "=~ /^x$/i" is unnecessarily ugly and wrong, even though it
is obviously not the fault of this patch.
> @@ -4378,10 +4377,7 @@ prompt:
> sub ssl_client_cert {
> my ($cred, $realm, $may_save, $pool) = @_;
> $may_save = undef if $_no_auth_cache;
> - print STDERR "Client certificate filename: ";
> - STDERR->flush;
> - chomp(my $filename = <STDIN>);
> - $cred->cert_file($filename);
> + $cred->cert_file(Git->prompt("Client certificate filename: "));
> $cred->may_save($may_save);
> $SVN::_Core::SVN_NO_ERROR;
> }
We may later add an option to "prompt" method to allow the caller to say
that we are asking for a filename, and let GUI prompt helper to run a file
picker, but I think that is outside the immediate scope of this patch.
Just a thing for the future to keep in mind.
This patch itself looks almost perfect to me (modulo the above minor
nits), and except that it textually depends on 1/2 that may need to be
updated.
Thanks.
^ permalink raw reply
* Re: Git beginner - Need help understanding
From: Dov Grobgeld @ 2011-12-28 8:05 UTC (permalink / raw)
To: chirin; +Cc: git
In-Reply-To: <1325036313909-7131536.post@n2.nabble.com>
I'm glad to hear that your problem was solved.
On Wed, Dec 28, 2011 at 03:38, chirin <takonatto@gmail.com> wrote:
> [stuff deleted]
> What should I know about the 'states of A, B and the repository A and B
> interact with'?
The state of a repository are most easily described by the sequence of
commands done to it from its creation. The best way of learning and
solving problems is trying to reproduce them with the minimum amount
of steps. I.e. even if you are using a GUI tool for your convenience,
you should be familiar with the command line tools, since that is the
best way of conveying what you have done. My motto is: "Don't describe
in human language what you have done, but show me the exact
commands!". And there is no language better for such than the exact
command line.
Regards,
Dov
>
> --
> View this message in context: http://git.661346.n2.nabble.com/Git-beginner-Need-help-understanding-tp7129186p7131536.html
> Sent from the git mailing list archive at Nabble.com.
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* GIT and SSH
From: Reza Mostafid @ 2011-12-28 8:43 UTC (permalink / raw)
To: git
I am starting to use GIT and I would be grateful for a simple answer to a
specific situation to help me find the right ball-park.
a.) Does the communication that takes place between a GIT `client` and a remote
GIT `repository` involve 'ssh' traffic?
Our connections here are heavily censored and ssh traffic is suppressed most of
the time which is why I need to figure out why a simple
$ git clone git://<URL>
command chokes to a halt and freezes most of the time ( the same command when
executed remotely on our V.P.S. in Europe works flawlessly ).
b.) Are there means to make the `git` client on my machine circumvent this?
Y/N answers or brief hints to my questions suffice, I'll work out the rest.
Basically I would like to know whether there is a point at all trying to make
git work from where I am, given the limitations mentioned.
Regards
Reza
^ permalink raw reply
* Re: GIT and SSH
From: Dov Grobgeld @ 2011-12-28 9:55 UTC (permalink / raw)
To: Reza Mostafid; +Cc: git
In-Reply-To: <loom.20111228T091942-66@post.gmane.org>
Git supports multiple transport protocols. Among them are git, ssh,
and https. (You can also use direct file system access, but it is
questionable whether to call that a protocol). Each of the protocols
have their advantages and drawbacks. The git protocol is only used for
reading, and not for writing, but is supposed to be very fast. The
common firewall filtering of the git protocol port 9418 is another
problem. ssh is the prefered protocol for writing to a remote
protocol. But if ssh is filtered, then http/https may be used, which
is very slow for large repositories, but it has the advantage that it
is the least blocked protocol.
For more info see:
http://progit.org/book/ch4-1.html
Regards,
Dov
On Wed, Dec 28, 2011 at 10:43, Reza Mostafid <m.r.mostafid@gmail.com> wrote:
> I am starting to use GIT and I would be grateful for a simple answer to a
> specific situation to help me find the right ball-park.
>
>
> a.) Does the communication that takes place between a GIT `client` and a remote
> GIT `repository` involve 'ssh' traffic?
>
>
> Our connections here are heavily censored and ssh traffic is suppressed most of
> the time which is why I need to figure out why a simple
>
> $ git clone git://<URL>
>
> command chokes to a halt and freezes most of the time ( the same command when
> executed remotely on our V.P.S. in Europe works flawlessly ).
>
>
> b.) Are there means to make the `git` client on my machine circumvent this?
>
>
> Y/N answers or brief hints to my questions suffice, I'll work out the rest.
>
> Basically I would like to know whether there is a point at all trying to make
> git work from where I am, given the limitations mentioned.
>
> Regards
>
> Reza
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: GIT and SSH
From: Carlos Martín Nieto @ 2011-12-28 10:15 UTC (permalink / raw)
To: Dov Grobgeld; +Cc: Reza Mostafid, git
In-Reply-To: <CA++fsGFOC6bV4gC+ozBKP3EmoAX4CcfTrHjjpMWPkh7vYOfgAw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2104 bytes --]
On Wed, Dec 28, 2011 at 11:55:24AM +0200, Dov Grobgeld wrote:
> Git supports multiple transport protocols. Among them are git, ssh,
> and https. (You can also use direct file system access, but it is
> questionable whether to call that a protocol). Each of the protocols
> have their advantages and drawbacks. The git protocol is only used for
> reading, and not for writing, but is supposed to be very fast. The
> common firewall filtering of the git protocol port 9418 is another
> problem. ssh is the prefered protocol for writing to a remote
> protocol. But if ssh is filtered, then http/https may be used, which
> is very slow for large repositories, but it has the advantage that it
> is the least blocked protocol.
Slow for large repositories? Are you thinking of the dumb HTTP
transport? That one shouldn't be used for doing any serious work. The
Smart HTTP transport is just the git smart protocol (the same one
git:// and ssh:// URLs speak) wrapped inside HTTP communication. The
negotiation phase is a more expensive than with either git or ssh, as
HTTP is stateless and you need to remind the remote what you want and
what you've already agreed on, but the actual transfer of data is done
the same way than with the others so overall it shouldn't be that
noticeable.
Now, to the OP's concerns: yes, the ssh transport does generate ssh
transport, as that's the whole point. You authenticate against the
remote machine's ssh daemon and run git-upload-pack or
git-receive-pack as needed (for fetching or pushing). If corporate
policy doesn't allow ssh you should either fix the policy or use the
smart HTTP protocol, though this involves messing with passwords and
their associated problems. I'm not saying ssh keys don't have their
complications, but I much prefer them.
We can't help you diagnose why your clone is stalling without more
information. It could be that the connection between the computers is
flaky, git trying to take too much memory on the remote or local
machines or any number of things. See if setting GIT_TRACE=1 in the
environment helps to see what's going on.
cmn
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply
* Re: [PATCH 2/2] git-svn, perl/Git.pm: extend and use Git->prompt method for querying users
From: Sven Strickroth @ 2011-12-28 10:41 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Jakub Narebski, Jeff King
In-Reply-To: <7vpqf91kqo.fsf@alter.siamese.dyndns.org>
Am 28.12.2011 03:41 schrieb Junio C Hamano:
> I am afraid the extra "Certificate unknown. " prefix may make the prompt
> way too long to fit on a line on the terminal or in the GUI. Would it be
> Ok to perhaps add LF to make it a multi-line prompt? Do GUI based helpers
> make that into a dialog box with multi-line prompt, or do they just barf?
LF is problematic. But we could do $prompt =~ s/\n/ /g; in _prompt()-method.
--
Best regards,
Sven Strickroth
ClamAV, a GPL anti-virus toolkit http://www.clamav.net
PGP key id F5A9D4C4 @ any key-server
^ permalink raw reply
* Re: GIT and SSH
From: Reza Mostafid @ 2011-12-28 11:01 UTC (permalink / raw)
To: git
In-Reply-To: <loom.20111228T091942-66@post.gmane.org>
I forgot to mention, I am an embedded developer located in Iran.
The filtering I am talking about is by the government. All ISP's get their
bandwith from centrally allocated trunks. This allows control.
I know that ssh packets get dropped for extended periods frequently.
We have an Ubuntu virtual server outside of Iran which we use as a proxy and
connect to it via 'ssh' sox provxy ( -D 8090 ).
Many times some sort of script or intelligence is operation which severely
throttles the connection as soon as the data rate exceeds certain "benign"
levels. All this has been confirmed by the network `gurus` and admin people I
work with. This is the best we can tell from what we observe.
As mentioned when we execute the simple GIT clone command from our VPS
( located outside Iran ) the command works flawlessly.
What I would be interested in is to somehow make git avoid using transport
over ssh. The government censors are interested only in blocking people
accessing illicit sites via S.O.X-5 or VPN.
To them anything over SSH is suspicious. If we could somehow update using a
plain transport method, they couldn't care less about source code being sent to
us.
Regards
Reza
^ permalink raw reply
* Re: GIT and SSH
From: Jakub Narebski @ 2011-12-28 11:02 UTC (permalink / raw)
To: Carlos Martín Nieto; +Cc: Dov Grobgeld, Reza Mostafid, git
In-Reply-To: <20111228101512.GA2192@beez.lab.cmartin.tk>
Carlos Martín Nieto <cmn@elego.de> writes:
> On Wed, Dec 28, 2011 at 11:55:24AM +0200, Dov Grobgeld wrote:
> > Git supports multiple transport protocols. Among them are git, ssh,
> > and https. (You can also use direct file system access, but it is
> > questionable whether to call that a protocol). Each of the protocols
> > have their advantages and drawbacks. The git protocol is only used for
> > reading, and not for writing, but is supposed to be very fast. The
FYI git:// protocol can theoretically be used for pushing, but it is
not recommended because git:// protocol is not authenthicated - that
is why you need to enable pushing via git:// explicitly.
Just git trivia.
> > common firewall filtering of the git protocol port 9418 is another
> > problem. ssh is the prefered protocol for writing to a remote
> > protocol. But if ssh is filtered, then http/https may be used, which
> > is very slow for large repositories, but it has the advantage that it
> > is the least blocked protocol.
>
> Slow for large repositories? Are you thinking of the dumb HTTP
> transport? That one shouldn't be used for doing any serious work. The
> Smart HTTP transport is just the git smart protocol (the same one
> git:// and ssh:// URLs speak) wrapped inside HTTP communication. The
> negotiation phase is a more expensive than with either git or ssh, as
> HTTP is stateless and you need to remind the remote what you want and
> what you've already agreed on, but the actual transfer of data is done
> the same way than with the others so overall it shouldn't be that
> noticeable.
Note that for "smart" transports ("smart" HTTP, SSH) you need to have
git installed on server, or at least have git-upload-pack and
git-receive-pack somewhere (you can configure client where it is to be
found on server).
Note that git uses curl for both smart and dumb HTTP transports, so
things like 'http_proxy' and 'HTTPS_PROXY' environment variables
should work.
> Now, to the OP's concerns: yes, the ssh transport does generate ssh
> transport, as that's the whole point. You authenticate against the
> remote machine's ssh daemon and run git-upload-pack or
> git-receive-pack as needed (for fetching or pushing). If corporate
> policy doesn't allow ssh you should either fix the policy or use the
> smart HTTP protocol, though this involves messing with passwords and
> their associated problems. I'm not saying ssh keys don't have their
> complications, but I much prefer them.
Note that if the problem is giving shell accounts with SSH access, the
solution is to use one of git repository management tools, like
Gitosis (Python + setuptools, no longer developed) or Gitolite (Perl).
From what I remember both use _single_ *restricted* account and
public-key authenthication.
If I am not mistaken Gitolite can help with "smart" HTTP transport
access too.
> We can't help you diagnose why your clone is stalling without more
> information. It could be that the connection between the computers is
> flaky, git trying to take too much memory on the remote or local
> machines or any number of things. See if setting GIT_TRACE=1 in the
> environment helps to see what's going on.
Or even undocumented (!) GIT_TRACE_PACKET.
--
Jakub Narebski
^ permalink raw reply
* Re: [PATCH 1/2] git-svn, perl/Git.pm: add central method for prompting passwords honoring GIT_ASKPASS and SSH_ASKPASS
From: Sven Strickroth @ 2011-12-28 16:17 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski, Jeff King
In-Reply-To: <7vboqt2zm4.fsf@alter.siamese.dyndns.org>
Am 28.12.2011 03:34 schrieb Junio C Hamano:
>> + close ($fh);
>
> It seems that we aquired a SP after "close" compared to the
> original. What's the prevailing coding style in our Perl code?
>
> This close() of pipe to the subprocess is where a lot of error checking
> happens, no? Can this return an error?
>
> I can see the original ignored an error condition, but do we care, or not
> care?
close() can return a number in case of an error, but we already got our
response/line, so why care?
--
Best regards,
Sven Strickroth
ClamAV, a GPL anti-virus toolkit http://www.clamav.net
PGP key id F5A9D4C4 @ any key-server
^ permalink raw reply
* Re: [PATCH] gc --auto: warn garbage collection happens soon
From: Jeff King @ 2011-12-28 18:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Nguyễn Thái Ngọc Duy, git
In-Reply-To: <7vpqf94r8c.fsf@alter.siamese.dyndns.org>
On Tue, Dec 27, 2011 at 01:52:35PM -0800, Junio C Hamano wrote:
> And if the answer to that tongue-in-cheek question is no, what is the
> reason why the users will not find the messages disturbing, while loathing
> the auto-gc?
>
> I suspect that is because auto-gc takes long time, making the user wait,
> compared to the new message that may be noisy but quick. Perhaps the real
> cure for the disease is not to add the message but to make an auto-gc less
> painful, no?
>
> What are the things we could do to make auto-gc less painful?
>
> Are we doing something that is not necessary in auto-gc that takes time
> but that we can live without doing?
I don't personally find gc all that painful (though maybe that is
because I tend to gc myself and rarely hit the auto-gc), but I have
noticed that git-prune takes by far the most time to run. If you are
just doing an incremental pack, you might be packing only a few thousand
objects and not touching old history at all (and with many cores, the
delta compression flies by). But prune requires running "git rev-list
--objects --all", which takes something like 45 seconds for linux-2.6 on
my fast-ish laptop (and about 23 seconds for git.git).
We could perhaps cut out pruning in the auto-gc case unless there are a
lot of objects left over after the packing phase. It's not worth doing a
full prune to clean up a dozen objects[1]. It probably is if you have a
thousand objects left after packing.
-Peff
[1] Actually, it's not just having objects. You may have just exploded
unreachable objects from a pack, but they are still younger than the
2 week expiration period. Therefore trying to prune them is
pointless, because even if they are unreachable, you won't delete
them. So you really want to say "how many actual candidate objects
do we have for pruning?"
^ 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