-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* jk/help-alias: help: respect aliases make alias lookup a public, procedural function help: use parseopt
- Loading branch information
Showing
5 changed files
with
118 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "cache.h" | ||
|
||
static const char *alias_key; | ||
static char *alias_val; | ||
static int alias_lookup_cb(const char *k, const char *v) | ||
{ | ||
if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) { | ||
if (!v) | ||
return config_error_nonbool(k); | ||
alias_val = xstrdup(v); | ||
return 0; | ||
} | ||
return 0; | ||
} | ||
|
||
char *alias_lookup(const char *alias) | ||
{ | ||
alias_key = alias; | ||
alias_val = NULL; | ||
git_config(alias_lookup_cb); | ||
return alias_val; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters