All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Jensen <jjensen@workspacewhiz.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Quickly searching for a note
Date: Fri, 21 Sep 2012 12:29:50 -0600	[thread overview]
Message-ID: <505CB21E.4040607@workspacewhiz.com> (raw)
In-Reply-To: <7vy5k370n7.fsf@alter.siamese.dyndns.org>

----- Original Message -----
From: Junio C Hamano
Date: 9/21/2012 11:21 AM
> Joshua Jensen <jjensen@workspacewhiz.com> writes:
>
>> Background: To tie Perforce changelists to Git commits, I add a note
>> to a commit with the form "P4@123456".  Later, I use the note to sync
>> down the closest Perforce changelist matching the Git commit.
>>
>> I search for these notes by getting a list of revisions:
>>
>>          git rev-list --max-count=1000
>>
>> I iterate those revisions and run git show and grep on each:
>>
>>          git show -s --format=%N%n%s --show-notes=p4notes COMMIT
>>
>> For short runs, this isn't so bad.  For longer runs of commits (I just
>> walked through approximately 100), it takes a long time. Running 'git
>> show' is costing me about 7/10 of second, presumably because I am on
>> Windows.
> Is there any particular reason you do that as two separate steps?
> It would feel more natural, at least to me, to do something along
> the lines of
>
> 	git log --show-notes=p4notes -1000
>
>
Thanks for the reply.

I did not make clear above that I want to stop looking when I find the 
first commit that has the note.

In the case of 'git log --show-notes=p4notes -1000', Git will process 
and hand me the log output for 1,000 commits.  It is rare I need to walk 
that deep.  We saw 300 commits deep once on a long-lived branch that 
hadn't been merged in yet, but I'd be surprised to see 1,000.

Still, it shows an arbitrary choice.  Really, I want to say to Git: Walk 
up the history as far as you need to go from HEAD and return to me the 
first commit containing the text "P4@".

Any other thoughts?

-Josh

  reply	other threads:[~2012-09-21 18:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21 14:41 Quickly searching for a note Joshua Jensen
2012-09-21 15:10 ` Andreas Schwab
2012-09-21 18:34   ` Joshua Jensen
2012-09-21 17:21 ` Junio C Hamano
2012-09-21 18:29   ` Joshua Jensen [this message]
2012-09-21 20:04     ` Junio C Hamano
2012-09-21 20:25       ` Joshua Jensen
2012-09-21 20:50         ` Johannes Sixt
2012-09-21 21:10           ` Joshua Jensen
2012-09-21 23:37             ` Jeff King
2012-09-21 23:51               ` Junio C Hamano
2012-09-22 16:10                 ` Michael J Gruber
2012-09-22 20:23                   ` Junio C Hamano
2012-09-23 15:07                     ` Michael J Gruber
2012-09-25  0:42                       ` Jeff King
2012-09-25  7:24                         ` Michael J Gruber
2012-09-25  0:38                     ` Jeff King
2012-09-25 16:19                       ` Junio C Hamano
2012-09-22  4:51 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=505CB21E.4040607@workspacewhiz.com \
    --to=jjensen@workspacewhiz.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.