Commit d5386da
committed
replace-refs: fix support of qualified replace ref paths
The enactment of replace refs in
replace-object.c#register_replace_ref() explicitly uses the last
portion of the ref "path", the substring after the last slash, as the
object ID to be replaced. This means that replace refs can be
organized into different paths; you can separate replace refs created
for different purposes, like "refs/replace/2012-migration/*". This in
turn makes it practical to store prepared replace refs in different ref
paths on a git server, and have users "map" them, via specific
refspecs, into their local repos; different types of replacements can
be mapped into different sub-paths of refs/replace/.
The only way this didn't "work" is in the commit decoration process,
in log-tree.c#add_ref_decoration(), where different logic was used to
obtain the replaced object ID, removing the "refs/replace/" prefix
only. This inconsistent logic meant that more structured replace ref
paths caused a warning to be printed, and the "replaced" decoration to
be omitted.
Fix this decoration logic to use the same "last part of ref path"
logic, fixing spurious warnings (and missing decorations) for users
of more structured replace ref paths. Also add tests for qualified
replace ref paths.
Signed-off-by: Tao Klerks <tao@klerks.biz>1 parent f65182a commit d5386da
3 files changed
+30
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
166 | 168 | | |
167 | 169 | | |
168 | | - | |
169 | | - | |
| 170 | + | |
170 | 171 | | |
171 | 172 | | |
172 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
134 | 151 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
546 | 546 | | |
547 | 547 | | |
548 | 548 | | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
549 | 559 | | |
0 commit comments