Skip to content

Commit

Permalink
revwalk: make git_revwalk_(push|hide)_glob() leverage git_reference_f…
Browse files Browse the repository at this point in the history
…oreach_glob()
  • Loading branch information
nulltoken committed Jun 22, 2012
1 parent 527ed55 commit 1163434
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/revwalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,18 +540,14 @@ static int push_ref(git_revwalk *walk, const char *refname, int hide)

struct push_cb_data {
git_revwalk *walk;
const char *glob;
int hide;
};

static int push_glob_cb(const char *refname, void *data_)
{
struct push_cb_data *data = (struct push_cb_data *)data_;

if (!p_fnmatch(data->glob, refname, 0))
return push_ref(data->walk, refname, data->hide);

return 0;
return push_ref(data->walk, refname, data->hide);
}

static int push_glob(git_revwalk *walk, const char *glob, int hide)
Expand Down Expand Up @@ -584,11 +580,10 @@ static int push_glob(git_revwalk *walk, const char *glob, int hide)
goto on_error;

data.walk = walk;
data.glob = git_buf_cstr(&buf);
data.hide = hide;

if (git_reference_foreach(
walk->repo, GIT_REF_LISTALL, push_glob_cb, &data) < 0)
if (git_reference_foreach_glob(
walk->repo, git_buf_cstr(&buf), GIT_REF_LISTALL, push_glob_cb, &data) < 0)
goto on_error;

regfree(&preg);
Expand Down

0 comments on commit 1163434

Please sign in to comment.