]>
Commit | Line | Data |
---|---|---|
4264dc15 JH |
1 | #include "cache.h" |
2 | #include "builtin.h" | |
3 | #include "commit.h" | |
4 | #include "refs.h" | |
5 | #include "dir.h" | |
8d8b9f62 | 6 | #include "tree-walk.h" |
1389d9dd JH |
7 | #include "diff.h" |
8 | #include "revision.h" | |
9 | #include "reachable.h" | |
10 | ||
11 | /* | |
12 | * reflog expire | |
13 | */ | |
14 | ||
15 | static const char reflog_expire_usage[] = | |
cf39f54e | 16 | "git-reflog (show|expire) [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>..."; |
3c386aa3 | 17 | static const char reflog_delete_usage[] = |
55f10565 | 18 | "git-reflog delete [--verbose] [--dry-run] [--rewrite] [--updateref] <refs>..."; |
4264dc15 | 19 | |
4aec56d1 JH |
20 | static unsigned long default_reflog_expire; |
21 | static unsigned long default_reflog_expire_unreachable; | |
22 | ||
1389d9dd JH |
23 | struct cmd_reflog_expire_cb { |
24 | struct rev_info revs; | |
25 | int dry_run; | |
26 | int stalefix; | |
2b81fab2 | 27 | int rewrite; |
55f10565 | 28 | int updateref; |
1389d9dd JH |
29 | int verbose; |
30 | unsigned long expire_total; | |
31 | unsigned long expire_unreachable; | |
552cecc2 | 32 | int recno; |
1389d9dd JH |
33 | }; |
34 | ||
4264dc15 JH |
35 | struct expire_reflog_cb { |
36 | FILE *newlog; | |
37 | const char *ref; | |
38 | struct commit *ref_commit; | |
1389d9dd | 39 | struct cmd_reflog_expire_cb *cmd; |
2b81fab2 | 40 | unsigned char last_kept_sha1[20]; |
4264dc15 JH |
41 | }; |
42 | ||
bda3a31c JH |
43 | struct collected_reflog { |
44 | unsigned char sha1[20]; | |
45 | char reflog[FLEX_ARRAY]; | |
46 | }; | |
47 | struct collect_reflog_cb { | |
48 | struct collected_reflog **e; | |
49 | int alloc; | |
50 | int nr; | |
51 | }; | |
52 | ||
cd1f9c36 JH |
53 | #define INCOMPLETE (1u<<10) |
54 | #define STUDYING (1u<<11) | |
55 | ||
8d8b9f62 JH |
56 | static int tree_is_complete(const unsigned char *sha1) |
57 | { | |
58 | struct tree_desc desc; | |
cd1f9c36 JH |
59 | struct name_entry entry; |
60 | int complete; | |
61 | struct tree *tree; | |
8d8b9f62 | 62 | |
cd1f9c36 JH |
63 | tree = lookup_tree(sha1); |
64 | if (!tree) | |
8d8b9f62 | 65 | return 0; |
cd1f9c36 JH |
66 | if (tree->object.flags & SEEN) |
67 | return 1; | |
68 | if (tree->object.flags & INCOMPLETE) | |
69 | return 0; | |
70 | ||
6fda5e51 | 71 | if (!tree->buffer) { |
21666f1a | 72 | enum object_type type; |
6fda5e51 LT |
73 | unsigned long size; |
74 | void *data = read_sha1_file(sha1, &type, &size); | |
cd1f9c36 JH |
75 | if (!data) { |
76 | tree->object.flags |= INCOMPLETE; | |
8d8b9f62 JH |
77 | return 0; |
78 | } | |
cd1f9c36 | 79 | tree->buffer = data; |
6fda5e51 | 80 | tree->size = size; |
8d8b9f62 | 81 | } |
6fda5e51 | 82 | init_tree_desc(&desc, tree->buffer, tree->size); |
cd1f9c36 JH |
83 | complete = 1; |
84 | while (tree_entry(&desc, &entry)) { | |
85 | if (!has_sha1_file(entry.sha1) || | |
86 | (S_ISDIR(entry.mode) && !tree_is_complete(entry.sha1))) { | |
87 | tree->object.flags |= INCOMPLETE; | |
88 | complete = 0; | |
89 | } | |
90 | } | |
91 | free(tree->buffer); | |
92 | tree->buffer = NULL; | |
8d8b9f62 | 93 | |
cd1f9c36 JH |
94 | if (complete) |
95 | tree->object.flags |= SEEN; | |
96 | return complete; | |
97 | } | |
1389d9dd JH |
98 | |
99 | static int commit_is_complete(struct commit *commit) | |
100 | { | |
101 | struct object_array study; | |
102 | struct object_array found; | |
103 | int is_incomplete = 0; | |
104 | int i; | |
105 | ||
106 | /* early return */ | |
107 | if (commit->object.flags & SEEN) | |
108 | return 1; | |
109 | if (commit->object.flags & INCOMPLETE) | |
110 | return 0; | |
111 | /* | |
112 | * Find all commits that are reachable and are not marked as | |
113 | * SEEN. Then make sure the trees and blobs contained are | |
114 | * complete. After that, mark these commits also as SEEN. | |
115 | * If some of the objects that are needed to complete this | |
116 | * commit are missing, mark this commit as INCOMPLETE. | |
117 | */ | |
118 | memset(&study, 0, sizeof(study)); | |
119 | memset(&found, 0, sizeof(found)); | |
120 | add_object_array(&commit->object, NULL, &study); | |
121 | add_object_array(&commit->object, NULL, &found); | |
122 | commit->object.flags |= STUDYING; | |
123 | while (study.nr) { | |
124 | struct commit *c; | |
125 | struct commit_list *parent; | |
126 | ||
127 | c = (struct commit *)study.objects[--study.nr].item; | |
128 | if (!c->object.parsed && !parse_object(c->object.sha1)) | |
129 | c->object.flags |= INCOMPLETE; | |
130 | ||
131 | if (c->object.flags & INCOMPLETE) { | |
132 | is_incomplete = 1; | |
133 | break; | |
134 | } | |
135 | else if (c->object.flags & SEEN) | |
136 | continue; | |
137 | for (parent = c->parents; parent; parent = parent->next) { | |
138 | struct commit *p = parent->item; | |
139 | if (p->object.flags & STUDYING) | |
140 | continue; | |
141 | p->object.flags |= STUDYING; | |
142 | add_object_array(&p->object, NULL, &study); | |
143 | add_object_array(&p->object, NULL, &found); | |
144 | } | |
145 | } | |
146 | if (!is_incomplete) { | |
cd1f9c36 JH |
147 | /* |
148 | * make sure all commits in "found" array have all the | |
1389d9dd JH |
149 | * necessary objects. |
150 | */ | |
cd1f9c36 | 151 | for (i = 0; i < found.nr; i++) { |
1389d9dd JH |
152 | struct commit *c = |
153 | (struct commit *)found.objects[i].item; | |
cd1f9c36 | 154 | if (!tree_is_complete(c->tree->object.sha1)) { |
1389d9dd | 155 | is_incomplete = 1; |
cd1f9c36 JH |
156 | c->object.flags |= INCOMPLETE; |
157 | } | |
1389d9dd JH |
158 | } |
159 | if (!is_incomplete) { | |
160 | /* mark all found commits as complete, iow SEEN */ | |
161 | for (i = 0; i < found.nr; i++) | |
162 | found.objects[i].item->flags |= SEEN; | |
163 | } | |
164 | } | |
165 | /* clear flags from the objects we traversed */ | |
166 | for (i = 0; i < found.nr; i++) | |
167 | found.objects[i].item->flags &= ~STUDYING; | |
168 | if (is_incomplete) | |
169 | commit->object.flags |= INCOMPLETE; | |
cd1f9c36 JH |
170 | else { |
171 | /* | |
172 | * If we come here, we have (1) traversed the ancestry chain | |
173 | * from the "commit" until we reach SEEN commits (which are | |
174 | * known to be complete), and (2) made sure that the commits | |
175 | * encountered during the above traversal refer to trees that | |
176 | * are complete. Which means that we know *all* the commits | |
177 | * we have seen during this process are complete. | |
178 | */ | |
179 | for (i = 0; i < found.nr; i++) | |
180 | found.objects[i].item->flags |= SEEN; | |
181 | } | |
1389d9dd JH |
182 | /* free object arrays */ |
183 | free(study.objects); | |
184 | free(found.objects); | |
185 | return !is_incomplete; | |
186 | } | |
187 | ||
4264dc15 JH |
188 | static int keep_entry(struct commit **it, unsigned char *sha1) |
189 | { | |
8d8b9f62 JH |
190 | struct commit *commit; |
191 | ||
4264dc15 JH |
192 | if (is_null_sha1(sha1)) |
193 | return 1; | |
8d8b9f62 JH |
194 | commit = lookup_commit_reference_gently(sha1, 1); |
195 | if (!commit) | |
196 | return 0; | |
197 | ||
1389d9dd JH |
198 | /* |
199 | * Make sure everything in this commit exists. | |
200 | * | |
201 | * We have walked all the objects reachable from the refs | |
202 | * and cache earlier. The commits reachable by this commit | |
203 | * must meet SEEN commits -- and then we should mark them as | |
204 | * SEEN as well. | |
205 | */ | |
206 | if (!commit_is_complete(commit)) | |
8d8b9f62 JH |
207 | return 0; |
208 | *it = commit; | |
209 | return 1; | |
4264dc15 JH |
210 | } |
211 | ||
212 | static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1, | |
883d60fa JS |
213 | const char *email, unsigned long timestamp, int tz, |
214 | const char *message, void *cb_data) | |
4264dc15 JH |
215 | { |
216 | struct expire_reflog_cb *cb = cb_data; | |
4264dc15 JH |
217 | struct commit *old, *new; |
218 | ||
1389d9dd | 219 | if (timestamp < cb->cmd->expire_total) |
4264dc15 JH |
220 | goto prune; |
221 | ||
2b81fab2 BC |
222 | if (cb->cmd->rewrite) |
223 | osha1 = cb->last_kept_sha1; | |
224 | ||
9bbaa6cc | 225 | old = new = NULL; |
1389d9dd JH |
226 | if (cb->cmd->stalefix && |
227 | (!keep_entry(&old, osha1) || !keep_entry(&new, nsha1))) | |
4264dc15 JH |
228 | goto prune; |
229 | ||
9bbaa6cc JH |
230 | if (timestamp < cb->cmd->expire_unreachable) { |
231 | if (!cb->ref_commit) | |
232 | goto prune; | |
233 | if (!old && !is_null_sha1(osha1)) | |
234 | old = lookup_commit_reference_gently(osha1, 1); | |
235 | if (!new && !is_null_sha1(nsha1)) | |
236 | new = lookup_commit_reference_gently(nsha1, 1); | |
4a164d48 JH |
237 | if ((old && !in_merge_bases(old, &cb->ref_commit, 1)) || |
238 | (new && !in_merge_bases(new, &cb->ref_commit, 1))) | |
9bbaa6cc JH |
239 | goto prune; |
240 | } | |
4264dc15 | 241 | |
552cecc2 JS |
242 | if (cb->cmd->recno && --(cb->cmd->recno) == 0) |
243 | goto prune; | |
244 | ||
883d60fa JS |
245 | if (cb->newlog) { |
246 | char sign = (tz < 0) ? '-' : '+'; | |
247 | int zone = (tz < 0) ? (-tz) : tz; | |
248 | fprintf(cb->newlog, "%s %s %s %lu %c%04d\t%s", | |
249 | sha1_to_hex(osha1), sha1_to_hex(nsha1), | |
250 | email, timestamp, sign, zone, | |
251 | message); | |
2b81fab2 | 252 | hashcpy(cb->last_kept_sha1, nsha1); |
883d60fa | 253 | } |
1389d9dd | 254 | if (cb->cmd->verbose) |
883d60fa | 255 | printf("keep %s", message); |
4264dc15 JH |
256 | return 0; |
257 | prune: | |
1389d9dd | 258 | if (!cb->newlog || cb->cmd->verbose) |
883d60fa | 259 | printf("%sprune %s", cb->newlog ? "" : "would ", message); |
4264dc15 JH |
260 | return 0; |
261 | } | |
262 | ||
4264dc15 JH |
263 | static int expire_reflog(const char *ref, const unsigned char *sha1, int unused, void *cb_data) |
264 | { | |
265 | struct cmd_reflog_expire_cb *cmd = cb_data; | |
266 | struct expire_reflog_cb cb; | |
267 | struct ref_lock *lock; | |
9a13f0b7 | 268 | char *log_file, *newlog_path = NULL; |
4264dc15 JH |
269 | int status = 0; |
270 | ||
4264dc15 JH |
271 | memset(&cb, 0, sizeof(cb)); |
272 | /* we take the lock for the ref itself to prevent it from | |
273 | * getting updated. | |
274 | */ | |
68db31cc | 275 | lock = lock_any_ref_for_update(ref, sha1, 0); |
4264dc15 JH |
276 | if (!lock) |
277 | return error("cannot lock ref '%s'", ref); | |
9a13f0b7 NP |
278 | log_file = xstrdup(git_path("logs/%s", ref)); |
279 | if (!file_exists(log_file)) | |
4264dc15 JH |
280 | goto finish; |
281 | if (!cmd->dry_run) { | |
282 | newlog_path = xstrdup(git_path("logs/%s.lock", ref)); | |
283 | cb.newlog = fopen(newlog_path, "w"); | |
284 | } | |
285 | ||
286 | cb.ref_commit = lookup_commit_reference_gently(sha1, 1); | |
4264dc15 | 287 | cb.ref = ref; |
1389d9dd | 288 | cb.cmd = cmd; |
4264dc15 JH |
289 | for_each_reflog_ent(ref, expire_reflog_ent, &cb); |
290 | finish: | |
291 | if (cb.newlog) { | |
4cd883d7 | 292 | if (fclose(cb.newlog)) { |
4264dc15 JH |
293 | status |= error("%s: %s", strerror(errno), |
294 | newlog_path); | |
4cd883d7 | 295 | unlink(newlog_path); |
55f10565 BC |
296 | } else if (cmd->updateref && |
297 | (write_in_full(lock->lock_fd, | |
298 | sha1_to_hex(cb.last_kept_sha1), 40) != 40 || | |
299 | write_in_full(lock->lock_fd, "\n", 1) != 1 || | |
300 | close_ref(lock) < 0)) { | |
301 | status |= error("Couldn't write %s", | |
302 | lock->lk->filename); | |
303 | unlink(newlog_path); | |
4cd883d7 | 304 | } else if (rename(newlog_path, log_file)) { |
4264dc15 | 305 | status |= error("cannot rename %s to %s", |
9a13f0b7 | 306 | newlog_path, log_file); |
4264dc15 | 307 | unlink(newlog_path); |
55f10565 BC |
308 | } else if (cmd->updateref && commit_ref(lock)) { |
309 | status |= error("Couldn't set %s", lock->ref_name); | |
336d09da PH |
310 | } else { |
311 | adjust_shared_perm(log_file); | |
4264dc15 JH |
312 | } |
313 | } | |
314 | free(newlog_path); | |
9a13f0b7 | 315 | free(log_file); |
4264dc15 JH |
316 | unlock_ref(lock); |
317 | return status; | |
318 | } | |
319 | ||
bda3a31c JH |
320 | static int collect_reflog(const char *ref, const unsigned char *sha1, int unused, void *cb_data) |
321 | { | |
322 | struct collected_reflog *e; | |
323 | struct collect_reflog_cb *cb = cb_data; | |
324 | size_t namelen = strlen(ref); | |
325 | ||
326 | e = xmalloc(sizeof(*e) + namelen + 1); | |
327 | hashcpy(e->sha1, sha1); | |
328 | memcpy(e->reflog, ref, namelen + 1); | |
329 | ALLOC_GROW(cb->e, cb->nr + 1, cb->alloc); | |
330 | cb->e[cb->nr++] = e; | |
331 | return 0; | |
332 | } | |
333 | ||
ef90d6d4 | 334 | static int reflog_expire_config(const char *var, const char *value, void *cb) |
4aec56d1 | 335 | { |
4f342b96 JH |
336 | if (!strcmp(var, "gc.reflogexpire")) { |
337 | if (!value) | |
338 | config_error_nonbool(var); | |
4aec56d1 | 339 | default_reflog_expire = approxidate(value); |
4f342b96 JH |
340 | return 0; |
341 | } | |
342 | if (!strcmp(var, "gc.reflogexpireunreachable")) { | |
343 | if (!value) | |
344 | config_error_nonbool(var); | |
4aec56d1 | 345 | default_reflog_expire_unreachable = approxidate(value); |
4f342b96 JH |
346 | return 0; |
347 | } | |
ef90d6d4 | 348 | return git_default_config(var, value, cb); |
4aec56d1 JH |
349 | } |
350 | ||
4264dc15 JH |
351 | static int cmd_reflog_expire(int argc, const char **argv, const char *prefix) |
352 | { | |
353 | struct cmd_reflog_expire_cb cb; | |
354 | unsigned long now = time(NULL); | |
355 | int i, status, do_all; | |
356 | ||
ef90d6d4 | 357 | git_config(reflog_expire_config, NULL); |
4aec56d1 | 358 | |
4264dc15 JH |
359 | save_commit_buffer = 0; |
360 | do_all = status = 0; | |
361 | memset(&cb, 0, sizeof(cb)); | |
4aec56d1 JH |
362 | |
363 | if (!default_reflog_expire_unreachable) | |
364 | default_reflog_expire_unreachable = now - 30 * 24 * 3600; | |
365 | if (!default_reflog_expire) | |
366 | default_reflog_expire = now - 90 * 24 * 3600; | |
367 | cb.expire_total = default_reflog_expire; | |
368 | cb.expire_unreachable = default_reflog_expire_unreachable; | |
4264dc15 | 369 | |
1389d9dd JH |
370 | /* |
371 | * We can trust the commits and objects reachable from refs | |
372 | * even in older repository. We cannot trust what's reachable | |
373 | * from reflog if the repository was pruned with older git. | |
374 | */ | |
375 | ||
4264dc15 JH |
376 | for (i = 1; i < argc; i++) { |
377 | const char *arg = argv[i]; | |
378 | if (!strcmp(arg, "--dry-run") || !strcmp(arg, "-n")) | |
379 | cb.dry_run = 1; | |
cc44c765 | 380 | else if (!prefixcmp(arg, "--expire=")) |
4264dc15 | 381 | cb.expire_total = approxidate(arg + 9); |
cc44c765 | 382 | else if (!prefixcmp(arg, "--expire-unreachable=")) |
4264dc15 | 383 | cb.expire_unreachable = approxidate(arg + 21); |
1389d9dd JH |
384 | else if (!strcmp(arg, "--stale-fix")) |
385 | cb.stalefix = 1; | |
2b81fab2 BC |
386 | else if (!strcmp(arg, "--rewrite")) |
387 | cb.rewrite = 1; | |
55f10565 BC |
388 | else if (!strcmp(arg, "--updateref")) |
389 | cb.updateref = 1; | |
4264dc15 JH |
390 | else if (!strcmp(arg, "--all")) |
391 | do_all = 1; | |
1389d9dd JH |
392 | else if (!strcmp(arg, "--verbose")) |
393 | cb.verbose = 1; | |
4264dc15 JH |
394 | else if (!strcmp(arg, "--")) { |
395 | i++; | |
396 | break; | |
397 | } | |
398 | else if (arg[0] == '-') | |
399 | usage(reflog_expire_usage); | |
400 | else | |
401 | break; | |
402 | } | |
1389d9dd JH |
403 | if (cb.stalefix) { |
404 | init_revisions(&cb.revs, prefix); | |
405 | if (cb.verbose) | |
406 | printf("Marking reachable objects..."); | |
407 | mark_reachable_objects(&cb.revs, 0); | |
408 | if (cb.verbose) | |
409 | putchar('\n'); | |
410 | } | |
411 | ||
bda3a31c JH |
412 | if (do_all) { |
413 | struct collect_reflog_cb collected; | |
414 | int i; | |
415 | ||
416 | memset(&collected, 0, sizeof(collected)); | |
417 | for_each_reflog(collect_reflog, &collected); | |
418 | for (i = 0; i < collected.nr; i++) { | |
419 | struct collected_reflog *e = collected.e[i]; | |
420 | status |= expire_reflog(e->reflog, e->sha1, 0, &cb); | |
421 | free(e); | |
422 | } | |
423 | free(collected.e); | |
424 | } | |
425 | ||
4264dc15 JH |
426 | while (i < argc) { |
427 | const char *ref = argv[i++]; | |
428 | unsigned char sha1[20]; | |
429 | if (!resolve_ref(ref, sha1, 1, NULL)) { | |
430 | status |= error("%s points nowhere!", ref); | |
431 | continue; | |
432 | } | |
433 | status |= expire_reflog(ref, sha1, 0, &cb); | |
434 | } | |
435 | return status; | |
436 | } | |
437 | ||
552cecc2 JS |
438 | static int count_reflog_ent(unsigned char *osha1, unsigned char *nsha1, |
439 | const char *email, unsigned long timestamp, int tz, | |
440 | const char *message, void *cb_data) | |
441 | { | |
442 | struct cmd_reflog_expire_cb *cb = cb_data; | |
443 | if (!cb->expire_total || timestamp < cb->expire_total) | |
444 | cb->recno++; | |
445 | return 0; | |
446 | } | |
447 | ||
448 | static int cmd_reflog_delete(int argc, const char **argv, const char *prefix) | |
449 | { | |
450 | struct cmd_reflog_expire_cb cb; | |
451 | int i, status = 0; | |
452 | ||
552cecc2 JS |
453 | memset(&cb, 0, sizeof(cb)); |
454 | ||
455 | for (i = 1; i < argc; i++) { | |
3c386aa3 BC |
456 | const char *arg = argv[i]; |
457 | if (!strcmp(arg, "--dry-run") || !strcmp(arg, "-n")) | |
458 | cb.dry_run = 1; | |
2b81fab2 BC |
459 | else if (!strcmp(arg, "--rewrite")) |
460 | cb.rewrite = 1; | |
55f10565 BC |
461 | else if (!strcmp(arg, "--updateref")) |
462 | cb.updateref = 1; | |
3c386aa3 BC |
463 | else if (!strcmp(arg, "--verbose")) |
464 | cb.verbose = 1; | |
465 | else if (!strcmp(arg, "--")) { | |
466 | i++; | |
467 | break; | |
468 | } | |
469 | else if (arg[0] == '-') | |
470 | usage(reflog_delete_usage); | |
471 | else | |
472 | break; | |
473 | } | |
474 | ||
475 | if (argc - i < 1) | |
476 | return error("Nothing to delete?"); | |
477 | ||
478 | for ( ; i < argc; i++) { | |
552cecc2 JS |
479 | const char *spec = strstr(argv[i], "@{"); |
480 | unsigned char sha1[20]; | |
481 | char *ep, *ref; | |
482 | int recno; | |
483 | ||
484 | if (!spec) { | |
cb97cc9f | 485 | status |= error("Not a reflog: %s", argv[i]); |
552cecc2 JS |
486 | continue; |
487 | } | |
488 | ||
489 | if (!dwim_ref(argv[i], spec - argv[i], sha1, &ref)) { | |
490 | status |= error("%s points nowhere!", argv[i]); | |
491 | continue; | |
492 | } | |
493 | ||
494 | recno = strtoul(spec + 2, &ep, 10); | |
495 | if (*ep == '}') { | |
496 | cb.recno = -recno; | |
497 | for_each_reflog_ent(ref, count_reflog_ent, &cb); | |
498 | } else { | |
499 | cb.expire_total = approxidate(spec + 2); | |
500 | for_each_reflog_ent(ref, count_reflog_ent, &cb); | |
501 | cb.expire_total = 0; | |
502 | } | |
503 | ||
504 | status |= expire_reflog(ref, sha1, 0, &cb); | |
505 | free(ref); | |
506 | } | |
507 | return status; | |
508 | } | |
509 | ||
1389d9dd JH |
510 | /* |
511 | * main "reflog" | |
512 | */ | |
513 | ||
4264dc15 JH |
514 | static const char reflog_usage[] = |
515 | "git-reflog (expire | ...)"; | |
516 | ||
517 | int cmd_reflog(int argc, const char **argv, const char *prefix) | |
518 | { | |
cf39f54e LT |
519 | /* With no command, we default to showing it. */ |
520 | if (argc < 2 || *argv[1] == '-') | |
521 | return cmd_log_reflog(argc, argv, prefix); | |
522 | ||
523 | if (!strcmp(argv[1], "show")) | |
524 | return cmd_log_reflog(argc - 1, argv + 1, prefix); | |
525 | ||
526 | if (!strcmp(argv[1], "expire")) | |
4264dc15 | 527 | return cmd_reflog_expire(argc - 1, argv + 1, prefix); |
cf39f54e | 528 | |
552cecc2 JS |
529 | if (!strcmp(argv[1], "delete")) |
530 | return cmd_reflog_delete(argc - 1, argv + 1, prefix); | |
531 | ||
cf39f54e LT |
532 | /* Not a recognized reflog command..*/ |
533 | usage(reflog_usage); | |
4264dc15 | 534 | } |