From: Sven Verdoolaege <redacted>
This patch series implements a mechanism for cloning submodules.
Each submodule is specified by a 'submodule.<submodule>.url'
configuration option, e.g.,
bash-3.00$ ./git-config --remote=http://www.liacs.nl/~sverdool/isa.git --get-regexp 'submodule\..*\.url'
submodule.cloog.url /home/sverdool/public_html/cloog.git
submodule.cloog.url http://www.liacs.nl/~sverdool/cloog.git
git-clone will use the first url that works.
E.g., a
git clone --submodules ssh://liacs/~/public_html/isa.git
(which only works for me), will use the first url, while a
git clone --submodules http://www.liacs.nl/~sverdool/isa.git
will use the second.
The cloning of submodules is now handled inside git-fetch.
skimo
@@ -0,0 +1,52 @@+#include"http_config.h"+#include"http.h"++intgit_http_fetch_config(constchar*repo,char*config,intconfig_len)+{+charurl[PATH_MAX];+intlen=strlen(repo);++intfd;+FILE*configfile;+structactive_request_slot*slot;+structslot_resultsresults;++strcpy(url,repo);+while(len>0&&url[len-1]=='/')+--len;+snprintf(url+len,sizeof(url)-len,"/config");++fd=git_mkstemp(config,config_len,".config_XXXXXX");+if(fd>=0)+configfile=fdopen(fd,"w");+if(fd<0||!configfile)+returnerror("Unable to open local file %s for config",+config);++http_init();++slot=get_active_slot();+slot->results=&results;+curl_easy_setopt(slot->curl,CURLOPT_FILE,configfile);+curl_easy_setopt(slot->curl,CURLOPT_WRITEFUNCTION,fwrite);+curl_easy_setopt(slot->curl,CURLOPT_URL,url);+slot->local=configfile;++if(start_active_slot(slot)){+run_active_slot(slot);+if(results.curl_result!=CURLE_OK){+fclose(configfile);+warning("Unable to get config %s\n%s",url,+curl_errorstr);+}+}else{+fclose(configfile);+returnerror("Unable to start request");+}++http_cleanup();++fclose(configfile);++return0;+}
@@ -0,0 +1,37 @@+git-dump-config(1)+====================++NAME+----+git-dump-config - Dump config options+++SYNOPSIS+--------+'git-dump-config' <directory>++DESCRIPTION+-----------+Invoked by 'git-config --remote' and dumps the config file to the+other end over the git protocol.++This command is usually not invoked directly by the end user. The UI+for the protocol is on the 'git-config' side, where it is used to get+options from a remote repository.++OPTIONS+-------+<directory>::+ The repository to get the config options from.++Author+------+Written by Sven Verdoolaege.++Documentation+--------------+Documentation by Sven Verdoolaege.++GIT+---+Part of the gitlink:git[7] suite
@@ -0,0 +1,29 @@+#include"git-compat-util.h"+#include"cache.h"+#include"pkt-line.h"++staticconstchardump_config_usage[]="git-dump-config <dir>";++staticintdump_config(constchar*var,constchar*value)+{+packet_write(1,"%s",var);+packet_write(1,"%s",value);+return0;+}++intmain(intargc,char**argv)+{+char*dir;++if(argc!=2)+usage(dump_config_usage);++dir=argv[1];+if(!enter_repo(dir,0))+die("'%s': unable to chdir or not a git archive",dir);++git_config(dump_config);+packet_flush(1);++return0;+}
@@ -9,16 +9,25 @@ git-config - Get and set repository or global options SYNOPSIS -------- [verse]-'git-config' [--system | --global] [type] name [value [value_regex]]-'git-config' [--system | --global] [type] --add name value-'git-config' [--system | --global] [type] --replace-all name [value [value_regex]]-'git-config' [--system | --global] [type] --get name [value_regex]-'git-config' [--system | --global] [type] --get-all name [value_regex]-'git-config' [--system | --global] [type] --unset name [value_regex]-'git-config' [--system | --global] [type] --unset-all name [value_regex]-'git-config' [--system | --global] [type] --rename-section old_name new_name-'git-config' [--system | --global] [type] --remove-section name-'git-config' [--system | --global] -l | --list+'git-config' [--system | --global | --remote=[<host>:]<directory ]+ [type] name [value [value_regex]]+'git-config' [--system | --global | --remote=[<host>:]<directory ]+ [type] --add name value+'git-config' [--system | --global | --remote=[<host>:]<directory ]+ [type] --replace-all name [value [value_regex]]+'git-config' [--system | --global | --remote=[<host>:]<directory ]+ [type] --get name [value_regex]+'git-config' [--system | --global | --remote=[<host>:]<directory ]+ [type] --get-all name [value_regex]+'git-config' [--system | --global | --remote=[<host>:]<directory ]+ [type] --unset name [value_regex]+'git-config' [--system | --global | --remote=[<host>:]<directory ]+ [type] --unset-all name [value_regex]+'git-config' [--system | --global | --remote=[<host>:]<directory ]+ [type] --rename-section old_name new_name+'git-config' [--system | --global | --remote=[<host>:]<directory ]+ [type] --remove-section name+'git-config' [--system | --global | --remote=[<host>:]<directory ] -l | --list DESCRIPTION -----------
@@ -80,6 +89,10 @@ OPTIONS Use system-wide $(prefix)/etc/gitconfig rather than the repository .git/config.+--remote=[<host>:]<directory+ Use remote config instead of the repository .git/config.+ Only available for reading options.+ --remove-section:: Remove the given section from the configuration file.
@@ -212,7 +222,7 @@ else# Match the index to the working tree, and do a three-way.gitdiff-files--name-only|gitupdate-index--remove--stdin&&work=`gitwrite-tree`&&-gitread-tree$v--reset-u$new||exit+gitread-tree$v$submodules--reset-u$new||exitevalGITHEAD_$new='${new_name:-${branch:-$new}}'&&evalGITHEAD_$work=local&&
@@ -223,7 +233,7 @@ else# this is not a real merge before committing, but just carrying# the working tree changes along.unmerged=`gitls-files-u`-gitread-tree$v--reset$new+gitread-tree$v$submodules--reset$newcase"$unmerged"in'');;*)
@@ -172,6 +181,16 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)continue;}+if(!strcmp(arg,"--no-submodules")){+opts.submodules=0;+continue;+}++if(!strcmp(arg,"--submodules")){+opts.submodules=1;+continue;+}+/* "-m" stands for "merge", meaning we start in stage 1 */if(!strcmp(arg,"-m")){if(stage||opts.merge||opts.prefix)
@@ -163,6 +164,44 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkoutreturn0;}+staticintcheckout_submodule(constchar*path,structcache_entry*ce,conststructcheckout*state)+{+staticcharcwd[PATH_MAX];+constchar*gitdirenv;+constchar*args[10];+intargc;+interr;++if(!state->submodules)+return0;++if(!getcwd(cwd,sizeof(cwd))||cwd[0]!='/')+die("Unable to read current working directory");++if(chdir(path))+die("Cannot move to '%s'",path);++argc=0;+args[argc++]="checkout";+if(state->force)+args[argc++]="-f";+args[argc++]=sha1_to_hex(ce->sha1);+args[argc]=NULL;++gitdirenv=getenv(GIT_DIR_ENVIRONMENT);+unsetenv(GIT_DIR_ENVIRONMENT);+err=run_command_v_opt(args,RUN_GIT_CMD);+setenv(GIT_DIR_ENVIRONMENT,gitdirenv,1);++if(chdir(cwd))+die("Cannot come back to cwd");++if(err)+returnerror("failed to run git-checkout in submodule '%s'",path);++return0;+}+intcheckout_entry(structcache_entry*ce,conststructcheckout*state,char*topath){staticcharpath[PATH_MAX+1];
@@ -193,9 +232,8 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *t*/unlink(path);if(S_ISDIR(st.st_mode)){-/* If it is a gitlink, leave it alone! */if(S_ISDIRLNK(ntohl(ce->ce_mode)))-return0;+returncheckout_submodule(path,ce,state);if(!state->force)returnerror("%s is a directory",path);remove_subtree(path);
From: Sven Verdoolaege <redacted>
If the submodules are not clean, then we will get an error
when we actally do the checkout.
Signed-off-by: Sven Verdoolaege <redacted>
---
unpack-trees.c | 43 ++++++++++++++++++++++++++++++++++---------
1 files changed, 34 insertions(+), 9 deletions(-)
@@ -426,11 +427,24 @@ static void invalidate_ce_path(struct cache_entry *ce)cache_tree_invalidate_path(active_cache_tree,ce->name);}-staticintverify_clean_subdirectory(constchar*path,constchar*action,+/* Check that checking out ce->sha1 in subdir ce->name is not+*goingtooverwriteanyworkingfiles.+*+*FIXME:implementthisfunction,sowecandetectproblems+*early,ratherthanwaitinguntilweactuallytrytocheckout+*thesubmodules.+*/+staticintverify_clean_submodule(structcache_entry*ce,constchar*action,+structunpack_trees_options*o)+{+return0;+}++staticintverify_clean_subdirectory(structcache_entry*ce,constchar*action,structunpack_trees_options*o){/*-*weareabouttoextract"path";wewouldnotwanttolose+*weareabouttoextract"ce->name";wewouldnotwanttolose*anythingintheexistingdirectorythere.*/intnamelen;
@@ -438,13 +452,24 @@ static int verify_clean_subdirectory(const char *path, const char *action,structdir_structd;char*pathbuf;intcnt=0;+unsignedcharsha1[20];++if(S_ISDIRLNK(ntohl(ce->ce_mode))&&+resolve_gitlink_ref(ce->name,"HEAD",sha1)==0){+/* If we are not going to update the submodule, then+*wedon'tcare.+*/+if(!o->submodules||!hashcmp(sha1,ce->sha1))+return0;+verify_clean_submodule(ce,action,o);+}/**Firstlet'smakesurewedonothavealocalmodification*inthatdirectory.*/-namelen=strlen(path);-pos=cache_name_pos(path,namelen);+namelen=strlen(ce->name);+pos=cache_name_pos(ce->name,namelen);if(0<=pos)returncnt;/* we have it as nondirectory */pos=-pos-1;
From: Sven Verdoolaege <redacted>
This allows us to use the methods provided by http.c
from within libgit, in particular config.c.
Signed-off-by: Sven Verdoolaege <redacted>
---
http-fetch.c | 5 ++++-
http-push.c | 5 ++++-
http.h | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
@@ -219,6 +224,10 @@ thenfifi+# Write out $origin URL+GIT_CONFIG="$GIT_DIR/config"+git-configremote."$origin".url"$repo"||exit+ rm-f"$GIT_DIR/CLONE_HEAD"# We do local magic only when the user tells us to.
@@ -299,11 +308,9 @@ yes,yes)fi;;*)-case"$upload_pack"in-'')git-fetch-pack--all-k$quiet$depth$no_progress"$repo";;-*)git-fetch-pack--all-k$quiet"$upload_pack"$depth$no_progress"$repo";;-esac>"$GIT_DIR/CLONE_HEAD"||-die"fetch-pack from '$repo' failed."+git-fetch--all-k$quiet"$upload_pack"$depth\+$separate_remote_flag"$origin"||+die"fetch from '$repo' failed.";;esac;;
@@ -387,9 +394,6 @@ thenorigin_track="$remote_top/$head_points_at"&&git-update-refHEAD"$head_sha1"&&-# Upstream URL-git-configremote."$origin".url"$repo"&&-# Set up the mappings to track the remote branches.git-configremote."$origin".fetch\"+refs/heads/*:$remote_top/*"'^$'&&
@@ -143,7 +154,9 @@ esac# branches file, and just fetch those and refspecs explicitly given.# Otherwise we do what we always did.-reflist=$(get_remote_refs_for_fetch"$@")+iftest-z"$all";then+reflist=$(get_remote_refs_for_fetch"$@")+fiiftest"$tags"thentaglist=`IFS=' '&&
@@ -165,8 +178,10 @@ fi fetch_all_at_once(){-eval=$(echo"$1"|git-fetch--toolparse-reflist"-")-eval"$eval"+iftest-z"$all";then+eval=$(echo"$1"|git-fetch--toolparse-reflist"-")+eval"$eval"+fi(:subshellbecausewemuckwithIFSIFS=" $LF"
@@ -179,7 +194,8 @@ fetch_all_at_once () {git-bundleunbundle"$remote"$rref||echofailed"$remote"else-iftest-d"$remote"&&+iftest-z"$all"&&+test-d"$remote"&&# The remote might be our alternate. With# this optimization we will bypass fetch-pack
From: Sven Verdoolaege <redacted>
We will need the full cache_entry later to figure out if we are dealing
with a submodule.
Signed-off-by: Sven Verdoolaege <redacted>
---
unpack-trees.c | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
@@ -548,7 +548,7 @@ static void verify_absent(const char *path, const char *action,}die("Untracked working tree file '%s' "-"would be %s by merge.",path,action);+"would be %s by merge.",ce->name,action);}}
From: Sven Verdoolaege <redacted>
This makes it easier for scripts to call git-fetch with options
that may or may not be set.
Signed-off-by: Sven Verdoolaege <redacted>
---
git-fetch.sh | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
From: Sven Verdoolaege <redacted>
When the --submodules option is specified, git-clone will search
for submodule.<submodule>.url options in the remote configuration
and clone each submodule using the first url that it can use from
the local site.
Signed-off-by: Sven Verdoolaege <redacted>
---
Documentation/config.txt | 7 +++
Documentation/git-clone.txt | 6 ++-
git-clone.sh | 18 +++++++-
git-fetch.sh | 90 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 117 insertions(+), 4 deletions(-)
@@ -256,6 +256,10 @@ You probably do not need to adjust this value. + Common unit suffixes of 'k', 'm', or 'g' are supported.+core.submodules+ If true, gitlink:git-checkout[1] also checks out submodules.+ False by default.+ alias.*:: Command aliases for the gitlink:git[1] command wrapper - e.g. after defining "alias.last = cat-file commit HEAD", the invocation
@@ -606,6 +610,9 @@ showbranch.default:: The default set of branches for gitlink:git-show-branch[1]. See gitlink:git-show-branch[1].+submodule.<submodule>.url+ The URL of a submodule. See gitlink:git-clone[1].+ tar.umask:: By default, gitlink:git-tar-tree[1] sets file and directories modes to 0666 or 0777. While this is both useful and acceptable for projects
@@ -105,6 +105,10 @@ OPTIONS with a long history, and would want to send in a fixes as patches.+--submodules::+ Clone submodules specified in (remote) configuration parameters+ submodule.<submodule>.url.+ <repository>:: The (possibly remote) repository to clone from. It can be any URL git-fetch supports.
@@ -156,6 +159,10 @@ thenthendie'--bare and --origin $origin options are incompatible.'fi+iftest-n"$submodules"+then+die'--bare and --submodules origin options are incompatible.'+fino_checkout=yesuse_separate_remote=fi
@@ -309,7 +316,7 @@ yes,yes);;*)git-fetch--all-k$quiet"$upload_pack"$depth\-$separate_remote_flag"$origin"||+$separate_remote_flag$submodules"$origin"||die"fetch from '$repo' failed.";;esac
@@ -15,6 +15,70 @@ LF=''IFS="$LF"+local_URL(){+# tranforms a "URL" on the remote to a URL that works on the local machine+# $1 - remote, $2 - URL on remote+echo"$1$2">&2+case"$1"in+https://*|http://*|ftp://*)+case"$2"in+https://*|http://*|ftp://*)+echo$2+esac+;;+ssh://*)+case"$2"in+https://*|http://*|ftp://*)+echo$2+;;+/*)+echo$(echo$1|sed-e's/\(ssh:\/\/[^\/]*\)\/.*/\1/')$2+esac+;;+/*)+echo$2+;;+*)+case"$2"in+https://*|http://*|ftp://*)+echo$2+esac+esac+}++clone_submodules(){+# $1 - remote+remote=$1+(:subshellbecausewemuckwithIFS+IFS=" $LF"+cd"$GIT_DIR/.."+git-config--remote="$remote"--get-regexp'submodule\..*\.url'|\+sed-e's/^submodule\.//'-e's/\.url / /'|+whilereadsubmoduleURL+do+previous=$(git-config"submodule.$submodule.url")+iftest-n"$previous"+then+continue;+fi+URL=$(local_URL"$remote""$URL")+iftest-z"$URL"+then+continue;+fi+# At this point, we don't know if the submodule+# appears in the HEAD of the supermodule, so clone it+# without a checkout and overwrite HEAD so that a subsequent+# checkout won't assume the submodule has already been+# checked out.+git-clone--submodules-n"$URL""$submodule"+z40=0000000000000000000000000000000000000000+GIT_DIR="$submodule/.git"git-update-ref--no-derefHEAD$z40+git-config"submodule.$submodule.url""$URL"+done+)+}+all=no_tags=tags=
@@ -149,6 +223,18 @@ case "$tags$no_tags" inesacesac+case"$submodules"in+'')+case"$(git-config--boolcore.submodules)"in+true)+submodues=yes+;;+*)+submodules=no+;;+esac+esac+# If --tags (and later --heads or --all) is specified, then we are# not talking about defaults stored in Pull: line of remotes or# branches file, and just fetch those and refspecs explicitly given.
@@ -407,3 +493,7 @@ case "$orig_head" infi;;esac++iftest"$submodules"=yes;then+clone_submodules"$remote"+fi
@@ -262,8 +262,8 @@ yes,yes)git-ls-remote"$repo">"$GIT_DIR/CLONE_HEAD"||exit1;; *)-case"$repo"in-rsync://*)+case"$bare,$repo"in+*,rsync://*)case"$depth"in"");;*)die"shallow over rsync not supported";;
@@ -295,7 +295,7 @@ yes,yes)figit-ls-remote"$repo">"$GIT_DIR/CLONE_HEAD"||exit1;;-https://*|http://*|ftp://*)+yes,https://*|yes,http://*|yes,ftp://*)case"$depth"in"");;*)die"shallow over http or ftp not supported";;
From: Alex Riesen <hidden> Date: 2016-06-15 22:43:11
skimo@liacs.nl, Fri, May 18, 2007 21:24:56 +0200:
This option currently has no effect.
Can we have this option (and corresponding support in the following
patches, of course) first? It is enough to have subprojects working
locally, and people can start using them immediately: anyone can clone
the subprojects manually if he wishes so.
Cloning of subprojects is still unclear, and frankly I'm not sure it
should be done at all. Not even with an option which is off by
default.
From: Alex Riesen <hidden> Date: 2016-06-15 22:43:11
skimo@liacs.nl, Fri, May 18, 2007 21:24:58 +0200:
+ if (err)
+ return error("failed to run git-checkout in submodule '%s'", path);
We may need an option to ignore these failures. Maybe even active by
default. Imagine a superproject with _optional_ submodules, where it
is just nice to know that some submodules weren't checked out. BTW,
doesn't git-checkout already prints an error?
From: Alex Riesen <hidden> Date: 2016-06-15 22:43:11
skimo@liacs.nl, Fri, May 18, 2007 21:24:58 +0200:
+ if (!getcwd(cwd, sizeof(cwd)) || cwd[0] != '/')
+ die("Unable to read current working directory");
+
+ if (chdir(path))
+ die("Cannot move to '%s'", path);
+
How about modifying run_command to chdir after fork?
You'd save the hassle of save/restoring cwd and don't mess up process'
context (which is always a good idea to preserve). The code'd be
simplier, too.
From: Sven Verdoolaege <hidden> Date: 2016-06-15 22:43:11
On Fri, May 18, 2007 at 11:56:42PM +0200, Alex Riesen wrote:
skimo@liacs.nl, Fri, May 18, 2007 21:24:58 +0200:
quoted
+ if (err)
+ return error("failed to run git-checkout in submodule '%s'", path);
We may need an option to ignore these failures. Maybe even active by
default. Imagine a superproject with _optional_ submodules, where it
is just nice to know that some submodules weren't checked out. BTW,
doesn't git-checkout already prints an error?
Probably. You probably noticed that I haven't written any tests yet...
Still, the error that git-checkout prints may not give enough of a clue
that something was wrong with a submodule.
skimo
From: Sven Verdoolaege <hidden> Date: 2016-06-15 22:43:11
I noticed there's a whole thread about subprojects that I haven't read yet,
so this may have been addressed already ....
On Fri, May 18, 2007 at 11:53:12PM +0200, Alex Riesen wrote:
Can we have this option (and corresponding support in the following
patches, of course) first?
That's why the clone thing comes last.
It is enough to have subprojects working
locally, and people can start using them immediately: anyone can clone
the subprojects manually if he wishes so.
Anyone can run git-write-tree and git-commit-tree is she wishes so...
Cloning of subprojects is still unclear, and frankly I'm not sure it
should be done at all. Not even with an option which is off by
default.
Then don't use it.
The reason for not putting this in shouldn't be that someone doesn't
think it is useful; the reason should be that my code is crap.
skimo
From: Alex Riesen <hidden> Date: 2016-06-15 22:43:11
It can make code simplier (no need to preserve cwd) and safer
(no chance the cwd of the current process is accidentally forgotten).
Signed-off-by: Alex Riesen <redacted>
---
Alex Riesen, Sat, May 19, 2007 00:00:14 +0200:
skimo@liacs.nl, Fri, May 18, 2007 21:24:58 +0200:
quoted
+ if (!getcwd(cwd, sizeof(cwd)) || cwd[0] != '/')
+ die("Unable to read current working directory");
+
+ if (chdir(path))
+ die("Cannot move to '%s'", path);
+
How about modifying run_command to chdir after fork?
You'd save the hassle of save/restoring cwd and don't mess up process'
context (which is always a good idea to preserve). The code'd be
simplier, too.
something like this
run-command.c | 27 ++++++++++++++++++++++-----
run-command.h | 2 ++
2 files changed, 24 insertions(+), 5 deletions(-)
@@ -73,6 +73,9 @@ int start_command(struct child_process *cmd)close(cmd->out);}+if(cmd->dir&&chdir(cmd->dir))+die("exec %s: cd to %s failed (%s)",cmd->argv[0],+cmd->dir,strerror(errno));if(cmd->git_cmd){execv_git_cmd(cmd->argv);}else{
@@ -133,13 +136,27 @@ int run_command(struct child_process *cmd)returnfinish_command(cmd);}+staticvoidprepare_run_command_v_opt(structchild_process*cmd,+constchar**argv,intopt)+{+memset(cmd,0,sizeof(*cmd));+cmd->argv=argv;+cmd->no_stdin=opt&RUN_COMMAND_NO_STDIN?1:0;+cmd->git_cmd=opt&RUN_GIT_CMD?1:0;+cmd->stdout_to_stderr=opt&RUN_COMMAND_STDOUT_TO_STDERR?1:0;+}+intrun_command_v_opt(constchar**argv,intopt){structchild_processcmd;-memset(&cmd,0,sizeof(cmd));-cmd.argv=argv;-cmd.no_stdin=opt&RUN_COMMAND_NO_STDIN?1:0;-cmd.git_cmd=opt&RUN_GIT_CMD?1:0;-cmd.stdout_to_stderr=opt&RUN_COMMAND_STDOUT_TO_STDERR?1:0;+prepare_run_command_v_opt(&cmd,argv,opt);+returnrun_command(&cmd);+}++intrun_command_v_opt_cd(constchar**argv,intopt,constchar*dir)+{+structchild_processcmd;+prepare_run_command_v_opt(&cmd,argv,opt);+cmd.dir=dir;returnrun_command(&cmd);}
@@ -32,5 +33,6 @@ int run_command(struct child_process *);#define RUN_GIT_CMD 2 /*If this is to be git sub-command */#define RUN_COMMAND_STDOUT_TO_STDERR 4intrun_command_v_opt(constchar**argv,intopt);+intrun_command_v_opt_cd(constchar**argv,intopt,constchar*dir);#endif
From: Junio C Hamano <hidden> Date: 2016-06-15 22:43:11
skimo@liacs.nl writes:
From: Sven Verdoolaege <redacted>
This makes it easier for scripts to call git-fetch with options
that may or may not be set.
For git-fetch it does not matter as I do not think there is any
valid case to pass an empty string as a parameter to it (even
"fetch from our own repository" requires a single dot). But
from discipline point of view, I am not happy about this.
If you are talking about shell scripts, the standard way to do
that is to say ${1+"$1"}.
Hmmm.
I am not absolutely sure if the fcc387db change was correct
anymore, but in any case, this removal of dead code should not
break anything.
But this does not belong to your series either.
Perhaps I should apply this to 'master' regardless of the rest
of the series.
From: Alex Riesen <hidden> Date: 2016-06-15 22:43:11
Sven Verdoolaege, Sat, May 19, 2007 00:03:23 +0200:
On Fri, May 18, 2007 at 11:56:42PM +0200, Alex Riesen wrote:
quoted
skimo@liacs.nl, Fri, May 18, 2007 21:24:58 +0200:
quoted
+ if (err)
+ return error("failed to run git-checkout in submodule '%s'", path);
We may need an option to ignore these failures. Maybe even active by
default. Imagine a superproject with _optional_ submodules, where it
is just nice to know that some submodules weren't checked out. BTW,
doesn't git-checkout already prints an error?
Probably. You probably noticed that I haven't written any tests yet...
I see. It was a very ... provocative patch series :)
Still, the error that git-checkout prints may not give enough of a clue
that something was wrong with a submodule.
Like, for example, it failed because the directory is not a git repo
yet, because the previous git-checkout was called _without_
--submodule and the directories created are just empty.
Anyway, just a "failed to run git-checkout" is not very helpful
either. Come to think about it, there is not very much you can tell
out of super-project context. git-checkout will always know better.
From: Alex Riesen <hidden> Date: 2016-06-15 22:43:11
Sven Verdoolaege, Sat, May 19, 2007 00:08:26 +0200:
I noticed there's a whole thread about subprojects that I haven't read yet,
so this may have been addressed already ....
Not the checkout, which is strange. It's mostly about cloning.
On Fri, May 18, 2007 at 11:53:12PM +0200, Alex Riesen wrote:
quoted
Can we have this option (and corresponding support in the following
patches, of course) first?
That's why the clone thing comes last.
quoted
It is enough to have subprojects working
locally, and people can start using them immediately: anyone can clone
the subprojects manually if he wishes so.
Anyone can run git-write-tree and git-commit-tree is she wishes so...
It is much more tedious. It have to be done recursively, and with
right SHA and you have to cd into right direcotry first and it is
git-read-tree and git-checkout-index, BTW.
IOW, it is hard.
The reason for not putting this in shouldn't be that someone doesn't
think it is useful; the reason should be that my code is crap.
The code is not a problem. It can be also discarded because you
implemented something no one wants.
I just meant to say, that even if no one wants your subproject cloning
code, _I_ support your checkout effort and I am asking for it to be
put in.
"First", as the cloning discussion does not seem to be finished (and,
as I said, I am not interested in cloning anyway).
@@ -175,12 +174,6 @@ static int checkout_submodule(const char *path, struct cache_entry *ce, const stif(!state->submodules)return0;-if(!getcwd(cwd,sizeof(cwd))||cwd[0]!='/')-die("Unable to read current working directory");--if(chdir(path))-die("Cannot move to '%s'",path);-argc=0;args[argc++]="checkout";if(state->force)
@@ -190,12 +183,9 @@ static int checkout_submodule(const char *path, struct cache_entry *ce, const stgitdirenv=getenv(GIT_DIR_ENVIRONMENT);unsetenv(GIT_DIR_ENVIRONMENT);-err=run_command_v_opt(args,RUN_GIT_CMD);+err=run_command_v_opt_cd(args,RUN_GIT_CMD,path);setenv(GIT_DIR_ENVIRONMENT,gitdirenv,1);-if(chdir(cwd))-die("Cannot come back to cwd");-if(err)returnerror("failed to run git-checkout in submodule '%s'",path);
From: Alex Riesen <hidden> Date: 2016-06-15 22:43:11
skimo@liacs.nl, Fri, May 18, 2007 21:25:01 +0200:
quoted hunk
@@ -261,7 +287,8 @@ static int fetch_native_store(FILE *fp, const char *remote, const char *remote_nick, const char *refs,- int verbose, int force)+ int verbose, int force,+ int all, int use_separate_remote) { char buffer[1024]; int err = 0;
This code produces warning about possible uninitialized used of
single_force and not_for_merge. I used the patch below, but didn't
look into what the "all" does.
---
builtin-fetch--tool.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
From: Petr Baudis <hidden> Date: 2016-06-15 22:43:11
On Fri, May 18, 2007 at 09:24:56PM CEST, skimo@liacs.nl wrote:
From: Sven Verdoolaege <redacted>
This option currently has no effect.
Signed-off-by: Sven Verdoolaege <redacted>
Nacked-by: Petr Baudis [off-list ref]
Please do not add more undocumented parameters - include documentation
in the patch adding the parameter.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Ever try. Ever fail. No matter. // Try again. Fail again. Fail better.
-- Samuel Beckett
Thus Documentation/git-checkout.txt needs to be updated as well.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Ever try. Ever fail. No matter. // Try again. Fail again. Fail better.
-- Samuel Beckett
From: Sven Verdoolaege <hidden> Date: 2016-06-15 22:43:11
On Sat, May 19, 2007 at 12:52:34AM +0200, Alex Riesen wrote:
This code produces warning about possible uninitialized used of
single_force and not_for_merge. I used the patch below, but didn't
look into what the "all" does.
Sorry for being sloppy. It is assumed that "all" is only used
for cloning and then the other two flags don't really matter,
but I should've set some defaults.
Yours look fine, thanks.
A fixed-up version is available in the "submodules" branch
of http://www.liacs.nl/~sverdool/git.git or
www.liacs.nl/~sverdool/gitweb.cgi?p=git.git;a=shortlog;h=submodules
skimo