Re: [PATCH 1/2] submodule: Include check for objects when fetching
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 22, 2016, 22:54 UTC
- Message-ID
- <xmqqoab84apu.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1456180548-20996-2-git-send-email-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 9 quoted lines
> Junio wrote: >> To be complete, the rev-list command line should also run with >> "--objects"; after all, a commit walker fetch may have downloaded >> commit chain completely but haven't fetched necessary trees and >> blobs when it was killed, and "rev-list $sha1 --not --all" would not >> catch such a breakage without "--objects". > > By adding the --objects switch to rev-list we make sure to do a complete > check.
You also need to drop "-n1" for the command to be equivalent to quickfetch, I think.
Show 19 quoted lines
> > Signed-off-by: Stefan Beller <sbeller@google.com> > --- > git-submodule.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/git-submodule.sh b/git-submodule.sh > index 9bc5c5f..f5d6675 100755 > --- a/git-submodule.sh > +++ b/git-submodule.sh > @@ -746,7 +746,7 @@ Maybe you want to use 'update --init'?")" > # Run fetch only if $sha1 isn't present or it > # is not reachable from a ref. > (clear_local_git_env; cd "$sm_path" && > - ( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) && > + ( (rev=$(git rev-list --objects -n 1 $sha1 --not --all 2>/dev/null) && > test -z "$rev") || git-fetch)) || > die "$(eval_gettext "Unable to fetch in submodule path '\$displaypath'")" > fi