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

Re: [PATCH] Completion must sort before using uniq

From
Joachim Schmitz <jojo@schmitz-digital.de>
Date
Nov 23, 2012, 08:09 UTC
Message-ID
<k8nb0t$2pf$1@ger.gmane.org>
In-Reply-To
<CAFj1UpF2wh0imcqW7Ez_J14R_07a_A1-YWESaGrHRNa7Nsv-xg@mail.gmail.com>
Marc Khouzam wrote:
> The uniq program only works with sorted input.  The man page states
> "uniq prints the unique lines in a sorted file".
...
Show 8 quoted lines
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -321,7 +321,7 @@ __git_refs ()
>                                if [[ "$ref" == "$cur"* ]]; then
>                                        echo "$ref"
>                                fi
> -                       done | uniq -u
> +                       done | sort | uniq -u

Is 'sort -u' not universally available and sufficient here? It is POSIX at least: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html

Bye, Jojo 
Previous: Marc KhouzamNext: Felipe Contreras
Message 2 of 8 in “Completion must sort before using uniq”
  1. Completion must sort before using uniqMarc Khouzam, Nov 22, 2012
  2. Joachim SchmitzNov 23, 2012
  3. Felipe ContrerasNov 23, 2012
  4. Completion must sort before using uniqMarc Khouzam, Nov 23, 2012
  5. Felipe ContrerasNov 23, 2012
  6. Completion must sort before using uniqMarc Khouzam, Nov 23, 2012
  7. Felipe ContrerasNov 23, 2012
  8. Junio C HamanoNov 25, 2012

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.