go-git icon indicating copy to clipboard operation
go-git copied to clipboard

[Question] How can I get a tag by commit hash?

Open guiferpa opened this issue 6 years ago • 2 comments

Hey, I am using this project for retrieve datas from a git local repository and I trying to do a range of commit between head commit and last created tag. I thinking that to do it I need figure out the tag based in a search using commit hash as parameter.

For example:

commit c65ab6c4edfdea5069c371896267f433392a723c ----> HEAD
Author: Guilherme Paixão <[email protected]>
Date:   Mon Apr 1 12:46:50 2019 -0300

    Update .gitlab-ci.yml

commit 7ef0120983b0a7ddd5565e5813683f3b7d33b13d
Author: Guilherme Paixão <[email protected]>
Date:   Mon Apr 1 12:44:30 2019 -0300

    Update .gitlab-ci.yml

commit 1b95b1d42321632beb4e2d3cffcf42ee9d6b7004 (tag: v1.0.12)
Author: Guilherme Paixão <[email protected]>
Date:   Mon Mar 25 19:10:59 2019 -0300

    Fix addr for Redis instance

commit 4f3270def081c0c79087b0e4ce4e5ace97ae9fee
Author: Guilherme Paixão <[email protected]>
Date:   Sat Mar 23 13:21:12 2019 -0300

    Create expiresIn and secret for authenticate and validate resource as config

commit 040218b230008279dd081178f24e9943a3045fe6
Author: Guilherme Paixão <[email protected]>
Date:   Sat Mar 23 12:34:17 2019 -0300

In this example I will get only the first and second commits, because the next commit is a tag.

Tks

guiferpa avatar Apr 04 '19 16:04 guiferpa

Have you made any progress on this @guiferpa ? I am facing a similar issue myself.

leosunmo avatar Jan 22 '20 22:01 leosunmo

@leosunmo nothing yet. if it looks like a improve I can do this.

guiferpa avatar Jan 22 '20 23:01 guiferpa