]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jk/describe-blob'
authorJunio C Hamano <gitster@pobox.com>
Fri, 29 Aug 2025 16:44:37 +0000 (09:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 Aug 2025 16:44:38 +0000 (09:44 -0700)
"git describe <blob>" misbehaves and/or crashes in some corner
cases, which has been taught to exit with failure gracefully.

* jk/describe-blob:
  describe: pass commit to describe_commit()
  describe: handle blob traversal with no commits
  describe: catch unborn branch in describe_blob()
  describe: error if blob not found
  describe: pass oid struct by const pointer

1  2 
builtin/describe.c

index 054097621082092facfe58da152b1a05b92565e1,04df89d56b91e71b5ff7f619a5d38229857cde78..fbe78ace668683561e671dffd2a6a52badec6fc6
@@@ -352,10 -313,10 +352,10 @@@ static void append_suffix(int depth, co
                    repo_find_unique_abbrev(the_repository, oid, abbrev));
  }
  
- static void describe_commit(struct object_id *oid, struct strbuf *dst)
+ static void describe_commit(struct commit *cmit, struct strbuf *dst)
  {
-       struct commit *cmit, *gave_up_on = NULL;
+       struct commit *gave_up_on = NULL;
 -      struct commit_list *list;
 +      struct lazy_queue queue = LAZY_QUEUE_INIT;
        struct commit_name *n;
        struct possible_tag all_matches[MAX_TAGS];
        unsigned int match_cnt = 0, annotated_cnt = 0, cur_match;