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

Re: I just want the revision

From
Jeff King <peff@peff.net>
Date
Oct 11, 2021, 16:18 UTC
Message-ID
<YWRjztTfBNvKbsWR@coredump.intra.peff.net>
In-Reply-To
<e257c62e-edff-f559-95e7-374b623a3f61@zoho.com>
On Sun, Oct 10, 2021 at 07:37:12PM -0700, ToddAndMargo wrote:
Show 14 quoted lines
> I am trying to write a script to tell me the latest revision
> showing on
> 
> https://gitlab.freedesktop.org/spice/win32/spice-nsis/-/tree/master
> 
> which is 'virtio-win: rebase on 0.164", but I can only see this
> from a web browser, as the page is dynamic.
> 
> I do have access to the git link on that page:
> 
> https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
> 
> Does git (or some other) have a way of telling me
> JUST the revision without having to download the turkey?

I'd probably use an API provided by the hosting service in this case, as Christian recommended, since it will be the most efficient route. But just for the sake of completeness, if you wanted to limit yourself only to Git commands, you could make a partial shallow clone of a single branch like this:

  git clone --bare --depth 1 --filter=tree:0 \
	https://gitlab.freedesktop.org/spice/win32/spice-nsis.git
  cd spice-nsis.git
  git log -1 --format=%s

That should fetch only a single object. You only get the HEAD branch because --depth implies --single-branch. You can use "clone -b" to get a different branch if you want.

-Peff
Previous: Daniel Knittl-FrankNext: ToddAndMargo
Message 9 of 10 in “I just want the revision”
  1. ToddAndMargoOct 11, 2021
  2. Christian CouderOct 11, 2021
  3. ToddAndMargoOct 11, 2021
  4. ToddAndMargoOct 11, 2021
  5. Christian CouderOct 11, 2021
  6. ToddAndMargoOct 11, 2021
  7. Christian CouderOct 11, 2021
  8. Daniel Knittl-FrankOct 11, 2021
  9. Jeff KingOct 11, 2021
  10. ToddAndMargoOct 12, 2021

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.