git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: ephemeral-branches instead of detached-head?

From
Sitaram Chamarty <sitaramc@gmail.com>
Date
Aug 14, 2013, 09:05 UTC
Message-ID
<520B486D.1040602@gmail.com>
In-Reply-To
<CAPrKj1ZQL0N7VFfZ3qS14Nhp8O4Kaez9QWK7AvqCXZds1Q=mRw@mail.gmail.com>
On 08/14/2013 12:40 PM, Andres Perera wrote:
Show 42 quoted lines
> On Wed, Aug 14, 2013 at 2:02 AM, Sitaram Chamarty <sitaramc@gmail.com> wrote:
>> On 08/14/2013 07:14 AM, Junio C Hamano wrote:
>>> Sitaram Chamarty <sitaramc@gmail.com> writes:
>>>
>>>>     # all reflog entries that are not on a branch, tag, or remote
>>>>     d1 = !gitk --date-order $(git log -g --pretty=%H) --not --branches --tags --remotes
>>>>     # all dangling commits not on a branch, tag, or remote
>>>>     d2 = !gitk --date-order $(git fsck | grep "dangling.commit" | cut -f3 -d' ') --not --branches --tags --remotes
>>>>
>>>> (Apologies if something like this was already said; I was not following
>>>> the discussion closely enough to notice)
>>>
>>> Yup.
>>>
>>> A potential problem is that the output from "log -g --pretty=%H" or
>>> "fsck | grep dangling" may turn out to be humongous.  Other than
>>> that, they correctly compute what you want.
>>
>> I thought I mentioned that but I can't find my email now so maybe I
>> didn't.
>>
>> In practice though, I find that, bash at least seems happy to take
>> command lines as long as 7+ million characters long, so with the default
>> reflog expire times, that should work out to 10,000 commits *per day*.
>> [Tested with: echo {1000000..1900000}  > junk; echo `cat junk` | wc]
> 
> echo is a builtin in bash, as is the case with other shell implementations
> 
> builtins may have different limit's than exec()'s ARG_MAX
> 
> $ getconf ARG_MAX
> 262144
> $ perl -e 'print "A" x (262144 * 2)' | wc -c
>   524288
> $ perl -e 'print "A" x (262144 * 2)' | sh -c 'read v; echo "$v"' | wc -c
>   524289
> $ perl -e 'print "A" x (262144 * 2)' | sh -c 'read v; /bin/echo "$v"' | wc -c
> sh: /bin/echo: Argument list too long
>        0
> 
> builtin's argument buffer limit tends to be aligned with the
> implementation's lexer buffer limit
Aah; good catch -- I did not know this.  Thanks!

My systems show 2621440 on CentOS 6 and 2097152 on Fedora 19, so -- dividing by 8 (abbrev SHA + space) then by 90, that's still 2900 commits *per day* to run past this limit though!

(side note: making a single argument that long seems to have a much lower limit than having multiple arguments:

    $ /bin/echo `perl -e 'print "A" x (1000000)'` | wc
    -bash: /bin/echo: Argument list too long
          0       0       0
    $ /bin/echo `perl -e 'print "A " x (1000000)'` | wc
          1 1000000 2000000

notice that the second one is twice as long in terms of bytes, but it's not a single argument).

Previous: Andres PereraNext: Andres Perera
Message 19 of 24 in “ephemeral-branches instead of detached-head?”
  1. David JeskeAug 12, 2013
  2. Jonathan NiederAug 12, 2013
  3. Junio C HamanoAug 12, 2013
  4. David JeskeAug 12, 2013
  5. David JeskeAug 12, 2013
  6. Duy NguyenAug 12, 2013
  7. Andreas SchwabAug 12, 2013
  8. Junio C HamanoAug 12, 2013
  9. David JeskeAug 12, 2013
  10. David JeskeAug 12, 2013
  11. Junio C HamanoAug 12, 2013
  12. Duy NguyenAug 13, 2013
  13. Junio C HamanoAug 13, 2013
  14. Sitaram ChamartyAug 14, 2013
  15. Junio C HamanoAug 14, 2013
  16. Sitaram ChamartyAug 14, 2013
  17. Jeff KingAug 14, 2013
  18. Andres PereraAug 14, 2013
  19. Sitaram ChamartyAug 14, 2013
  20. Andres PereraAug 14, 2013
  21. Duy NguyenAug 13, 2013
  22. Fwd: ephemeral-branches instead of detached-head?David Jeske, Aug 13, 2013
  23. Junio C HamanoAug 13, 2013
  24. Junio C HamanoAug 13, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.