* Re: [PATCH] remote-curl: don't hang when a server dies before any output
From: Jeff King @ 2016-11-15 0:44 UTC (permalink / raw)
To: David Turner; +Cc: git, spearce
In-Reply-To: <20161114194049.mktpsvgdhex2f4zv@sigill.intra.peff.net>
On Mon, Nov 14, 2016 at 02:40:49PM -0500, Jeff King wrote:
> On Mon, Nov 14, 2016 at 01:24:31PM -0500, Jeff King wrote:
>
> > 2. Have remote-curl understand enough of the protocol that it can
> > abort rather than hang.
> >
> > I think that's effectively the approach of your patch, but for one
> > specific case. But could we, for example, make sure that everything
> > we proxy is a complete set of pktlines and ends with a flush? And
> > if not, then we hang up on fetch-pack.
> >
> > I _think_ that would work, because even the pack is always encased
> > in pktlines for smart-http.
>
> So something like this. It turned out to be a lot uglier than I had
> hoped because we get fed the data from curl in odd-sized chunks, so we
> need a state machine.
>
> But it does seem to work. At least it doesn't seem to break anything in
> the test suite, and it fixes the new tests you added. I'd worry that
> there's some obscure case where the response isn't packetized in the
> same way.
Actually, I take it back. I think it works for a single round of ref
negotiation, but not for multiple. Enabling GIT_TEST_LONG=1 causes it to
fail t5551.
I think I've probably made a mis-assumption on exactly when in the HTTP
protocol we will see a flush packet (and perhaps that is a sign that
this protocol-snooping approach is not a good one).
I don't have time to dig more on this tonight, and I'll be traveling for
the rest of the week. So if anybody is interested, please feel free to
dig into it.
-Peff
^ permalink raw reply
* Re: [PATCH] remote-curl: don't hang when a server dies before any output
From: Junio C Hamano @ 2016-11-15 1:02 UTC (permalink / raw)
To: Jeff King; +Cc: David Turner, git, spearce
In-Reply-To: <20161115004426.unheihlmftlw6ex7@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Actually, I take it back. I think it works for a single round of ref
> negotiation, but not for multiple. Enabling GIT_TEST_LONG=1 causes it to
> fail t5551.
>
> I think I've probably made a mis-assumption on exactly when in the HTTP
> protocol we will see a flush packet (and perhaps that is a sign that
> this protocol-snooping approach is not a good one).
Hmph. I think I tried David's original under GIT_TEST_LONG and saw
it got stuck; could be the same issue, I guess.
^ permalink raw reply
* Re: RFC: Enable delayed responses to Git clean/smudge filter requests
From: Eric Wong @ 2016-11-15 1:03 UTC (permalink / raw)
To: Lars Schneider; +Cc: git
In-Reply-To: <D10F7C47-14E8-465B-8B7A-A09A1B28A39F@gmail.com>
Lars Schneider <larsxschneider@gmail.com> wrote:
> Hi,
>
> Git always performs a clean/smudge filter on files in sequential order.
> Sometimes a filter operation can take a noticeable amount of time.
> This blocks the entire Git process.
I have the same problem in many places which aren't git :>
> I would like to give a filter process the possibility to answer Git with
> "I got your request, I am processing it, ask me for the result later!".
>
> I see the following way to realize this:
>
> In unpack-trees.c:check_updates() [1] we loop through the cache
> entries and "ask me later" could be an acceptable return value of the
> checkout_entry() call. The loop could run until all entries returned
> success or error.
>
> The filter machinery is triggered in various other places in Git and
> all places that want to support "ask me later" would need to be patched
> accordingly.
That all sounds reasonable.
The filter itself would need to be aware of parallelism
if it lives for multiple objects, right?
> Do you think this could be a viable approach?
It'd probably require a bit of work, but yes, I think it's viable.
We already do this with curl_multi requests for parallel
fetching from dumb HTTP servers, but that's driven by curl
internals operating with a select/poll loop.
Perhaps the curl API could be a good example for doing this.
> Do you see a better way?
Nope, I prefer non-blocking state machines to threads for
debuggability and determinism.
Anyways, I'll plan on doing something similar (in Perl) with the
synchronous parts of public-inbox which relies on "cat-file --batch"
at some point... (my rotational disks are sloooooooow :<)
^ permalink raw reply
* [PATCH 0/2] bug fix with push --dry-run and submodules
From: Brandon Williams @ 2016-11-15 1:18 UTC (permalink / raw)
To: git; +Cc: Brandon Williams
While trying to understand how the recursive pushing of submodules worked I
discovered that when push was instructed to do a dry-run, while also configured
to push unpushed submodules 'on-demand', that the submodule pushes weren't
configured to perform dry-runs, but actually performed the pushes. This
resulted in the submodules being pushed while leaving the superproject unpushed
which is undesirable behavior for a dry-run.
This series introduces a test to illustrate the bug as well as a patch to
correct this behavior by passing the --dry-run flag to the child processes
which perform the submodule pushes during a dry-run.
This series is based against 'origin/hv/submodule-not-yet-pushed-fix'
Brandon Williams (2):
push: --dry-run updates submodules when --recurse-submodules=on-demand
push: fix --dry-run to not push submodules
submodule.c | 13 ++++++++-----
submodule.h | 4 +++-
t/t5531-deep-submodule-push.sh | 26 +++++++++++++++++++++++++-
transport.c | 9 ++++++---
4 files changed, 42 insertions(+), 10 deletions(-)
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply
* [PATCH 1/2] push: --dry-run updates submodules when --recurse-submodules=on-demand
From: Brandon Williams @ 2016-11-15 1:18 UTC (permalink / raw)
To: git; +Cc: Brandon Williams
In-Reply-To: <1479172735-698-1-git-send-email-bmwill@google.com>
This patch adds a test to illustrate how push run with --dry-run doesn't
actually perform a dry-run when push is configured to push submodules
on-demand. Instead all submodules which need to be pushed are actually
pushed to their remotes while any updates for the superproject are
performed as a dry-run. This is a bug and not the intended behaviour of
a dry-run.
Signed-off-by: Brandon Williams <bmwill@google.com>
---
t/t5531-deep-submodule-push.sh | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index 198ce84..e6ccc30 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -427,7 +427,31 @@ test_expect_success 'push unpushable submodule recursively fails' '
cd submodule.git &&
git rev-parse master >../actual
) &&
- test_cmp expected actual
+ test_cmp expected actual &&
+ git -C work reset --hard master^
+'
+
+test_expect_failure 'push --dry-run does not recursively update submodules' '
+ (
+ cd work &&
+ (
+ cd gar/bage &&
+ git checkout master &&
+ git rev-parse master >../../../expected_submodule &&
+ > junk9 &&
+ git add junk9 &&
+ git commit -m "Ninth junk"
+ ) &&
+ git checkout master &&
+ git rev-parse master >../expected_pub
+ git add gar/bage &&
+ git commit -m "Ninth commit for gar/bage" &&
+ git push --dry-run --recurse-submodules=on-demand ../pub.git master
+ ) &&
+ git -C submodule.git rev-parse master >actual_submodule &&
+ git -C pub.git rev-parse master >actual_pub &&
+ test_cmp expected_pub actual_pub &&
+ test_cmp expected_submodule actual_submodule
'
test_done
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related
* [PATCH 2/2] push: fix --dry-run to not push submodules
From: Brandon Williams @ 2016-11-15 1:18 UTC (permalink / raw)
To: git; +Cc: Brandon Williams
In-Reply-To: <1479172735-698-1-git-send-email-bmwill@google.com>
Teach push to respect the --dry-run option when configured to
recursively push submodules 'on-demand'. This is done by passing the
--dry-run flag to the child process which performs a push for a
submodules when performing a dry-run.
In order to preserve good user experience, the additional check for
unpushed submodules is skipped during a dry-run when
--recurse-submodules=on-demand. The check is skipped because the submodule
pushes were performed as dry-runs and this check would always fail as the
submodules would still need to be pushed.
Signed-off-by: Brandon Williams <bmwill@google.com>
---
submodule.c | 13 ++++++++-----
submodule.h | 4 +++-
t/t5531-deep-submodule-push.sh | 2 +-
transport.c | 9 ++++++---
4 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/submodule.c b/submodule.c
index a05c2a3..7b9bed1 100644
--- a/submodule.c
+++ b/submodule.c
@@ -676,16 +676,17 @@ int find_unpushed_submodules(struct sha1_array *hashes,
return needs_pushing->nr;
}
-static int push_submodule(const char *path)
+static int push_submodule(const char *path, int dry_run)
{
if (add_submodule_odb(path))
return 1;
if (for_each_remote_ref_submodule(path, has_remote, NULL) > 0) {
struct child_process cp = CHILD_PROCESS_INIT;
- const char *argv[] = {"push", NULL};
+ argv_array_push(&cp.args, "push");
+ if (dry_run)
+ argv_array_push(&cp.args, "--dry-run");
- cp.argv = argv;
prepare_submodule_repo_env(&cp.env_array);
cp.git_cmd = 1;
cp.no_stdin = 1;
@@ -698,7 +699,9 @@ static int push_submodule(const char *path)
return 1;
}
-int push_unpushed_submodules(struct sha1_array *hashes, const char *remotes_name)
+int push_unpushed_submodules(struct sha1_array *hashes,
+ const char *remotes_name,
+ int dry_run)
{
int i, ret = 1;
struct string_list needs_pushing = STRING_LIST_INIT_DUP;
@@ -709,7 +712,7 @@ int push_unpushed_submodules(struct sha1_array *hashes, const char *remotes_name
for (i = 0; i < needs_pushing.nr; i++) {
const char *path = needs_pushing.items[i].string;
fprintf(stderr, "Pushing submodule '%s'\n", path);
- if (!push_submodule(path)) {
+ if (!push_submodule(path, dry_run)) {
fprintf(stderr, "Unable to push submodule '%s'\n", path);
ret = 0;
}
diff --git a/submodule.h b/submodule.h
index 065b2f0..a38e0f3 100644
--- a/submodule.h
+++ b/submodule.h
@@ -65,7 +65,9 @@ int merge_submodule(unsigned char result[20], const char *path, const unsigned c
const unsigned char a[20], const unsigned char b[20], int search);
int find_unpushed_submodules(struct sha1_array *hashes, const char *remotes_name,
struct string_list *needs_pushing);
-int push_unpushed_submodules(struct sha1_array *hashes, const char *remotes_name);
+extern int push_unpushed_submodules(struct sha1_array *hashes,
+ const char *remotes_name,
+ int dry_run);
void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir);
int parallel_submodules(void);
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index e6ccc30..54f334c 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -431,7 +431,7 @@ test_expect_success 'push unpushable submodule recursively fails' '
git -C work reset --hard master^
'
-test_expect_failure 'push --dry-run does not recursively update submodules' '
+test_expect_success 'push --dry-run does not recursively update submodules' '
(
cd work &&
(
diff --git a/transport.c b/transport.c
index f6bec0d..4ad08d0 100644
--- a/transport.c
+++ b/transport.c
@@ -921,15 +921,18 @@ int transport_push(struct transport *transport,
if (!is_null_oid(&ref->new_oid))
sha1_array_append(&hashes, ref->new_oid.hash);
- if (!push_unpushed_submodules(&hashes, transport->remote->name)) {
+ if (!push_unpushed_submodules(&hashes,
+ transport->remote->name,
+ pretend)) {
sha1_array_clear(&hashes);
die ("Failed to push all needed submodules!");
}
sha1_array_clear(&hashes);
}
- if ((flags & (TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND |
- TRANSPORT_RECURSE_SUBMODULES_CHECK)) && !is_bare_repository()) {
+ if (((flags & TRANSPORT_RECURSE_SUBMODULES_CHECK) ||
+ ((flags & TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND) &&
+ !pretend)) && !is_bare_repository()) {
struct ref *ref = remote_refs;
struct string_list needs_pushing = STRING_LIST_INIT_DUP;
struct sha1_array hashes = SHA1_ARRAY_INIT;
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related
* Re: [PATCH v7 16/17] branch: use ref-filter printing APIs
From: Jacob Keller @ 2016-11-15 1:36 UTC (permalink / raw)
To: Karthik Nayak; +Cc: Git mailing list
In-Reply-To: <CAOLa=ZQSQe=jfTpdyscZCZgi5p6cVLN23oi2eE-hqFTXgt2LEQ@mail.gmail.com>
On Mon, Nov 14, 2016 at 11:23 AM, Karthik Nayak <karthik.188@gmail.com> wrote:
> Hello
>
> On Wed, Nov 9, 2016 at 5:44 AM, Jacob Keller <jacob.keller@gmail.com> wrote:
>> On Tue, Nov 8, 2016 at 12:12 PM, Karthik Nayak <karthik.188@gmail.com> wrote:
>>> From: Karthik Nayak <karthik.188@gmail.com>
>>>
>>> Port branch.c to use ref-filter APIs for printing. This clears out
>>> most of the code used in branch.c for printing and replaces them with
>>> calls made to the ref-filter library.
>>
>> Nice. This looks correct based on checking against the current
>> branch.c implementation by hand. There was one minor change I
>> suggested but I'm not really sure it buys is that much.
>>
>
> Thanks for this review. More down.
>
>>> + if (filter->verbose > 1)
>>> + strbuf_addf(&local, "%%(if)%%(upstream)%%(then)[%s%%(upstream:short)%s%%(if)%%(upstream:track)"
>>> + "%%(then): %%(upstream:track,nobracket)%%(end)] %%(end)%%(contents:subject)",
>>> + branch_get_color(BRANCH_COLOR_UPSTREAM), branch_get_color(BRANCH_COLOR_RESET));
>>
>> When we have extra verbose, we check whether we have an upstream, and
>> if so, we print the short name of that upstream inside brackets. If we
>> have tracking information, we print that without brackets, and then we
>> end this section. Finally we print the subject.
>>
>> We could almost re-use the code for the subject bits, but I'm not sure
>> it's worth it. Maybe drop the %contents:subject part and add it
>> afterwards since we always want it? It would remove some duplication
>> but overall not sure it's actually worth it.
>>
>
> If you see that's the last part we add to the 'local' strbuf in the
> verbose case.
> If we want to remove the duplication we'll end up adding one more
> strbuf_addf(...).
> So I guess its better this way.
>
Agreed, I think that it makes more sense to keep this as is. It is
relatively complicated and the strings do have some duplicate code,
but I think it's still ok.
Thanks,
Jake
> --
> Regards,
> Karthik Nayak
^ permalink raw reply
* Re: [PATCH] remote-curl: don't hang when a server dies before any output
From: Jeff King @ 2016-11-15 2:40 UTC (permalink / raw)
To: David Turner; +Cc: git, spearce
In-Reply-To: <20161115004426.unheihlmftlw6ex7@sigill.intra.peff.net>
On Mon, Nov 14, 2016 at 07:44:26PM -0500, Jeff King wrote:
> > But it does seem to work. At least it doesn't seem to break anything in
> > the test suite, and it fixes the new tests you added. I'd worry that
> > there's some obscure case where the response isn't packetized in the
> > same way.
>
> Actually, I take it back. I think it works for a single round of ref
> negotiation, but not for multiple. Enabling GIT_TEST_LONG=1 causes it to
> fail t5551.
>
> I think I've probably made a mis-assumption on exactly when in the HTTP
> protocol we will see a flush packet (and perhaps that is a sign that
> this protocol-snooping approach is not a good one).
Yep, that is it. The server may end with an ACK or a NAK, not a flush
packet. So going this route really does mean teaching remote-curl a lot
more about the protocol, which is pretty nasty. I think trying to
somehow signal the end-of-response to fetch-pack would be a more
maintainable approach.
-Peff
^ permalink raw reply
* Re: [PATCH] remote-curl: don't hang when a server dies before any output
From: Jeff King @ 2016-11-15 3:58 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Turner, git, spearce
In-Reply-To: <xmqqa8d1v9lo.fsf@gitster.mtv.corp.google.com>
On Mon, Nov 14, 2016 at 05:02:27PM -0800, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > Actually, I take it back. I think it works for a single round of ref
> > negotiation, but not for multiple. Enabling GIT_TEST_LONG=1 causes it to
> > fail t5551.
> >
> > I think I've probably made a mis-assumption on exactly when in the HTTP
> > protocol we will see a flush packet (and perhaps that is a sign that
> > this protocol-snooping approach is not a good one).
>
> Hmph. I think I tried David's original under GIT_TEST_LONG and saw
> it got stuck; could be the same issue, I guess.
It works OK here. I think it is just that the test is really slow (by
design).
-Peff
^ permalink raw reply
* Re: [PATCH v15 02/27] bisect: rewrite `check_term_format` shell function in C
From: Pranit Bauva @ 2016-11-15 5:16 UTC (permalink / raw)
To: Stephan Beyer; +Cc: Git List
In-Reply-To: <61aacd44-cb6a-2bbb-7fb4-933e2505040d@gmx.net>
Hey Stephan,
On Tue, Nov 15, 2016 at 3:50 AM, Stephan Beyer <s-beyer@gmx.net> wrote:
> Hi,
>
> I saw in the recent "What's cooking" mail that this is still waiting
> for review, so I thought I could interfere and help reviewing it from a
> non-git-developer point of view.
> But only two commits for today. The first one seems fine. The second
> one makes me write this mail ;-)
Thanks a lot!
> On 10/14/2016 04:14 PM, Pranit Bauva wrote:
>> +static int check_term_format(const char *term, const char *orig_term)
>> +{
> [...]
>> + if (one_of(term, "help", "start", "skip", "next", "reset",
>> + "visualize", "replay", "log", "run", NULL))
> [... vs ...]
>> -check_term_format () {
>> - term=$1
>> - git check-ref-format refs/bisect/"$term" ||
>> - die "$(eval_gettext "'\$term' is not a valid term")"
>> - case "$term" in
>> - help|start|terms|skip|next|reset|visualize|replay|log|run)
>
> Is there a reasons why "terms" has been dropped from the list?
It is a mistake. I will rectify.. Thanks!
Regards,
Pranit Bauva
^ permalink raw reply
* Re: [PATCH v7 13/17] ref-filter: add `:dir` and `:base` options for ref printing atoms
From: Karthik Nayak @ 2016-11-15 6:48 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jacob Keller, Git mailing list
In-Reply-To: <xmqqy40lx2k8.fsf@gitster.mtv.corp.google.com>
On Tue, Nov 15, 2016 at 1:21 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Karthik Nayak <karthik.188@gmail.com> writes:
>
>>> - More importantly, what do these do? I do not think of a good
>>> description that generalizes "base of refs/foo/bar/boz is foo" to
>>> explain your :base.
>>
>> $ ./git for-each-ref --format "%(refname)%(end) %(refname:dir)"
>> refs/heads/master refs/heads
>> refs/heads/ref-filter refs/heads
>> refs/remotes/junio/va/i18n refs/remotes/junio/va
>>
>> $ ./git for-each-ref refs/heads --format
>> "%(align:left,30)%(refname)%(end) %(refname:base)"
>> refs/heads/master heads
>> refs/heads/ref-filter heads
>> refs/remotes/junio/va/i18n remotes
>>
>> I guess this should clear it up.
>
> Hmph.
>
> I would guess from these examples that :dir is an equivalent to
> dirname(). But it is unclear how :base is defined. Is it the path
> component that comes immediately after "refs/" that appears at the
> beginning?
':dir' is equivalent to dirname(). Yup, base is the folder right after 'refs/'.
For local branches it is 'heads' for remotes it is 'remotes'. This is useful
when we want to make decisions based on the type of branch we're dealing
with (using along with %(if)...%(end)).
--
Regards,
Karthik Nayak
^ permalink raw reply
* Re: [PATCH 1/2] push: --dry-run updates submodules when --recurse-submodules=on-demand
From: Johannes Sixt @ 2016-11-15 7:03 UTC (permalink / raw)
To: Brandon Williams, git
In-Reply-To: <1479172735-698-2-git-send-email-bmwill@google.com>
Am 15.11.2016 um 02:18 schrieb Brandon Williams:
> diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
> index 198ce84..e6ccc30 100755
> --- a/t/t5531-deep-submodule-push.sh
> +++ b/t/t5531-deep-submodule-push.sh
> @@ -427,7 +427,31 @@ test_expect_success 'push unpushable submodule recursively fails' '
> cd submodule.git &&
> git rev-parse master >../actual
> ) &&
> - test_cmp expected actual
> + test_cmp expected actual &&
> + git -C work reset --hard master^
This line looks like a clean-up to be done after the test case. You
should wrap it in test_when_finished, but outside of a sub-shell, which
looks like it's just one line earlier, before the test_cmp.
> +'
> +
> +test_expect_failure 'push --dry-run does not recursively update submodules' '
> + (
> + cd work &&
> + (
> + cd gar/bage &&
> + git checkout master &&
> + git rev-parse master >../../../expected_submodule &&
> + > junk9 &&
> + git add junk9 &&
> + git commit -m "Ninth junk"
> + ) &&
Could you please avoid this nested sub-shell? It is fine to cd around
when you are in a sub-shell.
> + git checkout master &&
> + git rev-parse master >../expected_pub
Broken && chain.
> + git add gar/bage &&
> + git commit -m "Ninth commit for gar/bage" &&
> + git push --dry-run --recurse-submodules=on-demand ../pub.git master
> + ) &&
> + git -C submodule.git rev-parse master >actual_submodule &&
> + git -C pub.git rev-parse master >actual_pub &&
All of the commands above are 'git something' that could become 'git -C
work something' and then the sub-shell would be unnecessary. I'm not
sure I would appreciate the verbosity of the result, though. (Perhaps
aligning the git subcommands after -C foo would help.)
> + test_cmp expected_pub actual_pub &&
> + test_cmp expected_submodule actual_submodule
> '
>
> test_done
>
^ permalink raw reply
* Re: [PATCH v7 13/17] ref-filter: add `:dir` and `:base` options for ref printing atoms
From: Jacob Keller @ 2016-11-15 7:55 UTC (permalink / raw)
To: Karthik Nayak; +Cc: Junio C Hamano, Git mailing list
In-Reply-To: <CAOLa=ZQepW9GiUrKEWXojpy10B86K-jb84G_dJeL=mqtjZ4AWg@mail.gmail.com>
On Mon, Nov 14, 2016 at 10:48 PM, Karthik Nayak <karthik.188@gmail.com> wrote:
> On Tue, Nov 15, 2016 at 1:21 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Karthik Nayak <karthik.188@gmail.com> writes:
>>
>>>> - More importantly, what do these do? I do not think of a good
>>>> description that generalizes "base of refs/foo/bar/boz is foo" to
>>>> explain your :base.
>>>
>>> $ ./git for-each-ref --format "%(refname)%(end) %(refname:dir)"
>>> refs/heads/master refs/heads
>>> refs/heads/ref-filter refs/heads
>>> refs/remotes/junio/va/i18n refs/remotes/junio/va
>>>
>>> $ ./git for-each-ref refs/heads --format
>>> "%(align:left,30)%(refname)%(end) %(refname:base)"
>>> refs/heads/master heads
>>> refs/heads/ref-filter heads
>>> refs/remotes/junio/va/i18n remotes
>>>
>>> I guess this should clear it up.
>>
>> Hmph.
>>
>> I would guess from these examples that :dir is an equivalent to
>> dirname(). But it is unclear how :base is defined. Is it the path
>> component that comes immediately after "refs/" that appears at the
>> beginning?
>
> ':dir' is equivalent to dirname(). Yup, base is the folder right after 'refs/'.
> For local branches it is 'heads' for remotes it is 'remotes'. This is useful
> when we want to make decisions based on the type of branch we're dealing
> with (using along with %(if)...%(end)).
>
> --
> Regards,
> Karthik Nayak
dirname makes sense. What about implementing a reverse variant of
strip, which you could perform stripping of right-most components and
instead of stripping by a number, strip "to" a number, ie: keep the
left N most components, and then you could use something like
"keep=2" to keep "refs/heads"
?
I think that would be more general purpose than basename, and less confusing?
Thanks,
Jake
^ permalink raw reply
* Re: [PATCH v7 13/17] ref-filter: add `:dir` and `:base` options for ref printing atoms
From: Jacob Keller @ 2016-11-15 7:56 UTC (permalink / raw)
To: Karthik Nayak; +Cc: Junio C Hamano, Git mailing list
In-Reply-To: <CA+P7+xo6OqcpLZ7v_m1EPm85eK2xCPD_LCw1Ly2RSPeSC0Ei7g@mail.gmail.com>
On Mon, Nov 14, 2016 at 11:55 PM, Jacob Keller <jacob.keller@gmail.com> wrote:
> On Mon, Nov 14, 2016 at 10:48 PM, Karthik Nayak <karthik.188@gmail.com> wrote:
>> On Tue, Nov 15, 2016 at 1:21 AM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Karthik Nayak <karthik.188@gmail.com> writes:
>>>
>>>>> - More importantly, what do these do? I do not think of a good
>>>>> description that generalizes "base of refs/foo/bar/boz is foo" to
>>>>> explain your :base.
>>>>
>>>> $ ./git for-each-ref --format "%(refname)%(end) %(refname:dir)"
>>>> refs/heads/master refs/heads
>>>> refs/heads/ref-filter refs/heads
>>>> refs/remotes/junio/va/i18n refs/remotes/junio/va
>>>>
>>>> $ ./git for-each-ref refs/heads --format
>>>> "%(align:left,30)%(refname)%(end) %(refname:base)"
>>>> refs/heads/master heads
>>>> refs/heads/ref-filter heads
>>>> refs/remotes/junio/va/i18n remotes
>>>>
>>>> I guess this should clear it up.
>>>
>>> Hmph.
>>>
>>> I would guess from these examples that :dir is an equivalent to
>>> dirname(). But it is unclear how :base is defined. Is it the path
>>> component that comes immediately after "refs/" that appears at the
>>> beginning?
>>
>> ':dir' is equivalent to dirname(). Yup, base is the folder right after 'refs/'.
>> For local branches it is 'heads' for remotes it is 'remotes'. This is useful
>> when we want to make decisions based on the type of branch we're dealing
>> with (using along with %(if)...%(end)).
>>
>> --
>> Regards,
>> Karthik Nayak
>
>
> dirname makes sense. What about implementing a reverse variant of
> strip, which you could perform stripping of right-most components and
> instead of stripping by a number, strip "to" a number, ie: keep the
> left N most components, and then you could use something like
>
> "keep=2" to keep "refs/heads"
>
> ?
>
> I think that would be more general purpose than basename, and less confusing?
>
> Thanks,
> Jake
You could even make it compatible with strip so that:
"keep=2,strip=1" would return the equivalent of base?
Thanks,
Jake
^ permalink raw reply
* Git status takes too long- How to improve the performance of git
From: ravalika @ 2016-11-15 9:33 UTC (permalink / raw)
To: git
Hi All,
We are using git-1.8.2 version for version control.
It is an centralized server and git status takes too long
How to improve the performance of git status
Git repo details:
Size of the .git folder is 8.9MB
Number of commits approx 53838 (git rev-list HEAD --count)
Number of branches - 330
Number of files - 63883
Working tree clone size is 4.3GB
time git status shows
real 0m23.673s
user 0m9.432s
sys 0m3.793s
then after 5 mins
real 0m4.864s
user 0m1.417s
sys 0m4.710s
And I have experimented the following ways
- - Setting core.ignorestat to true
- - Git gc &git clean
- - Shallow clone – Reducing number of commits
- - Clone only one branch
- Git repacking - git repack -ad && git prune
- - Cold/warm cache
Could you please let me know, what are the ways to improve the git
performance ?
I have gone through the mailing lists.
Thank you,
Renuka
--
View this message in context: http://git.661346.n2.nabble.com/Git-status-takes-too-long-How-to-improve-the-performance-of-git-tp7657456.html
Sent from the git mailing list archive at Nabble.com.
^ permalink raw reply
* Re: Git status takes too long- How to improve the performance of git
From: Fredrik Gustafsson @ 2016-11-15 10:24 UTC (permalink / raw)
To: ravalika; +Cc: git
In-Reply-To: <1479202392275-7657456.post@n2.nabble.com>
Hi,
On Tue, Nov 15, 2016 at 02:33:12AM -0700, ravalika wrote:
> We are using git-1.8.2 version for version control.
That's a three (almost four) year old version of git. Your first test
should be to see if an upgrade to a recent version will improve things.
> It is an centralized server and git status takes too long
A centralized server? How? git is designed to be runned locally. If
you're running git on a network file system, the performance will
suffer. Could you elaborate on how your environment is setup?
>
> How to improve the performance of git status
>
> Git repo details:
>
> Size of the .git folder is 8.9MB
> Number of commits approx 53838 (git rev-list HEAD --count)
> Number of branches - 330
> Number of files - 63883
> Working tree clone size is 4.3GB
.git folder of 8.9 MEGABYTE and working tree of 4.3 GIGABYTE? Is this a
typo?
>
> time git status shows
> real 0m23.673s
> user 0m9.432s
> sys 0m3.793s
>
> then after 5 mins
> real 0m4.864s
> user 0m1.417s
> sys 0m4.710s
A slow disc and empty caches are slow. Two ways of improving this is to
have faster discs or make sure your cache is up to date. When I'd a
really slow disc, I'd my shell to run a git status in the background to
load the cache everytime I started working on a project. This is however
an ugly hack that wasn't approved to be a part of git.
>
> And I have experimented the following ways
> - - Setting core.ignorestat to true
> - - Git gc &git clean
> - - Shallow clone – Reducing number of commits
> - - Clone only one branch
> - Git repacking - git repack -ad && git prune
> - - Cold/warm cache
>
> Could you please let me know, what are the ways to improve the git
> performance ?
> I have gone through the mailing lists.
You could always check the --assume-unchanged bit, see the manual page
for git update-index. However this is quite extreme and demanding for
the user.
--
Fredrik Gustafsson
phone: +46 733-608274
e-mail: iveqy@iveqy.com
website: http://www.iveqy.com
^ permalink raw reply
* Re: Git status takes too long- How to improve the performance of git
From: Christian Couder @ 2016-11-15 11:44 UTC (permalink / raw)
To: ravalika; +Cc: git, Fredrik Gustafsson
In-Reply-To: <20161115102400.GC28860@paksenarrion.iveqy.com>
On Tue, Nov 15, 2016 at 11:24 AM, Fredrik Gustafsson <iveqy@iveqy.com> wrote:
> On Tue, Nov 15, 2016 at 02:33:12AM -0700, ravalika wrote:
[...]
>> And I have experimented the following ways
>> - - Setting core.ignorestat to true
>> - - Git gc &git clean
>> - - Shallow clone – Reducing number of commits
>> - - Clone only one branch
>> - Git repacking - git repack -ad && git prune
>> - - Cold/warm cache
>>
>> Could you please let me know, what are the ways to improve the git
>> performance ?
>> I have gone through the mailing lists.
>
> You could always check the --assume-unchanged bit, see the manual page
> for git update-index. However this is quite extreme and demanding for
> the user.
If you install a recent version version, you may be able to use the
untracked cache feature.
(See "core.untrackedCache" in the git config documentation and
--untracked-cache in the git update-index documentation.)
^ permalink raw reply
* Re: [PATCH v1 2/2] travis-ci: disable GIT_TEST_HTTPD for macOS
From: Heiko Voigt @ 2016-11-15 12:07 UTC (permalink / raw)
To: Lars Schneider
Cc: Jeff King, Junio C Hamano, Torsten Bögershausen, git,
Eric Sunshine
In-Reply-To: <2088B631-4FE8-4232-9F3C-699122E6A7B0@gmail.com>
On Fri, Nov 11, 2016 at 09:22:51AM +0100, Lars Schneider wrote:
> To all macOS users on the list:
> Does anyone execute the tests with GIT_TEST_HTTPD enabled successfully?
Nope. The following tests fail for me on master: 5539, 5540, 5541, 5542,
5550, 5551, 5561, 5812.
Cheers Heiko
^ permalink raw reply
* New to git, need help!
From: Mayank Gupta @ 2016-11-15 12:30 UTC (permalink / raw)
To: git
Hi All,
I'm new to open source and have recently joined this mailing list.
Since I'm new at this, I think I can initially contribute to the
community by fixing some small bugs or errors but as the documentation
is too large, I don't know where to start.
So if anybody could guide me on how to go about it, it would be really
appreciated.
Thanks,
Mayank
^ permalink raw reply
* git shortlog vs. stdin
From: Andreas Krey @ 2016-11-15 13:04 UTC (permalink / raw)
To: git
Hi all,
I observed a strange an unexpected behaviour in 'git shortlog'.
When in git.git:
$ git shortlog -sn | wc
1441 4493 31477
but with input redirected:
$ git shortlog -sn </dev/null | wc
0 0 0
--no-pager expectedly doesn't help.
Observed with 2.6.2 and 2.10.0-rc1.
I originally stumbled over this while trying something like
$ ls z* | while read name rest; do
echo "$name" ====; git --no-pager shortlog | tail -4; done
where it also essentially terminates the while loop,
presumably by eating the stdin to the loop.
Bug or feature?
- Andreas
--
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800
^ permalink raw reply
* Re: git shortlog vs. stdin
From: Christian Neukirchen @ 2016-11-15 13:39 UTC (permalink / raw)
To: git
In-Reply-To: <20161115130418.GA28847@inner.h.apk.li>
Andreas Krey <a.krey@gmx.de> writes:
> Bug or feature?
Documented feature, but you're holding it wrong ;)
If no revisions are passed on the command line and either standard
input is not a terminal or there is no current branch, git shortlog
will output a summary of the log read from standard input, without
reference to the current repository.
(Note that you can use shortlog ala "git log --pretty=short | git shortlog")
--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org
^ permalink raw reply
* Protecting old temporary objects being reused from concurrent "git gc"?
From: Matt McCutchen @ 2016-11-15 14:13 UTC (permalink / raw)
To: git
The Braid subproject management tool stores the subproject content in
the main tree and is able to switch to a different upstream revision of
a subproject by doing the equivalent of "git read-tree -m" on the
superproject tree and the two upstream trees. The tricky part is
preparing temporary trees with the upstream content moved to the path
configured for the superproject. The usual method is "git read-tree
--prefix", but using what index file? Braid currently uses the user's
actual worktree, which can leave a mess if it gets interrupted:
https://github.com/cristibalan/braid/blob/7d81da6e86e24de62a74f3ab8d880666cb343b04/lib/braid/commands/update.rb#L98
I want to change this to something that won't leave an inconsistent
state if interrupted. I've written code for this kind of thing before
that sets GIT_INDEX_FILE and uses a temporary index file and "git
write-tree". But I realized that if "git gc" runs concurrently, the
generated tree could be deleted before it is used and the tool would
fail. If I had a need to run "git commit-tree", it seems like I might
even end up with a commit object with a broken reference to a tree.
"git gc" normally doesn't delete objects that were created in the last
2 weeks, but if an identical tree was added to the object database more
than 2 weeks ago by another operation and is unreferenced, it could be
reused without updating its mtime and it could still get deleted.
Is there a recommended way to avoid this kind of problem in add-on
tools? (I searched the Git documentation and the web for information
about races with "git gc" and didn't find anything useful.) If not, it
seems to be a significant design flaw in "git gc", even if the problem
is extremely rare in practice. I wonder if some of the built-in
commands may have the same problem, though I haven't tried to test
them. If this is confirmed to be a known problem affecting built-in
commands, then at least I won't feel bad about introducing the
same problem into add-on tools. :/
Thanks,
Matt
^ permalink raw reply
* Re: [PATCH v1 2/2] travis-ci: disable GIT_TEST_HTTPD for macOS
From: Lars Schneider @ 2016-11-15 14:18 UTC (permalink / raw)
To: Heiko Voigt
Cc: Jeff King, Junio C Hamano, Torsten Bögershausen, git,
Eric Sunshine
In-Reply-To: <20161115120718.GA7854@book.hvoigt.net>
> On 15 Nov 2016, at 13:07, Heiko Voigt <hvoigt@hvoigt.net> wrote:
>
> On Fri, Nov 11, 2016 at 09:22:51AM +0100, Lars Schneider wrote:
>> To all macOS users on the list:
>> Does anyone execute the tests with GIT_TEST_HTTPD enabled successfully?
>
> Nope. The following tests fail for me on master: 5539, 5540, 5541, 5542,
> 5550, 5551, 5561, 5812.
That's what I see, too. Apache needs to be configured in some special way
to make them work and I was wondering if anyone has figured that out
already for macOS...
However, I much prefer Peff's idea to test against real world servers:
http://public-inbox.org/git/20161111092824.qqgrmhtkuw3wpbwa@sigill.intra.peff.net/
- Lars
^ permalink raw reply
* Re: RFC: Enable delayed responses to Git clean/smudge filter requests
From: Lars Schneider @ 2016-11-15 14:29 UTC (permalink / raw)
To: Eric Wong; +Cc: git
In-Reply-To: <20161115010356.GA29602@starla>
> On 15 Nov 2016, at 02:03, Eric Wong <e@80x24.org> wrote:
>
> Lars Schneider <larsxschneider@gmail.com> wrote:
>> Hi,
>>
>> Git always performs a clean/smudge filter on files in sequential order.
>> Sometimes a filter operation can take a noticeable amount of time.
>> This blocks the entire Git process.
>
> I have the same problem in many places which aren't git :>
>
>> I would like to give a filter process the possibility to answer Git with
>> "I got your request, I am processing it, ask me for the result later!".
>>
>> I see the following way to realize this:
>>
>> In unpack-trees.c:check_updates() [1] we loop through the cache
>> entries and "ask me later" could be an acceptable return value of the
>> checkout_entry() call. The loop could run until all entries returned
>> success or error.
>>
>> The filter machinery is triggered in various other places in Git and
>> all places that want to support "ask me later" would need to be patched
>> accordingly.
>
> That all sounds reasonable.
>
> The filter itself would need to be aware of parallelism
> if it lives for multiple objects, right?
Correct. This way Git doesn't need to deal with threading...
>> Do you think this could be a viable approach?
>
> It'd probably require a bit of work, but yes, I think it's viable.
>
> We already do this with curl_multi requests for parallel
> fetching from dumb HTTP servers, but that's driven by curl
> internals operating with a select/poll loop.
>
> Perhaps the curl API could be a good example for doing this.
Thanks for the pointer!
>> Do you see a better way?
>
> Nope, I prefer non-blocking state machines to threads for
> debuggability and determinism.
Agreed!
> Anyways, I'll plan on doing something similar (in Perl) with the
> synchronous parts of public-inbox which relies on "cat-file --batch"
> at some point... (my rotational disks are sloooooooow :<)
That sounds interesting! What changes to you have in mind for
"cat-file --batch"? We are thinking about performance improvements
in that area, too. I would be happy to help reviewing your patches!
Thanks a lot for your RFC feedback,
Lars
^ permalink raw reply
* [PATCH v3 0/4] Speedup finding of unpushed submodules
From: Heiko Voigt @ 2016-11-15 14:56 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jeff King, Stefan Beller, Jens.Lehmann, Fredrik Gustafsson,
Leandro Lucarella
You can find the second iteration of this series here:
http://public-inbox.org/git/cover.1475851621.git.hvoigt@hvoigt.net/
All mentioned issues should be fixed. I put the NEEDSWORK comment in a
seperate patch since it seemed to me as if we did not fully agree on
that. So in case we decide against it we can just drop that patch.
Cheers Heiko
Heiko Voigt (4):
serialize collection of changed submodules
serialize collection of refs that contain submodule changes
batch check whether submodule needs pushing into one call
submodule_needs_pushing() NEEDSWORK when we can not answer this
question
submodule.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++-------------
submodule.h | 5 ++-
transport.c | 29 +++++++++++----
3 files changed, 118 insertions(+), 36 deletions(-)
--
2.10.1.386.gc503e45
^ 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