File tree Expand file tree Collapse file tree 2 files changed +74
-5
lines changed
Expand file tree Collapse file tree 2 files changed +74
-5
lines changed Original file line number Diff line number Diff line change @@ -463,11 +463,16 @@ impl Path {
463463 to_result : impl FnOnce ( & cache:: Transaction , git2:: Oid ) -> FieldResult < R > ,
464464 ) -> FieldResult < R > {
465465 let transaction = context. transaction . lock ( ) ?;
466- let id = transaction
467- . repo ( )
468- . find_tree ( self . tree ) ?
469- . get_path ( & self . path ) ?
470- . id ( ) ;
466+
467+ let id = if self . path == std:: path:: Path :: new ( "" ) {
468+ self . tree
469+ } else {
470+ transaction
471+ . repo ( )
472+ . find_tree ( self . tree ) ?
473+ . get_path ( & self . path ) ?
474+ . id ( )
475+ } ;
471476 to_result ( & transaction, id)
472477 }
473478
Original file line number Diff line number Diff line change 1+ $ . $ {TESTDIR}/ setup_test_env. sh
2+ $ cd $ {TESTTMP}
3+
4+
5+ $ git clone -q http: // localhost: 8001 / real_repo. git
6+ warning: You appear to have cloned an empty repository.
7+
8+ $ curl -s http: // localhost: 8002 / version
9+ Version : 0.3 . 0
10+
11+ $ cd real_repo
12+
13+ $ git status
14+ On branch master
15+
16+ No commits yet
17+
18+ nothing to commit (create/ copy files and use " git add" to track)
19+
20+ $ git checkout -b master
21+ Switched to a new branch ' master'
22+
23+ $ mkdir ws
24+ $ cat > ws/ file1 << EOF
25+ > content
26+ > EOF
27+ $ mkdir ws2
28+ $ cat > ws2/ file2 << EOF
29+ > content2
30+ > EOF
31+
32+ $ git add ws*/*
33+ $ git commit -m " add file1" 1 > / dev/ null
34+
35+ $ git push
36+ To http: // localhost: 8001 / real_repo. git
37+ * [new branch] master -> master
38+
39+ $ cd $ {TESTTMP}
40+
41+ $ cat > .. / query << EOF
42+ > {" query" : " {
43+ > rev(at: \" refs/heads/master\" ) {
44+ > dir {
45+ > path
46+ > hash
47+ > }
48+ > }
49+ > }" }
50+ > EOF
51+
52+ $ cat ../query | curl -s -X POST -H " content-type: application/ json" --data @- " http: // localhost: 8002 /~/ graphql/ real_repo. git"
53+ {
54+ " data" : {
55+ " rev" : {
56+ " dir" : {
57+ " path" : " " ,
58+ " hash" : " fcd9aba1ef0c6d812452bdcb04ac155f5d7f42d6"
59+ }
60+ }
61+ }
62+ } (no-eol)
63+
64+ $ cat ${ TESTTMP} /josh-proxy.out
You can’t perform that action at this time.
0 commit comments