[kommit] [Bug 486951] Crash when opening GIT repository with lightweight tags

2024-05-29 Thread Yaroslav Sidlovsky
https://bugs.kde.org/show_bug.cgi?id=486951

--- Comment #14 from Yaroslav Sidlovsky  ---
Looks good. Thanks!

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository with lightweight tags

2024-05-29 Thread Hamed Masafi
https://bugs.kde.org/show_bug.cgi?id=486951

--- Comment #13 from Hamed Masafi  ---
Ok; you're right. please check out new commit

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository with lightweight tags

2024-05-29 Thread Yaroslav Sidlovsky
https://bugs.kde.org/show_bug.cgi?id=486951

--- Comment #12 from Yaroslav Sidlovsky  ---
Also in my example it's this is taken into account and name is taken from ref
name `refs/tags/`:
```
mName = QString(refName).remove(QRegularExpression("^refs/tags/"));
```

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository with lightweight tags

2024-05-29 Thread Yaroslav Sidlovsky
https://bugs.kde.org/show_bug.cgi?id=486951

--- Comment #11 from Yaroslav Sidlovsky  ---
But it has name and displayed for example with `git log` or `tig`.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository with lightweight tags

2024-05-29 Thread Hamed Masafi
https://bugs.kde.org/show_bug.cgi?id=486951

--- Comment #10 from Hamed Masafi  ---
Yes, because it doesn't has name, isn't logical?

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository with lightweight tags

2024-05-29 Thread Yaroslav Sidlovsky
https://bugs.kde.org/show_bug.cgi?id=486951

--- Comment #9 from Yaroslav Sidlovsky  ---
Almost good but tag names is not displayed.
You can test it with this git repo:
```
1. mkdir /tmp/git && cd /tmp/git
2. git init
3. touch README.md && git add README.md && git commit -m 1
4. git tag some_tag

kommit /tmp/git
```

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository with lightweight tags

2024-05-29 Thread Hamed Masafi
https://bugs.kde.org/show_bug.cgi?id=486951

Hamed Masafi  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Hamed Masafi  ---
Hi Yaroslav
In new commit light tags are detected and the information are taken from
commit. Please check it out and let me know the result.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository with lightweight tags

2024-05-15 Thread Yaroslav Sidlovsky
https://bugs.kde.org/show_bug.cgi?id=486951

--- Comment #7 from Yaroslav Sidlovsky  ---
If `git_tag_lookup` fails to find tag - you can use `git_commit_lookup` to get
commit info.
And later create `Tag` class instance from the commit, something like that:
```
Tag::Tag(const char *refName, git_commit *commit)
{
mName = QString(refName).remove(QRegularExpression("^refs/tags/"));
mMessage = git_commit_message(commit);
const auto author = git_commit_author(commit);
mTagger.reset(new Signature{author});
}
```

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository with lightweight tags

2024-05-15 Thread Hamed Masafi
https://bugs.kde.org/show_bug.cgi?id=486951

Hamed Masafi  changed:

   What|Removed |Added

 Status|REPORTED|ASSIGNED
 Ever confirmed|0   |1

--- Comment #6 from Hamed Masafi  ---
Thank you for this in-depth review. For now I've applied your proposed. But in
next commits I'll work more on this, of course, with the help of the clues you
gave.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository with lightweight tags

2024-05-15 Thread Yaroslav Sidlovsky
https://bugs.kde.org/show_bug.cgi?id=486951

Yaroslav Sidlovsky  changed:

   What|Removed |Added

Summary|Crash when opening GIT  |Crash when opening GIT
   |repository  |repository with lightweight
   ||tags

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository

2024-05-13 Thread Yaroslav Sidlovsky
https://bugs.kde.org/show_bug.cgi?id=486951

--- Comment #5 from Yaroslav Sidlovsky  ---
Some light on situation that `git_tag_lookup` is not working for all tags:

git_tag_lookup only works for annotated tags:
https://github.com/libgit2/libgit2/issues/5586 
> git_tag_lookup to emphasise that this will not work for all tags. that it 
> only works for annotated tags and not for lightweight tags

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository

2024-05-13 Thread Yaroslav Sidlovsky
https://bugs.kde.org/show_bug.cgi?id=486951

--- Comment #4 from Yaroslav Sidlovsky  ---
P.S. After applying the patch console shows this errors:
```
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
libgit2 error: the requested type does not match the type in the ODB
```

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository

2024-05-13 Thread Yaroslav Sidlovsky
https://bugs.kde.org/show_bug.cgi?id=486951

Yaroslav Sidlovsky  changed:

   What|Removed |Added

URL||https://bugzilla.redhat.com
   ||/show_bug.cgi?id=2280215

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository

2024-05-13 Thread Yaroslav Sidlovsky
https://bugs.kde.org/show_bug.cgi?id=486951

--- Comment #3 from Yaroslav Sidlovsky  ---
Created attachment 169431
  --> https://bugs.kde.org/attachment.cgi?id=169431=edit
kommit-fix-crash.patch

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository

2024-05-13 Thread Yaroslav Sidlovsky
https://bugs.kde.org/show_bug.cgi?id=486951

--- Comment #2 from Yaroslav Sidlovsky  ---
After some debugging it turns out that crash happens because return value from
function `git_tag_lookup` is ignored it is non zero.

I'm talking about this line of code:
https://invent.kde.org/sdk/kommit/-/blob/5954f99cf5e5db96c13a73fd1752e4ad2211fa1e/src/libkommit/gitmanager.cpp?page=2#L1266

Proposed patch:
```
diff --git a/src/libkommit/gitmanager.cpp b/src/libkommit/gitmanager.cpp
index c1b4244..8f8ce9f 100644
--- a/src/libkommit/gitmanager.cpp
+++ b/src/libkommit/gitmanager.cpp
@@ -1241,7 +1241,14 @@ void Manager::forEachTags(std::function cb)
 Q_UNUSED(name)
 auto w = reinterpret_cast(payload);
 git_tag *t;
-git_tag_lookup(, w->repo, oid_c);
+int ret = git_tag_lookup(, w->repo, oid_c);
+if (ret) {
+const auto err = git_error_last();
+if (err) {
+qWarning().noquote().nospace() << "libgit2 error: " <<
err->message;
+}
+return 0;
+}

 if (!t)
 return 0;
```

Macros PRINT_ERROR won't work here.

-- 
You are receiving this mail because:
You are watching all bug changes.

[kommit] [Bug 486951] Crash when opening GIT repository

2024-05-13 Thread Yaroslav Sidlovsky
https://bugs.kde.org/show_bug.cgi?id=486951

--- Comment #1 from Yaroslav Sidlovsky  ---
Created attachment 169430
  --> https://bugs.kde.org/attachment.cgi?id=169430=edit
GDB backtrace

-- 
You are receiving this mail because:
You are watching all bug changes.