Generalize the "show each ref" code in receice-pack

This turns it into a generic "do xyz for each ref" library function.
This commit is contained in:
Linus Torvalds
2005-07-02 20:23:36 -07:00
parent ad8c80a58f
commit 8a65ff7666
3 changed files with 77 additions and 53 deletions

6
refs.h
View File

@ -1,6 +1,12 @@
#ifndef REFS_H
#define REFS_H
/*
* Calls the specified function for each ref file until it returns nonzero,
* and returns the value
*/
extern int for_each_ref(int (*fn)(const char *path, unsigned char *sha1));
/** Reads the refs file specified into sha1 **/
extern int get_ref_sha1(const char *ref, unsigned char *sha1);