Skip to content

Commit

Permalink
[PATCH] Move git_author_info and git_commiter_info to ident.c
Browse files Browse the repository at this point in the history
Moving these functions allows all of the logic for figuring out what
these values are to be shared between programs.

Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
ebiederm authored and Linus Torvalds committed Jul 15, 2005
1 parent e64e1b7 commit d289d13
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ void datestamp(char *buf, int bufsize);

extern int setup_ident(void);
extern char *get_ident(const char *name, const char *email, const char *date_str);
extern char *git_author_info(void);
extern char *git_committer_info(void);

static inline void *xmalloc(size_t size)
{
Expand Down
10 changes: 0 additions & 10 deletions commit-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,6 @@ static int new_parent(int idx)
return 1;
}

static char *git_author_info(void)
{
return get_ident(gitenv("GIT_AUTHOR_NAME"), gitenv("GIT_AUTHOR_EMAIL"), gitenv("GIT_AUTHOR_DATE"));
}

static char *git_committer_info(void)
{
return get_ident(gitenv("GIT_COMMITTER_NAME"), gitenv("GIT_COMMITTER_EMAIL"), gitenv("GIT_COMMITTER_DATE"));
}

int main(int argc, char **argv)
{
int i;
Expand Down
10 changes: 10 additions & 0 deletions ident.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,13 @@ char *get_ident(const char *name, const char *email, const char *date_str)
buffer[i] = 0;
return buffer;
}

char *git_author_info(void)
{
return get_ident(gitenv("GIT_AUTHOR_NAME"), gitenv("GIT_AUTHOR_EMAIL"), gitenv("GIT_AUTHOR_DATE"));
}

char *git_committer_info(void)
{
return get_ident(gitenv("GIT_COMMITTER_NAME"), gitenv("GIT_COMMITTER_EMAIL"), gitenv("GIT_COMMITTER_DATE"));
}

0 comments on commit d289d13

Please sign in to comment.