Skip to content

Commit 61643c0

Browse files
authored
Make filter_commit work with tag objects (#1394)
Change: tags-objects-fix
1 parent f95c264 commit 61643c0

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

josh-core/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,10 @@ pub fn filter_commit(
221221
oid: git2::Oid,
222222
permissions: filter::Filter,
223223
) -> JoshResult<git2::Oid> {
224-
let original_commit = transaction.repo().find_commit(oid)?;
224+
let original_commit = {
225+
let obj = transaction.repo().find_object(oid, None)?;
226+
obj.peel_to_commit()?
227+
};
225228

226229
let perms_commit = if let Some(s) = transaction.get_ref(permissions, oid) {
227230
s

tests/proxy/clone_subtree_tags.t

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
1 file changed, 1 insertion(+)
3131
create mode 100644 sub1/file12
3232

33+
$ git tag -m "a tag object" a_tag_object
3334

3435
$ mkdir sub2
3536
$ echo contents1 > sub2/file2
@@ -40,7 +41,7 @@
4041
create mode 100644 sub2/file2
4142

4243
$ git describe --tags
43-
a_tag-2-gbbc3f80
44+
a_tag_object-1-gbbc3f80
4445

4546
$ tree
4647
.
@@ -65,6 +66,7 @@
6566
$ git push --tags
6667
To http://localhost:8001/real_repo.git
6768
* [new tag] a_tag -> a_tag
69+
* [new tag] a_tag_object -> a_tag_object
6870

6971
$ cd ${TESTTMP}
7072

@@ -84,7 +86,7 @@
8486
* add file1
8587

8688
$ git describe --tags
87-
a_tag-1-g6e99e1e
89+
a_tag_object
8890

8991
$ cat file1
9092
contents1
@@ -142,6 +144,8 @@
142144
| | | |-- 282e9cdc1b972fffd08fd21eead43bc0c83cb8
143145
| | | |-- c3f8026800792a43ffbc932153f4864509378e
144146
| | | `-- f54cff926d013ce65a3b1cf4e8d239c43beb4b
147+
| | |-- c1
148+
| | | `-- 90f9e0d45065e20a13996f541c3571ed317c45
145149
| | |-- c8
146150
| | | `-- 2fc150c43f13cc56c0e9caeba01b58ec612022
147151
| | |-- fa
@@ -158,7 +162,8 @@
158162
| | |-- heads
159163
| | | `-- master
160164
| | `-- tags
161-
| | `-- a_tag
165+
| | |-- a_tag
166+
| | `-- a_tag_object
162167
| `-- tags
163168
`-- overlay
164169
|-- HEAD
@@ -178,5 +183,5 @@
178183
|-- namespaces
179184
`-- tags
180185

181-
38 directories, 26 files
186+
39 directories, 28 files
182187
$ cat ${TESTTMP}/josh-proxy.out | grep TAGS

0 commit comments

Comments
 (0)