Skip to content

describe --contains / name-rev --weight

Junio C Hamano git 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest6 patches 0 repliesNew

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6name-rev: lose unnecessary typedefbuiltin/name-rev.c+3 -30 replies
2/6name_rev: clarify the logic to assign a new tip-name to a commitbuiltin/name-rev.c+25 -200 replies
3/6name-rev: --weight optionbuiltin/name-rev.c+102 -21 reply
4/6name-rev --weight: cache the computed weight in notesbuiltin/name-rev.c+51 -50 replies
5/6name-rev --weight: tests and documentationDocumentation/git-name-rev.txt t/t6039-name-rev.sh+73 -30 replies
6/6describe --contains: use "name-rev --weight"builtin/describe.c+2 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/6] describe --contains / name-rev --weight

Greg KH noticed that the commit 0136db586c that was merged to the mainline back in v3.5-rc1 days was merged again as part of a different branch to the mainline before v3.6-rc1.

"git describe --contains" gives the commit a name based on the newer v3.6-rc1 tag, which was surprising.

This is because "describe --contains" calls "name-rev", which tries to use the tag that minimizes the steps between the tag and the commit being named. The branch merged recently to the mainline did not have as much work done on top of the commit as the old branch that was merged earlier, and "name-rev" chose to use the newer tag to base the name on.

The new "--weight" option introduced by this series tells it to use the oldest tag that contains the commit being named instead. This matches what people expect from "describe --contains" better.

Junio C Hamano (6):
name-rev: lose unnecessary typedef
name_rev: clarify the logic to assign a new tip-name to a commit
name-rev: --weight option
name-rev --weight: cache the computed weight in notes name-rev --weight: tests and documentation
describe --contains: use "name-rev --weight"

 Documentation/git-name-rev.txt |  14 ++-
 builtin/describe.c             |   3 +-
 builtin/name-rev.c             | 195 ++++++++++++++++++++++++++++++++++++-----
 t/t6039-name-rev.sh            |  62 +++++++++++++
 4 files changed, 248 insertions(+), 26 deletions(-)
 create mode 100755 t/t6039-name-rev.sh
Signature · 1 line
1.7.12.286.g9df01f7