-
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.
pull: implement skeletal builtin pull
For the purpose of rewriting git-pull.sh into a C builtin, implement a skeletal builtin/pull.c that redirects to $GIT_EXEC_PATH/git-pull.sh if the environment variable _GIT_USE_BUILTIN_PULL is not defined. This allows us to fall back on the functional git-pull.sh when running the test suite for tests that depend on a working git-pull implementation. This redirection should be removed when all the features of git-pull.sh have been re-implemented in builtin/pull.c. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Loading branch information
Paul Tan
authored and
Junio C Hamano
committed
Jun 15, 2015
1 parent
85b3432
commit 1e1ea69
Showing
4 changed files
with
36 additions
and
0 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
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,33 @@ | ||
/* | ||
* Builtin "git pull" | ||
* | ||
* Based on git-pull.sh by Junio C Hamano | ||
* | ||
* Fetch one or more remote refs and merge it/them into the current HEAD. | ||
*/ | ||
#include "cache.h" | ||
#include "builtin.h" | ||
#include "parse-options.h" | ||
#include "exec_cmd.h" | ||
|
||
static const char * const pull_usage[] = { | ||
NULL | ||
}; | ||
|
||
static struct option pull_options[] = { | ||
OPT_END() | ||
}; | ||
|
||
int cmd_pull(int argc, const char **argv, const char *prefix) | ||
{ | ||
if (!getenv("_GIT_USE_BUILTIN_PULL")) { | ||
const char *path = mkpath("%s/git-pull", git_exec_path()); | ||
|
||
if (sane_execvp(path, (char **)argv) < 0) | ||
die_errno("could not exec %s", path); | ||
} | ||
|
||
argc = parse_options(argc, argv, prefix, pull_options, pull_usage, 0); | ||
|
||
return 0; | ||
} |
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